View Javadoc

    1   package org.apache.turbine.services.security.torque.om;
    2
    3
    4   import java.math.BigDecimal;
    5   import java.sql.Connection;
    6   import java.util.ArrayList;
    7   import java.util.Collections;
    8   import java.util.Date;
    9   import java.util.List;
    10
    11  import org.apache.commons.lang.ObjectUtils;
    12  import org.apache.torque.TorqueException;
    13  import org.apache.torque.map.TableMap;
    14  import org.apache.torque.om.BaseObject;
    15  import org.apache.torque.om.ComboKey;
    16  import org.apache.torque.om.DateKey;
    17  import org.apache.torque.om.NumberKey;
    18  import org.apache.torque.om.ObjectKey;
    19  import org.apache.torque.om.SimpleKey;
    20  import org.apache.torque.om.StringKey;
    21  import org.apache.torque.om.Persistent;
    22  import org.apache.torque.util.Criteria;
    23  import org.apache.torque.util.Transaction;
    24
    25
    26
    27
    28
    29  /**
    30   * This class was autogenerated by Torque on:
    31   *
    32   * [Thu Jun 23 17:25:46 CEST 2011]
    33   *
    34   * You should not use this class directly.  It should not even be
    35   * extended all references should be to TurbinePermission
    36   */
    37  public abstract class BaseTurbinePermission extends BaseObject
    38  {
    39      /** Serial version */
    40      private static final long serialVersionUID = 1308842746584L;
    41
    42      /** The Peer class */
    43      private static final TurbinePermissionPeer peer =
    44          new TurbinePermissionPeer();
    45
    46
    47      /** The value for the permissionId field */
    48      private int permissionId;
    49
    50      /** The value for the name field */
    51      private String name;
    52
    53
    54      /**
    55       * Get the PermissionId
    56       *
    57       * @return int
    58       */
    59      public int getPermissionId()
    60      {
    61          return permissionId;
    62      }
    63
    64
    65      /**
    66       * Set the value of PermissionId
    67       *
    68       * @param v new value
    69       */
    70      public void setPermissionId(int v) throws TorqueException
    71      {
    72
    73          if (this.permissionId != v)
    74          {
    75              this.permissionId = v;
    76              setModified(true);
    77          }
    78
    79
    80
    81          // update associated TurbineRolePermission
    82          if (collTurbineRolePermissions != null)
    83          {
    84              for (int i = 0; i < collTurbineRolePermissions.size(); i++)
    85              {
    86                  ((TurbineRolePermission) collTurbineRolePermissions.get(i))
    87                          .setPermissionId(v);
    88              }
    89          }
    90      }
    91
    92      /**
    93       * Get the Name
    94       *
    95       * @return String
    96       */
    97      public String getName()
    98      {
    99          return name;
    100     }
    101
    102
    103     /**
    104      * Set the value of Name
    105      *
    106      * @param v new value
    107      */
    108     public void setName(String v)
    109     {
    110
    111         if (!ObjectUtils.equals(this.name, v))
    112         {
    113             this.name = v;
    114             setModified(true);
    115         }
    116
    117
    118     }
    119
    120
    121
    122
    123     /**
    124      * Collection to store aggregation of collTurbineRolePermissions
    125      */
    126     protected List<TurbineRolePermission> collTurbineRolePermissions;
    127
    128     /**
    129      * Temporary storage of collTurbineRolePermissions to save a possible db hit in
    130      * the event objects are add to the collection, but the
    131      * complete collection is never requested.
    132      */
    133     protected void initTurbineRolePermissions()
    134     {
    135         if (collTurbineRolePermissions == null)
    136         {
    137             collTurbineRolePermissions = new ArrayList<TurbineRolePermission>();
    138         }
    139     }
    140
    141
    142     /**
    143      * Method called to associate a TurbineRolePermission object to this object
    144      * through the TurbineRolePermission foreign key attribute
    145      *
    146      * @param l TurbineRolePermission
    147      * @throws TorqueException
    148      */
    149     public void addTurbineRolePermission(TurbineRolePermission l) throws TorqueException
    150     {
    151         getTurbineRolePermissions().add(l);
    152         l.setTurbinePermission((TurbinePermission) this);
    153     }
    154
    155     /**
    156      * Method called to associate a TurbineRolePermission object to this object
    157      * through the TurbineRolePermission foreign key attribute using connection.
    158      *
    159      * @param l TurbineRolePermission
    160      * @throws TorqueException
    161      */
    162     public void addTurbineRolePermission(TurbineRolePermission l, Connection con) throws TorqueException
    163     {
    164         getTurbineRolePermissions(con).add(l);
    165         l.setTurbinePermission((TurbinePermission) this);
    166     }
    167
    168     /**
    169      * The criteria used to select the current contents of collTurbineRolePermissions
    170      */
    171     private Criteria lastTurbineRolePermissionsCriteria = null;
    172
    173     /**
    174      * If this collection has already been initialized, returns
    175      * the collection. Otherwise returns the results of
    176      * getTurbineRolePermissions(new Criteria())
    177      *
    178      * @return the collection of associated objects
    179      * @throws TorqueException
    180      */
    181     public List<TurbineRolePermission> getTurbineRolePermissions()
    182         throws TorqueException
    183     {
    184         if (collTurbineRolePermissions == null)
    185         {
    186             collTurbineRolePermissions = getTurbineRolePermissions(new Criteria(10));
    187         }
    188         return collTurbineRolePermissions;
    189     }
    190
    191     /**
    192      * If this collection has already been initialized with
    193      * an identical criteria, it returns the collection.
    194      * Otherwise if this TurbinePermission has previously
    195      * been saved, it will retrieve related TurbineRolePermissions from storage.
    196      * If this TurbinePermission is new, it will return
    197      * an empty collection or the current collection, the criteria
    198      * is ignored on a new object.
    199      *
    200      * @throws TorqueException
    201      */
    202     public List<TurbineRolePermission> getTurbineRolePermissions(Criteria criteria) throws TorqueException
    203     {
    204         if (collTurbineRolePermissions == null)
    205         {
    206             if (isNew())
    207             {
    208                collTurbineRolePermissions = new ArrayList<TurbineRolePermission>();
    209             }
    210             else
    211             {
    212                 criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId() );
    213                 collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria);
    214             }
    215         }
    216         else
    217         {
    218             // criteria has no effect for a new object
    219             if (!isNew())
    220             {
    221                 // the following code is to determine if a new query is
    222                 // called for.  If the criteria is the same as the last
    223                 // one, just return the collection.
    224                 criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId());
    225                 if (!lastTurbineRolePermissionsCriteria.equals(criteria))
    226                 {
    227                     collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria);
    228                 }
    229             }
    230         }
    231         lastTurbineRolePermissionsCriteria = criteria;
    232
    233         return collTurbineRolePermissions;
    234     }
    235
    236     /**
    237      * If this collection has already been initialized, returns
    238      * the collection. Otherwise returns the results of
    239      * getTurbineRolePermissions(new Criteria(),Connection)
    240      * This method takes in the Connection also as input so that
    241      * referenced objects can also be obtained using a Connection
    242      * that is taken as input
    243      */
    244     public List<TurbineRolePermission> getTurbineRolePermissions(Connection con) throws TorqueException
    245     {
    246         if (collTurbineRolePermissions == null)
    247         {
    248             collTurbineRolePermissions = getTurbineRolePermissions(new Criteria(10), con);
    249         }
    250         return collTurbineRolePermissions;
    251     }
    252
    253     /**
    254      * If this collection has already been initialized with
    255      * an identical criteria, it returns the collection.
    256      * Otherwise if this TurbinePermission has previously
    257      * been saved, it will retrieve related TurbineRolePermissions from storage.
    258      * If this TurbinePermission is new, it will return
    259      * an empty collection or the current collection, the criteria
    260      * is ignored on a new object.
    261      * This method takes in the Connection also as input so that
    262      * referenced objects can also be obtained using a Connection
    263      * that is taken as input
    264      */
    265     public List<TurbineRolePermission> getTurbineRolePermissions(Criteria criteria, Connection con)
    266             throws TorqueException
    267     {
    268         if (collTurbineRolePermissions == null)
    269         {
    270             if (isNew())
    271             {
    272                collTurbineRolePermissions = new ArrayList<TurbineRolePermission>();
    273             }
    274             else
    275             {
    276                  criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId());
    277                  collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria, con);
    278              }
    279          }
    280          else
    281          {
    282              // criteria has no effect for a new object
    283              if (!isNew())
    284              {
    285                  // the following code is to determine if a new query is
    286                  // called for.  If the criteria is the same as the last
    287                  // one, just return the collection.
    288                  criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId());
    289                  if (!lastTurbineRolePermissionsCriteria.equals(criteria))
    290                  {
    291                      collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria, con);
    292                  }
    293              }
    294          }
    295          lastTurbineRolePermissionsCriteria = criteria;
    296
    297          return collTurbineRolePermissions;
    298      }
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310     /**
    311      * If this collection has already been initialized with
    312      * an identical criteria, it returns the collection.
    313      * Otherwise if this TurbinePermission is new, it will return
    314      * an empty collection; or if this TurbinePermission has previously
    315      * been saved, it will retrieve related TurbineRolePermissions from storage.
    316      *
    317      * This method is protected by default in order to keep the public
    318      * api reasonable.  You can provide public methods for those you
    319      * actually need in TurbinePermission.
    320      */
    321     protected List<TurbineRolePermission> getTurbineRolePermissionsJoinTurbineRole(Criteria criteria)
    322         throws TorqueException
    323     {
    324         if (collTurbineRolePermissions == null)
    325         {
    326             if (isNew())
    327             {
    328                collTurbineRolePermissions = new ArrayList<TurbineRolePermission>();
    329             }
    330             else
    331             {
    332                 criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId());
    333                 collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbineRole(criteria);
    334             }
    335         }
    336         else
    337         {
    338             // the following code is to determine if a new query is
    339             // called for.  If the criteria is the same as the last
    340             // one, just return the collection.
    341             criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId());
    342             if (!lastTurbineRolePermissionsCriteria.equals(criteria))
    343             {
    344                 collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbineRole(criteria);
    345             }
    346         }
    347         lastTurbineRolePermissionsCriteria = criteria;
    348
    349         return collTurbineRolePermissions;
    350     }
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360     /**
    361      * If this collection has already been initialized with
    362      * an identical criteria, it returns the collection.
    363      * Otherwise if this TurbinePermission is new, it will return
    364      * an empty collection; or if this TurbinePermission has previously
    365      * been saved, it will retrieve related TurbineRolePermissions from storage.
    366      *
    367      * This method is protected by default in order to keep the public
    368      * api reasonable.  You can provide public methods for those you
    369      * actually need in TurbinePermission.
    370      */
    371     protected List<TurbineRolePermission> getTurbineRolePermissionsJoinTurbinePermission(Criteria criteria)
    372         throws TorqueException
    373     {
    374         if (collTurbineRolePermissions == null)
    375         {
    376             if (isNew())
    377             {
    378                collTurbineRolePermissions = new ArrayList<TurbineRolePermission>();
    379             }
    380             else
    381             {
    382                 criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId());
    383                 collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbinePermission(criteria);
    384             }
    385         }
    386         else
    387         {
    388             // the following code is to determine if a new query is
    389             // called for.  If the criteria is the same as the last
    390             // one, just return the collection.
    391             criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, getPermissionId());
    392             if (!lastTurbineRolePermissionsCriteria.equals(criteria))
    393             {
    394                 collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbinePermission(criteria);
    395             }
    396         }
    397         lastTurbineRolePermissionsCriteria = criteria;
    398
    399         return collTurbineRolePermissions;
    400     }
    401
    402
    403
    404
    405     private static List<String> fieldNames = null;
    406
    407     /**
    408      * Generate a list of field names.
    409      *
    410      * @return a list of field names
    411      */
    412     public static synchronized List<String> getFieldNames()
    413     {
    414         if (fieldNames == null)
    415         {
    416             fieldNames = new ArrayList<String>();
    417             fieldNames.add("PermissionId");
    418             fieldNames.add("Name");
    419             fieldNames = Collections.unmodifiableList(fieldNames);
    420         }
    421         return fieldNames;
    422     }
    423
    424     /**
    425      * Retrieves a field from the object by field (Java) name passed in as a String.
    426      *
    427      * @param name field name
    428      * @return value
    429      */
    430     public Object getByName(String name)
    431     {
    432         if (name.equals("PermissionId"))
    433         {
    434             return new Integer(getPermissionId());
    435         }
    436         if (name.equals("Name"))
    437         {
    438             return getName();
    439         }
    440         return null;
    441     }
    442
    443     /**
    444      * Set a field in the object by field (Java) name.
    445      *
    446      * @param name field name
    447      * @param value field value
    448      * @return True if value was set, false if not (invalid name / protected field).
    449      * @throws IllegalArgumentException if object type of value does not match field object type.
    450      * @throws TorqueException If a problem occurs with the set[Field] method.
    451      */
    452     public boolean setByName(String name, Object value )
    453         throws TorqueException, IllegalArgumentException
    454     {
    455         if (name.equals("PermissionId"))
    456         {
    457             if (value == null || ! (Integer.class.isInstance(value)))
    458             {
    459                 throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
    460             }
    461             setPermissionId(((Integer) value).intValue());
    462             return true;
    463         }
    464         if (name.equals("Name"))
    465         {
    466             // Object fields can be null
    467             if (value != null && ! String.class.isInstance(value))
    468             {
    469                 throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
    470             }
    471             setName((String) value);
    472             return true;
    473         }
    474         return false;
    475     }
    476
    477     /**
    478      * Retrieves a field from the object by name passed in
    479      * as a String.  The String must be one of the static
    480      * Strings defined in this Class' Peer.
    481      *
    482      * @param name peer name
    483      * @return value
    484      */
    485     public Object getByPeerName(String name)
    486     {
    487         if (name.equals(TurbinePermissionPeer.PERMISSION_ID))
    488         {
    489             return new Integer(getPermissionId());
    490         }
    491         if (name.equals(TurbinePermissionPeer.PERMISSION_NAME))
    492         {
    493             return getName();
    494         }
    495         return null;
    496     }
    497
    498     /**
    499      * Set field values by Peer Field Name
    500      *
    501      * @param name field name
    502      * @param value field value
    503      * @return True if value was set, false if not (invalid name / protected field).
    504      * @throws IllegalArgumentException if object type of value does not match field object type.
    505      * @throws TorqueException If a problem occurs with the set[Field] method.
    506      */
    507     public boolean setByPeerName(String name, Object value)
    508         throws TorqueException, IllegalArgumentException
    509     {
    510       if (TurbinePermissionPeer.PERMISSION_ID.equals(name))
    511         {
    512             return setByName("PermissionId", value);
    513         }
    514       if (TurbinePermissionPeer.PERMISSION_NAME.equals(name))
    515         {
    516             return setByName("Name", value);
    517         }
    518         return false;
    519     }
    520
    521     /**
    522      * Retrieves a field from the object by Position as specified
    523      * in the xml schema.  Zero-based.
    524      *
    525      * @param pos position in xml schema
    526      * @return value
    527      */
    528     public Object getByPosition(int pos)
    529     {
    530         if (pos == 0)
    531         {
    532             return new Integer(getPermissionId());
    533         }
    534         if (pos == 1)
    535         {
    536             return getName();
    537         }
    538         return null;
    539     }
    540
    541     /**
    542      * Set field values by its position (zero based) in the XML schema.
    543      *
    544      * @param position The field position
    545      * @param value field value
    546      * @return True if value was set, false if not (invalid position / protected field).
    547      * @throws IllegalArgumentException if object type of value does not match field object type.
    548      * @throws TorqueException If a problem occurs with the set[Field] method.
    549      */
    550     public boolean setByPosition(int position, Object value)
    551         throws TorqueException, IllegalArgumentException
    552     {
    553     if (position == 0)
    554         {
    555             return setByName("PermissionId", value);
    556         }
    557     if (position == 1)
    558         {
    559             return setByName("Name", value);
    560         }
    561         return false;
    562     }
    563
    564     /**
    565      * Stores the object in the database.  If the object is new,
    566      * it inserts it; otherwise an update is performed.
    567      *
    568      * @throws Exception
    569      */
    570     public void save() throws Exception
    571     {
    572         save(TurbinePermissionPeer.DATABASE_NAME);
    573     }
    574
    575     /**
    576      * Stores the object in the database.  If the object is new,
    577      * it inserts it; otherwise an update is performed.
    578      * Note: this code is here because the method body is
    579      * auto-generated conditionally and therefore needs to be
    580      * in this file instead of in the super class, BaseObject.
    581      *
    582      * @param dbName
    583      * @throws TorqueException
    584      */
    585     public void save(String dbName) throws TorqueException
    586     {
    587         Connection con = null;
    588         try
    589         {
    590             con = Transaction.begin(dbName);
    591             save(con);
    592             Transaction.commit(con);
    593         }
    594         catch(TorqueException e)
    595         {
    596             Transaction.safeRollback(con);
    597             throw e;
    598         }
    599     }
    600
    601     /** flag to prevent endless save loop, if this object is referenced
    602         by another object which falls in this transaction. */
    603     private boolean alreadyInSave = false;
    604     /**
    605      * Stores the object in the database.  If the object is new,
    606      * it inserts it; otherwise an update is performed.  This method
    607      * is meant to be used as part of a transaction, otherwise use
    608      * the save() method and the connection details will be handled
    609      * internally
    610      *
    611      * @param con
    612      * @throws TorqueException
    613      */
    614     public void save(Connection con) throws TorqueException
    615     {
    616         if (!alreadyInSave)
    617         {
    618             alreadyInSave = true;
    619
    620
    621
    622             // If this object has been modified, then save it to the database.
    623             if (isModified())
    624             {
    625                 if (isNew())
    626                 {
    627                     TurbinePermissionPeer.doInsert((TurbinePermission) this, con);
    628                     setNew(false);
    629                 }
    630                 else
    631                 {
    632                     TurbinePermissionPeer.doUpdate((TurbinePermission) this, con);
    633                 }
    634             }
    635
    636
    637             if (collTurbineRolePermissions != null)
    638             {
    639                 for (int i = 0; i < collTurbineRolePermissions.size(); i++)
    640                 {
    641                     ((TurbineRolePermission) collTurbineRolePermissions.get(i)).save(con);
    642                 }
    643             }
    644             alreadyInSave = false;
    645         }
    646     }
    647
    648
    649     /**
    650      * Set the PrimaryKey using ObjectKey.
    651      *
    652      * @param key permissionId ObjectKey
    653      */
    654     public void setPrimaryKey(ObjectKey key)
    655         throws TorqueException
    656     {
    657         setPermissionId(((NumberKey) key).intValue());
    658     }
    659
    660     /**
    661      * Set the PrimaryKey using a String.
    662      *
    663      * @param key
    664      */
    665     public void setPrimaryKey(String key) throws TorqueException
    666     {
    667         setPermissionId(Integer.parseInt(key));
    668     }
    669
    670
    671     /**
    672      * returns an id that differentiates this object from others
    673      * of its class.
    674      */
    675     public ObjectKey getPrimaryKey()
    676     {
    677         return SimpleKey.keyFor(getPermissionId());
    678     }
    679
    680
    681     /**
    682      * Makes a copy of this object.
    683      * It creates a new object filling in the simple attributes.
    684      * It then fills all the association collections and sets the
    685      * related objects to isNew=true.
    686      */
    687     public TurbinePermission copy() throws TorqueException
    688     {
    689         return copy(true);
    690     }
    691
    692     /**
    693      * Makes a copy of this object using connection.
    694      * It creates a new object filling in the simple attributes.
    695      * It then fills all the association collections and sets the
    696      * related objects to isNew=true.
    697      *
    698      * @param con the database connection to read associated objects.
    699      */
    700     public TurbinePermission copy(Connection con) throws TorqueException
    701     {
    702         return copy(true, con);
    703     }
    704
    705     /**
    706      * Makes a copy of this object.
    707      * It creates a new object filling in the simple attributes.
    708      * If the parameter deepcopy is true, it then fills all the
    709      * association collections and sets the related objects to
    710      * isNew=true.
    711      *
    712      * @param deepcopy whether to copy the associated objects.
    713      */
    714     public TurbinePermission copy(boolean deepcopy) throws TorqueException
    715     {
    716         return copyInto(new TurbinePermission(), deepcopy);
    717     }
    718
    719     /**
    720      * Makes a copy of this object using connection.
    721      * It creates a new object filling in the simple attributes.
    722      * If the parameter deepcopy is true, it then fills all the
    723      * association collections and sets the related objects to
    724      * isNew=true.
    725      *
    726      * @param deepcopy whether to copy the associated objects.
    727      * @param con the database connection to read associated objects.
    728      */
    729     public TurbinePermission copy(boolean deepcopy, Connection con) throws TorqueException
    730     {
    731         return copyInto(new TurbinePermission(), deepcopy, con);
    732     }
    733
    734     /**
    735      * Fills the copyObj with the contents of this object.
    736      * The associated objects are also copied and treated as new objects.
    737      *
    738      * @param copyObj the object to fill.
    739      */
    740     protected TurbinePermission copyInto(TurbinePermission copyObj) throws TorqueException
    741     {
    742         return copyInto(copyObj, true);
    743     }
    744
    745
    746     /**
    747      * Fills the copyObj with the contents of this object using connection.
    748      * The associated objects are also copied and treated as new objects.
    749      *
    750      * @param copyObj the object to fill.
    751      * @param con the database connection to read associated objects.
    752      */
    753     protected TurbinePermission copyInto(TurbinePermission copyObj, Connection con) throws TorqueException
    754     {
    755         return copyInto(copyObj, true, con);
    756     }
    757
    758     /**
    759      * Fills the copyObj with the contents of this object.
    760      * If deepcopy is true, The associated objects are also copied
    761      * and treated as new objects.
    762      *
    763      * @param copyObj the object to fill.
    764      * @param deepcopy whether the associated objects should be copied.
    765      */
    766     protected TurbinePermission copyInto(TurbinePermission copyObj, boolean deepcopy) throws TorqueException
    767     {
    768         copyObj.setPermissionId(permissionId);
    769         copyObj.setName(name);
    770
    771         copyObj.setPermissionId( 0);
    772
    773         if (deepcopy)
    774         {
    775
    776
    777         List<TurbineRolePermission> vTurbineRolePermissions = getTurbineRolePermissions();
    778         if (vTurbineRolePermissions != null)
    779         {
    780             for (int i = 0; i < vTurbineRolePermissions.size(); i++)
    781             {
    782                 TurbineRolePermission obj =  vTurbineRolePermissions.get(i);
    783                 copyObj.addTurbineRolePermission(obj.copy());
    784             }
    785         }
    786         else
    787         {
    788             copyObj.collTurbineRolePermissions = null;
    789         }
    790         }
    791         return copyObj;
    792     }
    793
    794
    795     /**
    796      * Fills the copyObj with the contents of this object using connection.
    797      * If deepcopy is true, The associated objects are also copied
    798      * and treated as new objects.
    799      *
    800      * @param copyObj the object to fill.
    801      * @param deepcopy whether the associated objects should be copied.
    802      * @param con the database connection to read associated objects.
    803      */
    804     protected TurbinePermission copyInto(TurbinePermission copyObj, boolean deepcopy, Connection con) throws TorqueException
    805     {
    806         copyObj.setPermissionId(permissionId);
    807         copyObj.setName(name);
    808
    809         copyObj.setPermissionId( 0);
    810
    811         if (deepcopy)
    812         {
    813
    814
    815         List<TurbineRolePermission> vTurbineRolePermissions = getTurbineRolePermissions(con);
    816         if (vTurbineRolePermissions != null)
    817         {
    818             for (int i = 0; i < vTurbineRolePermissions.size(); i++)
    819             {
    820                 TurbineRolePermission obj =  vTurbineRolePermissions.get(i);
    821                 copyObj.addTurbineRolePermission(obj.copy(con), con);
    822             }
    823         }
    824         else
    825         {
    826             copyObj.collTurbineRolePermissions = null;
    827         }
    828         }
    829         return copyObj;
    830     }
    831
    832
    833
    834     /**
    835      * returns a peer instance associated with this om.  Since Peer classes
    836      * are not to have any instance attributes, this method returns the
    837      * same instance for all member of this class. The method could therefore
    838      * be static, but this would prevent one from overriding the behavior.
    839      */
    840     public TurbinePermissionPeer getPeer()
    841     {
    842         return peer;
    843     }
    844
    845     /**
    846      * Retrieves the TableMap object related to this Table data without
    847      * compiler warnings of using getPeer().getTableMap().
    848      *
    849      * @return The associated TableMap object.
    850      */
    851     public TableMap getTableMap() throws TorqueException
    852     {
    853         return TurbinePermissionPeer.getTableMap();
    854     }
    855
    856
    857     public String toString()
    858     {
    859         StringBuffer str = new StringBuffer();
    860         str.append("TurbinePermission:\n");
    861         str.append("PermissionId = ")
    862            .append(getPermissionId())
    863            .append("\n");
    864         str.append("Name = ")
    865            .append(getName())
    866            .append("\n");
    867         return(str.toString());
    868     }
    869 }