View Javadoc

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