View Javadoc
1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.melati.poem.generated;
4   
5   
6   import java.util.Collections;
7   import java.util.Enumeration;
8   import java.util.List;
9   import org.melati.poem.AccessPoemException;
10  import org.melati.poem.CachedSelection;
11  import org.melati.poem.Column;
12  import org.melati.poem.Field;
13  import org.melati.poem.Group;
14  import org.melati.poem.GroupCapability;
15  import org.melati.poem.GroupMembership;
16  import org.melati.poem.GroupTable;
17  import org.melati.poem.JdbcPersistent;
18  import org.melati.poem.PoemDatabaseTables;
19  import org.melati.poem.ValidationPoemException;
20  import org.melati.poem.util.EmptyEnumeration;
21  
22  
23  /**
24   * Melati POEM generated abstract base class for a <code>Persistent</code> 
25   * <code>group</code> Object.
26   *
27   * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
28   */
29  public abstract class GroupBase extends JdbcPersistent {
30  
31  
32   /**
33    * Retrieves the Database object.
34    * 
35    * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
36    * @return the database
37    */
38    public PoemDatabaseTables getPoemDatabaseTables() {
39      return (PoemDatabaseTables)getDatabase();
40    }
41  
42  
43   /**
44    * Retrieves the  <code>GroupTable</code> table 
45    * which this <code>Persistent</code> is from.
46    * 
47    * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
48    * @return the GroupTable
49    */
50    @SuppressWarnings("unchecked")
51    public GroupTable<Group> getGroupTable() {
52      return (GroupTable<Group>)getTable();
53    }
54  
55    @SuppressWarnings("unchecked")
56    private GroupTable<Group> _getGroupTable() {
57      return (GroupTable<Group>)getTable();
58    }
59  
60    // Fields in this table 
61   /**
62    * id - The Table Row Object ID 
63    */
64    protected Integer id;
65   /**
66    * name - A human-readable name for the group 
67    */
68    protected String name;
69  
70  
71   /**
72    * Retrieves the <code>Id</code> value, without locking, 
73    * for this <code>group</code> <code>Persistent</code>.
74    *
75    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
76    * @return the Integer id
77    */
78    public Integer getId_unsafe() {
79      return id;
80    }
81  
82  
83   /**
84    * Sets the <code>Id</code> value directly, without checking, 
85    * for this group <code>Persistent</code>.
86    * 
87    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
88    * @param cooked  the pre-validated value to set
89    */
90    public void setId_unsafe(Integer cooked) {
91      id = cooked;
92    }
93  
94   /**
95    * Retrieves the Id value, with locking, for this 
96    * <code>group</code> <code>Persistent</code>.
97    * Field description: 
98    *   The Table Row Object ID 
99    * 
100   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
101   * @throws AccessPoemException 
102   *         if the current <code>AccessToken</code> 
103   *         does not confer write access rights 
104   * @return the value of the field <code>Id</code> for this 
105   *         <code>group</code> <code>Persistent</code>  
106   */
107 
108   public Integer getId()
109       throws AccessPoemException {
110     readLock();
111     return getId_unsafe();
112   }
113 
114 
115  /**
116   * Sets the <code>Id</code> value, with checking, for this 
117   * <code>group</code> <code>Persistent</code>.
118   * Field description: 
119   *   The Table Row Object ID 
120   * 
121   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
122   * @param cooked  a validated <code>int</code> 
123   * @throws AccessPoemException 
124   *         if the current <code>AccessToken</code> 
125   *         does not confer write access rights
126   * @throws ValidationPoemException 
127   *         if the value is not valid
128   */
129   public void setId(Integer cooked)
130       throws AccessPoemException, ValidationPoemException {
131     _getGroupTable().getIdColumn().
132       getType().assertValidCooked(cooked);
133     writeLock();
134     setId_unsafe(cooked);
135   }
136 
137  /**
138   * Sets the <code>Id</code> value, with checking, for this 
139   * <code>group</code> <code>Persistent</code>.
140   * Field description: 
141   *   The Table Row Object ID 
142   * 
143   * 
144   * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 
145   * @param cooked  a validated <code>int</code>
146   * @throws AccessPoemException 
147   *         if the current <code>AccessToken</code> 
148   *         does not confer write access rights
149   * @throws ValidationPoemException 
150   *         if the value is not valid
151   */
152 
153   public final void setId(int cooked)
154       throws AccessPoemException, ValidationPoemException {
155     setId(new Integer(cooked));
156   }
157 
158 
159  /**
160   * Retrieves the <code>Id</code> value as a <code>Field</code>
161   * from this <code>group</code> <code>Persistent</code>.
162   * 
163   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
164   * @throws AccessPoemException 
165   *         if the current <code>AccessToken</code> 
166   *         does not confer write access rights
167   * @return the Integer id
168   */
169   public Field<Integer> getIdField() throws AccessPoemException {
170     Column<Integer> c = _getGroupTable().getIdColumn();
171     return new Field<Integer>((Integer)c.getRaw(this), c);
172   }
173 
174 
175  /**
176   * Retrieves the <code>Name</code> value, without locking, 
177   * for this <code>group</code> <code>Persistent</code>.
178   *
179   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
180   * @return the String name
181   */
182   public String getName_unsafe() {
183     return name;
184   }
185 
186 
187  /**
188   * Sets the <code>Name</code> value directly, without checking, 
189   * for this group <code>Persistent</code>.
190   * 
191   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
192   * @param cooked  the pre-validated value to set
193   */
194   public void setName_unsafe(String cooked) {
195     name = cooked;
196   }
197 
198  /**
199   * Retrieves the Name value, with locking, for this 
200   * <code>group</code> <code>Persistent</code>.
201   * Field description: 
202   *   A human-readable name for the group 
203   * 
204   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
205   * @throws AccessPoemException 
206   *         if the current <code>AccessToken</code> 
207   *         does not confer write access rights 
208   * @return the value of the field <code>Name</code> for this 
209   *         <code>group</code> <code>Persistent</code>  
210   */
211 
212   public String getName()
213       throws AccessPoemException {
214     readLock();
215     return getName_unsafe();
216   }
217 
218 
219  /**
220   * Sets the <code>Name</code> value, with checking, for this 
221   * <code>group</code> <code>Persistent</code>.
222   * Field description: 
223   *   A human-readable name for the group 
224   * 
225   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
226   * @param cooked  a validated <code>int</code> 
227   * @throws AccessPoemException 
228   *         if the current <code>AccessToken</code> 
229   *         does not confer write access rights
230   * @throws ValidationPoemException 
231   *         if the value is not valid
232   */
233   public void setName(String cooked)
234       throws AccessPoemException, ValidationPoemException {
235     _getGroupTable().getNameColumn().
236       getType().assertValidCooked(cooked);
237     writeLock();
238     setName_unsafe(cooked);
239   }
240 
241 
242  /**
243   * Retrieves the <code>Name</code> value as a <code>Field</code>
244   * from this <code>group</code> <code>Persistent</code>.
245   * 
246   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
247   * @throws AccessPoemException 
248   *         if the current <code>AccessToken</code> 
249   *         does not confer write access rights
250   * @return the String name
251   */
252   public Field<String> getNameField() throws AccessPoemException {
253     Column<String> c = _getGroupTable().getNameColumn();
254     return new Field<String>((String)c.getRaw(this), c);
255   }
256 
257   private CachedSelection<GroupMembership> groupGroupMemberships = null;
258   /** References to this Group in the GroupMembership table via its group field.*/
259   @SuppressWarnings("unchecked")
260   public Enumeration<GroupMembership> getGroupGroupMemberships() {
261     if (getTroid() == null)
262       return new EmptyEnumeration<GroupMembership>();
263     else {
264       if (groupGroupMemberships == null)
265         groupGroupMemberships =
266           getPoemDatabaseTables().getGroupMembershipTable().getGroupColumn().cachedSelectionWhereEq(getTroid());
267       return groupGroupMemberships.objects();
268     }
269   }
270 
271 
272   /** References to this Group in the GroupMembership table via its group field, as a List.*/
273   public List<GroupMembership> getGroupGroupMembershipList() {
274     return Collections.list(getGroupGroupMemberships());
275   }
276 
277 
278 
279   private CachedSelection<GroupCapability> groupGroupCapabilitys = null;
280   /** References to this Group in the GroupCapability table via its group field.*/
281   @SuppressWarnings("unchecked")
282   public Enumeration<GroupCapability> getGroupGroupCapabilitys() {
283     if (getTroid() == null)
284       return new EmptyEnumeration<GroupCapability>();
285     else {
286       if (groupGroupCapabilitys == null)
287         groupGroupCapabilitys =
288           getPoemDatabaseTables().getGroupCapabilityTable().getGroupColumn().cachedSelectionWhereEq(getTroid());
289       return groupGroupCapabilitys.objects();
290     }
291   }
292 
293 
294   /** References to this Group in the GroupCapability table via its group field, as a List.*/
295   public List<GroupCapability> getGroupGroupCapabilityList() {
296     return Collections.list(getGroupGroupCapabilitys());
297   }
298 
299 
300 
301 }
302