1 // Do not edit this file! It was generated by Melati POEM's DSD preprocessor.
2
3 package org.paneris.rimauresq.model.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.JdbcPersistent;
10 import org.melati.poem.NoSuchRowPoemException;
11 import org.melati.poem.ValidationPoemException;
12 import org.paneris.rimauresq.model.Product;
13 import org.paneris.rimauresq.model.RimauresqDatabaseTables;
14 import org.paneris.rimauresq.model.ShopOrder;
15 import org.paneris.rimauresq.model.ShopOrderItemTable;
16 import org.paneris.rimauresq.model.User;
17
18
19 /**
20 * Melati POEM generated abstract base class for a <code>Persistent</code>
21 * <code>ShopOrderItem</code> Object.
22 *
23 * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava
24 */
25 public abstract class ShopOrderItemBase extends JdbcPersistent {
26
27
28 /**
29 * Retrieves the Database object.
30 *
31 * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava
32 * @return the database
33 */
34 public RimauresqDatabaseTables getRimauresqDatabaseTables() {
35 return (RimauresqDatabaseTables)getDatabase();
36 }
37
38
39 /**
40 * Retrieves the <code>ShopOrderItemTable</code> table
41 * which this <code>Persistent</code> is from.
42 *
43 * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava
44 * @return the ShopOrderItemTable
45 */
46 public ShopOrderItemTable getShopOrderItemTable() {
47 return (ShopOrderItemTable)getTable();
48 }
49
50 private ShopOrderItemTable _getShopOrderItemTable() {
51 return (ShopOrderItemTable)getTable();
52 }
53
54 // Fields in this table
55 /**
56 * id
57 */
58 protected Integer id;
59 /**
60 * User
61 */
62 protected Integer user;
63 /**
64 * Product
65 */
66 protected Integer product;
67 /**
68 * Quantity
69 */
70 protected Integer quantity;
71 /**
72 * Order Number - The order number for this pruchase
73 */
74 protected Integer order;
75 /**
76 * Amount (in GBP) - The amount of this line (in GBP)
77 */
78 protected Double amount;
79
80
81 /**
82 * Retrieves the <code>Id</code> value, without locking,
83 * for this <code>ShopOrderItem</code> <code>Persistent</code>.
84 *
85 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
86 * @return the Integer id
87 */
88 public Integer getId_unsafe() {
89 return id;
90 }
91
92
93 /**
94 * Sets the <code>Id</code> value directly, without checking,
95 * for this ShopOrderItem <code>Persistent</code>.
96 *
97 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
98 * @param cooked the pre-validated value to set
99 */
100 public void setId_unsafe(Integer cooked) {
101 id = cooked;
102 }
103
104 /**
105 * Retrieves the Id value, with locking, for this
106 * <code>ShopOrderItem</code> <code>Persistent</code>.
107 *
108 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
109 * @throws AccessPoemException
110 * if the current <code>AccessToken</code>
111 * does not confer write access rights
112 * @return the value of the field <code>Id</code> for this
113 * <code>ShopOrderItem</code> <code>Persistent</code>
114 */
115
116 public Integer getId()
117 throws AccessPoemException {
118 readLock();
119 return getId_unsafe();
120 }
121
122
123 /**
124 * Sets the <code>Id</code> value, with checking, for this
125 * <code>ShopOrderItem</code> <code>Persistent</code>.
126 *
127 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
128 * @param cooked a validated <code>int</code>
129 * @throws AccessPoemException
130 * if the current <code>AccessToken</code>
131 * does not confer write access rights
132 * @throws ValidationPoemException
133 * if the value is not valid
134 */
135 public void setId(Integer cooked)
136 throws AccessPoemException, ValidationPoemException {
137 _getShopOrderItemTable().getIdColumn().
138 getType().assertValidCooked(cooked);
139 writeLock();
140 setId_unsafe(cooked);
141 }
142
143 /**
144 * Sets the <code>Id</code> value, with checking, for this
145 * <code>ShopOrderItem</code> <code>Persistent</code>.
146 *
147 * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
148 * @param cooked a validated <code>int</code>
149 * @throws AccessPoemException
150 * if the current <code>AccessToken</code>
151 * does not confer write access rights
152 * @throws ValidationPoemException
153 * if the value is not valid
154 */
155
156 public final void setId(int cooked)
157 throws AccessPoemException, ValidationPoemException {
158 setId(new Integer(cooked));
159 }
160
161
162 /**
163 * Retrieves the <code>Id</code> value as a <code>Field</code>
164 * from this <code>ShopOrderItem</code> <code>Persistent</code>.
165 *
166 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator
167 * @throws AccessPoemException
168 * if the current <code>AccessToken</code>
169 * does not confer write access rights
170 * @return the Integer id
171 */
172 public Field getIdField() throws AccessPoemException {
173 Column c = _getShopOrderItemTable().getIdColumn();
174 return new Field(c.getRaw(this), c);
175 }
176
177
178 /**
179 * Retrieves the <code>User</code> value, without locking,
180 * for this <code>ShopOrderItem</code> <code>Persistent</code>.
181 *
182 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
183 * @return the Integer user
184 */
185 public Integer getUser_unsafe() {
186 return user;
187 }
188
189
190 /**
191 * Sets the <code>User</code> value directly, without checking,
192 * for this ShopOrderItem <code>Persistent</code>.
193 *
194 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
195 * @param cooked the pre-validated value to set
196 */
197 public void setUser_unsafe(Integer cooked) {
198 user = cooked;
199 }
200
201 /**
202 * Retrieves the Table Row Object ID.
203 *
204 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
205 * @throws AccessPoemException
206 * if the current <code>AccessToken</code>
207 * does not confer read access rights
208 * @return the TROID as an <code>Integer</code>
209 */
210
211 public Integer getUserTroid()
212 throws AccessPoemException {
213 readLock();
214 return getUser_unsafe();
215 }
216
217
218 /**
219 * Sets the Table Row Object ID.
220 *
221 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
222 * @param raw a Table Row Object Id
223 * @throws AccessPoemException
224 * if the current <code>AccessToken</code>
225 * does not confer write access rights
226 */
227 public void setUserTroid(Integer raw)
228 throws AccessPoemException {
229 setUser(raw == null ? null :
230 (User)getRimauresqDatabaseTables().getUserTable().getUserObject(raw));
231 }
232
233
234 /**
235 * Retrieves the <code>User</code> object referred to.
236 *
237 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
238 * @throws AccessPoemException
239 * if the current <code>AccessToken</code>
240 * does not confer read access rights
241 * @throws NoSuchRowPoemException
242 * if the <code>Persistent</code> has yet to be allocated a TROID
243 * @return the <code>User</code> as a <code>User</code>
244 */
245 public User getUser()
246 throws AccessPoemException, NoSuchRowPoemException {
247 Integer troid = getUserTroid();
248 return troid == null ? null :
249 (User)getRimauresqDatabaseTables().getUserTable().getUserObject(troid);
250 }
251
252
253 /**
254 * Set the User.
255 *
256 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
257 * @param cooked a validated <code>User</code>
258 * @throws AccessPoemException
259 * if the current <code>AccessToken</code>
260 * does not confer write access rights
261 */
262 public void setUser(User cooked)
263 throws AccessPoemException {
264 _getShopOrderItemTable().
265 getUserColumn().
266 getType().assertValidCooked(cooked);
267 writeLock();
268 if (cooked == null)
269 setUser_unsafe(null);
270 else {
271 cooked.existenceLock();
272 setUser_unsafe(cooked.troid());
273 }
274 }
275
276
277 /**
278 * Retrieves the <code>User</code> value as a <code>Field</code>
279 * from this <code>ShopOrderItem</code> <code>Persistent</code>.
280 *
281 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator
282 * @throws AccessPoemException
283 * if the current <code>AccessToken</code>
284 * does not confer write access rights
285 * @return the Integer user
286 */
287 public Field getUserField() throws AccessPoemException {
288 Column c = _getShopOrderItemTable().getUserColumn();
289 return new Field(c.getRaw(this), c);
290 }
291
292
293 /**
294 * Retrieves the <code>Product</code> value, without locking,
295 * for this <code>ShopOrderItem</code> <code>Persistent</code>.
296 *
297 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
298 * @return the Integer product
299 */
300 public Integer getProduct_unsafe() {
301 return product;
302 }
303
304
305 /**
306 * Sets the <code>Product</code> value directly, without checking,
307 * for this ShopOrderItem <code>Persistent</code>.
308 *
309 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
310 * @param cooked the pre-validated value to set
311 */
312 public void setProduct_unsafe(Integer cooked) {
313 product = cooked;
314 }
315
316 /**
317 * Retrieves the Table Row Object ID.
318 *
319 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
320 * @throws AccessPoemException
321 * if the current <code>AccessToken</code>
322 * does not confer read access rights
323 * @return the TROID as an <code>Integer</code>
324 */
325
326 public Integer getProductTroid()
327 throws AccessPoemException {
328 readLock();
329 return getProduct_unsafe();
330 }
331
332
333 /**
334 * Sets the Table Row Object ID.
335 *
336 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
337 * @param raw a Table Row Object Id
338 * @throws AccessPoemException
339 * if the current <code>AccessToken</code>
340 * does not confer write access rights
341 */
342 public void setProductTroid(Integer raw)
343 throws AccessPoemException {
344 setProduct(raw == null ? null :
345 getRimauresqDatabaseTables().getProductTable().getProductObject(raw));
346 }
347
348
349 /**
350 * Retrieves the <code>Product</code> object referred to.
351 *
352 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
353 * @throws AccessPoemException
354 * if the current <code>AccessToken</code>
355 * does not confer read access rights
356 * @throws NoSuchRowPoemException
357 * if the <code>Persistent</code> has yet to be allocated a TROID
358 * @return the <code>Product</code> as a <code>Product</code>
359 */
360 public Product getProduct()
361 throws AccessPoemException, NoSuchRowPoemException {
362 Integer troid = getProductTroid();
363 return troid == null ? null :
364 getRimauresqDatabaseTables().getProductTable().getProductObject(troid);
365 }
366
367
368 /**
369 * Set the Product.
370 *
371 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
372 * @param cooked a validated <code>Product</code>
373 * @throws AccessPoemException
374 * if the current <code>AccessToken</code>
375 * does not confer write access rights
376 */
377 public void setProduct(Product cooked)
378 throws AccessPoemException {
379 _getShopOrderItemTable().
380 getProductColumn().
381 getType().assertValidCooked(cooked);
382 writeLock();
383 if (cooked == null)
384 setProduct_unsafe(null);
385 else {
386 cooked.existenceLock();
387 setProduct_unsafe(cooked.troid());
388 }
389 }
390
391
392 /**
393 * Retrieves the <code>Product</code> value as a <code>Field</code>
394 * from this <code>ShopOrderItem</code> <code>Persistent</code>.
395 *
396 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator
397 * @throws AccessPoemException
398 * if the current <code>AccessToken</code>
399 * does not confer write access rights
400 * @return the Integer product
401 */
402 public Field getProductField() throws AccessPoemException {
403 Column c = _getShopOrderItemTable().getProductColumn();
404 return new Field(c.getRaw(this), c);
405 }
406
407
408 /**
409 * Retrieves the <code>Quantity</code> value, without locking,
410 * for this <code>ShopOrderItem</code> <code>Persistent</code>.
411 *
412 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
413 * @return the Integer quantity
414 */
415 public Integer getQuantity_unsafe() {
416 return quantity;
417 }
418
419
420 /**
421 * Sets the <code>Quantity</code> value directly, without checking,
422 * for this ShopOrderItem <code>Persistent</code>.
423 *
424 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
425 * @param cooked the pre-validated value to set
426 */
427 public void setQuantity_unsafe(Integer cooked) {
428 quantity = cooked;
429 }
430
431 /**
432 * Retrieves the Quantity value, with locking, for this
433 * <code>ShopOrderItem</code> <code>Persistent</code>.
434 *
435 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
436 * @throws AccessPoemException
437 * if the current <code>AccessToken</code>
438 * does not confer write access rights
439 * @return the value of the field <code>Quantity</code> for this
440 * <code>ShopOrderItem</code> <code>Persistent</code>
441 */
442
443 public Integer getQuantity()
444 throws AccessPoemException {
445 readLock();
446 return getQuantity_unsafe();
447 }
448
449
450 /**
451 * Sets the <code>Quantity</code> value, with checking, for this
452 * <code>ShopOrderItem</code> <code>Persistent</code>.
453 *
454 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
455 * @param cooked a validated <code>int</code>
456 * @throws AccessPoemException
457 * if the current <code>AccessToken</code>
458 * does not confer write access rights
459 * @throws ValidationPoemException
460 * if the value is not valid
461 */
462 public void setQuantity(Integer cooked)
463 throws AccessPoemException, ValidationPoemException {
464 _getShopOrderItemTable().getQuantityColumn().
465 getType().assertValidCooked(cooked);
466 writeLock();
467 setQuantity_unsafe(cooked);
468 }
469
470 /**
471 * Sets the <code>Quantity</code> value, with checking, for this
472 * <code>ShopOrderItem</code> <code>Persistent</code>.
473 *
474 * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
475 * @param cooked a validated <code>int</code>
476 * @throws AccessPoemException
477 * if the current <code>AccessToken</code>
478 * does not confer write access rights
479 * @throws ValidationPoemException
480 * if the value is not valid
481 */
482
483 public final void setQuantity(int cooked)
484 throws AccessPoemException, ValidationPoemException {
485 setQuantity(new Integer(cooked));
486 }
487
488
489 /**
490 * Retrieves the <code>Quantity</code> value as a <code>Field</code>
491 * from this <code>ShopOrderItem</code> <code>Persistent</code>.
492 *
493 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator
494 * @throws AccessPoemException
495 * if the current <code>AccessToken</code>
496 * does not confer write access rights
497 * @return the Integer quantity
498 */
499 public Field getQuantityField() throws AccessPoemException {
500 Column c = _getShopOrderItemTable().getQuantityColumn();
501 return new Field(c.getRaw(this), c);
502 }
503
504
505 /**
506 * Retrieves the <code>Order</code> value, without locking,
507 * for this <code>ShopOrderItem</code> <code>Persistent</code>.
508 *
509 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
510 * @return the Integer order
511 */
512 public Integer getOrder_unsafe() {
513 return order;
514 }
515
516
517 /**
518 * Sets the <code>Order</code> value directly, without checking,
519 * for this ShopOrderItem <code>Persistent</code>.
520 *
521 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
522 * @param cooked the pre-validated value to set
523 */
524 public void setOrder_unsafe(Integer cooked) {
525 order = cooked;
526 }
527
528 /**
529 * Retrieves the Table Row Object ID.
530 *
531 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
532 * @throws AccessPoemException
533 * if the current <code>AccessToken</code>
534 * does not confer read access rights
535 * @return the TROID as an <code>Integer</code>
536 */
537
538 public Integer getOrderTroid()
539 throws AccessPoemException {
540 readLock();
541 return getOrder_unsafe();
542 }
543
544
545 /**
546 * Sets the Table Row Object ID.
547 *
548 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
549 * @param raw a Table Row Object Id
550 * @throws AccessPoemException
551 * if the current <code>AccessToken</code>
552 * does not confer write access rights
553 */
554 public void setOrderTroid(Integer raw)
555 throws AccessPoemException {
556 setOrder(raw == null ? null :
557 getRimauresqDatabaseTables().getShopOrderTable().getShopOrderObject(raw));
558 }
559
560
561 /**
562 * Retrieves the <code>Order</code> object referred to.
563 *
564 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
565 * @throws AccessPoemException
566 * if the current <code>AccessToken</code>
567 * does not confer read access rights
568 * @throws NoSuchRowPoemException
569 * if the <code>Persistent</code> has yet to be allocated a TROID
570 * @return the <code>Order</code> as a <code>ShopOrder</code>
571 */
572 public ShopOrder getOrder()
573 throws AccessPoemException, NoSuchRowPoemException {
574 Integer troid = getOrderTroid();
575 return troid == null ? null :
576 getRimauresqDatabaseTables().getShopOrderTable().getShopOrderObject(troid);
577 }
578
579
580 /**
581 * Set the Order.
582 *
583 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
584 * @param cooked a validated <code>ShopOrder</code>
585 * @throws AccessPoemException
586 * if the current <code>AccessToken</code>
587 * does not confer write access rights
588 */
589 public void setOrder(ShopOrder cooked)
590 throws AccessPoemException {
591 _getShopOrderItemTable().
592 getOrderColumn().
593 getType().assertValidCooked(cooked);
594 writeLock();
595 if (cooked == null)
596 setOrder_unsafe(null);
597 else {
598 cooked.existenceLock();
599 setOrder_unsafe(cooked.troid());
600 }
601 }
602
603
604 /**
605 * Retrieves the <code>Order</code> value as a <code>Field</code>
606 * from this <code>ShopOrderItem</code> <code>Persistent</code>.
607 *
608 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator
609 * @throws AccessPoemException
610 * if the current <code>AccessToken</code>
611 * does not confer write access rights
612 * @return the Integer order
613 */
614 public Field getOrderField() throws AccessPoemException {
615 Column c = _getShopOrderItemTable().getOrderColumn();
616 return new Field(c.getRaw(this), c);
617 }
618
619
620 /**
621 * Retrieves the <code>Amount</code> value, without locking,
622 * for this <code>ShopOrderItem</code> <code>Persistent</code>.
623 *
624 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
625 * @return the Double amount
626 */
627 public Double getAmount_unsafe() {
628 return amount;
629 }
630
631
632 /**
633 * Sets the <code>Amount</code> value directly, without checking,
634 * for this ShopOrderItem <code>Persistent</code>.
635 *
636 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods
637 * @param cooked the pre-validated value to set
638 */
639 public void setAmount_unsafe(Double cooked) {
640 amount = cooked;
641 }
642
643 /**
644 * Retrieves the Amount value, with locking, for this
645 * <code>ShopOrderItem</code> <code>Persistent</code>.
646 * Field description:
647 * The amount of this line (in GBP)
648 *
649 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
650 * @throws AccessPoemException
651 * if the current <code>AccessToken</code>
652 * does not confer write access rights
653 * @return the value of the field <code>Amount</code> for this
654 * <code>ShopOrderItem</code> <code>Persistent</code>
655 */
656
657 public Double getAmount()
658 throws AccessPoemException {
659 readLock();
660 return getAmount_unsafe();
661 }
662
663
664 /**
665 * Sets the <code>Amount</code> value, with checking, for this
666 * <code>ShopOrderItem</code> <code>Persistent</code>.
667 * Field description:
668 * The amount of this line (in GBP)
669 *
670 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
671 * @param cooked a validated <code>int</code>
672 * @throws AccessPoemException
673 * if the current <code>AccessToken</code>
674 * does not confer write access rights
675 * @throws ValidationPoemException
676 * if the value is not valid
677 */
678 public void setAmount(Double cooked)
679 throws AccessPoemException, ValidationPoemException {
680 _getShopOrderItemTable().getAmountColumn().
681 getType().assertValidCooked(cooked);
682 writeLock();
683 setAmount_unsafe(cooked);
684 }
685
686 /**
687 * Sets the <code>Amount</code> value, with checking, for this <code>ShopOrderItem</code> <code>Persistent</code>.
688 * Field description:
689 * The amount of this line (in GBP)
690 *
691 *
692 * @generator org.melati.poem.prepro.DoubleFieldDef#generateBaseMethods
693 * @param cooked a validated <code>int</code>
694 * @throws AccessPoemException
695 * if the current <code>AccessToken</code>
696 * does not confer write access rights
697 * @throws ValidationPoemException
698 * if the value is not valid
699 */
700
701 public final void setAmount(double cooked)
702 throws AccessPoemException, ValidationPoemException {
703 setAmount(new Double(cooked));
704 }
705
706
707 /**
708 * Retrieves the <code>Amount</code> value as a <code>Field</code>
709 * from this <code>ShopOrderItem</code> <code>Persistent</code>.
710 *
711 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator
712 * @throws AccessPoemException
713 * if the current <code>AccessToken</code>
714 * does not confer write access rights
715 * @return the Double amount
716 */
717 public Field getAmountField() throws AccessPoemException {
718 Column c = _getShopOrderItemTable().getAmountColumn();
719 return new Field(c.getRaw(this), c);
720 }
721 }
722