1
2
3 package org.paneris.jammyjoes.model.generated;
4
5 import java.sql.Date;
6 import org.melati.poem.AccessPoemException;
7 import org.melati.poem.BooleanPoemType;
8 import org.melati.poem.Column;
9 import org.melati.poem.Database;
10 import org.melati.poem.DatePoemType;
11 import org.melati.poem.DefinitionSource;
12 import org.melati.poem.DisplayLevel;
13 import org.melati.poem.DoublePoemType;
14 import org.melati.poem.Field;
15 import org.melati.poem.IntegerPoemType;
16 import org.melati.poem.JdbcPersistent;
17 import org.melati.poem.Persistent;
18 import org.melati.poem.PoemException;
19 import org.melati.poem.ReferencePoemType;
20 import org.melati.poem.Searchability;
21 import org.melati.poem.StringPoemType;
22 import org.melati.poem.TroidPoemType;
23 import org.melati.poem.ValidationPoemException;
24 import org.paneris.jammyjoes.model.JammyjoesDatabaseTables;
25 import org.paneris.jammyjoes.model.JammyjoesTable;
26 import org.paneris.jammyjoes.model.Product;
27 import org.paneris.jammyjoes.model.StockTransaction;
28 import org.paneris.jammyjoes.model.StockTransactionType;
29
30
31 /**
32 * Melati POEM generated base class for
33 <code>Table</code> <code>StockTransaction</code>.
34 *
35 * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava
36 */
37
38 public class StockTransactionTableBase extends JammyjoesTable {
39
40 private Column col_id = null;
41 private Column col_type = null;
42 private Column col_date = null;
43 private Column col_product = null;
44 private Column col_quantity = null;
45 private Column col_costprice = null;
46 private Column col_retailpriceincvat = null;
47 private Column col_vatexempt = null;
48 private Column col_comment = null;
49
50 /**
51 * Constructor.
52 *
53 * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava
54 * @param database the POEM database we are using
55 * @param name the name of this <code>Table</code>
56 * @param definitionSource which definition is being used
57 * @throws PoemException if anything goes wrong
58 */
59
60 public StockTransactionTableBase(
61 Database database, String name,
62 DefinitionSource definitionSource) throws PoemException {
63 super(database, name, definitionSource);
64 }
65
66
67 /**
68 * Get the database tables.
69 *
70 * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava
71 * @return the database tables
72 */
73 public JammyjoesDatabaseTables getJammyjoesDatabaseTables() {
74 return (JammyjoesDatabaseTables)getDatabase();
75 }
76
77 public void init() throws PoemException {
78 super.init();
79 defineColumn(col_id =
80 new Column(this, "id",
81 new TroidPoemType(),
82 DefinitionSource.dsd) {
83 public Object getCooked(Persistent g)
84 throws AccessPoemException, PoemException {
85 return ((StockTransaction)g).getId();
86 }
87
88 public void setCooked(Persistent g, Object cooked)
89 throws AccessPoemException, ValidationPoemException {
90 ((StockTransaction)g).setId((Integer)cooked);
91 }
92
93 public Field asField(Persistent g) {
94 return ((StockTransaction)g).getIdField();
95 }
96
97 protected boolean defaultUserEditable() {
98 return false;
99 }
100
101 protected boolean defaultUserCreateable() {
102 return false;
103 }
104
105 protected DisplayLevel defaultDisplayLevel() {
106 return DisplayLevel.record;
107 }
108
109 protected Searchability defaultSearchability() {
110 return Searchability.no;
111 }
112
113 protected int defaultDisplayOrder() {
114 return 0;
115 }
116
117 public Object getRaw_unsafe(Persistent g)
118 throws AccessPoemException {
119 return ((StockTransaction)g).getId_unsafe();
120 }
121
122 public void setRaw_unsafe(Persistent g, Object raw)
123 throws AccessPoemException {
124 ((StockTransaction)g).setId_unsafe((Integer)raw);
125 }
126
127 public Object getRaw(Persistent g)
128 throws AccessPoemException {
129 return ((StockTransaction)g).getId();
130 }
131
132 public void setRaw(Persistent g, Object raw)
133 throws AccessPoemException {
134 ((StockTransaction)g).setId((Integer)raw);
135 }
136 });
137
138 defineColumn(col_type =
139 new Column(this, "type",
140 new ReferencePoemType(getJammyjoesDatabaseTables().
141 getStockTransactionTypeTable(), false),
142 DefinitionSource.dsd) {
143 public Object getCooked(Persistent g)
144 throws AccessPoemException, PoemException {
145 return ((StockTransaction)g).getType();
146 }
147
148 public void setCooked(Persistent g, Object cooked)
149 throws AccessPoemException, ValidationPoemException {
150 ((StockTransaction)g).setType((StockTransactionType)cooked);
151 }
152
153 public Field asField(Persistent g) {
154 return ((StockTransaction)g).getTypeField();
155 }
156
157 protected DisplayLevel defaultDisplayLevel() {
158 return DisplayLevel.summary;
159 }
160
161 protected Searchability defaultSearchability() {
162 return Searchability.primary;
163 }
164
165 protected Integer defaultDisplayOrderPriority() {
166 return new Integer(1);
167 }
168
169 protected int defaultDisplayOrder() {
170 return 1;
171 }
172
173 public Object getRaw_unsafe(Persistent g)
174 throws AccessPoemException {
175 return ((StockTransaction)g).getType_unsafe();
176 }
177
178 public void setRaw_unsafe(Persistent g, Object raw)
179 throws AccessPoemException {
180 ((StockTransaction)g).setType_unsafe((Integer)raw);
181 }
182
183 public Object getRaw(Persistent g)
184 throws AccessPoemException {
185 return ((StockTransaction)g).getTypeTroid();
186 }
187
188 public void setRaw(Persistent g, Object raw)
189 throws AccessPoemException {
190 ((StockTransaction)g).setTypeTroid((Integer)raw);
191 }
192 });
193
194 defineColumn(col_date =
195 new Column(this, "date",
196 new DatePoemType(true),
197 DefinitionSource.dsd) {
198 public Object getCooked(Persistent g)
199 throws AccessPoemException, PoemException {
200 return ((StockTransaction)g).getDate();
201 }
202
203 public void setCooked(Persistent g, Object cooked)
204 throws AccessPoemException, ValidationPoemException {
205 ((StockTransaction)g).setDate((Date)cooked);
206 }
207
208 public Field asField(Persistent g) {
209 return ((StockTransaction)g).getDateField();
210 }
211
212 protected DisplayLevel defaultDisplayLevel() {
213 return DisplayLevel.summary;
214 }
215
216 protected Searchability defaultSearchability() {
217 return Searchability.yes;
218 }
219
220 protected Integer defaultDisplayOrderPriority() {
221 return new Integer(0);
222 }
223
224 protected boolean defaultSortDescending() {
225 return true;
226 }
227
228 protected String defaultDisplayName() {
229 return "Date";
230 }
231
232 protected int defaultDisplayOrder() {
233 return 2;
234 }
235
236 protected String defaultDescription() {
237 return "Leave blank for today's date";
238 }
239
240 public Object getRaw_unsafe(Persistent g)
241 throws AccessPoemException {
242 return ((StockTransaction)g).getDate_unsafe();
243 }
244
245 public void setRaw_unsafe(Persistent g, Object raw)
246 throws AccessPoemException {
247 ((StockTransaction)g).setDate_unsafe((Date)raw);
248 }
249
250 public Object getRaw(Persistent g)
251 throws AccessPoemException {
252 return ((StockTransaction)g).getDate();
253 }
254
255 public void setRaw(Persistent g, Object raw)
256 throws AccessPoemException {
257 ((StockTransaction)g).setDate((Date)raw);
258 }
259 });
260
261 defineColumn(col_product =
262 new Column(this, "product",
263 new ReferencePoemType(getJammyjoesDatabaseTables().
264 getProductTable(), false),
265 DefinitionSource.dsd) {
266 public Object getCooked(Persistent g)
267 throws AccessPoemException, PoemException {
268 return ((StockTransaction)g).getProduct();
269 }
270
271 public void setCooked(Persistent g, Object cooked)
272 throws AccessPoemException, ValidationPoemException {
273 ((StockTransaction)g).setProduct((Product)cooked);
274 }
275
276 public Field asField(Persistent g) {
277 return ((StockTransaction)g).getProductField();
278 }
279
280 protected DisplayLevel defaultDisplayLevel() {
281 return DisplayLevel.summary;
282 }
283
284 protected Searchability defaultSearchability() {
285 return Searchability.yes;
286 }
287
288 protected Integer defaultDisplayOrderPriority() {
289 return new Integer(2);
290 }
291
292 protected int defaultDisplayOrder() {
293 return 3;
294 }
295
296 protected String defaultRenderinfo() {
297 return "SelectionWindow";
298 }
299
300 public Object getRaw_unsafe(Persistent g)
301 throws AccessPoemException {
302 return ((StockTransaction)g).getProduct_unsafe();
303 }
304
305 public void setRaw_unsafe(Persistent g, Object raw)
306 throws AccessPoemException {
307 ((StockTransaction)g).setProduct_unsafe((Integer)raw);
308 }
309
310 public Object getRaw(Persistent g)
311 throws AccessPoemException {
312 return ((StockTransaction)g).getProductTroid();
313 }
314
315 public void setRaw(Persistent g, Object raw)
316 throws AccessPoemException {
317 ((StockTransaction)g).setProductTroid((Integer)raw);
318 }
319 });
320
321 defineColumn(col_quantity =
322 new Column(this, "quantity",
323 new IntegerPoemType(false),
324 DefinitionSource.dsd) {
325 public Object getCooked(Persistent g)
326 throws AccessPoemException, PoemException {
327 return ((StockTransaction)g).getQuantity();
328 }
329
330 public void setCooked(Persistent g, Object cooked)
331 throws AccessPoemException, ValidationPoemException {
332 ((StockTransaction)g).setQuantity((Integer)cooked);
333 }
334
335 public Field asField(Persistent g) {
336 return ((StockTransaction)g).getQuantityField();
337 }
338
339 protected DisplayLevel defaultDisplayLevel() {
340 return DisplayLevel.summary;
341 }
342
343 protected Searchability defaultSearchability() {
344 return Searchability.no;
345 }
346
347 protected String defaultDisplayName() {
348 return "Quantity";
349 }
350
351 protected int defaultDisplayOrder() {
352 return 4;
353 }
354
355 public Object getRaw_unsafe(Persistent g)
356 throws AccessPoemException {
357 return ((StockTransaction)g).getQuantity_unsafe();
358 }
359
360 public void setRaw_unsafe(Persistent g, Object raw)
361 throws AccessPoemException {
362 ((StockTransaction)g).setQuantity_unsafe((Integer)raw);
363 }
364
365 public Object getRaw(Persistent g)
366 throws AccessPoemException {
367 return ((StockTransaction)g).getQuantity();
368 }
369
370 public void setRaw(Persistent g, Object raw)
371 throws AccessPoemException {
372 ((StockTransaction)g).setQuantity((Integer)raw);
373 }
374 });
375
376 defineColumn(col_costprice =
377 new Column(this, "costprice",
378 new DoublePoemType(true),
379 DefinitionSource.dsd) {
380 public Object getCooked(Persistent g)
381 throws AccessPoemException, PoemException {
382 return ((StockTransaction)g).getCostprice();
383 }
384
385 public void setCooked(Persistent g, Object cooked)
386 throws AccessPoemException, ValidationPoemException {
387 ((StockTransaction)g).setCostprice((Double)cooked);
388 }
389
390 public Field asField(Persistent g) {
391 return ((StockTransaction)g).getCostpriceField();
392 }
393
394 protected DisplayLevel defaultDisplayLevel() {
395 return DisplayLevel.record;
396 }
397
398 protected Searchability defaultSearchability() {
399 return Searchability.no;
400 }
401
402 protected String defaultDisplayName() {
403 return "Cost Price";
404 }
405
406 protected int defaultDisplayOrder() {
407 return 5;
408 }
409
410 protected String defaultDescription() {
411 return "Leave blank for purchases and stock ajustments";
412 }
413
414 public Object getRaw_unsafe(Persistent g)
415 throws AccessPoemException {
416 return ((StockTransaction)g).getCostprice_unsafe();
417 }
418
419 public void setRaw_unsafe(Persistent g, Object raw)
420 throws AccessPoemException {
421 ((StockTransaction)g).setCostprice_unsafe((Double)raw);
422 }
423
424 public Object getRaw(Persistent g)
425 throws AccessPoemException {
426 return ((StockTransaction)g).getCostprice();
427 }
428
429 public void setRaw(Persistent g, Object raw)
430 throws AccessPoemException {
431 ((StockTransaction)g).setCostprice((Double)raw);
432 }
433 });
434
435 defineColumn(col_retailpriceincvat =
436 new Column(this, "retailpriceincvat",
437 new DoublePoemType(true),
438 DefinitionSource.dsd) {
439 public Object getCooked(Persistent g)
440 throws AccessPoemException, PoemException {
441 return ((StockTransaction)g).getRetailpriceincvat();
442 }
443
444 public void setCooked(Persistent g, Object cooked)
445 throws AccessPoemException, ValidationPoemException {
446 ((StockTransaction)g).setRetailpriceincvat((Double)cooked);
447 }
448
449 public Field asField(Persistent g) {
450 return ((StockTransaction)g).getRetailpriceincvatField();
451 }
452
453 protected DisplayLevel defaultDisplayLevel() {
454 return DisplayLevel.record;
455 }
456
457 protected Searchability defaultSearchability() {
458 return Searchability.no;
459 }
460
461 protected String defaultDisplayName() {
462 return "Retail Price inc VAT (if VAT is payable)";
463 }
464
465 protected int defaultDisplayOrder() {
466 return 6;
467 }
468
469 protected String defaultDescription() {
470 return "Leave blank for purchases and stock ajustments";
471 }
472
473 public Object getRaw_unsafe(Persistent g)
474 throws AccessPoemException {
475 return ((StockTransaction)g).getRetailpriceincvat_unsafe();
476 }
477
478 public void setRaw_unsafe(Persistent g, Object raw)
479 throws AccessPoemException {
480 ((StockTransaction)g).setRetailpriceincvat_unsafe((Double)raw);
481 }
482
483 public Object getRaw(Persistent g)
484 throws AccessPoemException {
485 return ((StockTransaction)g).getRetailpriceincvat();
486 }
487
488 public void setRaw(Persistent g, Object raw)
489 throws AccessPoemException {
490 ((StockTransaction)g).setRetailpriceincvat((Double)raw);
491 }
492 });
493
494 defineColumn(col_vatexempt =
495 new Column(this, "vatexempt",
496 new BooleanPoemType(false),
497 DefinitionSource.dsd) {
498 public Object getCooked(Persistent g)
499 throws AccessPoemException, PoemException {
500 return ((StockTransaction)g).getVatexempt();
501 }
502
503 public void setCooked(Persistent g, Object cooked)
504 throws AccessPoemException, ValidationPoemException {
505 ((StockTransaction)g).setVatexempt((Boolean)cooked);
506 }
507
508 public Field asField(Persistent g) {
509 return ((StockTransaction)g).getVatexemptField();
510 }
511
512 protected DisplayLevel defaultDisplayLevel() {
513 return DisplayLevel.record;
514 }
515
516 protected Searchability defaultSearchability() {
517 return Searchability.yes;
518 }
519
520 protected String defaultDisplayName() {
521 return "Exempt from VAT?";
522 }
523
524 protected int defaultDisplayOrder() {
525 return 7;
526 }
527
528 protected String defaultDescription() {
529 return "Leave blank for purchases and stock ajustments";
530 }
531
532 public Object getRaw_unsafe(Persistent g)
533 throws AccessPoemException {
534 return ((StockTransaction)g).getVatexempt_unsafe();
535 }
536
537 public void setRaw_unsafe(Persistent g, Object raw)
538 throws AccessPoemException {
539 ((StockTransaction)g).setVatexempt_unsafe((Boolean)raw);
540 }
541
542 public Object getRaw(Persistent g)
543 throws AccessPoemException {
544 return ((StockTransaction)g).getVatexempt();
545 }
546
547 public void setRaw(Persistent g, Object raw)
548 throws AccessPoemException {
549 ((StockTransaction)g).setVatexempt((Boolean)raw);
550 }
551 });
552
553 defineColumn(col_comment =
554 new Column(this, "comment",
555 new StringPoemType(true, -1),
556 DefinitionSource.dsd) {
557 public Object getCooked(Persistent g)
558 throws AccessPoemException, PoemException {
559 return ((StockTransaction)g).getComment();
560 }
561
562 public void setCooked(Persistent g, Object cooked)
563 throws AccessPoemException, ValidationPoemException {
564 ((StockTransaction)g).setComment((String)cooked);
565 }
566
567 public Field asField(Persistent g) {
568 return ((StockTransaction)g).getCommentField();
569 }
570
571 protected DisplayLevel defaultDisplayLevel() {
572 return DisplayLevel.record;
573 }
574
575 protected Searchability defaultSearchability() {
576 return Searchability.no;
577 }
578
579 protected int defaultDisplayOrder() {
580 return 8;
581 }
582
583 protected String defaultDescription() {
584 return "Comment";
585 }
586
587 protected int defaultWidth() {
588 return 40;
589 }
590
591 protected int defaultHeight() {
592 return 3;
593 }
594
595 public Object getRaw_unsafe(Persistent g)
596 throws AccessPoemException {
597 return ((StockTransaction)g).getComment_unsafe();
598 }
599
600 public void setRaw_unsafe(Persistent g, Object raw)
601 throws AccessPoemException {
602 ((StockTransaction)g).setComment_unsafe((String)raw);
603 }
604
605 public Object getRaw(Persistent g)
606 throws AccessPoemException {
607 return ((StockTransaction)g).getComment();
608 }
609
610 public void setRaw(Persistent g, Object raw)
611 throws AccessPoemException {
612 ((StockTransaction)g).setComment((String)raw);
613 }
614 });
615 }
616
617
618 /**
619 * Retrieves the <code>Id</code> <code>Column</code> for this
620 * <code>StockTransaction</code> <code>Table</code>.
621 *
622 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
623 * @return the id <code>Column</code>
624 */
625 public final Column getIdColumn() {
626 return col_id;
627 }
628
629
630 /**
631 * Retrieves the <code>Type</code> <code>Column</code> for this
632 * <code>StockTransaction</code> <code>Table</code>.
633 *
634 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
635 * @return the type <code>Column</code>
636 */
637 public final Column getTypeColumn() {
638 return col_type;
639 }
640
641
642 /**
643 * Retrieves the <code>Date</code> <code>Column</code> for this
644 * <code>StockTransaction</code> <code>Table</code>.
645 *
646 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
647 * @return the date <code>Column</code>
648 */
649 public final Column getDateColumn() {
650 return col_date;
651 }
652
653
654 /**
655 * Retrieves the <code>Product</code> <code>Column</code> for this
656 * <code>StockTransaction</code> <code>Table</code>.
657 *
658 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
659 * @return the product <code>Column</code>
660 */
661 public final Column getProductColumn() {
662 return col_product;
663 }
664
665
666 /**
667 * Retrieves the <code>Quantity</code> <code>Column</code> for this
668 * <code>StockTransaction</code> <code>Table</code>.
669 *
670 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
671 * @return the quantity <code>Column</code>
672 */
673 public final Column getQuantityColumn() {
674 return col_quantity;
675 }
676
677
678 /**
679 * Retrieves the <code>Costprice</code> <code>Column</code> for this
680 * <code>StockTransaction</code> <code>Table</code>.
681 *
682 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
683 * @return the costprice <code>Column</code>
684 */
685 public final Column getCostpriceColumn() {
686 return col_costprice;
687 }
688
689
690 /**
691 * Retrieves the <code>Retailpriceincvat</code> <code>Column</code> for this
692 * <code>StockTransaction</code> <code>Table</code>.
693 *
694 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
695 * @return the retailpriceincvat <code>Column</code>
696 */
697 public final Column getRetailpriceincvatColumn() {
698 return col_retailpriceincvat;
699 }
700
701
702 /**
703 * Retrieves the <code>Vatexempt</code> <code>Column</code> for this
704 * <code>StockTransaction</code> <code>Table</code>.
705 *
706 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
707 * @return the vatexempt <code>Column</code>
708 */
709 public final Column getVatexemptColumn() {
710 return col_vatexempt;
711 }
712
713
714 /**
715 * Retrieves the <code>Comment</code> <code>Column</code> for this
716 * <code>StockTransaction</code> <code>Table</code>.
717 *
718 * @generator org.melati.poem.prepro.FieldDef#generateColAccessor
719 * @return the comment <code>Column</code>
720 */
721 public final Column getCommentColumn() {
722 return col_comment;
723 }
724
725
726 /**
727 * Retrieve the <code>StockTransaction</code> as a <code>StockTransaction</code>.
728 *
729 * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava
730 * @param troid a Table Row Oject ID
731 * @return the <code>Persistent</code> identified by the <code>troid</code>
732 */
733 public StockTransaction getStockTransactionObject(Integer troid) {
734 return (StockTransaction)getObject(troid);
735 }
736
737
738 /**
739 * Retrieve the <code>StockTransaction</code>
740 * as a <code>StockTransaction</code>.
741 *
742 * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava
743 * @param troid a Table Row Object ID
744 * @return the <code>Persistent</code> identified */
745 public StockTransaction getStockTransactionObject(int troid) {
746 return (StockTransaction)getObject(troid);
747 }
748
749 protected JdbcPersistent _newPersistent() {
750 return new StockTransaction();
751 }
752 protected String defaultDisplayName() {
753 return "Stock Transaction";
754 }
755
756 protected String defaultDescription() {
757 return "Stock Transaction";
758 }
759
760 protected boolean defaultRememberAllTroids() {
761 return true;
762 }
763
764 protected String defaultCategory() {
765 return "Data";
766 }
767
768 protected int defaultDisplayOrder() {
769 return 40;
770 }
771 }
772