View Javadoc

1   package olr.om;
2   
3   
4   import java.sql.Connection;
5   import java.util.ArrayList;
6   import java.util.Collections;
7   import java.util.Date;
8   import java.util.List;
9   
10  import org.apache.commons.lang.ObjectUtils;
11  import org.apache.torque.TorqueException;
12  import org.apache.torque.om.BaseObject;
13  import org.apache.torque.om.NumberKey;
14  import org.apache.torque.om.ObjectKey;
15  import org.apache.torque.om.SimpleKey;
16  import org.apache.torque.util.Criteria;
17  import org.apache.torque.util.Transaction;
18  
19    
20      
21    
22  /***
23   * This class was autogenerated by Torque on:
24   *
25   * [Tue Jul 13 14:47:47 CEST 2004]
26   *
27   * You should not use this class directly.  It should not even be
28   * extended all references should be to RdfResource
29   */
30  public abstract class BaseRdfResource extends BaseObject
31  {
32      /*** The Peer class */
33      private static final RdfResourcePeer peer =
34          new RdfResourcePeer();
35  
36          
37      /*** The value for the id field */
38      private int id;
39        
40      /*** The value for the ns field */
41      private int ns;
42        
43      /*** The value for the roName field */
44      private String roName;
45        
46      /*** The value for the usr field */
47      private int usr;
48        
49      /*** The value for the modified field */
50      private Date modified;
51                                            
52      /*** The value for the garbage field */
53      private int garbage = 0;
54    
55      
56      /***
57       * Get the Id
58       *
59       * @return int
60       */
61      public int getId()
62      {
63          return id;
64      }
65  
66                                                
67      /***
68       * Set the value of Id
69       *
70       * @param v new value
71       */
72      public void setId(int v) throws TorqueException
73      {
74      
75                    if (this.id != v)
76                {
77              this.id = v;
78              setModified(true);
79          }
80      
81            
82                                    
83          // update associated RdfStatement
84          if (collRdfStatementsRelatedByPredicate != null)
85          {
86              for (int i = 0; i < collRdfStatementsRelatedByPredicate.size(); i++)
87              {
88                  ((RdfStatement) collRdfStatementsRelatedByPredicate.get(i))
89                      .setPredicate(v);
90              }
91          }
92                                            
93          // update associated RdfStatement
94          if (collRdfStatementsRelatedByObjResource != null)
95          {
96              for (int i = 0; i < collRdfStatementsRelatedByObjResource.size(); i++)
97              {
98                  ((RdfStatement) collRdfStatementsRelatedByObjResource.get(i))
99                      .setObjResource(v);
100             }
101         }
102                                           
103         // update associated RdfStatement
104         if (collRdfStatementsRelatedBySubject != null)
105         {
106             for (int i = 0; i < collRdfStatementsRelatedBySubject.size(); i++)
107             {
108                 ((RdfStatement) collRdfStatementsRelatedBySubject.get(i))
109                     .setSubject(v);
110             }
111         }
112                       }
113   
114     /***
115      * Get the Ns
116      *
117      * @return int
118      */
119     public int getNs()
120     {
121         return ns;
122     }
123 
124                               
125     /***
126      * Set the value of Ns
127      *
128      * @param v new value
129      */
130     public void setNs(int v) throws TorqueException
131     {
132     
133                   if (this.ns != v)
134               {
135             this.ns = v;
136             setModified(true);
137         }
138     
139                           
140                 if (aRdfNamespace != null && !(aRdfNamespace.getId() == v))
141                 {
142             aRdfNamespace = null;
143         }
144       
145               }
146   
147     /***
148      * Get the RoName
149      *
150      * @return String
151      */
152     public String getRoName()
153     {
154         return roName;
155     }
156 
157                         
158     /***
159      * Set the value of RoName
160      *
161      * @param v new value
162      */
163     public void setRoName(String v) 
164     {
165     
166                   if (!ObjectUtils.equals(this.roName, v))
167               {
168             this.roName = v;
169             setModified(true);
170         }
171     
172           
173               }
174   
175     /***
176      * Get the Usr
177      *
178      * @return int
179      */
180     public int getUsr()
181     {
182         return usr;
183     }
184 
185                               
186     /***
187      * Set the value of Usr
188      *
189      * @param v new value
190      */
191     public void setUsr(int v) throws TorqueException
192     {
193     
194                   if (this.usr != v)
195               {
196             this.usr = v;
197             setModified(true);
198         }
199     
200                           
201                 if (aRdfUser != null && !(aRdfUser.getId() == v))
202                 {
203             aRdfUser = null;
204         }
205       
206               }
207   
208     /***
209      * Get the Modified
210      *
211      * @return Date
212      */
213     public Date getModified()
214     {
215         return modified;
216     }
217 
218                         
219     /***
220      * Set the value of Modified
221      *
222      * @param v new value
223      */
224     public void setModified(Date v) 
225     {
226     
227                   if (!ObjectUtils.equals(this.modified, v))
228               {
229             this.modified = v;
230             setModified(true);
231         }
232     
233           
234               }
235   
236     /***
237      * Get the Garbage
238      *
239      * @return int
240      */
241     public int getGarbage()
242     {
243         return garbage;
244     }
245 
246                         
247     /***
248      * Set the value of Garbage
249      *
250      * @param v new value
251      */
252     public void setGarbage(int v) 
253     {
254     
255                   if (this.garbage != v)
256               {
257             this.garbage = v;
258             setModified(true);
259         }
260     
261           
262               }
263   
264       
265     
266                   
267     
268         private RdfNamespace aRdfNamespace;
269 
270     /***
271      * Declares an association between this object and a RdfNamespace object
272      *
273      * @param v RdfNamespace
274      * @throws TorqueException
275      */
276     public void setRdfNamespace(RdfNamespace v) throws TorqueException
277     {
278             if (v == null)
279         {
280                     setNs(0);
281                   }
282         else
283         {
284             setNs(v.getId());
285         }
286                 aRdfNamespace = v;
287     }
288 
289                                             
290     /***
291      * Get the associated RdfNamespace object
292      *
293      * @return the associated RdfNamespace object
294      * @throws TorqueException
295      */
296     public RdfNamespace getRdfNamespace() throws TorqueException
297     {
298         if (aRdfNamespace == null && (this.ns > 0))
299         {
300                           aRdfNamespace = RdfNamespacePeer.retrieveByPK(SimpleKey.keyFor(this.ns));
301               
302             /* The following can be used instead of the line above to
303                guarantee the related object contains a reference
304                to this object, but this level of coupling
305                may be undesirable in many circumstances.
306                As it can lead to a db query with many results that may
307                never be used.
308                RdfNamespace obj = RdfNamespacePeer.retrieveByPK(this.ns);
309                obj.addRdfResources(this);
310             */
311         }
312         return aRdfNamespace;
313     }
314 
315     /***
316      * Provides convenient way to set a relationship based on a
317      * ObjectKey.  e.g.
318      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
319      *
320            */
321     public void setRdfNamespaceKey(ObjectKey key) throws TorqueException
322     {
323       
324                         setNs(((NumberKey) key).intValue());
325                   }
326     
327     
328                   
329     
330         private RdfUser aRdfUser;
331 
332     /***
333      * Declares an association between this object and a RdfUser object
334      *
335      * @param v RdfUser
336      * @throws TorqueException
337      */
338     public void setRdfUser(RdfUser v) throws TorqueException
339     {
340             if (v == null)
341         {
342                     setUsr(0);
343                   }
344         else
345         {
346             setUsr(v.getId());
347         }
348                 aRdfUser = v;
349     }
350 
351                                             
352     /***
353      * Get the associated RdfUser object
354      *
355      * @return the associated RdfUser object
356      * @throws TorqueException
357      */
358     public RdfUser getRdfUser() throws TorqueException
359     {
360         if (aRdfUser == null && (this.usr > 0))
361         {
362                           aRdfUser = RdfUserPeer.retrieveByPK(SimpleKey.keyFor(this.usr));
363               
364             /* The following can be used instead of the line above to
365                guarantee the related object contains a reference
366                to this object, but this level of coupling
367                may be undesirable in many circumstances.
368                As it can lead to a db query with many results that may
369                never be used.
370                RdfUser obj = RdfUserPeer.retrieveByPK(this.usr);
371                obj.addRdfResources(this);
372             */
373         }
374         return aRdfUser;
375     }
376 
377     /***
378      * Provides convenient way to set a relationship based on a
379      * ObjectKey.  e.g.
380      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
381      *
382            */
383     public void setRdfUserKey(ObjectKey key) throws TorqueException
384     {
385       
386                         setUsr(((NumberKey) key).intValue());
387                   }
388        
389                                         
390             
391     /***
392      * Collection to store aggregation of collRdfStatementsRelatedByPredicate
393      */
394     protected List collRdfStatementsRelatedByPredicate;
395 
396     /***
397      * Temporary storage of collRdfStatementsRelatedByPredicate to save a possible db hit in
398      * the event objects are add to the collection, but the
399      * complete collection is never requested.
400      */
401     protected void initRdfStatementsRelatedByPredicate()
402     {
403         if (collRdfStatementsRelatedByPredicate == null)
404         {
405             collRdfStatementsRelatedByPredicate = new ArrayList();
406         }
407     }
408 
409     /***
410      * Method called to associate a RdfStatement object to this object
411      * through the RdfStatement foreign key attribute
412      *
413      * @param l RdfStatement
414      * @throws TorqueException
415      */
416     public void addRdfStatementRelatedByPredicate(RdfStatement l) throws TorqueException
417     {
418         getRdfStatementsRelatedByPredicate().add(l);
419         l.setRdfResourceRelatedByPredicate((RdfResource) this);
420     }
421 
422     /***
423      * The criteria used to select the current contents of collRdfStatementsRelatedByPredicate
424      */
425     private Criteria lastRdfStatementsRelatedByPredicateCriteria = null;
426 
427     /***
428      * If this collection has already been initialized, returns
429      * the collection. Otherwise returns the results of
430      * getRdfStatementsRelatedByPredicate(new Criteria())
431      *
432      * @throws TorqueException
433      */
434     public List getRdfStatementsRelatedByPredicate() throws TorqueException
435     {
436         if (collRdfStatementsRelatedByPredicate == null)
437         {
438             collRdfStatementsRelatedByPredicate = getRdfStatementsRelatedByPredicate(new Criteria(10));
439         }
440         return collRdfStatementsRelatedByPredicate;
441     }
442 
443     /***
444      * If this collection has already been initialized with
445      * an identical criteria, it returns the collection.
446      * Otherwise if this RdfResource has previously
447      * been saved, it will retrieve related RdfStatementsRelatedByPredicate from storage.
448      * If this RdfResource is new, it will return
449      * an empty collection or the current collection, the criteria
450      * is ignored on a new object.
451      *
452      * @throws TorqueException
453      */
454     public List getRdfStatementsRelatedByPredicate(Criteria criteria) throws TorqueException
455     {
456         if (collRdfStatementsRelatedByPredicate == null)
457         {
458             if (isNew())
459             {
460                collRdfStatementsRelatedByPredicate = new ArrayList();
461             }
462             else
463             {
464                       criteria.add(RdfStatementPeer.PREDICATE, getId() );
465                       collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelect(criteria);
466             }
467         }
468         else
469         {
470             // criteria has no effect for a new object
471             if (!isNew())
472             {
473                 // the following code is to determine if a new query is
474                 // called for.  If the criteria is the same as the last
475                 // one, just return the collection.
476                       criteria.add(RdfStatementPeer.PREDICATE, getId());
477                       if (!lastRdfStatementsRelatedByPredicateCriteria.equals(criteria))
478                 {
479                     collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelect(criteria);
480                 }
481             }
482         }
483         lastRdfStatementsRelatedByPredicateCriteria = criteria;
484 
485         return collRdfStatementsRelatedByPredicate;
486     }
487 
488     /***
489      * If this collection has already been initialized, returns
490      * the collection. Otherwise returns the results of
491      * getRdfStatementsRelatedByPredicate(new Criteria(),Connection)
492      * This method takes in the Connection also as input so that
493      * referenced objects can also be obtained using a Connection
494      * that is taken as input
495      */
496     public List getRdfStatementsRelatedByPredicate(Connection con) throws TorqueException
497     {
498         if (collRdfStatementsRelatedByPredicate == null)
499         {
500             collRdfStatementsRelatedByPredicate = getRdfStatementsRelatedByPredicate(new Criteria(10), con);
501         }
502         return collRdfStatementsRelatedByPredicate;
503     }
504 
505     /***
506      * If this collection has already been initialized with
507      * an identical criteria, it returns the collection.
508      * Otherwise if this RdfResource has previously
509      * been saved, it will retrieve related RdfStatementsRelatedByPredicate from storage.
510      * If this RdfResource is new, it will return
511      * an empty collection or the current collection, the criteria
512      * is ignored on a new object.
513      * This method takes in the Connection also as input so that
514      * referenced objects can also be obtained using a Connection
515      * that is taken as input
516      */
517     public List getRdfStatementsRelatedByPredicate(Criteria criteria, Connection con)
518             throws TorqueException
519     {
520         if (collRdfStatementsRelatedByPredicate == null)
521         {
522             if (isNew())
523             {
524                collRdfStatementsRelatedByPredicate = new ArrayList();
525             }
526             else
527             {
528                        criteria.add(RdfStatementPeer.PREDICATE, getId());
529                        collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelect(criteria, con);
530              }
531          }
532          else
533          {
534              // criteria has no effect for a new object
535              if (!isNew())
536              {
537                  // the following code is to determine if a new query is
538                  // called for.  If the criteria is the same as the last
539                  // one, just return the collection.
540                        criteria.add(RdfStatementPeer.PREDICATE, getId());
541                        if (!lastRdfStatementsRelatedByPredicateCriteria.equals(criteria))
542                  {
543                      collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelect(criteria, con);
544                  }
545              }
546          }
547          lastRdfStatementsRelatedByPredicateCriteria = criteria;
548 
549          return collRdfStatementsRelatedByPredicate;
550      }
551 
552                                           
553               
554                     
555                     
556                                 
557                                                               
558                                         
559                     
560                                 
561           
562     /***
563      * If this collection has already been initialized with
564      * an identical criteria, it returns the collection.
565      * Otherwise if this RdfResource is new, it will return
566      * an empty collection; or if this RdfResource has previously
567      * been saved, it will retrieve related RdfStatementsRelatedByPredicate from storage.
568      *
569      * This method is protected by default in order to keep the public
570      * api reasonable.  You can provide public methods for those you
571      * actually need in RdfResource.
572      */
573     protected List getRdfStatementsRelatedByPredicateJoinRdfUser(Criteria criteria)
574         throws TorqueException
575     {
576         if (collRdfStatementsRelatedByPredicate == null)
577         {
578             if (isNew())
579             {
580                collRdfStatementsRelatedByPredicate = new ArrayList();
581             }
582             else
583             {
584                             criteria.add(RdfStatementPeer.PREDICATE, getId());
585                             collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfUser(criteria);
586             }
587         }
588         else
589         {
590             // the following code is to determine if a new query is
591             // called for.  If the criteria is the same as the last
592             // one, just return the collection.
593             boolean newCriteria = true;
594                         criteria.add(RdfStatementPeer.PREDICATE, getId());
595                         if (!lastRdfStatementsRelatedByPredicateCriteria.equals(criteria))
596             {
597                 collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfUser(criteria);
598             }
599         }
600         lastRdfStatementsRelatedByPredicateCriteria = criteria;
601 
602         return collRdfStatementsRelatedByPredicate;
603     }
604                   
605                     
606                               
607                                             
608                                                                           
609                                         
610                     
611                                             
612                   
613                     
614                               
615                                             
616                                                                           
617                                         
618                     
619                                 
620           
621     /***
622      * If this collection has already been initialized with
623      * an identical criteria, it returns the collection.
624      * Otherwise if this RdfResource is new, it will return
625      * an empty collection; or if this RdfResource has previously
626      * been saved, it will retrieve related RdfStatementsRelatedByPredicate from storage.
627      *
628      * This method is protected by default in order to keep the public
629      * api reasonable.  You can provide public methods for those you
630      * actually need in RdfResource.
631      */
632     protected List getRdfStatementsRelatedByPredicateJoinRdfResourceRelatedByObjResource(Criteria criteria)
633         throws TorqueException
634     {
635         if (collRdfStatementsRelatedByPredicate == null)
636         {
637             if (isNew())
638             {
639                collRdfStatementsRelatedByPredicate = new ArrayList();
640             }
641             else
642             {
643                             criteria.add(RdfStatementPeer.PREDICATE, getId());
644                             collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfResourceRelatedByObjResource(criteria);
645             }
646         }
647         else
648         {
649             // the following code is to determine if a new query is
650             // called for.  If the criteria is the same as the last
651             // one, just return the collection.
652             boolean newCriteria = true;
653                         criteria.add(RdfStatementPeer.PREDICATE, getId());
654                         if (!lastRdfStatementsRelatedByPredicateCriteria.equals(criteria))
655             {
656                 collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfResourceRelatedByObjResource(criteria);
657             }
658         }
659         lastRdfStatementsRelatedByPredicateCriteria = criteria;
660 
661         return collRdfStatementsRelatedByPredicate;
662     }
663                   
664                     
665                               
666                                             
667                                                                           
668                                         
669                     
670                                 
671           
672     /***
673      * If this collection has already been initialized with
674      * an identical criteria, it returns the collection.
675      * Otherwise if this RdfResource is new, it will return
676      * an empty collection; or if this RdfResource has previously
677      * been saved, it will retrieve related RdfStatementsRelatedByPredicate from storage.
678      *
679      * This method is protected by default in order to keep the public
680      * api reasonable.  You can provide public methods for those you
681      * actually need in RdfResource.
682      */
683     protected List getRdfStatementsRelatedByPredicateJoinRdfResourceRelatedBySubject(Criteria criteria)
684         throws TorqueException
685     {
686         if (collRdfStatementsRelatedByPredicate == null)
687         {
688             if (isNew())
689             {
690                collRdfStatementsRelatedByPredicate = new ArrayList();
691             }
692             else
693             {
694                             criteria.add(RdfStatementPeer.PREDICATE, getId());
695                             collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfResourceRelatedBySubject(criteria);
696             }
697         }
698         else
699         {
700             // the following code is to determine if a new query is
701             // called for.  If the criteria is the same as the last
702             // one, just return the collection.
703             boolean newCriteria = true;
704                         criteria.add(RdfStatementPeer.PREDICATE, getId());
705                         if (!lastRdfStatementsRelatedByPredicateCriteria.equals(criteria))
706             {
707                 collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfResourceRelatedBySubject(criteria);
708             }
709         }
710         lastRdfStatementsRelatedByPredicateCriteria = criteria;
711 
712         return collRdfStatementsRelatedByPredicate;
713     }
714                   
715                     
716                     
717                                 
718                                                               
719                                         
720                     
721                                 
722           
723     /***
724      * If this collection has already been initialized with
725      * an identical criteria, it returns the collection.
726      * Otherwise if this RdfResource is new, it will return
727      * an empty collection; or if this RdfResource has previously
728      * been saved, it will retrieve related RdfStatementsRelatedByPredicate from storage.
729      *
730      * This method is protected by default in order to keep the public
731      * api reasonable.  You can provide public methods for those you
732      * actually need in RdfResource.
733      */
734     protected List getRdfStatementsRelatedByPredicateJoinRdfLiteral(Criteria criteria)
735         throws TorqueException
736     {
737         if (collRdfStatementsRelatedByPredicate == null)
738         {
739             if (isNew())
740             {
741                collRdfStatementsRelatedByPredicate = new ArrayList();
742             }
743             else
744             {
745                             criteria.add(RdfStatementPeer.PREDICATE, getId());
746                             collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfLiteral(criteria);
747             }
748         }
749         else
750         {
751             // the following code is to determine if a new query is
752             // called for.  If the criteria is the same as the last
753             // one, just return the collection.
754             boolean newCriteria = true;
755                         criteria.add(RdfStatementPeer.PREDICATE, getId());
756                         if (!lastRdfStatementsRelatedByPredicateCriteria.equals(criteria))
757             {
758                 collRdfStatementsRelatedByPredicate = RdfStatementPeer.doSelectJoinRdfLiteral(criteria);
759             }
760         }
761         lastRdfStatementsRelatedByPredicateCriteria = criteria;
762 
763         return collRdfStatementsRelatedByPredicate;
764     }
765                             
766 
767 
768                                   
769             
770     /***
771      * Collection to store aggregation of collRdfStatementsRelatedByObjResource
772      */
773     protected List collRdfStatementsRelatedByObjResource;
774 
775     /***
776      * Temporary storage of collRdfStatementsRelatedByObjResource to save a possible db hit in
777      * the event objects are add to the collection, but the
778      * complete collection is never requested.
779      */
780     protected void initRdfStatementsRelatedByObjResource()
781     {
782         if (collRdfStatementsRelatedByObjResource == null)
783         {
784             collRdfStatementsRelatedByObjResource = new ArrayList();
785         }
786     }
787 
788     /***
789      * Method called to associate a RdfStatement object to this object
790      * through the RdfStatement foreign key attribute
791      *
792      * @param l RdfStatement
793      * @throws TorqueException
794      */
795     public void addRdfStatementRelatedByObjResource(RdfStatement l) throws TorqueException
796     {
797         getRdfStatementsRelatedByObjResource().add(l);
798         l.setRdfResourceRelatedByObjResource((RdfResource) this);
799     }
800 
801     /***
802      * The criteria used to select the current contents of collRdfStatementsRelatedByObjResource
803      */
804     private Criteria lastRdfStatementsRelatedByObjResourceCriteria = null;
805 
806     /***
807      * If this collection has already been initialized, returns
808      * the collection. Otherwise returns the results of
809      * getRdfStatementsRelatedByObjResource(new Criteria())
810      *
811      * @throws TorqueException
812      */
813     public List getRdfStatementsRelatedByObjResource() throws TorqueException
814     {
815         if (collRdfStatementsRelatedByObjResource == null)
816         {
817             collRdfStatementsRelatedByObjResource = getRdfStatementsRelatedByObjResource(new Criteria(10));
818         }
819         return collRdfStatementsRelatedByObjResource;
820     }
821 
822     /***
823      * If this collection has already been initialized with
824      * an identical criteria, it returns the collection.
825      * Otherwise if this RdfResource has previously
826      * been saved, it will retrieve related RdfStatementsRelatedByObjResource from storage.
827      * If this RdfResource is new, it will return
828      * an empty collection or the current collection, the criteria
829      * is ignored on a new object.
830      *
831      * @throws TorqueException
832      */
833     public List getRdfStatementsRelatedByObjResource(Criteria criteria) throws TorqueException
834     {
835         if (collRdfStatementsRelatedByObjResource == null)
836         {
837             if (isNew())
838             {
839                collRdfStatementsRelatedByObjResource = new ArrayList();
840             }
841             else
842             {
843                       criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId() );
844                       collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelect(criteria);
845             }
846         }
847         else
848         {
849             // criteria has no effect for a new object
850             if (!isNew())
851             {
852                 // the following code is to determine if a new query is
853                 // called for.  If the criteria is the same as the last
854                 // one, just return the collection.
855                       criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
856                       if (!lastRdfStatementsRelatedByObjResourceCriteria.equals(criteria))
857                 {
858                     collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelect(criteria);
859                 }
860             }
861         }
862         lastRdfStatementsRelatedByObjResourceCriteria = criteria;
863 
864         return collRdfStatementsRelatedByObjResource;
865     }
866 
867     /***
868      * If this collection has already been initialized, returns
869      * the collection. Otherwise returns the results of
870      * getRdfStatementsRelatedByObjResource(new Criteria(),Connection)
871      * This method takes in the Connection also as input so that
872      * referenced objects can also be obtained using a Connection
873      * that is taken as input
874      */
875     public List getRdfStatementsRelatedByObjResource(Connection con) throws TorqueException
876     {
877         if (collRdfStatementsRelatedByObjResource == null)
878         {
879             collRdfStatementsRelatedByObjResource = getRdfStatementsRelatedByObjResource(new Criteria(10), con);
880         }
881         return collRdfStatementsRelatedByObjResource;
882     }
883 
884     /***
885      * If this collection has already been initialized with
886      * an identical criteria, it returns the collection.
887      * Otherwise if this RdfResource has previously
888      * been saved, it will retrieve related RdfStatementsRelatedByObjResource from storage.
889      * If this RdfResource is new, it will return
890      * an empty collection or the current collection, the criteria
891      * is ignored on a new object.
892      * This method takes in the Connection also as input so that
893      * referenced objects can also be obtained using a Connection
894      * that is taken as input
895      */
896     public List getRdfStatementsRelatedByObjResource(Criteria criteria, Connection con)
897             throws TorqueException
898     {
899         if (collRdfStatementsRelatedByObjResource == null)
900         {
901             if (isNew())
902             {
903                collRdfStatementsRelatedByObjResource = new ArrayList();
904             }
905             else
906             {
907                        criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
908                        collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelect(criteria, con);
909              }
910          }
911          else
912          {
913              // criteria has no effect for a new object
914              if (!isNew())
915              {
916                  // the following code is to determine if a new query is
917                  // called for.  If the criteria is the same as the last
918                  // one, just return the collection.
919                        criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
920                        if (!lastRdfStatementsRelatedByObjResourceCriteria.equals(criteria))
921                  {
922                      collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelect(criteria, con);
923                  }
924              }
925          }
926          lastRdfStatementsRelatedByObjResourceCriteria = criteria;
927 
928          return collRdfStatementsRelatedByObjResource;
929      }
930 
931                                           
932               
933                     
934                     
935                                 
936                                                               
937                                         
938                     
939                                 
940           
941     /***
942      * If this collection has already been initialized with
943      * an identical criteria, it returns the collection.
944      * Otherwise if this RdfResource is new, it will return
945      * an empty collection; or if this RdfResource has previously
946      * been saved, it will retrieve related RdfStatementsRelatedByObjResource from storage.
947      *
948      * This method is protected by default in order to keep the public
949      * api reasonable.  You can provide public methods for those you
950      * actually need in RdfResource.
951      */
952     protected List getRdfStatementsRelatedByObjResourceJoinRdfUser(Criteria criteria)
953         throws TorqueException
954     {
955         if (collRdfStatementsRelatedByObjResource == null)
956         {
957             if (isNew())
958             {
959                collRdfStatementsRelatedByObjResource = new ArrayList();
960             }
961             else
962             {
963                             criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
964                             collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfUser(criteria);
965             }
966         }
967         else
968         {
969             // the following code is to determine if a new query is
970             // called for.  If the criteria is the same as the last
971             // one, just return the collection.
972             boolean newCriteria = true;
973                         criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
974                         if (!lastRdfStatementsRelatedByObjResourceCriteria.equals(criteria))
975             {
976                 collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfUser(criteria);
977             }
978         }
979         lastRdfStatementsRelatedByObjResourceCriteria = criteria;
980 
981         return collRdfStatementsRelatedByObjResource;
982     }
983                   
984                     
985                               
986                                             
987                                                                           
988                                         
989                     
990                                 
991           
992     /***
993      * If this collection has already been initialized with
994      * an identical criteria, it returns the collection.
995      * Otherwise if this RdfResource is new, it will return
996      * an empty collection; or if this RdfResource has previously
997      * been saved, it will retrieve related RdfStatementsRelatedByObjResource from storage.
998      *
999      * This method is protected by default in order to keep the public
1000      * api reasonable.  You can provide public methods for those you
1001      * actually need in RdfResource.
1002      */
1003     protected List getRdfStatementsRelatedByObjResourceJoinRdfResourceRelatedByPredicate(Criteria criteria)
1004         throws TorqueException
1005     {
1006         if (collRdfStatementsRelatedByObjResource == null)
1007         {
1008             if (isNew())
1009             {
1010                collRdfStatementsRelatedByObjResource = new ArrayList();
1011             }
1012             else
1013             {
1014                             criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
1015                             collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfResourceRelatedByPredicate(criteria);
1016             }
1017         }
1018         else
1019         {
1020             // the following code is to determine if a new query is
1021             // called for.  If the criteria is the same as the last
1022             // one, just return the collection.
1023             boolean newCriteria = true;
1024                         criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
1025                         if (!lastRdfStatementsRelatedByObjResourceCriteria.equals(criteria))
1026             {
1027                 collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfResourceRelatedByPredicate(criteria);
1028             }
1029         }
1030         lastRdfStatementsRelatedByObjResourceCriteria = criteria;
1031 
1032         return collRdfStatementsRelatedByObjResource;
1033     }
1034                   
1035                     
1036                               
1037                                             
1038                                                                           
1039                                         
1040                     
1041                                             
1042                   
1043                     
1044                               
1045                                             
1046                                                                           
1047                                         
1048                     
1049                                 
1050           
1051     /***
1052      * If this collection has already been initialized with
1053      * an identical criteria, it returns the collection.
1054      * Otherwise if this RdfResource is new, it will return
1055      * an empty collection; or if this RdfResource has previously
1056      * been saved, it will retrieve related RdfStatementsRelatedByObjResource from storage.
1057      *
1058      * This method is protected by default in order to keep the public
1059      * api reasonable.  You can provide public methods for those you
1060      * actually need in RdfResource.
1061      */
1062     protected List getRdfStatementsRelatedByObjResourceJoinRdfResourceRelatedBySubject(Criteria criteria)
1063         throws TorqueException
1064     {
1065         if (collRdfStatementsRelatedByObjResource == null)
1066         {
1067             if (isNew())
1068             {
1069                collRdfStatementsRelatedByObjResource = new ArrayList();
1070             }
1071             else
1072             {
1073                             criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
1074                             collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfResourceRelatedBySubject(criteria);
1075             }
1076         }
1077         else
1078         {
1079             // the following code is to determine if a new query is
1080             // called for.  If the criteria is the same as the last
1081             // one, just return the collection.
1082             boolean newCriteria = true;
1083                         criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
1084                         if (!lastRdfStatementsRelatedByObjResourceCriteria.equals(criteria))
1085             {
1086                 collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfResourceRelatedBySubject(criteria);
1087             }
1088         }
1089         lastRdfStatementsRelatedByObjResourceCriteria = criteria;
1090 
1091         return collRdfStatementsRelatedByObjResource;
1092     }
1093                   
1094                     
1095                     
1096                                 
1097                                                               
1098                                         
1099                     
1100                                 
1101           
1102     /***
1103      * If this collection has already been initialized with
1104      * an identical criteria, it returns the collection.
1105      * Otherwise if this RdfResource is new, it will return
1106      * an empty collection; or if this RdfResource has previously
1107      * been saved, it will retrieve related RdfStatementsRelatedByObjResource from storage.
1108      *
1109      * This method is protected by default in order to keep the public
1110      * api reasonable.  You can provide public methods for those you
1111      * actually need in RdfResource.
1112      */
1113     protected List getRdfStatementsRelatedByObjResourceJoinRdfLiteral(Criteria criteria)
1114         throws TorqueException
1115     {
1116         if (collRdfStatementsRelatedByObjResource == null)
1117         {
1118             if (isNew())
1119             {
1120                collRdfStatementsRelatedByObjResource = new ArrayList();
1121             }
1122             else
1123             {
1124                             criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
1125                             collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfLiteral(criteria);
1126             }
1127         }
1128         else
1129         {
1130             // the following code is to determine if a new query is
1131             // called for.  If the criteria is the same as the last
1132             // one, just return the collection.
1133             boolean newCriteria = true;
1134                         criteria.add(RdfStatementPeer.OBJ_RESOURCE, getId());
1135                         if (!lastRdfStatementsRelatedByObjResourceCriteria.equals(criteria))
1136             {
1137                 collRdfStatementsRelatedByObjResource = RdfStatementPeer.doSelectJoinRdfLiteral(criteria);
1138             }
1139         }
1140         lastRdfStatementsRelatedByObjResourceCriteria = criteria;
1141 
1142         return collRdfStatementsRelatedByObjResource;
1143     }
1144                             
1145 
1146 
1147                                   
1148             
1149     /***
1150      * Collection to store aggregation of collRdfStatementsRelatedBySubject
1151      */
1152     protected List collRdfStatementsRelatedBySubject;
1153 
1154     /***
1155      * Temporary storage of collRdfStatementsRelatedBySubject to save a possible db hit in
1156      * the event objects are add to the collection, but the
1157      * complete collection is never requested.
1158      */
1159     protected void initRdfStatementsRelatedBySubject()
1160     {
1161         if (collRdfStatementsRelatedBySubject == null)
1162         {
1163             collRdfStatementsRelatedBySubject = new ArrayList();
1164         }
1165     }
1166 
1167     /***
1168      * Method called to associate a RdfStatement object to this object
1169      * through the RdfStatement foreign key attribute
1170      *
1171      * @param l RdfStatement
1172      * @throws TorqueException
1173      */
1174     public void addRdfStatementRelatedBySubject(RdfStatement l) throws TorqueException
1175     {
1176         getRdfStatementsRelatedBySubject().add(l);
1177         l.setRdfResourceRelatedBySubject((RdfResource) this);
1178     }
1179 
1180     /***
1181      * The criteria used to select the current contents of collRdfStatementsRelatedBySubject
1182      */
1183     private Criteria lastRdfStatementsRelatedBySubjectCriteria = null;
1184 
1185     /***
1186      * If this collection has already been initialized, returns
1187      * the collection. Otherwise returns the results of
1188      * getRdfStatementsRelatedBySubject(new Criteria())
1189      *
1190      * @throws TorqueException
1191      */
1192     public List getRdfStatementsRelatedBySubject() throws TorqueException
1193     {
1194         if (collRdfStatementsRelatedBySubject == null)
1195         {
1196             collRdfStatementsRelatedBySubject = getRdfStatementsRelatedBySubject(new Criteria(10));
1197         }
1198         return collRdfStatementsRelatedBySubject;
1199     }
1200 
1201     /***
1202      * If this collection has already been initialized with
1203      * an identical criteria, it returns the collection.
1204      * Otherwise if this RdfResource has previously
1205      * been saved, it will retrieve related RdfStatementsRelatedBySubject from storage.
1206      * If this RdfResource is new, it will return
1207      * an empty collection or the current collection, the criteria
1208      * is ignored on a new object.
1209      *
1210      * @throws TorqueException
1211      */
1212     public List getRdfStatementsRelatedBySubject(Criteria criteria) throws TorqueException
1213     {
1214         if (collRdfStatementsRelatedBySubject == null)
1215         {
1216             if (isNew())
1217             {
1218                collRdfStatementsRelatedBySubject = new ArrayList();
1219             }
1220             else
1221             {
1222                       criteria.add(RdfStatementPeer.SUBJECT, getId() );
1223                       collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelect(criteria);
1224             }
1225         }
1226         else
1227         {
1228             // criteria has no effect for a new object
1229             if (!isNew())
1230             {
1231                 // the following code is to determine if a new query is
1232                 // called for.  If the criteria is the same as the last
1233                 // one, just return the collection.
1234                       criteria.add(RdfStatementPeer.SUBJECT, getId());
1235                       if (!lastRdfStatementsRelatedBySubjectCriteria.equals(criteria))
1236                 {
1237                     collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelect(criteria);
1238                 }
1239             }
1240         }
1241         lastRdfStatementsRelatedBySubjectCriteria = criteria;
1242 
1243         return collRdfStatementsRelatedBySubject;
1244     }
1245 
1246     /***
1247      * If this collection has already been initialized, returns
1248      * the collection. Otherwise returns the results of
1249      * getRdfStatementsRelatedBySubject(new Criteria(),Connection)
1250      * This method takes in the Connection also as input so that
1251      * referenced objects can also be obtained using a Connection
1252      * that is taken as input
1253      */
1254     public List getRdfStatementsRelatedBySubject(Connection con) throws TorqueException
1255     {
1256         if (collRdfStatementsRelatedBySubject == null)
1257         {
1258             collRdfStatementsRelatedBySubject = getRdfStatementsRelatedBySubject(new Criteria(10), con);
1259         }
1260         return collRdfStatementsRelatedBySubject;
1261     }
1262 
1263     /***
1264      * If this collection has already been initialized with
1265      * an identical criteria, it returns the collection.
1266      * Otherwise if this RdfResource has previously
1267      * been saved, it will retrieve related RdfStatementsRelatedBySubject from storage.
1268      * If this RdfResource is new, it will return
1269      * an empty collection or the current collection, the criteria
1270      * is ignored on a new object.
1271      * This method takes in the Connection also as input so that
1272      * referenced objects can also be obtained using a Connection
1273      * that is taken as input
1274      */
1275     public List getRdfStatementsRelatedBySubject(Criteria criteria, Connection con)
1276             throws TorqueException
1277     {
1278         if (collRdfStatementsRelatedBySubject == null)
1279         {
1280             if (isNew())
1281             {
1282                collRdfStatementsRelatedBySubject = new ArrayList();
1283             }
1284             else
1285             {
1286                        criteria.add(RdfStatementPeer.SUBJECT, getId());
1287                        collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelect(criteria, con);
1288              }
1289          }
1290          else
1291          {
1292              // criteria has no effect for a new object
1293              if (!isNew())
1294              {
1295                  // the following code is to determine if a new query is
1296                  // called for.  If the criteria is the same as the last
1297                  // one, just return the collection.
1298                        criteria.add(RdfStatementPeer.SUBJECT, getId());
1299                        if (!lastRdfStatementsRelatedBySubjectCriteria.equals(criteria))
1300                  {
1301                      collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelect(criteria, con);
1302                  }
1303              }
1304          }
1305          lastRdfStatementsRelatedBySubjectCriteria = criteria;
1306 
1307          return collRdfStatementsRelatedBySubject;
1308      }
1309 
1310                                           
1311               
1312                     
1313                     
1314                                 
1315                                                               
1316                                         
1317                     
1318                                 
1319           
1320     /***
1321      * If this collection has already been initialized with
1322      * an identical criteria, it returns the collection.
1323      * Otherwise if this RdfResource is new, it will return
1324      * an empty collection; or if this RdfResource has previously
1325      * been saved, it will retrieve related RdfStatementsRelatedBySubject from storage.
1326      *
1327      * This method is protected by default in order to keep the public
1328      * api reasonable.  You can provide public methods for those you
1329      * actually need in RdfResource.
1330      */
1331     protected List getRdfStatementsRelatedBySubjectJoinRdfUser(Criteria criteria)
1332         throws TorqueException
1333     {
1334         if (collRdfStatementsRelatedBySubject == null)
1335         {
1336             if (isNew())
1337             {
1338                collRdfStatementsRelatedBySubject = new ArrayList();
1339             }
1340             else
1341             {
1342                             criteria.add(RdfStatementPeer.SUBJECT, getId());
1343                             collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfUser(criteria);
1344             }
1345         }
1346         else
1347         {
1348             // the following code is to determine if a new query is
1349             // called for.  If the criteria is the same as the last
1350             // one, just return the collection.
1351             boolean newCriteria = true;
1352                         criteria.add(RdfStatementPeer.SUBJECT, getId());
1353                         if (!lastRdfStatementsRelatedBySubjectCriteria.equals(criteria))
1354             {
1355                 collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfUser(criteria);
1356             }
1357         }
1358         lastRdfStatementsRelatedBySubjectCriteria = criteria;
1359 
1360         return collRdfStatementsRelatedBySubject;
1361     }
1362                   
1363                     
1364                               
1365                                             
1366                                                                           
1367                                         
1368                     
1369                                 
1370           
1371     /***
1372      * If this collection has already been initialized with
1373      * an identical criteria, it returns the collection.
1374      * Otherwise if this RdfResource is new, it will return
1375      * an empty collection; or if this RdfResource has previously
1376      * been saved, it will retrieve related RdfStatementsRelatedBySubject from storage.
1377      *
1378      * This method is protected by default in order to keep the public
1379      * api reasonable.  You can provide public methods for those you
1380      * actually need in RdfResource.
1381      */
1382     protected List getRdfStatementsRelatedBySubjectJoinRdfResourceRelatedByPredicate(Criteria criteria)
1383         throws TorqueException
1384     {
1385         if (collRdfStatementsRelatedBySubject == null)
1386         {
1387             if (isNew())
1388             {
1389                collRdfStatementsRelatedBySubject = new ArrayList();
1390             }
1391             else
1392             {
1393                             criteria.add(RdfStatementPeer.SUBJECT, getId());
1394                             collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfResourceRelatedByPredicate(criteria);
1395             }
1396         }
1397         else
1398         {
1399             // the following code is to determine if a new query is
1400             // called for.  If the criteria is the same as the last
1401             // one, just return the collection.
1402             boolean newCriteria = true;
1403                         criteria.add(RdfStatementPeer.SUBJECT, getId());
1404                         if (!lastRdfStatementsRelatedBySubjectCriteria.equals(criteria))
1405             {
1406                 collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfResourceRelatedByPredicate(criteria);
1407             }
1408         }
1409         lastRdfStatementsRelatedBySubjectCriteria = criteria;
1410 
1411         return collRdfStatementsRelatedBySubject;
1412     }
1413                   
1414                     
1415                               
1416                                             
1417                                                                           
1418                                         
1419                     
1420                                 
1421           
1422     /***
1423      * If this collection has already been initialized with
1424      * an identical criteria, it returns the collection.
1425      * Otherwise if this RdfResource is new, it will return
1426      * an empty collection; or if this RdfResource has previously
1427      * been saved, it will retrieve related RdfStatementsRelatedBySubject from storage.
1428      *
1429      * This method is protected by default in order to keep the public
1430      * api reasonable.  You can provide public methods for those you
1431      * actually need in RdfResource.
1432      */
1433     protected List getRdfStatementsRelatedBySubjectJoinRdfResourceRelatedByObjResource(Criteria criteria)
1434         throws TorqueException
1435     {
1436         if (collRdfStatementsRelatedBySubject == null)
1437         {
1438             if (isNew())
1439             {
1440                collRdfStatementsRelatedBySubject = new ArrayList();
1441             }
1442             else
1443             {
1444                             criteria.add(RdfStatementPeer.SUBJECT, getId());
1445                             collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfResourceRelatedByObjResource(criteria);
1446             }
1447         }
1448         else
1449         {
1450             // the following code is to determine if a new query is
1451             // called for.  If the criteria is the same as the last
1452             // one, just return the collection.
1453             boolean newCriteria = true;
1454                         criteria.add(RdfStatementPeer.SUBJECT, getId());
1455                         if (!lastRdfStatementsRelatedBySubjectCriteria.equals(criteria))
1456             {
1457                 collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfResourceRelatedByObjResource(criteria);
1458             }
1459         }
1460         lastRdfStatementsRelatedBySubjectCriteria = criteria;
1461 
1462         return collRdfStatementsRelatedBySubject;
1463     }
1464                   
1465                     
1466                               
1467                                             
1468                                                                           
1469                                         
1470                     
1471                                             
1472                   
1473                     
1474                     
1475                                 
1476                                                               
1477                                         
1478                     
1479                                 
1480           
1481     /***
1482      * If this collection has already been initialized with
1483      * an identical criteria, it returns the collection.
1484      * Otherwise if this RdfResource is new, it will return
1485      * an empty collection; or if this RdfResource has previously
1486      * been saved, it will retrieve related RdfStatementsRelatedBySubject from storage.
1487      *
1488      * This method is protected by default in order to keep the public
1489      * api reasonable.  You can provide public methods for those you
1490      * actually need in RdfResource.
1491      */
1492     protected List getRdfStatementsRelatedBySubjectJoinRdfLiteral(Criteria criteria)
1493         throws TorqueException
1494     {
1495         if (collRdfStatementsRelatedBySubject == null)
1496         {
1497             if (isNew())
1498             {
1499                collRdfStatementsRelatedBySubject = new ArrayList();
1500             }
1501             else
1502             {
1503                             criteria.add(RdfStatementPeer.SUBJECT, getId());
1504                             collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfLiteral(criteria);
1505             }
1506         }
1507         else
1508         {
1509             // the following code is to determine if a new query is
1510             // called for.  If the criteria is the same as the last
1511             // one, just return the collection.
1512             boolean newCriteria = true;
1513                         criteria.add(RdfStatementPeer.SUBJECT, getId());
1514                         if (!lastRdfStatementsRelatedBySubjectCriteria.equals(criteria))
1515             {
1516                 collRdfStatementsRelatedBySubject = RdfStatementPeer.doSelectJoinRdfLiteral(criteria);
1517             }
1518         }
1519         lastRdfStatementsRelatedBySubjectCriteria = criteria;
1520 
1521         return collRdfStatementsRelatedBySubject;
1522     }
1523                             
1524 
1525 
1526           
1527     private static List fieldNames = null;
1528 
1529     /***
1530      * Generate a list of field names.
1531      *
1532      * @return a list of field names
1533      */
1534     public static synchronized List getFieldNames()
1535     {
1536         if (fieldNames == null)
1537         {
1538             fieldNames = new ArrayList();
1539               fieldNames.add("Id");
1540               fieldNames.add("Ns");
1541               fieldNames.add("RoName");
1542               fieldNames.add("Usr");
1543               fieldNames.add("Modified");
1544               fieldNames.add("Garbage");
1545               fieldNames = Collections.unmodifiableList(fieldNames);
1546         }
1547         return fieldNames;
1548     }
1549 
1550     /***
1551      * Retrieves a field from the object by name passed in as a String.
1552      *
1553      * @param name field name
1554      * @return value
1555      */
1556     public Object getByName(String name)
1557     {
1558           if (name.equals("Id"))
1559         {
1560                 return new Integer(getId());
1561             }
1562           if (name.equals("Ns"))
1563         {
1564                 return new Integer(getNs());
1565             }
1566           if (name.equals("RoName"))
1567         {
1568                 return getRoName();
1569             }
1570           if (name.equals("Usr"))
1571         {
1572                 return new Integer(getUsr());
1573             }
1574           if (name.equals("Modified"))
1575         {
1576                 return getModified();
1577             }
1578           if (name.equals("Garbage"))
1579         {
1580                 return new Integer(getGarbage());
1581             }
1582           return null;
1583     }
1584     
1585     /***
1586      * Retrieves a field from the object by name passed in
1587      * as a String.  The String must be one of the static
1588      * Strings defined in this Class' Peer.
1589      *
1590      * @param name peer name
1591      * @return value
1592      */
1593     public Object getByPeerName(String name)
1594     {
1595           if (name.equals(RdfResourcePeer.ID))
1596         {
1597                 return new Integer(getId());
1598             }
1599           if (name.equals(RdfResourcePeer.NS))
1600         {
1601                 return new Integer(getNs());
1602             }
1603           if (name.equals(RdfResourcePeer.RO_NAME))
1604         {
1605                 return getRoName();
1606             }
1607           if (name.equals(RdfResourcePeer.USR))
1608         {
1609                 return new Integer(getUsr());
1610             }
1611           if (name.equals(RdfResourcePeer.MODIFIED))
1612         {
1613                 return getModified();
1614             }
1615           if (name.equals(RdfResourcePeer.GARBAGE))
1616         {
1617                 return new Integer(getGarbage());
1618             }
1619           return null;
1620     }
1621 
1622     /***
1623      * Retrieves a field from the object by Position as specified
1624      * in the xml schema.  Zero-based.
1625      *
1626      * @param pos position in xml schema
1627      * @return value
1628      */
1629     public Object getByPosition(int pos)
1630     {
1631             if (pos == 0)
1632         {
1633                 return new Integer(getId());
1634             }
1635               if (pos == 1)
1636         {
1637                 return new Integer(getNs());
1638             }
1639               if (pos == 2)
1640         {
1641                 return getRoName();
1642             }
1643               if (pos == 3)
1644         {
1645                 return new Integer(getUsr());
1646             }
1647               if (pos == 4)
1648         {
1649                 return getModified();
1650             }
1651               if (pos == 5)
1652         {
1653                 return new Integer(getGarbage());
1654             }
1655               return null;
1656     }
1657      
1658     /***
1659      * Stores the object in the database.  If the object is new,
1660      * it inserts it; otherwise an update is performed.
1661      *
1662      * @throws Exception
1663      */
1664     public void save() throws Exception
1665     {
1666           save(RdfResourcePeer.getMapBuilder()
1667                 .getDatabaseMap().getName());
1668       }
1669 
1670     /***
1671      * Stores the object in the database.  If the object is new,
1672      * it inserts it; otherwise an update is performed.
1673        * Note: this code is here because the method body is
1674      * auto-generated conditionally and therefore needs to be
1675      * in this file instead of in the super class, BaseObject.
1676        *
1677      * @param dbName
1678      * @throws TorqueException
1679      */
1680     public void save(String dbName) throws TorqueException
1681     {
1682         Connection con = null;
1683           try
1684         {
1685             con = Transaction.begin(dbName);
1686             save(con);
1687             Transaction.commit(con);
1688         }
1689         catch(TorqueException e)
1690         {
1691             Transaction.safeRollback(con);
1692             throw e;
1693         }
1694       }
1695 
1696       /*** flag to prevent endless save loop, if this object is referenced
1697         by another object which falls in this transaction. */
1698     private boolean alreadyInSave = false;
1699       /***
1700      * Stores the object in the database.  If the object is new,
1701      * it inserts it; otherwise an update is performed.  This method
1702      * is meant to be used as part of a transaction, otherwise use
1703      * the save() method and the connection details will be handled
1704      * internally
1705      *
1706      * @param con
1707      * @throws TorqueException
1708      */
1709     public void save(Connection con) throws TorqueException
1710     {
1711           if (!alreadyInSave)
1712         {
1713             alreadyInSave = true;
1714 
1715 
1716   
1717             // If this object has been modified, then save it to the database.
1718             if (isModified())
1719             {
1720                 if (isNew())
1721                 {
1722                     RdfResourcePeer.doInsert((RdfResource) this, con);
1723                     setNew(false);
1724                 }
1725                 else
1726                 {
1727                     RdfResourcePeer.doUpdate((RdfResource) this, con);
1728                 }
1729             }
1730 
1731                                                 
1732                 
1733             if (collRdfStatementsRelatedByPredicate != null)
1734             {
1735                 for (int i = 0; i < collRdfStatementsRelatedByPredicate.size(); i++)
1736                 {
1737                     ((RdfStatement) collRdfStatementsRelatedByPredicate.get(i)).save(con);
1738                 }
1739             }
1740                                                     
1741                 
1742             if (collRdfStatementsRelatedByObjResource != null)
1743             {
1744                 for (int i = 0; i < collRdfStatementsRelatedByObjResource.size(); i++)
1745                 {
1746                     ((RdfStatement) collRdfStatementsRelatedByObjResource.get(i)).save(con);
1747                 }
1748             }
1749                                                     
1750                 
1751             if (collRdfStatementsRelatedBySubject != null)
1752             {
1753                 for (int i = 0; i < collRdfStatementsRelatedBySubject.size(); i++)
1754                 {
1755                     ((RdfStatement) collRdfStatementsRelatedBySubject.get(i)).save(con);
1756                 }
1757             }
1758                           alreadyInSave = false;
1759         }
1760       }
1761 
1762 
1763                           
1764       /***
1765      * Set the PrimaryKey using ObjectKey.
1766      *
1767      * @param  id ObjectKey
1768      */
1769     public void setPrimaryKey(ObjectKey key)
1770         throws TorqueException
1771     {
1772             setId(((NumberKey) key).intValue());
1773         }
1774 
1775     /***
1776      * Set the PrimaryKey using a String.
1777      *
1778      * @param key
1779      */
1780     public void setPrimaryKey(String key) throws TorqueException
1781     {
1782             setId(Integer.parseInt(key));
1783         }
1784 
1785   
1786     /***
1787      * returns an id that differentiates this object from others
1788      * of its class.
1789      */
1790     public ObjectKey getPrimaryKey()
1791     {
1792           return SimpleKey.keyFor(getId());
1793       }
1794 
1795  
1796 
1797     /***
1798      * Makes a copy of this object.
1799      * It creates a new object filling in the simple attributes.
1800        * It then fills all the association collections and sets the
1801      * related objects to isNew=true.
1802        */
1803       public RdfResource copy() throws TorqueException
1804     {
1805         return copyInto(new RdfResource());
1806     }
1807   
1808     protected RdfResource copyInto(RdfResource copyObj) throws TorqueException
1809     {
1810           copyObj.setId(id);
1811           copyObj.setNs(ns);
1812           copyObj.setRoName(roName);
1813           copyObj.setUsr(usr);
1814           copyObj.setModified(modified);
1815           copyObj.setGarbage(garbage);
1816   
1817                     copyObj.setId(0);
1818                                           
1819                                                 
1820                 
1821         List v = getRdfStatementsRelatedByPredicate();
1822         for (int i = 0; i < v.size(); i++)
1823         {
1824             RdfStatement obj = (RdfStatement) v.get(i);
1825             copyObj.addRdfStatementRelatedByPredicate(obj.copy());
1826         }
1827                                                             
1828                 
1829         v = getRdfStatementsRelatedByObjResource();
1830         for (int i = 0; i < v.size(); i++)
1831         {
1832             RdfStatement obj = (RdfStatement) v.get(i);
1833             copyObj.addRdfStatementRelatedByObjResource(obj.copy());
1834         }
1835                                                             
1836                 
1837         v = getRdfStatementsRelatedBySubject();
1838         for (int i = 0; i < v.size(); i++)
1839         {
1840             RdfStatement obj = (RdfStatement) v.get(i);
1841             copyObj.addRdfStatementRelatedBySubject(obj.copy());
1842         }
1843                     
1844         return copyObj;
1845     }
1846 
1847     /***
1848      * returns a peer instance associated with this om.  Since Peer classes
1849      * are not to have any instance attributes, this method returns the
1850      * same instance for all member of this class. The method could therefore
1851      * be static, but this would prevent one from overriding the behavior.
1852      */
1853     public RdfResourcePeer getPeer()
1854     {
1855         return peer;
1856     }
1857 
1858     public String toString()
1859     {
1860         StringBuffer str = new StringBuffer();
1861         str.append("RdfResource:\n");
1862         str.append("Id = ")
1863            .append(getId())
1864            .append("\n");
1865         str.append("Ns = ")
1866            .append(getNs())
1867            .append("\n");
1868         str.append("RoName = ")
1869            .append(getRoName())
1870            .append("\n");
1871         str.append("Usr = ")
1872            .append(getUsr())
1873            .append("\n");
1874         str.append("Modified = ")
1875            .append(getModified())
1876            .append("\n");
1877         str.append("Garbage = ")
1878            .append(getGarbage())
1879            .append("\n");
1880         return(str.toString());
1881     }
1882 }