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.Capability;
12  import org.melati.poem.CapabilityTable;
13  import org.melati.poem.Column;
14  import org.melati.poem.Field;
15  import org.melati.poem.GroupCapability;
16  import org.melati.poem.JdbcPersistent;
17  import org.melati.poem.PoemDatabaseTables;
18  import org.melati.poem.TableInfo;
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>capability</code> Object.
26   *
27   * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
28   */
29  public abstract class CapabilityBase 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>CapabilityTable</code> table 
45    * which this <code>Persistent</code> is from.
46    * 
47    * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
48    * @return the CapabilityTable
49    */
50    @SuppressWarnings("unchecked")
51    public CapabilityTable<Capability> getCapabilityTable() {
52      return (CapabilityTable<Capability>)getTable();
53    }
54  
55    @SuppressWarnings("unchecked")
56    private CapabilityTable<Capability> _getCapabilityTable() {
57      return (CapabilityTable<Capability>)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 Capability 
67    */
68    protected String name;
69  
70  
71   /**
72    * Retrieves the <code>Id</code> value, without locking, 
73    * for this <code>capability</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 capability <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>capability</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>capability</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>capability</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     _getCapabilityTable().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>capability</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>capability</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 = _getCapabilityTable().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>capability</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 capability <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>capability</code> <code>Persistent</code>.
201   * Field description: 
202   *   A human-readable name for the Capability 
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>capability</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>capability</code> <code>Persistent</code>.
222   * Field description: 
223   *   A human-readable name for the Capability 
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     _getCapabilityTable().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>capability</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 = _getCapabilityTable().getNameColumn();
254     return new Field<String>((String)c.getRaw(this), c);
255   }
256 
257   private CachedSelection<GroupCapability> capabilityGroupCapabilitys = null;
258   /** References to this Capability in the GroupCapability table via its capability field.*/
259   @SuppressWarnings("unchecked")
260   public Enumeration<GroupCapability> getCapabilityGroupCapabilitys() {
261     if (getTroid() == null)
262       return new EmptyEnumeration<GroupCapability>();
263     else {
264       if (capabilityGroupCapabilitys == null)
265         capabilityGroupCapabilitys =
266           getPoemDatabaseTables().getGroupCapabilityTable().getCapabilityColumn().cachedSelectionWhereEq(getTroid());
267       return capabilityGroupCapabilitys.objects();
268     }
269   }
270 
271 
272   /** References to this Capability in the GroupCapability table via its capability field, as a List.*/
273   public List<GroupCapability> getCapabilityGroupCapabilityList() {
274     return Collections.list(getCapabilityGroupCapabilitys());
275   }
276 
277 
278 
279   private CachedSelection<TableInfo> defaultcanreadTableInfos = null;
280   /** References to this Capability in the TableInfo table via its defaultcanread field.*/
281   @SuppressWarnings("unchecked")
282   public Enumeration<TableInfo> getDefaultcanreadTableInfos() {
283     if (getTroid() == null)
284       return new EmptyEnumeration<TableInfo>();
285     else {
286       if (defaultcanreadTableInfos == null)
287         defaultcanreadTableInfos =
288           getPoemDatabaseTables().getTableInfoTable().getDefaultcanreadColumn().cachedSelectionWhereEq(getTroid());
289       return defaultcanreadTableInfos.objects();
290     }
291   }
292 
293 
294   /** References to this Capability in the TableInfo table via its defaultcanread field, as a List.*/
295   public List<TableInfo> getDefaultcanreadTableInfoList() {
296     return Collections.list(getDefaultcanreadTableInfos());
297   }
298 
299 
300 
301   private CachedSelection<TableInfo> defaultcanwriteTableInfos = null;
302   /** References to this Capability in the TableInfo table via its defaultcanwrite field.*/
303   @SuppressWarnings("unchecked")
304   public Enumeration<TableInfo> getDefaultcanwriteTableInfos() {
305     if (getTroid() == null)
306       return new EmptyEnumeration<TableInfo>();
307     else {
308       if (defaultcanwriteTableInfos == null)
309         defaultcanwriteTableInfos =
310           getPoemDatabaseTables().getTableInfoTable().getDefaultcanwriteColumn().cachedSelectionWhereEq(getTroid());
311       return defaultcanwriteTableInfos.objects();
312     }
313   }
314 
315 
316   /** References to this Capability in the TableInfo table via its defaultcanwrite field, as a List.*/
317   public List<TableInfo> getDefaultcanwriteTableInfoList() {
318     return Collections.list(getDefaultcanwriteTableInfos());
319   }
320 
321 
322 
323   private CachedSelection<TableInfo> defaultcandeleteTableInfos = null;
324   /** References to this Capability in the TableInfo table via its defaultcandelete field.*/
325   @SuppressWarnings("unchecked")
326   public Enumeration<TableInfo> getDefaultcandeleteTableInfos() {
327     if (getTroid() == null)
328       return new EmptyEnumeration<TableInfo>();
329     else {
330       if (defaultcandeleteTableInfos == null)
331         defaultcandeleteTableInfos =
332           getPoemDatabaseTables().getTableInfoTable().getDefaultcandeleteColumn().cachedSelectionWhereEq(getTroid());
333       return defaultcandeleteTableInfos.objects();
334     }
335   }
336 
337 
338   /** References to this Capability in the TableInfo table via its defaultcandelete field, as a List.*/
339   public List<TableInfo> getDefaultcandeleteTableInfoList() {
340     return Collections.list(getDefaultcandeleteTableInfos());
341   }
342 
343 
344 
345   private CachedSelection<TableInfo> cancreateTableInfos = null;
346   /** References to this Capability in the TableInfo table via its cancreate field.*/
347   @SuppressWarnings("unchecked")
348   public Enumeration<TableInfo> getCancreateTableInfos() {
349     if (getTroid() == null)
350       return new EmptyEnumeration<TableInfo>();
351     else {
352       if (cancreateTableInfos == null)
353         cancreateTableInfos =
354           getPoemDatabaseTables().getTableInfoTable().getCancreateColumn().cachedSelectionWhereEq(getTroid());
355       return cancreateTableInfos.objects();
356     }
357   }
358 
359 
360   /** References to this Capability in the TableInfo table via its cancreate field, as a List.*/
361   public List<TableInfo> getCancreateTableInfoList() {
362     return Collections.list(getCancreateTableInfos());
363   }
364 
365 
366 
367 }
368