001package org.apache.fulcrum.security.torque.om;
002
003import java.io.Serializable;
004import java.sql.Connection;
005import java.util.ArrayList;
006import java.util.List;
007import java.util.Objects;
008
009import org.apache.torque.TorqueException;
010import org.apache.torque.map.TableMap;
011import org.apache.torque.om.NumberKey;
012import org.apache.torque.om.ObjectKey;
013import org.apache.torque.om.SimpleKey;
014import org.apache.torque.om.Persistent;
015import org.apache.torque.criteria.Criteria;
016import org.apache.torque.util.TorqueConnection;
017import org.apache.torque.util.Transaction;
018
019/**
020 * This class was autogenerated by Torque on:
021 *
022 * [Thu Nov 04 13:34:21 CET 2021]
023 *
024 * You should not use this class directly.  It should not even be
025 * extended; all references should be to TurbineGroup
026 */
027@SuppressWarnings("unused")
028public abstract class BaseTurbineGroup extends org.apache.fulcrum.security.torque.turbine.DefaultAbstractTurbineGroup
029    implements Persistent, Serializable
030{
031    /** Serial version */
032    private static final long serialVersionUID = 1636029261762L;
033
034
035
036    /** Defines the entityId field. */
037    private Integer entityId = null;
038
039    /** Defines the entityName field. */
040    private String entityName = null;
041
042    /** Whether this object was modified after loading or after last save. */
043    private boolean modified = true;
044
045    /** 
046     * Whether this object was loaded from the database or already saved 
047     * (false) or whether it is not yet in the database(true).
048     */
049    private boolean isNew = true;
050
051    /** Flag which indicates whether this object is currently saving. */
052    private boolean saving = false;
053
054    /** 
055     * Flag which indicates whether this object is currently loaded
056     * from the database. 
057     */
058    private boolean loading = false;
059
060    /** 
061     * Flag which indicates whether this object was deleted from the database.
062     * Note that this flags does not always display the current database state,
063     * there is no magical connection between this flag and the database.
064     */
065    private boolean deleted = false;
066
067
068
069    /** Defines the collTurbineUserGroupRoles field. */
070    protected List<TurbineUserGroupRole> collTurbineUserGroupRoles = null;
071
072
073
074    /**
075     * Get the value of entityId.
076     *
077     * @return the value of entityId as Integer
078     */
079    public Integer getEntityId() 
080    {
081        
082        return entityId;
083    }
084
085    /**
086     * Set the value of entityId.
087     *
088     * @param v new value of entityId
089     */
090    public void setEntityId(Integer v)
091    {
092        if (!Objects.equals(this.entityId, v))
093        {
094            setModified(true);
095        }
096
097        this.entityId = v;
098
099        // update associated objects in collTurbineUserGroupRoles 
100        if (collTurbineUserGroupRoles != null)
101        {
102            for (TurbineUserGroupRole element : collTurbineUserGroupRoles)
103            {
104                element.setGroupId(v);
105            }
106        }
107
108    }
109    
110    /**
111     * Get the value of entityName.
112     *
113     * @return the value of entityName as String
114     */
115    public String getEntityName() 
116    {
117        
118        return entityName;
119    }
120
121    /**
122     * Set the value of entityName.
123     *
124     * @param v new value of entityName
125     */
126    public void setEntityName(String v)
127    {
128        if (!Objects.equals(this.entityName, v))
129        {
130            setModified(true);
131        }
132
133        this.entityName = v;
134
135
136    }
137    
138
139    /**
140     * Returns whether the object has ever been saved.  This will
141     * be false, if the object was retrieved from storage or was created
142     * and then saved.
143     *
144     * @return true, if the object has never been persisted.
145     */
146    public boolean isNew()
147    {
148        return isNew;
149    }
150
151    /**
152     * Sets whether the object has ever been saved.
153     *
154     * @param isNew true if the object has never been saved, false otherwise.
155     */
156    public void setNew(boolean isNew)
157    {
158        this.isNew = isNew;
159    }
160
161    /**
162     * Returns whether the object has been modified.
163     *
164     * @return True if the object has been modified.
165     */
166    public boolean isModified()
167    {
168        return modified;
169    }
170
171    /**
172     * Sets whether the object has been modified.
173     *
174     * @param modified true if the object has been modified, false otherwise.
175     */
176    public void setModified(boolean modified)
177    {
178        this.modified = modified;
179    }
180
181    /**
182     * Sets the modified state for the object to be false.
183     */
184    public void resetModified()
185    {
186        modified = false;
187    }
188
189
190    /**
191     * Returns whether this object is currently saving.
192     *
193     * @return true if this object is currently saving, false otherwise.
194     */
195    public boolean isSaving()
196    {
197        return saving;
198    }
199
200    /**
201     * Sets whether this object is currently saving.
202     *
203     * @param saving true if this object is currently saving, false otherwise.
204     */
205    public void setSaving(boolean saving)
206    {
207        this.saving = saving;
208    }
209
210
211    /**
212     * Returns whether this object is currently being loaded from the database.
213     *
214     * @return true if this object is currently loading, false otherwise.
215     */
216    public boolean isLoading()
217    {
218        return loading;
219    }
220
221    /**
222     * Sets whether this object is currently being loaded from the database.
223     *
224     * @param loading true if this object is currently loading, false otherwise.
225     */
226    public void setLoading(boolean loading)
227    {
228        this.loading = loading;
229    }
230
231
232    /**
233     * Returns whether this object was deleted from the database.
234     * Note that this getter does not automatically reflect database state,
235     * it will be set to true by Torque if doDelete() was called with this 
236     * object. Bulk deletes and deletes via primary key do not change
237     * this flag. Also, if doDelete() was called on an object which does
238     * not exist in the database, the deleted flag is set to true even if
239     * it was not deleted.
240     *
241     * @return true if this object was deleted, false otherwise.
242     */
243    public boolean isDeleted()
244    {
245        return deleted;
246    }
247
248    /**
249     * Sets whether this object was deleted from the database.
250     *
251     * @param deleted true if this object was deleted, false otherwise.
252     */
253    public void setDeleted(boolean deleted)
254    {
255        this.deleted = deleted;
256    }
257
258
259
260
261    /**
262     * Initializes the cache collTurbineUserGroupRoles for referenced objects.
263     * This, means, if collTurbineUserGroupRoles is null when this operation is called, it is
264     * initialized with an empty collection, otherwise it remains unchanged. 
265     *
266     * @return the (possibly new) content of the field collTurbineUserGroupRoles, not null.
267     */
268    public List<TurbineUserGroupRole> initTurbineUserGroupRoles()
269    {
270        if (collTurbineUserGroupRoles == null)
271        {
272            collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
273        }
274        return collTurbineUserGroupRoles;
275    }
276
277    /**
278     * Checks whether the cache collTurbineUserGroupRoles for referenced objects has either been
279     * loaded from the database or has been manually initialized.
280     *
281     * @return boolean true if initialized
282     */
283    public boolean isTurbineUserGroupRolesInitialized()
284    {
285        return (collTurbineUserGroupRoles != null);
286    }
287
288
289    /**
290     * Method called to associate a TurbineUserGroupRole object to this object
291     * through the collTurbineUserGroupRoles foreign key attribute.
292     * If the associated objects were not retrieved before
293     * and this object is not new, the associated objects are retrieved
294     * from the database before adding the <code>toAdd</code> object.
295     *
296     * @param toAdd the object to add to the associated objects, not null.
297     *
298     * @throws TorqueException if retrieval of the associated objects fails.
299     * @throws NullPointerException if toAdd is null.
300     */
301    public void addTurbineUserGroupRole(TurbineUserGroupRole toAdd)
302        throws TorqueException
303    {
304        toAdd.setTurbineGroup((TurbineGroup) this);
305        getTurbineUserGroupRoles().add(toAdd);
306    }
307
308    /**
309     * Method called to associate a TurbineUserGroupRole object to this object
310     * through the collTurbineUserGroupRoles foreign key attribute using connection.
311     *
312     * @param l TurbineUserGroupRole
313     * @throws TorqueException if retrieval of the associated objects fails.
314     */
315    public void addTurbineUserGroupRole(TurbineUserGroupRole l, Connection con) throws TorqueException
316    {
317        getTurbineUserGroupRoles(con).add(l);
318        l.setTurbineGroup((TurbineGroup) this);
319    }
320    
321    /**
322     * Method called to reset the cache of TurbineUserGroupRole objects
323     * which are related through the collTurbineUserGroupRoles foreign key attribute.
324     */
325    public void resetTurbineUserGroupRole()
326    {
327        collTurbineUserGroupRoles = null;
328    }
329
330
331    /**
332     * The criteria used to select the current contents of collTurbineUserGroupRoles
333     */
334    private Criteria lastTurbineUserGroupRoleCriteria = null;
335
336    /**
337     * If this collection has already been initialized, returns
338     * the collection. Otherwise returns the results of
339     * getTurbineUserGroupRoles(new Criteria())
340     *
341     * @return the collection of associated objects
342     * @throws TorqueException
343     */
344    public List<TurbineUserGroupRole> getTurbineUserGroupRoles()
345        throws TorqueException
346    {
347        if (collTurbineUserGroupRoles == null)
348        {
349            collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria());
350            for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
351            {
352                turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
353            }
354        }
355        return collTurbineUserGroupRoles;
356    }
357
358    /**
359     * If this collection has already been initialized with
360     * an identical criteria, it returns the collection.
361     * Otherwise if this BaseTurbineGroup has previously
362     * been saved, it will retrieve related collTurbineUserGroupRoles from storage.
363     * If this BaseTurbineGroup is new, it will return
364     * an empty collection or the current collection, the criteria
365     * is ignored on a new object.
366     *
367     * @throws TorqueException If a problem occurs with the get[criteria] method.     
368     */
369    public List<TurbineUserGroupRole> getTurbineUserGroupRoles(Criteria criteria) throws TorqueException
370    {
371        if (collTurbineUserGroupRoles == null)
372        {
373            if (isNew())
374            {
375               initTurbineUserGroupRoles();
376            }
377            else
378            {
379                criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
380                collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelect(criteria);
381                for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
382                {
383                    turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
384                }
385            }
386        }
387        else
388        {
389            // criteria has no effect for a new object
390            if (!isNew())
391            {
392                // the following code is to determine if a new query is
393                // called for.  If the criteria is the same as the last
394                // one, just return the collection.
395                criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
396                if (lastTurbineUserGroupRoleCriteria == null
397                        || !lastTurbineUserGroupRoleCriteria.equals(criteria))
398                {
399                    collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelect(criteria);
400                    for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
401                    {
402                        turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
403                    }
404                }
405            }
406        }
407        lastTurbineUserGroupRoleCriteria = criteria;
408        return collTurbineUserGroupRoles;
409    }
410
411    /**
412     * If this collection has already been initialized, returns
413     * the collection. Otherwise returns the results of
414     * getTurbineUserGroupRoles(new Criteria(),Connection)
415     * This method takes in the Connection also as input so that
416     * referenced objects can also be obtained using a Connection
417     * that is taken as input
418     *
419     * @param con the Connection
420     * @return List<TurbineUserGroupRole> results of the collection
421     * @throws TorqueException If a problem occurs with the get[connection] method.
422     */
423    public List<TurbineUserGroupRole> getTurbineUserGroupRoles(Connection con) throws TorqueException
424    {
425        if (collTurbineUserGroupRoles == null)
426        {
427            collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(), con);
428            for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
429            {
430                turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
431            }
432        }
433        return collTurbineUserGroupRoles;
434    }
435
436    /**
437     * If this collection has already been initialized with
438     * an identical criteria, it returns the collection.
439     * Otherwise if this BaseTurbineGroup has previously
440     * been saved, it will retrieve the related TurbineUserGroupRole Objects
441     * from storage.
442     * If this BaseTurbineGroup is new, it will return
443     * an empty collection or the current collection, the criteria
444     * is ignored on a new object.
445     * This method takes in the Connection also as input so that
446     * referenced objects can also be obtained using a Connection
447     * that is taken as input
448     *
449     * @param con the Connection
450     * @return List<TurbineUserGroupRole> results of the collection
451     * @throws TorqueException If a problem occurs with the get[connection] method.
452     */
453    public List<TurbineUserGroupRole> getTurbineUserGroupRoles(Criteria criteria, Connection con)
454            throws TorqueException
455    {
456        if (collTurbineUserGroupRoles == null)
457        {
458            if (isNew())
459            {
460               initTurbineUserGroupRoles();
461            }
462            else
463            {
464                criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
465                collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelect(criteria, con);
466                for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
467                {
468                    turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
469                }
470            }
471        }
472        else
473        {
474             // criteria has no effect for a new object
475            if (!isNew())
476            {
477                // the following code is to determine if a new query is
478                // called for.  If the criteria is the same as the last
479                // one, just return the collection.
480                criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
481                if (lastTurbineUserGroupRoleCriteria == null
482                        || !lastTurbineUserGroupRoleCriteria.equals(criteria))
483                {
484                    collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelect(criteria, con);
485                    for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
486                    {
487                        turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
488                    }
489                }
490            }
491        }
492        lastTurbineUserGroupRoleCriteria = criteria;
493
494        return collTurbineUserGroupRoles;
495    }
496
497    /**
498     * If this collection has already been initialized with
499     * an identical criteria, it returns the collection.
500     * Otherwise if this BaseTurbineGroup is new, it will return
501     * an empty collection; or if this thisObjectClassName has previously
502     * been saved, it will retrieve the related objects from storage.
503     *
504     * This method is protected by default in order to keep the public
505     * api reasonable.  You can change the access modifier to public
506     * by overriding this method in the child class.
507     *
508     * @return List<TurbineUserGroupRole> the collection
509     * @param criteria the criteria to use when filling the collection.
510     * @throws TorqueException if associated objects are not found
511     */
512    protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineUser(Criteria criteria) throws TorqueException
513    {
514        try (TorqueConnection connection = Transaction.begin(criteria.getDbName()))
515        {
516            List<TurbineUserGroupRole> result = getTurbineUserGroupRolesJoinTurbineUser(criteria, connection);
517
518            Transaction.commit(connection);
519            return result;
520        }
521    }
522
523    /**
524     * If this collection has already been initialized with
525     * an identical criteria, it returns the collection.
526     * Otherwise if this BaseTurbineGroup is new, it will return
527     * an empty collection; or if this BaseTurbineGroup has previously
528     * been saved, it will retrieve the related objects from storage.
529     *
530     * This method is protected by default in order to keep the public
531     * api reasonable.  You can change the access modifier to public
532     * by overriding this method in the child class.
533     */
534    protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineUser(Criteria criteria, Connection connection)
535        throws TorqueException
536    {
537        if (collTurbineUserGroupRoles == null)
538        {
539            if (isNew())
540            {
541                initTurbineUserGroupRoles();
542            }
543            else
544            {
545                criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
546                collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria, connection);
547                for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
548                {
549                    turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
550                }
551            }
552        }
553        else
554        {
555            // the following code is to determine if a new query is
556            // called for.  If the criteria is the same as the last
557            // one, just return the collection.
558            criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
559            if (lastTurbineUserGroupRoleCriteria == null
560                        || !lastTurbineUserGroupRoleCriteria.equals(criteria))
561            {
562                collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria, connection);
563                for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
564                {
565                    turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
566                }
567            }
568        }
569        lastTurbineUserGroupRoleCriteria = criteria;
570
571        return collTurbineUserGroupRoles;
572    }
573
574    /**
575     * If this collection has already been initialized with
576     * an identical criteria, it returns the collection.
577     * Otherwise if this BaseTurbineGroup is new, it will return
578     * an empty collection; or if this thisObjectClassName has previously
579     * been saved, it will retrieve the related objects from storage.
580     *
581     * This method is protected by default in order to keep the public
582     * api reasonable.  You can change the access modifier to public
583     * by overriding this method in the child class.
584     *
585     * @return List<TurbineUserGroupRole> the collection
586     * @param criteria the criteria to use when filling the collection.
587     * @throws TorqueException if associated objects are not found
588     */
589    protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria) throws TorqueException
590    {
591        try (TorqueConnection connection = Transaction.begin(criteria.getDbName()))
592        {
593            List<TurbineUserGroupRole> result = getTurbineUserGroupRolesJoinTurbineRole(criteria, connection);
594
595            Transaction.commit(connection);
596            return result;
597        }
598    }
599
600    /**
601     * If this collection has already been initialized with
602     * an identical criteria, it returns the collection.
603     * Otherwise if this BaseTurbineGroup is new, it will return
604     * an empty collection; or if this BaseTurbineGroup has previously
605     * been saved, it will retrieve the related objects from storage.
606     *
607     * This method is protected by default in order to keep the public
608     * api reasonable.  You can change the access modifier to public
609     * by overriding this method in the child class.
610     */
611    protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria, Connection connection)
612        throws TorqueException
613    {
614        if (collTurbineUserGroupRoles == null)
615        {
616            if (isNew())
617            {
618                initTurbineUserGroupRoles();
619            }
620            else
621            {
622                criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
623                collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria, connection);
624                for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
625                {
626                    turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
627                }
628            }
629        }
630        else
631        {
632            // the following code is to determine if a new query is
633            // called for.  If the criteria is the same as the last
634            // one, just return the collection.
635            criteria.and(org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
636            if (lastTurbineUserGroupRoleCriteria == null
637                        || !lastTurbineUserGroupRoleCriteria.equals(criteria))
638            {
639                collTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria, connection);
640                for (TurbineUserGroupRole turbineUserGroupRole : collTurbineUserGroupRoles)
641                {
642                    turbineUserGroupRole.setTurbineGroup((TurbineGroup) this);
643                }
644            }
645        }
646        lastTurbineUserGroupRoleCriteria = criteria;
647
648        return collTurbineUserGroupRoles;
649    }
650
651
652
653
654
655    /**
656     * Stores an object in the database.  If the object is new,
657     * it is inserted; otherwise an update is performed.
658     *
659     * @throws TorqueException if an error occurs during saving.
660     */
661    public void save() throws TorqueException
662    {
663        save(TurbineGroupPeer.DATABASE_NAME);
664    }
665
666    /**
667     * Stores an object in the database.  If the object is new,
668     * it is inserted; otherwise an update is performed.
669     *
670     * @param dbName the name of the database to which the object
671     *        should be saved.
672     *
673     * @throws TorqueException if an error occurs during saving.
674     */
675    public void save(String dbName) 
676            throws TorqueException
677    {
678        try (TorqueConnection con = Transaction.begin(dbName))
679        {
680            save(con);
681            Transaction.commit(con);
682        }
683    }
684
685    /**
686     * Stores an object in the database.  If the object is new,
687     * it is inserted; otherwise an update is performed.  This method
688     * is meant to be used as part of a transaction, otherwise use
689     * the save() method and the connection details will be handled
690     * internally.
691     *
692     * @param con the connection to use for saving the object, not null.
693     *
694     * @throws TorqueException if an error occurs during saving.
695     */
696    public void save(Connection con) 
697            throws TorqueException
698    {
699        if (isSaving())
700        {
701            return;
702        }
703        try
704        {
705            setSaving(true);
706            // If this object has been modified, then save it to the database.
707            if (isModified())
708            {
709                if (isNew())
710                {
711                    TurbineGroupPeer.doInsert((TurbineGroup) this, con);
712                    setNew(false);
713                }
714                else
715                {
716                    TurbineGroupPeer.doUpdate((TurbineGroup) this, con);
717                }
718            }
719
720            if (isTurbineUserGroupRolesInitialized())
721            {
722                for (TurbineUserGroupRole collTurbineUserGroupRoles : getTurbineUserGroupRoles())
723                {
724                    collTurbineUserGroupRoles.save(con);
725                }
726            }
727        }
728        finally
729        {
730            setSaving(false);
731        }
732    }
733
734
735
736
737    /**
738     * Set the PrimaryKey using ObjectKey.
739     *
740     * @param key entityId ObjectKey
741     */
742    public void setPrimaryKey(ObjectKey<?> key)
743        
744    {
745        setEntityId(Integer.valueOf(((NumberKey) key).intValue()));
746    }
747
748    /**
749     * Set the PrimaryKey using a String.
750     *
751     * @param key the primary key to set.
752     */
753    public void setPrimaryKey(String key) 
754    {
755        setEntityId(new Integer(key));
756    }
757
758
759    /**
760     * returns an id that differentiates this object from others
761     * of its class.
762     */
763    public ObjectKey<?> getPrimaryKey()
764    {
765        return SimpleKey.keyFor(getEntityId());
766    }
767
768
769
770    /**
771     * Makes a copy of this object.
772     * It creates a new object filling in the simple attributes.
773     * It then fills all the association collections and sets the
774     * related objects to isNew=true.
775     * @throws TorqueException if retrieval of the associated objects fails  
776     */
777    public TurbineGroup copy() throws TorqueException
778    {
779        return copy(true);
780    }
781
782    /**
783     * Makes a copy of this object using a connection.
784     * It creates a new object filling in the simple attributes.
785     * It then fills all the association collections and sets the
786     * related objects to isNew=true.
787     *
788     * @param con the database connection to read associated objects.
789     * @throws TorqueException if retrieval of the associated objects fails     
790     */
791    public TurbineGroup copy(Connection con) throws TorqueException
792    {
793        return copy(true, con);
794    }
795
796    /**
797     * Makes a copy of this object.
798     * It creates a new object filling in the simple attributes.
799     * If the parameter deepcopy is true, it then fills all the
800     * association collections and sets the related objects to
801     * isNew=true.
802     *
803     * @param deepcopy whether to copy the associated objects.
804     * @throws TorqueException if retrieval of the associated objects fails
805     */
806    public TurbineGroup copy(boolean deepcopy) throws TorqueException
807    {
808        TurbineGroup turbineGroup = new TurbineGroup();
809
810        return copyInto(turbineGroup, deepcopy);
811    }
812
813    /**
814     * Makes a copy of this object using connection.
815     * It creates a new object filling in the simple attributes.
816     * If the parameter deepcopy is true, it then fills all the
817     * association collections and sets the related objects to
818     * isNew=true.
819     *
820     * @param deepcopy whether to copy the associated objects.
821     * @param con the database connection to read associated objects.
822     * @throws TorqueException if retrieval of the associated objects fails
823     */
824    public TurbineGroup copy(boolean deepcopy, Connection con) throws TorqueException
825    {
826        TurbineGroup turbineGroup = new TurbineGroup();
827
828        return copyInto(turbineGroup, deepcopy, con);
829    }
830  
831    /**
832     * Fills the copyObj with the contents of this object.
833     * The associated objects are also copied and treated as new objects.
834     *
835     * @param copyObj the object to fill.
836     * @throws TorqueException if retrieval of the associated objects fails
837     */
838    public TurbineGroup copyInto(TurbineGroup copyObj) throws TorqueException
839    {
840        return copyInto(copyObj, true);
841    }
842
843    /**
844     * Fills the copyObj with the contents of this object using connection.
845     * The associated objects are also copied and treated as new objects.
846     *
847     * @param copyObj the object to fill.
848     * @param con the database connection to read associated objects.
849     * @throws TorqueException if retrieval of the associated objects fails
850     */
851    public TurbineGroup copyInto(TurbineGroup copyObj, Connection con) throws TorqueException
852    {
853        return copyInto(copyObj, true, con);
854    }
855  
856    /**
857     * Fills the copyObj with the contents of this object.
858     * If deepcopy is true, The associated objects are also copied
859     * and treated as new objects.
860     *
861     * @param copyObj the object to fill.
862     * @param deepcopy whether the associated objects should be copied.
863     * @throws TorqueException if retrieval of the associated objects fails
864     */
865    protected TurbineGroup copyInto(TurbineGroup copyObj, boolean deepcopy) throws TorqueException
866    {
867        copyObj.setEntityId((Integer) null);
868        copyObj.setEntityName(entityName);
869
870        if (deepcopy)
871        {
872            if (collTurbineUserGroupRoles != null)
873            {
874                for (TurbineUserGroupRole obj : collTurbineUserGroupRoles)
875                {
876                    copyObj.addTurbineUserGroupRole(obj.copy());
877                }
878            }
879            else
880            {
881                copyObj.collTurbineUserGroupRoles = null;
882            }
883        }
884        return copyObj;
885    }
886        
887    
888    /**
889     * Fills the copyObj with the contents of this object using connection.
890     * If deepcopy is true, The associated objects are also copied
891     * and treated as new objects.
892     *
893     * @param copyObj the object to fill.
894     * @param deepcopy whether the associated objects should be copied.
895     * @param con the database connection to read associated objects.
896     * @throws TorqueException if retrieval of the associated objects fails
897     */
898    public TurbineGroup copyInto(TurbineGroup copyObj, boolean deepcopy, Connection con) throws TorqueException
899    {
900        copyObj.setEntityId((Integer) null);
901        copyObj.setEntityName(entityName);
902
903        if (deepcopy)
904        {
905            for (TurbineUserGroupRole obj : getTurbineUserGroupRoles(con))
906            {
907                copyObj.addTurbineUserGroupRole(obj.copy());
908            }
909        }
910        return copyObj;
911    }
912
913    /** The Peer class */
914    private static final org.apache.fulcrum.security.torque.om.TurbineGroupPeer peer
915            = new org.apache.fulcrum.security.torque.om.TurbineGroupPeer();
916
917    /**
918     * returns a peer instance associated with this om.  Since Peer classes
919     * are not to have any instance attributes, this method returns the
920     * same instance for all member of this class. The method could therefore
921     * be static, but this would prevent one from overriding the behavior.
922     */
923    public org.apache.fulcrum.security.torque.om.TurbineGroupPeer getPeer()
924    {
925        return peer;
926    }
927
928    /**
929     * Retrieves the TableMap object related to this Table data without
930     * compiler warnings of using getPeer().getTableMap().
931     *
932     * @return The associated TableMap object.
933     * @throws TorqueException if associated objects are not found
934     */
935    public TableMap getTableMap() throws TorqueException
936    {
937        return org.apache.fulcrum.security.torque.om.TurbineGroupPeer.getTableMap();
938    }
939
940
941
942    public String toString()
943    {
944        StringBuffer str = new StringBuffer();
945        str.append("TurbineGroup:\n");
946        str.append("entityId = ")
947           .append(getEntityId())
948           .append("\n");
949        str.append("entityName = ")
950           .append(getEntityName())
951           .append("\n");
952        return(str.toString());
953    }
954
955    /**
956     * Compares the primary key of this instance with the key of another.
957     *
958     * @param toCompare The object to compare to.
959     * @return Whether the primary keys are equal and the object have the
960     *         same class.
961     */
962    public boolean equals(Object toCompare)
963    {
964        if (toCompare == null)
965        {
966            return false;
967        }
968        if (this == toCompare)
969        {
970            return true;
971        }
972        if (!getClass().equals(toCompare.getClass()))
973        {
974            return false;
975        }
976        TurbineGroup other = (TurbineGroup) toCompare;
977        if (getPrimaryKey() == null || other.getPrimaryKey() == null)
978        {
979            return false;
980        }
981        return getPrimaryKey().equals(other.getPrimaryKey());
982    }
983
984    /**
985     * If the primary key is not <code>null</code>, return the hashcode of the
986     * primary key.  Otherwise calls <code>Object.hashCode()</code>.
987     *
988     * @return an <code>int</code> value
989     */
990    public int hashCode()
991    {
992        ObjectKey<?> ok = getPrimaryKey();
993        if (ok == null)
994        {
995            return super.hashCode();
996        }
997
998        return ok.hashCode();
999    }
1000
1001
1002
1003    /**
1004     * Compares the content of this object to another object
1005     *
1006     * @param toCompare The object to compare to.
1007     * @return true if all of the columns in the other object have 
1008     *         the same value as the objects in this class.
1009     */
1010    public boolean valueEquals(TurbineGroup toCompare)
1011    {
1012        if (toCompare == null)
1013        {
1014            return false;
1015        }
1016        if (this == toCompare)
1017        {
1018            return true;
1019        }
1020        if (!Objects.equals(this.entityId, toCompare.getEntityId()))
1021        {
1022            return false;
1023        }
1024        if (!Objects.equals(this.entityName, toCompare.getEntityName()))
1025        {
1026            return false;
1027        }
1028        return true;
1029    }
1030
1031
1032
1033}