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 org.melati.poem.AccessPoemException;
7 import org.melati.poem.Column;
8 import org.melati.poem.Field;
9 import org.melati.poem.Group;
10 import org.melati.poem.GroupMembership;
11 import org.melati.poem.GroupMembershipTable;
12 import org.melati.poem.JdbcPersistent;
13 import org.melati.poem.NoSuchRowPoemException;
14 import org.melati.poem.PoemDatabaseTables;
15 import org.melati.poem.User;
16 import org.melati.poem.ValidationPoemException;
17
18
19 /**
20 * Melati POEM generated abstract base class for a <code>Persistent</code>
21 * <code>groupMembership</code> Object.
22 *
23 * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
24 */
25 public abstract class GroupMembershipBase extends JdbcPersistent {
26
27
28 /**
29 * Retrieves the Database object.
30 *
31 * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
32 * @return the database
33 */
34 public PoemDatabaseTables getPoemDatabaseTables() {
35 return (PoemDatabaseTables)getDatabase();
36 }
37
38
39 /**
40 * Retrieves the <code>GroupMembershipTable</code> table
41 * which this <code>Persistent</code> is from.
42 *
43 * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
44 * @return the GroupMembershipTable
45 */
46 @SuppressWarnings("unchecked")
47 public GroupMembershipTable<GroupMembership> getGroupMembershipTable() {
48 return (GroupMembershipTable<GroupMembership>)getTable();
49 }
50
51 @SuppressWarnings("unchecked")
52 private GroupMembershipTable<GroupMembership> _getGroupMembershipTable() {
53 return (GroupMembershipTable<GroupMembership>)getTable();
54 }
55
56 // Fields in this table
57 /**
58 * id - The Table Row Object ID
59 */
60 protected Integer id;
61 /**
62 * User - The user who belongs to the group
63 */
64 protected Integer user;
65 /**
66 * Group - The group to which the user belongs
67 */
68 protected Integer group;
69
70
71 /**
72 * Retrieves the <code>Id</code> value, without locking,
73 * for this <code>groupMembership</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 groupMembership <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>groupMembership</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>groupMembership</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>groupMembership</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 _getGroupMembershipTable().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>groupMembership</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>groupMembership</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 = _getGroupMembershipTable().getIdColumn();
171 return new Field<Integer>((Integer)c.getRaw(this), c);
172 }
173
174
175 /**
176 * Retrieves the <code>User</code> value, without locking,
177 * for this <code>groupMembership</code> <code>Persistent</code>.
178 *
179 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
180 * @return the Integer user
181 */
182 public Integer getUser_unsafe() {
183 return user;
184 }
185
186
187 /**
188 * Sets the <code>User</code> value directly, without checking,
189 * for this groupMembership <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 setUser_unsafe(Integer cooked) {
195 user = cooked;
196 }
197
198 /**
199 * Retrieves the Table Row Object ID.
200 *
201 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
202 * @throws AccessPoemException
203 * if the current <code>AccessToken</code>
204 * does not confer read access rights
205 * @return the TROID as an <code>Integer</code>
206 */
207
208 public Integer getUserTroid()
209 throws AccessPoemException {
210 readLock();
211 return getUser_unsafe();
212 }
213
214
215 /**
216 * Sets the Table Row Object ID.
217 *
218 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
219 * @param raw a Table Row Object Id
220 * @throws AccessPoemException
221 * if the current <code>AccessToken</code>
222 * does not confer write access rights
223 */
224 public void setUserTroid(Integer raw)
225 throws AccessPoemException {
226 setUser(raw == null ? null :
227 getPoemDatabaseTables().getUserTable().getUserObject(raw));
228 }
229
230
231 /**
232 * Retrieves the <code>User</code> object referred to.
233 *
234 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
235 * @throws AccessPoemException
236 * if the current <code>AccessToken</code>
237 * does not confer read access rights
238 * @throws NoSuchRowPoemException
239 * if the <code>Persistent</code> has yet to be allocated a TROID
240 * @return the <code>User</code> as a <code>User</code>
241 */
242 public User getUser()
243 throws AccessPoemException, NoSuchRowPoemException {
244 Integer troid = getUserTroid();
245 return troid == null ? null :
246 getPoemDatabaseTables().getUserTable().getUserObject(troid);
247 }
248
249
250 /**
251 * Set the User.
252 *
253 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
254 * @param cooked a validated <code>User</code>
255 * @throws AccessPoemException
256 * if the current <code>AccessToken</code>
257 * does not confer write access rights
258 */
259 public void setUser(User cooked)
260 throws AccessPoemException {
261 _getGroupMembershipTable().
262 getUserColumn().
263 getType().assertValidCooked(cooked);
264 writeLock();
265 if (cooked == null)
266 setUser_unsafe(null);
267 else {
268 cooked.existenceLock();
269 setUser_unsafe(cooked.troid());
270 }
271 }
272
273
274 /**
275 * Retrieves the <code>User</code> value as a <code>Field</code>
276 * from this <code>groupMembership</code> <code>Persistent</code>.
277 *
278 * see org.melati.poem.prepro.FieldDef#generateFieldCreator
279 * @throws AccessPoemException
280 * if the current <code>AccessToken</code>
281 * does not confer write access rights
282 * @return the Integer user
283 */
284 public Field<Integer> getUserField() throws AccessPoemException {
285 Column<Integer> c = _getGroupMembershipTable().getUserColumn();
286 return new Field<Integer>((Integer)c.getRaw(this), c);
287 }
288
289
290 /**
291 * Retrieves the <code>Group</code> value, without locking,
292 * for this <code>groupMembership</code> <code>Persistent</code>.
293 *
294 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
295 * @return the Integer group
296 */
297 public Integer getGroup_unsafe() {
298 return group;
299 }
300
301
302 /**
303 * Sets the <code>Group</code> value directly, without checking,
304 * for this groupMembership <code>Persistent</code>.
305 *
306 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
307 * @param cooked the pre-validated value to set
308 */
309 public void setGroup_unsafe(Integer cooked) {
310 group = cooked;
311 }
312
313 /**
314 * Retrieves the Table Row Object ID.
315 *
316 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
317 * @throws AccessPoemException
318 * if the current <code>AccessToken</code>
319 * does not confer read access rights
320 * @return the TROID as an <code>Integer</code>
321 */
322
323 public Integer getGroupTroid()
324 throws AccessPoemException {
325 readLock();
326 return getGroup_unsafe();
327 }
328
329
330 /**
331 * Sets the Table Row Object ID.
332 *
333 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
334 * @param raw a Table Row Object Id
335 * @throws AccessPoemException
336 * if the current <code>AccessToken</code>
337 * does not confer write access rights
338 */
339 public void setGroupTroid(Integer raw)
340 throws AccessPoemException {
341 setGroup(raw == null ? null :
342 getPoemDatabaseTables().getGroupTable().getGroupObject(raw));
343 }
344
345
346 /**
347 * Retrieves the <code>Group</code> object referred to.
348 *
349 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
350 * @throws AccessPoemException
351 * if the current <code>AccessToken</code>
352 * does not confer read access rights
353 * @throws NoSuchRowPoemException
354 * if the <code>Persistent</code> has yet to be allocated a TROID
355 * @return the <code>Group</code> as a <code>Group</code>
356 */
357 public Group getGroup()
358 throws AccessPoemException, NoSuchRowPoemException {
359 Integer troid = getGroupTroid();
360 return troid == null ? null :
361 getPoemDatabaseTables().getGroupTable().getGroupObject(troid);
362 }
363
364
365 /**
366 * Set the Group.
367 *
368 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
369 * @param cooked a validated <code>Group</code>
370 * @throws AccessPoemException
371 * if the current <code>AccessToken</code>
372 * does not confer write access rights
373 */
374 public void setGroup(Group cooked)
375 throws AccessPoemException {
376 _getGroupMembershipTable().
377 getGroupColumn().
378 getType().assertValidCooked(cooked);
379 writeLock();
380 if (cooked == null)
381 setGroup_unsafe(null);
382 else {
383 cooked.existenceLock();
384 setGroup_unsafe(cooked.troid());
385 }
386 }
387
388
389 /**
390 * Retrieves the <code>Group</code> value as a <code>Field</code>
391 * from this <code>groupMembership</code> <code>Persistent</code>.
392 *
393 * see org.melati.poem.prepro.FieldDef#generateFieldCreator
394 * @throws AccessPoemException
395 * if the current <code>AccessToken</code>
396 * does not confer write access rights
397 * @return the Integer group
398 */
399 public Field<Integer> getGroupField() throws AccessPoemException {
400 Column<Integer> c = _getGroupMembershipTable().getGroupColumn();
401 return new Field<Integer>((Integer)c.getRaw(this), c);
402 }
403
404 }
405