KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > om > dbregistry > BasePortletDbEntry


1 package org.apache.jetspeed.om.dbregistry;
2
3
4 import java.math.BigDecimal JavaDoc;
5 import java.sql.Connection JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.util.Collections JavaDoc;
8 import java.util.Date JavaDoc;
9 import java.util.List JavaDoc;
10
11 import org.apache.commons.lang.ObjectUtils;
12 import org.apache.torque.TorqueException;
13 import org.apache.torque.om.BaseObject;
14 import org.apache.torque.om.ComboKey;
15 import org.apache.torque.om.DateKey;
16 import org.apache.torque.om.NumberKey;
17 import org.apache.torque.om.ObjectKey;
18 import org.apache.torque.om.SimpleKey;
19 import org.apache.torque.om.StringKey;
20 import org.apache.torque.om.Persistent;
21 import org.apache.torque.util.Criteria;
22 import org.apache.torque.util.Transaction;
23
24
25 /**
26  * This class was autogenerated by Torque on:
27  *
28  * [Thu Apr 22 15:30:48 PDT 2004]
29  *
30  * You should not use this class directly. It should not even be
31  * extended all references should be to PortletDbEntry
32  */

33 public abstract class BasePortletDbEntry extends BaseObject
34 {
35     /** The Peer class */
36     private static final PortletDbEntryPeer peer =
37         new PortletDbEntryPeer();
38
39       
40     /** The value for the id field */
41     private long id;
42       
43     /** The value for the name field */
44     private String JavaDoc name;
45                                                                 
46     /** The value for the hidden field */
47     private boolean hidden=false;
48       
49     /** The value for the classname field */
50     private String JavaDoc classname;
51       
52     /** The value for the type field */
53     private String JavaDoc type;
54                                                                 
55     /** The value for the application field */
56     private boolean application=false;
57       
58     /** The value for the parentRef field */
59     private long parentRef;
60       
61     /** The value for the uRL field */
62     private String JavaDoc uRL;
63                                                                 
64     /** The value for the cachedonurl field */
65     private boolean cachedonurl=true;
66       
67     /** The value for the role field */
68     private String JavaDoc role;
69       
70     /** The value for the title field */
71     private String JavaDoc title;
72       
73     /** The value for the description field */
74     private String JavaDoc description;
75       
76     /** The value for the image field */
77     private String JavaDoc image;
78       
79     /** The value for the securityRef field */
80     private String JavaDoc securityRef;
81   
82   
83     /**
84      * Get the Id
85      * @return long
86      */

87     public long getId()
88     {
89         return id;
90     }
91
92                                               
93     /**
94      * Set the value of Id
95      */

96     public void setId(long v ) throws TorqueException
97     {
98     
99                   if (this.id != v)
100               {
101             this.id = v;
102             setModified(true);
103         }
104     
105           
106                                   
107         // update associated PortletCategory
108
if (collPortletCategorys != null )
109         {
110             for (int i = 0; i < collPortletCategorys.size(); i++)
111             {
112                 ((PortletCategory)collPortletCategorys.get(i))
113                         .setOwner(v);
114             }
115         }
116                                           
117         // update associated PortletParameter
118
if (collPortletParameters != null )
119         {
120             for (int i = 0; i < collPortletParameters.size(); i++)
121             {
122                 ((PortletParameter)collPortletParameters.get(i))
123                         .setPortletId(v);
124             }
125         }
126                                           
127         // update associated PortletMediatype
128
if (collPortletMediatypes != null )
129         {
130             for (int i = 0; i < collPortletMediatypes.size(); i++)
131             {
132                 ((PortletMediatype)collPortletMediatypes.get(i))
133                         .setId(v);
134             }
135         }
136                       }
137
138   
139     /**
140      * Get the Name
141      * @return String
142      */

143     public String JavaDoc getName()
144     {
145         return name;
146     }
147
148                         
149     /**
150      * Set the value of Name
151      */

152     public void setName(String JavaDoc v )
153     {
154     
155                   if (!ObjectUtils.equals(this.name, v))
156               {
157             this.name = v;
158             setModified(true);
159         }
160     
161           
162               }
163
164   
165     /**
166      * Get the Hidden
167      * @return boolean
168      */

169     public boolean getHidden()
170     {
171         return hidden;
172     }
173
174                         
175     /**
176      * Set the value of Hidden
177      */

178     public void setHidden(boolean v )
179     {
180     
181                   if (this.hidden != v)
182               {
183             this.hidden = v;
184             setModified(true);
185         }
186     
187           
188               }
189
190   
191     /**
192      * Get the Classname
193      * @return String
194      */

195     public String JavaDoc getClassname()
196     {
197         return classname;
198     }
199
200                         
201     /**
202      * Set the value of Classname
203      */

204     public void setClassname(String JavaDoc v )
205     {
206     
207                   if (!ObjectUtils.equals(this.classname, v))
208               {
209             this.classname = v;
210             setModified(true);
211         }
212     
213           
214               }
215
216   
217     /**
218      * Get the Type
219      * @return String
220      */

221     public String JavaDoc getType()
222     {
223         return type;
224     }
225
226                         
227     /**
228      * Set the value of Type
229      */

230     public void setType(String JavaDoc v )
231     {
232     
233                   if (!ObjectUtils.equals(this.type, v))
234               {
235             this.type = v;
236             setModified(true);
237         }
238     
239           
240               }
241
242   
243     /**
244      * Get the Application
245      * @return boolean
246      */

247     public boolean getApplication()
248     {
249         return application;
250     }
251
252                         
253     /**
254      * Set the value of Application
255      */

256     public void setApplication(boolean v )
257     {
258     
259                   if (this.application != v)
260               {
261             this.application = v;
262             setModified(true);
263         }
264     
265           
266               }
267
268   
269     /**
270      * Get the ParentRef
271      * @return long
272      */

273     public long getParentRef()
274     {
275         return parentRef;
276     }
277
278                         
279     /**
280      * Set the value of ParentRef
281      */

282     public void setParentRef(long v )
283     {
284     
285                   if (this.parentRef != v)
286               {
287             this.parentRef = v;
288             setModified(true);
289         }
290     
291           
292               }
293
294   
295     /**
296      * Get the URL
297      * @return String
298      */

299     public String JavaDoc getURL()
300     {
301         return uRL;
302     }
303
304                         
305     /**
306      * Set the value of URL
307      */

308     public void setURL(String JavaDoc v )
309     {
310     
311                   if (!ObjectUtils.equals(this.uRL, v))
312               {
313             this.uRL = v;
314             setModified(true);
315         }
316     
317           
318               }
319
320   
321     /**
322      * Get the Cachedonurl
323      * @return boolean
324      */

325     public boolean getCachedonurl()
326     {
327         return cachedonurl;
328     }
329
330                         
331     /**
332      * Set the value of Cachedonurl
333      */

334     public void setCachedonurl(boolean v )
335     {
336     
337                   if (this.cachedonurl != v)
338               {
339             this.cachedonurl = v;
340             setModified(true);
341         }
342     
343           
344               }
345
346   
347     /**
348      * Get the Role
349      * @return String
350      */

351     public String JavaDoc getRole()
352     {
353         return role;
354     }
355
356                         
357     /**
358      * Set the value of Role
359      */

360     public void setRole(String JavaDoc v )
361     {
362     
363                   if (!ObjectUtils.equals(this.role, v))
364               {
365             this.role = v;
366             setModified(true);
367         }
368     
369           
370               }
371
372   
373     /**
374      * Get the Title
375      * @return String
376      */

377     public String JavaDoc getTitle()
378     {
379         return title;
380     }
381
382                         
383     /**
384      * Set the value of Title
385      */

386     public void setTitle(String JavaDoc v )
387     {
388     
389                   if (!ObjectUtils.equals(this.title, v))
390               {
391             this.title = v;
392             setModified(true);
393         }
394     
395           
396               }
397
398   
399     /**
400      * Get the Description
401      * @return String
402      */

403     public String JavaDoc getDescription()
404     {
405         return description;
406     }
407
408                         
409     /**
410      * Set the value of Description
411      */

412     public void setDescription(String JavaDoc v )
413     {
414     
415                   if (!ObjectUtils.equals(this.description, v))
416               {
417             this.description = v;
418             setModified(true);
419         }
420     
421           
422               }
423
424   
425     /**
426      * Get the Image
427      * @return String
428      */

429     public String JavaDoc getImage()
430     {
431         return image;
432     }
433
434                         
435     /**
436      * Set the value of Image
437      */

438     public void setImage(String JavaDoc v )
439     {
440     
441                   if (!ObjectUtils.equals(this.image, v))
442               {
443             this.image = v;
444             setModified(true);
445         }
446     
447           
448               }
449
450   
451     /**
452      * Get the SecurityRef
453      * @return String
454      */

455     public String JavaDoc getSecurityRef()
456     {
457         return securityRef;
458     }
459
460                         
461     /**
462      * Set the value of SecurityRef
463      */

464     public void setSecurityRef(String JavaDoc v )
465     {
466     
467                   if (!ObjectUtils.equals(this.securityRef, v))
468               {
469             this.securityRef = v;
470             setModified(true);
471         }
472     
473           
474               }
475
476   
477          
478                                 
479             
480     /**
481      * Collection to store aggregation of collPortletCategorys
482      */

483     protected List JavaDoc collPortletCategorys;
484
485     /**
486      * Temporary storage of collPortletCategorys to save a possible db hit in
487      * the event objects are add to the collection, but the
488      * complete collection is never requested.
489      */

490     protected void initPortletCategorys()
491     {
492         if (collPortletCategorys == null)
493         {
494             collPortletCategorys = new ArrayList JavaDoc();
495         }
496     }
497
498             
499     /**
500      * Method called to associate a PortletCategory object to this object
501      * through the PortletCategory foreign key attribute
502      *
503      * @param PortletCategory l
504      */

505     public void addPortletCategory(PortletCategory l) throws TorqueException
506     {
507         getPortletCategorys().add(l);
508         l.setPortletDbEntry((PortletDbEntry)this);
509     }
510
511     /**
512      * The criteria used to select the current contents of collPortletCategorys
513      */

514     private Criteria lastPortletCategorysCriteria = null;
515
516     /**
517      * If this collection has already been initialized, returns
518      * the collection. Otherwise returns the results of
519      * getPortletCategorys(new Criteria())
520      */

521     public List JavaDoc getPortletCategorys() throws TorqueException
522     {
523         if (collPortletCategorys == null)
524         {
525             collPortletCategorys = getPortletCategorys(new Criteria(10));
526         }
527         return collPortletCategorys;
528     }
529
530     /**
531      * If this collection has already been initialized with
532      * an identical criteria, it returns the collection.
533      * Otherwise if this PortletDbEntry has previously
534      * been saved, it will retrieve related PortletCategorys from storage.
535      * If this PortletDbEntry is new, it will return
536      * an empty collection or the current collection, the criteria
537      * is ignored on a new object.
538      */

539     public List JavaDoc getPortletCategorys(Criteria criteria) throws TorqueException
540     {
541         if (collPortletCategorys == null)
542         {
543             if (isNew())
544             {
545                collPortletCategorys = new ArrayList JavaDoc();
546             }
547             else
548             {
549                       criteria.add(PortletCategoryPeer.OWNER, getId() );
550                       collPortletCategorys = PortletCategoryPeer.doSelect(criteria);
551             }
552         }
553         else
554         {
555             // criteria has no effect for a new object
556
if (!isNew())
557             {
558                 // the following code is to determine if a new query is
559
// called for. If the criteria is the same as the last
560
// one, just return the collection.
561
criteria.add(PortletCategoryPeer.OWNER, getId() );
562                       if (!lastPortletCategorysCriteria.equals(criteria))
563                 {
564                     collPortletCategorys = PortletCategoryPeer.doSelect(criteria);
565                 }
566             }
567         }
568         lastPortletCategorysCriteria = criteria;
569
570         return collPortletCategorys;
571     }
572
573     /**
574      * If this collection has already been initialized, returns
575      * the collection. Otherwise returns the results of
576      * getPortletCategorys(new Criteria(),Connection)
577      * This method takes in the Connection also as input so that
578      * referenced objects can also be obtained using a Connection
579      * that is taken as input
580      */

581     public List JavaDoc getPortletCategorys(Connection JavaDoc con) throws TorqueException
582     {
583         if (collPortletCategorys == null)
584         {
585             collPortletCategorys = getPortletCategorys(new Criteria(10),con);
586         }
587         return collPortletCategorys;
588     }
589
590     /**
591      * If this collection has already been initialized with
592      * an identical criteria, it returns the collection.
593      * Otherwise if this PortletDbEntry has previously
594      * been saved, it will retrieve related PortletCategorys from storage.
595      * If this PortletDbEntry is new, it will return
596      * an empty collection or the current collection, the criteria
597      * is ignored on a new object.
598      * This method takes in the Connection also as input so that
599      * referenced objects can also be obtained using a Connection
600      * that is taken as input
601      */

602     public List JavaDoc getPortletCategorys(Criteria criteria,Connection JavaDoc con) throws TorqueException
603     {
604         if (collPortletCategorys == null)
605         {
606             if (isNew())
607             {
608                collPortletCategorys = new ArrayList JavaDoc();
609             }
610             else
611             {
612                        criteria.add(PortletCategoryPeer.OWNER, getId() );
613                        collPortletCategorys = PortletCategoryPeer.doSelect(criteria,con);
614              }
615          }
616          else
617          {
618              // criteria has no effect for a new object
619
if (!isNew())
620              {
621                  // the following code is to determine if a new query is
622
// called for. If the criteria is the same as the last
623
// one, just return the collection.
624
criteria.add(PortletCategoryPeer.OWNER, getId() );
625                      if (!lastPortletCategorysCriteria.equals(criteria))
626                  {
627                      collPortletCategorys = PortletCategoryPeer.doSelect(criteria,con);
628                  }
629              }
630          }
631          lastPortletCategorysCriteria = criteria;
632
633          return collPortletCategorys;
634      }
635
636                   
637
638               
639                     
640                               
641                                 
642                                                               
643                                         
644                     
645                     
646           
647     /**
648      * If this collection has already been initialized with
649      * an identical criteria, it returns the collection.
650      * Otherwise if this PortletDbEntry is new, it will return
651      * an empty collection; or if this PortletDbEntry has previously
652      * been saved, it will retrieve related PortletCategorys from storage.
653      *
654      * This method is protected by default in order to keep the public
655      * api reasonable. You can provide public methods for those you
656      * actually need in PortletDbEntry.
657      */

658     protected List JavaDoc getPortletCategorysJoinPortletDbEntry(Criteria criteria)
659         throws TorqueException
660     {
661         if (collPortletCategorys == null)
662         {
663             if (isNew())
664             {
665                collPortletCategorys = new ArrayList JavaDoc();
666             }
667             else
668             {
669                             criteria.add(PortletCategoryPeer.OWNER, getId() );
670                             collPortletCategorys = PortletCategoryPeer.doSelectJoinPortletDbEntry(criteria);
671             }
672         }
673         else
674         {
675             // the following code is to determine if a new query is
676
// called for. If the criteria is the same as the last
677
// one, just return the collection.
678
boolean newCriteria = true;
679                             criteria.add(PortletCategoryPeer.OWNER, getId() );
680                         if (!lastPortletCategorysCriteria.equals(criteria))
681             {
682                 collPortletCategorys = PortletCategoryPeer.doSelectJoinPortletDbEntry(criteria);
683             }
684         }
685         lastPortletCategorysCriteria = criteria;
686
687         return collPortletCategorys;
688     }
689                             
690
691
692                           
693             
694     /**
695      * Collection to store aggregation of collPortletParameters
696      */

697     protected List JavaDoc collPortletParameters;
698
699     /**
700      * Temporary storage of collPortletParameters to save a possible db hit in
701      * the event objects are add to the collection, but the
702      * complete collection is never requested.
703      */

704     protected void initPortletParameters()
705     {
706         if (collPortletParameters == null)
707         {
708             collPortletParameters = new ArrayList JavaDoc();
709         }
710     }
711
712             
713     /**
714      * Method called to associate a PortletParameter object to this object
715      * through the PortletParameter foreign key attribute
716      *
717      * @param PortletParameter l
718      */

719     public void addPortletParameter(PortletParameter l) throws TorqueException
720     {
721         getPortletParameters().add(l);
722         l.setPortletDbEntry((PortletDbEntry)this);
723     }
724
725     /**
726      * The criteria used to select the current contents of collPortletParameters
727      */

728     private Criteria lastPortletParametersCriteria = null;
729
730     /**
731      * If this collection has already been initialized, returns
732      * the collection. Otherwise returns the results of
733      * getPortletParameters(new Criteria())
734      */

735     public List JavaDoc getPortletParameters() throws TorqueException
736     {
737         if (collPortletParameters == null)
738         {
739             collPortletParameters = getPortletParameters(new Criteria(10));
740         }
741         return collPortletParameters;
742     }
743
744     /**
745      * If this collection has already been initialized with
746      * an identical criteria, it returns the collection.
747      * Otherwise if this PortletDbEntry has previously
748      * been saved, it will retrieve related PortletParameters from storage.
749      * If this PortletDbEntry is new, it will return
750      * an empty collection or the current collection, the criteria
751      * is ignored on a new object.
752      */

753     public List JavaDoc getPortletParameters(Criteria criteria) throws TorqueException
754     {
755         if (collPortletParameters == null)
756         {
757             if (isNew())
758             {
759                collPortletParameters = new ArrayList JavaDoc();
760             }
761             else
762             {
763                       criteria.add(PortletParameterPeer.PORTLET_ID, getId() );
764                       collPortletParameters = PortletParameterPeer.doSelect(criteria);
765             }
766         }
767         else
768         {
769             // criteria has no effect for a new object
770
if (!isNew())
771             {
772                 // the following code is to determine if a new query is
773
// called for. If the criteria is the same as the last
774
// one, just return the collection.
775
criteria.add(PortletParameterPeer.PORTLET_ID, getId() );
776                       if (!lastPortletParametersCriteria.equals(criteria))
777                 {
778                     collPortletParameters = PortletParameterPeer.doSelect(criteria);
779                 }
780             }
781         }
782         lastPortletParametersCriteria = criteria;
783
784         return collPortletParameters;
785     }
786
787     /**
788      * If this collection has already been initialized, returns
789      * the collection. Otherwise returns the results of
790      * getPortletParameters(new Criteria(),Connection)
791      * This method takes in the Connection also as input so that
792      * referenced objects can also be obtained using a Connection
793      * that is taken as input
794      */

795     public List JavaDoc getPortletParameters(Connection JavaDoc con) throws TorqueException
796     {
797         if (collPortletParameters == null)
798         {
799             collPortletParameters = getPortletParameters(new Criteria(10),con);
800         }
801         return collPortletParameters;
802     }
803
804     /**
805      * If this collection has already been initialized with
806      * an identical criteria, it returns the collection.
807      * Otherwise if this PortletDbEntry has previously
808      * been saved, it will retrieve related PortletParameters from storage.
809      * If this PortletDbEntry is new, it will return
810      * an empty collection or the current collection, the criteria
811      * is ignored on a new object.
812      * This method takes in the Connection also as input so that
813      * referenced objects can also be obtained using a Connection
814      * that is taken as input
815      */

816     public List JavaDoc getPortletParameters(Criteria criteria,Connection JavaDoc con) throws TorqueException
817     {
818         if (collPortletParameters == null)
819         {
820             if (isNew())
821             {
822                collPortletParameters = new ArrayList JavaDoc();
823             }
824             else
825             {
826                        criteria.add(PortletParameterPeer.PORTLET_ID, getId() );
827                        collPortletParameters = PortletParameterPeer.doSelect(criteria,con);
828              }
829          }
830          else
831          {
832              // criteria has no effect for a new object
833
if (!isNew())
834              {
835                  // the following code is to determine if a new query is
836
// called for. If the criteria is the same as the last
837
// one, just return the collection.
838
criteria.add(PortletParameterPeer.PORTLET_ID, getId() );
839                      if (!lastPortletParametersCriteria.equals(criteria))
840                  {
841                      collPortletParameters = PortletParameterPeer.doSelect(criteria,con);
842                  }
843              }
844          }
845          lastPortletParametersCriteria = criteria;
846
847          return collPortletParameters;
848      }
849
850                   
851
852               
853                     
854                               
855                                 
856                                                               
857                                         
858                     
859                     
860           
861     /**
862      * If this collection has already been initialized with
863      * an identical criteria, it returns the collection.
864      * Otherwise if this PortletDbEntry is new, it will return
865      * an empty collection; or if this PortletDbEntry has previously
866      * been saved, it will retrieve related PortletParameters from storage.
867      *
868      * This method is protected by default in order to keep the public
869      * api reasonable. You can provide public methods for those you
870      * actually need in PortletDbEntry.
871      */

872     protected List JavaDoc getPortletParametersJoinPortletDbEntry(Criteria criteria)
873         throws TorqueException
874     {
875         if (collPortletParameters == null)
876         {
877             if (isNew())
878             {
879                collPortletParameters = new ArrayList JavaDoc();
880             }
881             else
882             {
883                             criteria.add(PortletParameterPeer.PORTLET_ID, getId() );
884                             collPortletParameters = PortletParameterPeer.doSelectJoinPortletDbEntry(criteria);
885             }
886         }
887         else
888         {
889             // the following code is to determine if a new query is
890
// called for. If the criteria is the same as the last
891
// one, just return the collection.
892
boolean newCriteria = true;
893                             criteria.add(PortletParameterPeer.PORTLET_ID, getId() );
894                         if (!lastPortletParametersCriteria.equals(criteria))
895             {
896                 collPortletParameters = PortletParameterPeer.doSelectJoinPortletDbEntry(criteria);
897             }
898         }
899         lastPortletParametersCriteria = criteria;
900
901         return collPortletParameters;
902     }
903                             
904
905
906                           
907             
908     /**
909      * Collection to store aggregation of collPortletMediatypes
910      */

911     protected List JavaDoc collPortletMediatypes;
912
913     /**
914      * Temporary storage of collPortletMediatypes to save a possible db hit in
915      * the event objects are add to the collection, but the
916      * complete collection is never requested.
917      */

918     protected void initPortletMediatypes()
919     {
920         if (collPortletMediatypes == null)
921         {
922             collPortletMediatypes = new ArrayList JavaDoc();
923         }
924     }
925
926             
927     /**
928      * Method called to associate a PortletMediatype object to this object
929      * through the PortletMediatype foreign key attribute
930      *
931      * @param PortletMediatype l
932      */

933     public void addPortletMediatype(PortletMediatype l) throws TorqueException
934     {
935         getPortletMediatypes().add(l);
936         l.setPortletDbEntry((PortletDbEntry)this);
937     }
938
939     /**
940      * The criteria used to select the current contents of collPortletMediatypes
941      */

942     private Criteria lastPortletMediatypesCriteria = null;
943
944     /**
945      * If this collection has already been initialized, returns
946      * the collection. Otherwise returns the results of
947      * getPortletMediatypes(new Criteria())
948      */

949     public List JavaDoc getPortletMediatypes() throws TorqueException
950     {
951         if (collPortletMediatypes == null)
952         {
953             collPortletMediatypes = getPortletMediatypes(new Criteria(10));
954         }
955         return collPortletMediatypes;
956     }
957
958     /**
959      * If this collection has already been initialized with
960      * an identical criteria, it returns the collection.
961      * Otherwise if this PortletDbEntry has previously
962      * been saved, it will retrieve related PortletMediatypes from storage.
963      * If this PortletDbEntry is new, it will return
964      * an empty collection or the current collection, the criteria
965      * is ignored on a new object.
966      */

967     public List JavaDoc getPortletMediatypes(Criteria criteria) throws TorqueException
968     {
969         if (collPortletMediatypes == null)
970         {
971             if (isNew())
972             {
973                collPortletMediatypes = new ArrayList JavaDoc();
974             }
975             else
976             {
977                       criteria.add(PortletMediatypePeer.ID, getId() );
978                       collPortletMediatypes = PortletMediatypePeer.doSelect(criteria);
979             }
980         }
981         else
982         {
983             // criteria has no effect for a new object
984
if (!isNew())
985             {
986                 // the following code is to determine if a new query is
987
// called for. If the criteria is the same as the last
988
// one, just return the collection.
989
criteria.add(PortletMediatypePeer.ID, getId() );
990                       if (!lastPortletMediatypesCriteria.equals(criteria))
991                 {
992                     collPortletMediatypes = PortletMediatypePeer.doSelect(criteria);
993                 }
994             }
995         }
996         lastPortletMediatypesCriteria = criteria;
997
998         return collPortletMediatypes;
999     }
1000
1001    /**
1002     * If this collection has already been initialized, returns
1003     * the collection. Otherwise returns the results of
1004     * getPortletMediatypes(new Criteria(),Connection)
1005     * This method takes in the Connection also as input so that
1006     * referenced objects can also be obtained using a Connection
1007     * that is taken as input
1008     */

1009    public List JavaDoc getPortletMediatypes(Connection JavaDoc con) throws TorqueException
1010    {
1011        if (collPortletMediatypes == null)
1012        {
1013            collPortletMediatypes = getPortletMediatypes(new Criteria(10),con);
1014        }
1015        return collPortletMediatypes;
1016    }
1017
1018    /**
1019     * If this collection has already been initialized with
1020     * an identical criteria, it returns the collection.
1021     * Otherwise if this PortletDbEntry has previously
1022     * been saved, it will retrieve related PortletMediatypes from storage.
1023     * If this PortletDbEntry is new, it will return
1024     * an empty collection or the current collection, the criteria
1025     * is ignored on a new object.
1026     * This method takes in the Connection also as input so that
1027     * referenced objects can also be obtained using a Connection
1028     * that is taken as input
1029     */

1030    public List JavaDoc getPortletMediatypes(Criteria criteria,Connection JavaDoc con) throws TorqueException
1031    {
1032        if (collPortletMediatypes == null)
1033        {
1034            if (isNew())
1035            {
1036               collPortletMediatypes = new ArrayList JavaDoc();
1037            }
1038            else
1039            {
1040                       criteria.add(PortletMediatypePeer.ID, getId() );
1041                       collPortletMediatypes = PortletMediatypePeer.doSelect(criteria,con);
1042             }
1043         }
1044         else
1045         {
1046             // criteria has no effect for a new object
1047
if (!isNew())
1048             {
1049                 // the following code is to determine if a new query is
1050
// called for. If the criteria is the same as the last
1051
// one, just return the collection.
1052
criteria.add(PortletMediatypePeer.ID, getId() );
1053                     if (!lastPortletMediatypesCriteria.equals(criteria))
1054                 {
1055                     collPortletMediatypes = PortletMediatypePeer.doSelect(criteria,con);
1056                 }
1057             }
1058         }
1059         lastPortletMediatypesCriteria = criteria;
1060
1061         return collPortletMediatypes;
1062     }
1063
1064                        
1065
1066              
1067                    
1068                              
1069                                
1070                                                              
1071                                        
1072                    
1073                    
1074          
1075    /**
1076     * If this collection has already been initialized with
1077     * an identical criteria, it returns the collection.
1078     * Otherwise if this PortletDbEntry is new, it will return
1079     * an empty collection; or if this PortletDbEntry has previously
1080     * been saved, it will retrieve related PortletMediatypes from storage.
1081     *
1082     * This method is protected by default in order to keep the public
1083     * api reasonable. You can provide public methods for those you
1084     * actually need in PortletDbEntry.
1085     */

1086    protected List JavaDoc getPortletMediatypesJoinPortletDbEntry(Criteria criteria)
1087        throws TorqueException
1088    {
1089        if (collPortletMediatypes == null)
1090        {
1091            if (isNew())
1092            {
1093               collPortletMediatypes = new ArrayList JavaDoc();
1094            }
1095            else
1096            {
1097                            criteria.add(PortletMediatypePeer.ID, getId() );
1098                            collPortletMediatypes = PortletMediatypePeer.doSelectJoinPortletDbEntry(criteria);
1099            }
1100        }
1101        else
1102        {
1103            // the following code is to determine if a new query is
1104
// called for. If the criteria is the same as the last
1105
// one, just return the collection.
1106
boolean newCriteria = true;
1107                            criteria.add(PortletMediatypePeer.ID, getId() );
1108                        if (!lastPortletMediatypesCriteria.equals(criteria))
1109            {
1110                collPortletMediatypes = PortletMediatypePeer.doSelectJoinPortletDbEntry(criteria);
1111            }
1112        }
1113        lastPortletMediatypesCriteria = criteria;
1114
1115        return collPortletMediatypes;
1116    }
1117                  
1118                    
1119                    
1120                                
1121                                                              
1122                                        
1123                    
1124                    
1125          
1126    /**
1127     * If this collection has already been initialized with
1128     * an identical criteria, it returns the collection.
1129     * Otherwise if this PortletDbEntry is new, it will return
1130     * an empty collection; or if this PortletDbEntry has previously
1131     * been saved, it will retrieve related PortletMediatypes from storage.
1132     *
1133     * This method is protected by default in order to keep the public
1134     * api reasonable. You can provide public methods for those you
1135     * actually need in PortletDbEntry.
1136     */

1137    protected List JavaDoc getPortletMediatypesJoinMediatype(Criteria criteria)
1138        throws TorqueException
1139    {
1140        if (collPortletMediatypes == null)
1141        {
1142            if (isNew())
1143            {
1144               collPortletMediatypes = new ArrayList JavaDoc();
1145            }
1146            else
1147            {
1148                            criteria.add(PortletMediatypePeer.ID, getId() );
1149                            collPortletMediatypes = PortletMediatypePeer.doSelectJoinMediatype(criteria);
1150            }
1151        }
1152        else
1153        {
1154            // the following code is to determine if a new query is
1155
// called for. If the criteria is the same as the last
1156
// one, just return the collection.
1157
boolean newCriteria = true;
1158                            criteria.add(PortletMediatypePeer.ID, getId() );
1159                        if (!lastPortletMediatypesCriteria.equals(criteria))
1160            {
1161                collPortletMediatypes = PortletMediatypePeer.doSelectJoinMediatype(criteria);
1162            }
1163        }
1164        lastPortletMediatypesCriteria = criteria;
1165
1166        return collPortletMediatypes;
1167    }
1168                            
1169
1170
1171          
1172    private static List JavaDoc fieldNames = null;
1173
1174    /**
1175     * Generate a list of field names.
1176     */

1177    public static synchronized List JavaDoc getFieldNames()
1178    {
1179        if (fieldNames == null)
1180        {
1181            fieldNames = new ArrayList JavaDoc();
1182              fieldNames.add("Id");
1183              fieldNames.add("Name");
1184              fieldNames.add("Hidden");
1185              fieldNames.add("Classname");
1186              fieldNames.add("Type");
1187              fieldNames.add("Application");
1188              fieldNames.add("ParentRef");
1189              fieldNames.add("URL");
1190              fieldNames.add("Cachedonurl");
1191              fieldNames.add("Role");
1192              fieldNames.add("Title");
1193              fieldNames.add("Description");
1194              fieldNames.add("Image");
1195              fieldNames.add("SecurityRef");
1196              fieldNames = Collections.unmodifiableList(fieldNames);
1197        }
1198        return fieldNames;
1199    }
1200
1201    /**
1202     * Retrieves a field from the object by name passed in
1203     * as a String.
1204     */

1205    public Object JavaDoc getByName(String JavaDoc name)
1206    {
1207          if (name.equals("Id"))
1208        {
1209                return new Long JavaDoc(getId());
1210            }
1211          if (name.equals("Name"))
1212        {
1213                return getName();
1214            }
1215          if (name.equals("Hidden"))
1216        {
1217                return new Boolean JavaDoc(getHidden());
1218            }
1219          if (name.equals("Classname"))
1220        {
1221                return getClassname();
1222            }
1223          if (name.equals("Type"))
1224        {
1225                return getType();
1226            }
1227          if (name.equals("Application"))
1228        {
1229                return new Boolean JavaDoc(getApplication());
1230            }
1231          if (name.equals("ParentRef"))
1232        {
1233                return new Long JavaDoc(getParentRef());
1234            }
1235          if (name.equals("URL"))
1236        {
1237                return getURL();
1238            }
1239          if (name.equals("Cachedonurl"))
1240        {
1241                return new Boolean JavaDoc(getCachedonurl());
1242            }
1243          if (name.equals("Role"))
1244        {
1245                return getRole();
1246            }
1247          if (name.equals("Title"))
1248        {
1249                return getTitle();
1250            }
1251          if (name.equals("Description"))
1252        {
1253                return getDescription();
1254            }
1255          if (name.equals("Image"))
1256        {
1257                return getImage();
1258            }
1259          if (name.equals("SecurityRef"))
1260        {
1261                return getSecurityRef();
1262            }
1263          return null;
1264    }
1265    
1266    /**
1267     * Retrieves a field from the object by name passed in
1268     * as a String. The String must be one of the static
1269     * Strings defined in this Class' Peer.
1270     */

1271    public Object JavaDoc getByPeerName(String JavaDoc name)
1272    {
1273          if (name.equals(PortletDbEntryPeer.ID ))
1274        {
1275                return new Long JavaDoc(getId());
1276            }
1277          if (name.equals(PortletDbEntryPeer.NAME ))
1278        {
1279                return getName();
1280            }
1281          if (name.equals(PortletDbEntryPeer.HIDDEN ))
1282        {
1283                return new Boolean JavaDoc(getHidden());
1284            }
1285          if (name.equals(PortletDbEntryPeer.CLASSNAME ))
1286        {
1287                return getClassname();
1288            }
1289          if (name.equals(PortletDbEntryPeer.TYPE ))
1290        {
1291                return getType();
1292            }
1293          if (name.equals(PortletDbEntryPeer.APPLICATION ))
1294        {
1295                return new Boolean JavaDoc(getApplication());
1296            }
1297          if (name.equals(PortletDbEntryPeer.PARENT ))
1298        {
1299                return new Long JavaDoc(getParentRef());
1300            }
1301          if (name.equals(PortletDbEntryPeer.URL ))
1302        {
1303                return getURL();
1304            }
1305          if (name.equals(PortletDbEntryPeer.CACHEDONURL ))
1306        {
1307                return new Boolean JavaDoc(getCachedonurl());
1308            }
1309          if (name.equals(PortletDbEntryPeer.ROLE ))
1310        {
1311                return getRole();
1312            }
1313          if (name.equals(PortletDbEntryPeer.TITLE ))
1314        {
1315                return getTitle();
1316            }
1317          if (name.equals(PortletDbEntryPeer.DESCRIPTION ))
1318        {
1319                return getDescription();
1320            }
1321          if (name.equals(PortletDbEntryPeer.IMAGE ))
1322        {
1323                return getImage();
1324            }
1325          if (name.equals(PortletDbEntryPeer.SECURITY ))
1326        {
1327                return getSecurityRef();
1328            }
1329          return null;
1330    }
1331
1332    /**
1333     * Retrieves a field from the object by Position as specified
1334     * in the xml schema. Zero-based.
1335     */

1336    public Object JavaDoc getByPosition(int pos)
1337    {
1338            if ( pos == 0 )
1339        {
1340                return new Long JavaDoc(getId());
1341            }
1342              if ( pos == 1 )
1343        {
1344                return getName();
1345            }
1346              if ( pos == 2 )
1347        {
1348                return new Boolean JavaDoc(getHidden());
1349            }
1350              if ( pos == 3 )
1351        {
1352                return getClassname();
1353            }
1354              if ( pos == 4 )
1355        {
1356                return getType();
1357            }
1358              if ( pos == 5 )
1359        {
1360                return new Boolean JavaDoc(getApplication());
1361            }
1362              if ( pos == 6 )
1363        {
1364                return new Long JavaDoc(getParentRef());
1365            }
1366              if ( pos == 7 )
1367        {
1368                return getURL();
1369            }
1370              if ( pos == 8 )
1371        {
1372                return new Boolean JavaDoc(getCachedonurl());
1373            }
1374              if ( pos == 9 )
1375        {
1376                return getRole();
1377            }
1378              if ( pos == 10 )
1379        {
1380                return getTitle();
1381            }
1382              if ( pos == 11 )
1383        {
1384                return getDescription();
1385            }
1386              if ( pos == 12 )
1387        {
1388                return getImage();
1389            }
1390              if ( pos == 13 )
1391        {
1392                return getSecurityRef();
1393            }
1394              return null;
1395    }
1396     
1397    /**
1398     * Stores the object in the database. If the object is new,
1399     * it inserts it; otherwise an update is performed.
1400     */

1401    public void save() throws Exception JavaDoc
1402    {
1403          save(PortletDbEntryPeer.getMapBuilder()
1404                .getDatabaseMap().getName());
1405      }
1406
1407    /**
1408     * Stores the object in the database. If the object is new,
1409     * it inserts it; otherwise an update is performed.
1410       * Note: this code is here because the method body is
1411     * auto-generated conditionally and therefore needs to be
1412     * in this file instead of in the super class, BaseObject.
1413       */

1414    public void save(String JavaDoc dbName) throws TorqueException
1415    {
1416        Connection JavaDoc con = null;
1417          try
1418        {
1419            con = Transaction.begin(dbName);
1420            save(con);
1421            Transaction.commit(con);
1422        }
1423        catch(TorqueException e)
1424        {
1425            Transaction.safeRollback(con);
1426            throw e;
1427        }
1428      }
1429
1430      /** flag to prevent endless save loop, if this object is referenced
1431        by another object which falls in this transaction. */

1432    private boolean alreadyInSave = false;
1433      /**
1434     * Stores the object in the database. If the object is new,
1435     * it inserts it; otherwise an update is performed. This method
1436     * is meant to be used as part of a transaction, otherwise use
1437     * the save() method and the connection details will be handled
1438     * internally
1439     */

1440    public void save(Connection JavaDoc con) throws TorqueException
1441    {
1442          if (!alreadyInSave)
1443        {
1444            alreadyInSave = true;
1445
1446
1447  
1448            // If this object has been modified, then save it to the database.
1449
if (isModified())
1450            {
1451                if (isNew())
1452                {
1453                    PortletDbEntryPeer.doInsert((PortletDbEntry)this, con);
1454                    setNew(false);
1455                }
1456                else
1457                {
1458                    PortletDbEntryPeer.doUpdate((PortletDbEntry)this, con);
1459                }
1460
1461                      if (isCacheOnSave())
1462                {
1463                    PortletDbEntryManager.putInstance(this);
1464                }
1465              }
1466
1467                                      
1468                            if (collPortletCategorys != null )
1469            {
1470                for (int i = 0; i < collPortletCategorys.size(); i++)
1471                {
1472                    ((PortletCategory)collPortletCategorys.get(i)).save(con);
1473                }
1474            }
1475                                          
1476                            if (collPortletParameters != null )
1477            {
1478                for (int i = 0; i < collPortletParameters.size(); i++)
1479                {
1480                    ((PortletParameter)collPortletParameters.get(i)).save(con);
1481                }
1482            }
1483                                          
1484                            if (collPortletMediatypes != null )
1485            {
1486                for (int i = 0; i < collPortletMediatypes.size(); i++)
1487                {
1488                    ((PortletMediatype)collPortletMediatypes.get(i)).save(con);
1489                }
1490            }
1491                          alreadyInSave = false;
1492        }
1493      }
1494
1495    /**
1496     * Specify whether to cache the object after saving to the db.
1497     * This method returns false
1498     */

1499    protected boolean isCacheOnSave()
1500    {
1501        return true;
1502    }
1503
1504                        
1505      /**
1506     * Set the PrimaryKey using ObjectKey.
1507     *
1508     * @param ObjectKey id
1509     */

1510    public void setPrimaryKey(ObjectKey id)
1511        throws TorqueException {
1512            setId(((NumberKey)id).longValue());
1513        }
1514
1515    /**
1516     * Set the PrimaryKey using a String.
1517     */

1518    public void setPrimaryKey(String JavaDoc key) throws TorqueException
1519    {
1520            setId(Long.parseLong(key));
1521        }
1522
1523  
1524    /**
1525     * returns an id that differentiates this object from others
1526     * of its class.
1527     */

1528    public ObjectKey getPrimaryKey()
1529    {
1530          return SimpleKey.keyFor(getId());
1531      }
1532 
1533
1534    /**
1535     * Makes a copy of this object.
1536     * It creates a new object filling in the simple attributes.
1537       * It then fills all the association collections.
1538       */

1539      public PortletDbEntry copy() throws TorqueException
1540    {
1541        PortletDbEntry copyObj = new PortletDbEntry();
1542            copyObj.setId(id);
1543          copyObj.setName(name);
1544          copyObj.setHidden(hidden);
1545          copyObj.setClassname(classname);
1546          copyObj.setType(type);
1547          copyObj.setApplication(application);
1548          copyObj.setParentRef(parentRef);
1549          copyObj.setURL(uRL);
1550          copyObj.setCachedonurl(cachedonurl);
1551          copyObj.setRole(role);
1552          copyObj.setTitle(title);
1553          copyObj.setDescription(description);
1554          copyObj.setImage(image);
1555          copyObj.setSecurityRef(securityRef);
1556  
1557                      copyObj.setId(0);
1558                                                                                          
1559                                      
1560                
1561        List JavaDoc v = getPortletCategorys();
1562        for (int i = 0; i < v.size(); i++)
1563        {
1564            PortletCategory obj = (PortletCategory) v.get(i);
1565            copyObj.addPortletCategory(obj.copy());
1566        }
1567                                                  
1568                
1569        v = getPortletParameters();
1570        for (int i = 0; i < v.size(); i++)
1571        {
1572            PortletParameter obj = (PortletParameter) v.get(i);
1573            copyObj.addPortletParameter(obj.copy());
1574        }
1575                                                  
1576                
1577        v = getPortletMediatypes();
1578        for (int i = 0; i < v.size(); i++)
1579        {
1580            PortletMediatype obj = (PortletMediatype) v.get(i);
1581            copyObj.addPortletMediatype(obj.copy());
1582        }
1583                            return copyObj;
1584    }
1585
1586    /**
1587     * returns a peer instance associated with this om. Since Peer classes
1588     * are not to have any instance attributes, this method returns the
1589     * same instance for all member of this class. The method could therefore
1590     * be static, but this would prevent one from overriding the behavior.
1591     */

1592    public PortletDbEntryPeer getPeer()
1593    {
1594        return peer;
1595    }
1596}
1597
Popular Tags