001    package org.apache.turbine.services.security.torque.om;
002    
003    
004    import java.math.BigDecimal;
005    import java.sql.Connection;
006    import java.util.ArrayList;
007    import java.util.Collections;
008    import java.util.Date;
009    import java.util.List;
010    
011    import org.apache.commons.lang.ObjectUtils;
012    import org.apache.torque.TorqueException;
013    import org.apache.torque.map.TableMap;
014    import org.apache.torque.om.BaseObject;
015    import org.apache.torque.om.ComboKey;
016    import org.apache.torque.om.DateKey;
017    import org.apache.torque.om.NumberKey;
018    import org.apache.torque.om.ObjectKey;
019    import org.apache.torque.om.SimpleKey;
020    import org.apache.torque.om.StringKey;
021    import org.apache.torque.om.Persistent;
022    import org.apache.torque.util.Criteria;
023    import org.apache.torque.util.Transaction;
024    
025    
026    
027    
028    
029    /**
030     * This class was autogenerated by Torque on:
031     *
032     * [Thu Jun 23 17:25:46 CEST 2011]
033     *
034     * You should not use this class directly.  It should not even be
035     * extended all references should be to TurbineGroup
036     */
037    public abstract class BaseTurbineGroup extends BaseObject
038    {
039        /** Serial version */
040        private static final long serialVersionUID = 1308842746584L;
041    
042        /** The Peer class */
043        private static final TurbineGroupPeer peer =
044            new TurbineGroupPeer();
045    
046    
047        /** The value for the groupId field */
048        private int groupId;
049    
050        /** The value for the name field */
051        private String name;
052    
053    
054        /**
055         * Get the GroupId
056         *
057         * @return int
058         */
059        public int getGroupId()
060        {
061            return groupId;
062        }
063    
064    
065        /**
066         * Set the value of GroupId
067         *
068         * @param v new value
069         */
070        public void setGroupId(int v) throws TorqueException
071        {
072    
073            if (this.groupId != v)
074            {
075                this.groupId = v;
076                setModified(true);
077            }
078    
079    
080    
081            // update associated TurbineUserGroupRole
082            if (collTurbineUserGroupRoles != null)
083            {
084                for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
085                {
086                    ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i))
087                            .setGroupId(v);
088                }
089            }
090        }
091    
092        /**
093         * Get the Name
094         *
095         * @return String
096         */
097        public String getName()
098        {
099            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 collTurbineUserGroupRoles
125         */
126        protected List<TurbineUserGroupRole> collTurbineUserGroupRoles;
127    
128        /**
129         * Temporary storage of collTurbineUserGroupRoles 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 initTurbineUserGroupRoles()
134        {
135            if (collTurbineUserGroupRoles == null)
136            {
137                collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
138            }
139        }
140    
141    
142        /**
143         * Method called to associate a TurbineUserGroupRole object to this object
144         * through the TurbineUserGroupRole foreign key attribute
145         *
146         * @param l TurbineUserGroupRole
147         * @throws TorqueException
148         */
149        public void addTurbineUserGroupRole(TurbineUserGroupRole l) throws TorqueException
150        {
151            getTurbineUserGroupRoles().add(l);
152            l.setTurbineGroup((TurbineGroup) this);
153        }
154    
155        /**
156         * Method called to associate a TurbineUserGroupRole object to this object
157         * through the TurbineUserGroupRole foreign key attribute using connection.
158         *
159         * @param l TurbineUserGroupRole
160         * @throws TorqueException
161         */
162        public void addTurbineUserGroupRole(TurbineUserGroupRole l, Connection con) throws TorqueException
163        {
164            getTurbineUserGroupRoles(con).add(l);
165            l.setTurbineGroup((TurbineGroup) this);
166        }
167    
168        /**
169         * The criteria used to select the current contents of collTurbineUserGroupRoles
170         */
171        private Criteria lastTurbineUserGroupRolesCriteria = null;
172    
173        /**
174         * If this collection has already been initialized, returns
175         * the collection. Otherwise returns the results of
176         * getTurbineUserGroupRoles(new Criteria())
177         *
178         * @return the collection of associated objects
179         * @throws TorqueException
180         */
181        public List<TurbineUserGroupRole> getTurbineUserGroupRoles()
182            throws TorqueException
183        {
184            if (collTurbineUserGroupRoles == null)
185            {
186                collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10));
187            }
188            return collTurbineUserGroupRoles;
189        }
190    
191        /**
192         * If this collection has already been initialized with
193         * an identical criteria, it returns the collection.
194         * Otherwise if this TurbineGroup has previously
195         * been saved, it will retrieve related TurbineUserGroupRoles from storage.
196         * If this TurbineGroup 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<TurbineUserGroupRole> getTurbineUserGroupRoles(Criteria criteria) throws TorqueException
203        {
204            if (collTurbineUserGroupRoles == null)
205            {
206                if (isNew())
207                {
208                   collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
209                }
210                else
211                {
212                    criteria.add(TurbineUserGroupRolePeer.GROUP_ID, getGroupId() );
213                    collTurbineUserGroupRoles = TurbineUserGroupRolePeer.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(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
225                    if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
226                    {
227                        collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
228                    }
229                }
230            }
231            lastTurbineUserGroupRolesCriteria = criteria;
232    
233            return collTurbineUserGroupRoles;
234        }
235    
236        /**
237         * If this collection has already been initialized, returns
238         * the collection. Otherwise returns the results of
239         * getTurbineUserGroupRoles(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<TurbineUserGroupRole> getTurbineUserGroupRoles(Connection con) throws TorqueException
245        {
246            if (collTurbineUserGroupRoles == null)
247            {
248                collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10), con);
249            }
250            return collTurbineUserGroupRoles;
251        }
252    
253        /**
254         * If this collection has already been initialized with
255         * an identical criteria, it returns the collection.
256         * Otherwise if this TurbineGroup has previously
257         * been saved, it will retrieve related TurbineUserGroupRoles from storage.
258         * If this TurbineGroup 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<TurbineUserGroupRole> getTurbineUserGroupRoles(Criteria criteria, Connection con)
266                throws TorqueException
267        {
268            if (collTurbineUserGroupRoles == null)
269            {
270                if (isNew())
271                {
272                   collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
273                }
274                else
275                {
276                     criteria.add(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
277                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.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(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
289                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
290                     {
291                         collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con);
292                     }
293                 }
294             }
295             lastTurbineUserGroupRolesCriteria = criteria;
296    
297             return collTurbineUserGroupRoles;
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 TurbineGroup is new, it will return
314         * an empty collection; or if this TurbineGroup has previously
315         * been saved, it will retrieve related TurbineUserGroupRoles 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 TurbineGroup.
320         */
321        protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineUser(Criteria criteria)
322            throws TorqueException
323        {
324            if (collTurbineUserGroupRoles == null)
325            {
326                if (isNew())
327                {
328                   collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
329                }
330                else
331                {
332                    criteria.add(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
333                    collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(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(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
342                if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
343                {
344                    collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
345                }
346            }
347            lastTurbineUserGroupRolesCriteria = criteria;
348    
349            return collTurbineUserGroupRoles;
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 TurbineGroup is new, it will return
364         * an empty collection; or if this TurbineGroup has previously
365         * been saved, it will retrieve related TurbineUserGroupRoles 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 TurbineGroup.
370         */
371        protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineGroup(Criteria criteria)
372            throws TorqueException
373        {
374            if (collTurbineUserGroupRoles == null)
375            {
376                if (isNew())
377                {
378                   collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
379                }
380                else
381                {
382                    criteria.add(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
383                    collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(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(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
392                if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
393                {
394                    collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
395                }
396            }
397            lastTurbineUserGroupRolesCriteria = criteria;
398    
399            return collTurbineUserGroupRoles;
400        }
401    
402    
403    
404    
405    
406    
407    
408    
409    
410        /**
411         * If this collection has already been initialized with
412         * an identical criteria, it returns the collection.
413         * Otherwise if this TurbineGroup is new, it will return
414         * an empty collection; or if this TurbineGroup has previously
415         * been saved, it will retrieve related TurbineUserGroupRoles from storage.
416         *
417         * This method is protected by default in order to keep the public
418         * api reasonable.  You can provide public methods for those you
419         * actually need in TurbineGroup.
420         */
421        protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria)
422            throws TorqueException
423        {
424            if (collTurbineUserGroupRoles == null)
425            {
426                if (isNew())
427                {
428                   collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
429                }
430                else
431                {
432                    criteria.add(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
433                    collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
434                }
435            }
436            else
437            {
438                // the following code is to determine if a new query is
439                // called for.  If the criteria is the same as the last
440                // one, just return the collection.
441                criteria.add(TurbineUserGroupRolePeer.GROUP_ID, getGroupId());
442                if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
443                {
444                    collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
445                }
446            }
447            lastTurbineUserGroupRolesCriteria = criteria;
448    
449            return collTurbineUserGroupRoles;
450        }
451    
452    
453    
454            
455        private static List<String> fieldNames = null;
456    
457        /**
458         * Generate a list of field names.
459         *
460         * @return a list of field names
461         */
462        public static synchronized List<String> getFieldNames()
463        {
464            if (fieldNames == null)
465            {
466                fieldNames = new ArrayList<String>();
467                fieldNames.add("GroupId");
468                fieldNames.add("Name");
469                fieldNames = Collections.unmodifiableList(fieldNames);
470            }
471            return fieldNames;
472        }
473    
474        /**
475         * Retrieves a field from the object by field (Java) name passed in as a String.
476         *
477         * @param name field name
478         * @return value
479         */
480        public Object getByName(String name)
481        {
482            if (name.equals("GroupId"))
483            {
484                return new Integer(getGroupId());
485            }
486            if (name.equals("Name"))
487            {
488                return getName();
489            }
490            return null;
491        }
492    
493        /**
494         * Set a field in the object by field (Java) name.
495         *
496         * @param name field name
497         * @param value field value
498         * @return True if value was set, false if not (invalid name / protected field).
499         * @throws IllegalArgumentException if object type of value does not match field object type.
500         * @throws TorqueException If a problem occurs with the set[Field] method.
501         */
502        public boolean setByName(String name, Object value )
503            throws TorqueException, IllegalArgumentException
504        {
505            if (name.equals("GroupId"))
506            {
507                if (value == null || ! (Integer.class.isInstance(value)))
508                {
509                    throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
510                }
511                setGroupId(((Integer) value).intValue());
512                return true;
513            }
514            if (name.equals("Name"))
515            {
516                // Object fields can be null
517                if (value != null && ! String.class.isInstance(value))
518                {
519                    throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
520                }
521                setName((String) value);
522                return true;
523            }
524            return false;
525        }
526    
527        /**
528         * Retrieves a field from the object by name passed in
529         * as a String.  The String must be one of the static
530         * Strings defined in this Class' Peer.
531         *
532         * @param name peer name
533         * @return value
534         */
535        public Object getByPeerName(String name)
536        {
537            if (name.equals(TurbineGroupPeer.GROUP_ID))
538            {
539                return new Integer(getGroupId());
540            }
541            if (name.equals(TurbineGroupPeer.GROUP_NAME))
542            {
543                return getName();
544            }
545            return null;
546        }
547    
548        /**
549         * Set field values by Peer Field Name
550         *
551         * @param name field name
552         * @param value field value
553         * @return True if value was set, false if not (invalid name / protected field).
554         * @throws IllegalArgumentException if object type of value does not match field object type.
555         * @throws TorqueException If a problem occurs with the set[Field] method.
556         */
557        public boolean setByPeerName(String name, Object value)
558            throws TorqueException, IllegalArgumentException
559        {
560          if (TurbineGroupPeer.GROUP_ID.equals(name))
561            {
562                return setByName("GroupId", value);
563            }
564          if (TurbineGroupPeer.GROUP_NAME.equals(name))
565            {
566                return setByName("Name", value);
567            }
568            return false;
569        }
570    
571        /**
572         * Retrieves a field from the object by Position as specified
573         * in the xml schema.  Zero-based.
574         *
575         * @param pos position in xml schema
576         * @return value
577         */
578        public Object getByPosition(int pos)
579        {
580            if (pos == 0)
581            {
582                return new Integer(getGroupId());
583            }
584            if (pos == 1)
585            {
586                return getName();
587            }
588            return null;
589        }
590    
591        /**
592         * Set field values by its position (zero based) in the XML schema.
593         *
594         * @param position The field position
595         * @param value field value
596         * @return True if value was set, false if not (invalid position / protected field).
597         * @throws IllegalArgumentException if object type of value does not match field object type.
598         * @throws TorqueException If a problem occurs with the set[Field] method.
599         */
600        public boolean setByPosition(int position, Object value)
601            throws TorqueException, IllegalArgumentException
602        {
603        if (position == 0)
604            {
605                return setByName("GroupId", value);
606            }
607        if (position == 1)
608            {
609                return setByName("Name", value);
610            }
611            return false;
612        }
613         
614        /**
615         * Stores the object in the database.  If the object is new,
616         * it inserts it; otherwise an update is performed.
617         *
618         * @throws Exception
619         */
620        public void save() throws Exception
621        {
622            save(TurbineGroupPeer.DATABASE_NAME);
623        }
624    
625        /**
626         * Stores the object in the database.  If the object is new,
627         * it inserts it; otherwise an update is performed.
628         * Note: this code is here because the method body is
629         * auto-generated conditionally and therefore needs to be
630         * in this file instead of in the super class, BaseObject.
631         *
632         * @param dbName
633         * @throws TorqueException
634         */
635        public void save(String dbName) throws TorqueException
636        {
637            Connection con = null;
638            try
639            {
640                con = Transaction.begin(dbName);
641                save(con);
642                Transaction.commit(con);
643            }
644            catch(TorqueException e)
645            {
646                Transaction.safeRollback(con);
647                throw e;
648            }
649        }
650    
651        /** flag to prevent endless save loop, if this object is referenced
652            by another object which falls in this transaction. */
653        private boolean alreadyInSave = false;
654        /**
655         * Stores the object in the database.  If the object is new,
656         * it inserts it; otherwise an update is performed.  This method
657         * is meant to be used as part of a transaction, otherwise use
658         * the save() method and the connection details will be handled
659         * internally
660         *
661         * @param con
662         * @throws TorqueException
663         */
664        public void save(Connection con) throws TorqueException
665        {
666            if (!alreadyInSave)
667            {
668                alreadyInSave = true;
669    
670    
671    
672                // If this object has been modified, then save it to the database.
673                if (isModified())
674                {
675                    if (isNew())
676                    {
677                        TurbineGroupPeer.doInsert((TurbineGroup) this, con);
678                        setNew(false);
679                    }
680                    else
681                    {
682                        TurbineGroupPeer.doUpdate((TurbineGroup) this, con);
683                    }
684                }
685    
686    
687                if (collTurbineUserGroupRoles != null)
688                {
689                    for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
690                    {
691                        ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i)).save(con);
692                    }
693                }
694                alreadyInSave = false;
695            }
696        }
697    
698    
699        /**
700         * Set the PrimaryKey using ObjectKey.
701         *
702         * @param key groupId ObjectKey
703         */
704        public void setPrimaryKey(ObjectKey key)
705            throws TorqueException
706        {
707            setGroupId(((NumberKey) key).intValue());
708        }
709    
710        /**
711         * Set the PrimaryKey using a String.
712         *
713         * @param key
714         */
715        public void setPrimaryKey(String key) throws TorqueException
716        {
717            setGroupId(Integer.parseInt(key));
718        }
719    
720    
721        /**
722         * returns an id that differentiates this object from others
723         * of its class.
724         */
725        public ObjectKey getPrimaryKey()
726        {
727            return SimpleKey.keyFor(getGroupId());
728        }
729     
730    
731        /**
732         * Makes a copy of this object.
733         * It creates a new object filling in the simple attributes.
734         * It then fills all the association collections and sets the
735         * related objects to isNew=true.
736         */
737        public TurbineGroup copy() throws TorqueException
738        {
739            return copy(true);
740        }
741    
742        /**
743         * Makes a copy of this object using connection.
744         * It creates a new object filling in the simple attributes.
745         * It then fills all the association collections and sets the
746         * related objects to isNew=true.
747         *
748         * @param con the database connection to read associated objects.
749         */
750        public TurbineGroup copy(Connection con) throws TorqueException
751        {
752            return copy(true, con);
753        }
754    
755        /**
756         * Makes a copy of this object.
757         * It creates a new object filling in the simple attributes.
758         * If the parameter deepcopy is true, it then fills all the
759         * association collections and sets the related objects to
760         * isNew=true.
761         *
762         * @param deepcopy whether to copy the associated objects.
763         */
764        public TurbineGroup copy(boolean deepcopy) throws TorqueException
765        {
766            return copyInto(new TurbineGroup(), deepcopy);
767        }
768    
769        /**
770         * Makes a copy of this object using connection.
771         * It creates a new object filling in the simple attributes.
772         * If the parameter deepcopy is true, it then fills all the
773         * association collections and sets the related objects to
774         * isNew=true.
775         *
776         * @param deepcopy whether to copy the associated objects.
777         * @param con the database connection to read associated objects.
778         */
779        public TurbineGroup copy(boolean deepcopy, Connection con) throws TorqueException
780        {
781            return copyInto(new TurbineGroup(), deepcopy, con);
782        }
783      
784        /**
785         * Fills the copyObj with the contents of this object.
786         * The associated objects are also copied and treated as new objects.
787         *
788         * @param copyObj the object to fill.
789         */
790        protected TurbineGroup copyInto(TurbineGroup copyObj) throws TorqueException
791        {
792            return copyInto(copyObj, true);
793        }
794    
795      
796        /**
797         * Fills the copyObj with the contents of this object using connection.
798         * The associated objects are also copied and treated as new objects.
799         *
800         * @param copyObj the object to fill.
801         * @param con the database connection to read associated objects.
802         */
803        protected TurbineGroup copyInto(TurbineGroup copyObj, Connection con) throws TorqueException
804        {
805            return copyInto(copyObj, true, con);
806        }
807      
808        /**
809         * Fills the copyObj with the contents of this object.
810         * If deepcopy is true, The associated objects are also copied
811         * and treated as new objects.
812         *
813         * @param copyObj the object to fill.
814         * @param deepcopy whether the associated objects should be copied.
815         */
816        protected TurbineGroup copyInto(TurbineGroup copyObj, boolean deepcopy) throws TorqueException
817        {
818            copyObj.setGroupId(groupId);
819            copyObj.setName(name);
820    
821            copyObj.setGroupId( 0);
822    
823            if (deepcopy)
824            {
825    
826    
827            List<TurbineUserGroupRole> vTurbineUserGroupRoles = getTurbineUserGroupRoles();
828            if (vTurbineUserGroupRoles != null)
829            {
830                for (int i = 0; i < vTurbineUserGroupRoles.size(); i++)
831                {
832                    TurbineUserGroupRole obj =  vTurbineUserGroupRoles.get(i);
833                    copyObj.addTurbineUserGroupRole(obj.copy());
834                }
835            }
836            else
837            {
838                copyObj.collTurbineUserGroupRoles = null;
839            }
840            }
841            return copyObj;
842        }
843            
844        
845        /**
846         * Fills the copyObj with the contents of this object using connection.
847         * If deepcopy is true, The associated objects are also copied
848         * and treated as new objects.
849         *
850         * @param copyObj the object to fill.
851         * @param deepcopy whether the associated objects should be copied.
852         * @param con the database connection to read associated objects.
853         */
854        protected TurbineGroup copyInto(TurbineGroup copyObj, boolean deepcopy, Connection con) throws TorqueException
855        {
856            copyObj.setGroupId(groupId);
857            copyObj.setName(name);
858    
859            copyObj.setGroupId( 0);
860    
861            if (deepcopy)
862            {
863    
864    
865            List<TurbineUserGroupRole> vTurbineUserGroupRoles = getTurbineUserGroupRoles(con);
866            if (vTurbineUserGroupRoles != null)
867            {
868                for (int i = 0; i < vTurbineUserGroupRoles.size(); i++)
869                {
870                    TurbineUserGroupRole obj =  vTurbineUserGroupRoles.get(i);
871                    copyObj.addTurbineUserGroupRole(obj.copy(con), con);
872                }
873            }
874            else
875            {
876                copyObj.collTurbineUserGroupRoles = null;
877            }
878            }
879            return copyObj;
880        }
881        
882        
883    
884        /**
885         * returns a peer instance associated with this om.  Since Peer classes
886         * are not to have any instance attributes, this method returns the
887         * same instance for all member of this class. The method could therefore
888         * be static, but this would prevent one from overriding the behavior.
889         */
890        public TurbineGroupPeer getPeer()
891        {
892            return peer;
893        }
894    
895        /**
896         * Retrieves the TableMap object related to this Table data without
897         * compiler warnings of using getPeer().getTableMap().
898         *
899         * @return The associated TableMap object.
900         */
901        public TableMap getTableMap() throws TorqueException
902        {
903            return TurbineGroupPeer.getTableMap();
904        }
905    
906    
907        public String toString()
908        {
909            StringBuffer str = new StringBuffer();
910            str.append("TurbineGroup:\n");
911            str.append("GroupId = ")
912               .append(getGroupId())
913               .append("\n");
914            str.append("Name = ")
915               .append(getName())
916               .append("\n");
917            return(str.toString());
918        }
919    }