## Class JoinsExamples.RecJoinSet

- java.lang.Object
- - JoinsExamples.RecJoinSet

- Enclosing class:
    JoinsExamples

      public static class JoinsExamples.RecJoinSet
      extends java.lang.Object

  This represents a joined set of records. In this example we show how to update a parent record and its associated child records as a unit using transactions. We use objects of this class to represent one of these joined set of records.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RecJoinSet()` | Create an empty Joined set of records.
    `RecJoinSet​(java.lang.String parent_tbl, com.netrics.likeit.NetricsRecord parent_rec)` | Creat a joined set of records for the given parent record.
    `RecJoinSet​(java.lang.String parent_tbl, com.netrics.likeit.NetricsRecord parent_rec, java.lang.String[] child_tbl_names, com.netrics.likeit.NetricsRecord[][] child_tbl_recs)` | Creat an initialized Joined set of records.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `com.netrics.likeit.NetricsRecord[]` | `getChildRecs​(java.lang.String child_tbl)` | Get an array of the child records for a particular child table.
    `java.lang.String[]` | `getChildTbls()` | Get an array of the child tables in this joined set.
    `com.netrics.likeit.NetricsRecord` | `getParentRec()` | Get the parent record.
    `java.lang.String` | `getParentTbl()` | Get the name of the parent table.
    `void` | `setChildRecords​(java.lang.String child_tbl, com.netrics.likeit.NetricsRecord[] child_recs)` | Set the list of records for a child table.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RecJoinSet

          public RecJoinSet()

      Create an empty Joined set of records.

    - #### RecJoinSet

          public RecJoinSet​(java.lang.String parent_tbl,
                            com.netrics.likeit.NetricsRecord parent_rec)

      Creat a joined set of records for the given parent record. Use setChildRecords method to add the child records.
      Parameters:
        `parent_tbl` - the name of the parent table of this join set.
        `parent_rec` - the parent record of this join set.

    - #### RecJoinSet

          public RecJoinSet​(java.lang.String parent_tbl,
                            com.netrics.likeit.NetricsRecord parent_rec,
                            java.lang.String[] child_tbl_names,
                            com.netrics.likeit.NetricsRecord[][] child_tbl_recs)

      Creat an initialized Joined set of records. This creates a fully initialized joined set of records.
      Parameters:
        `parent_tbl` - the name of the parent table of this join set.
        `parent_rec` - the parent record of this join set.
        `child_tbl_names` - an array of the child table names.
        `child_tbl_recs` - a two dimensional array of records, the first dimension corresponds to child_tbl_names, the second dimension is the array of records for that child table. I.e. child_tbl_records[i] is an array of records for child table: child_tbl_names[i].

  - ### Method Detail

    - #### setChildRecords

          public void setChildRecords​(java.lang.String child_tbl,
                                      com.netrics.likeit.NetricsRecord[] child_recs)

      Set the list of records for a child table. If no records exist for the given child table this adds it as a new child table and sets this list of records to a shallow copy of the given list of records. If the table already exists in this set as a child table the existing list of child records is replaced in its entirety by a shallow copy of the new list.
      Parameters:
        `child_tbl` - the name of the child table
        `child_recs` - an array of child records.

    - #### getParentTbl

          public java.lang.String getParentTbl()

      Get the name of the parent table.
      Returns:
        the name of teh parent table.

    - #### getParentRec

          public com.netrics.likeit.NetricsRecord getParentRec()

      Get the parent record.
      Returns:
        the parent record.

    - #### getChildTbls

          public java.lang.String[] getChildTbls()

      Get an array of the child tables in this joined set.
      Returns:
        an array of child tables.

    - #### getChildRecs

          public com.netrics.likeit.NetricsRecord[] getChildRecs​(java.lang.String child_tbl)

      Get an array of the child records for a particular child table.
      Parameters:
        `child_tbl` - child table to get records from.
      Returns:
        an array of child records.