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