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.BooleanPoemType;
7   import org.melati.poem.Column;
8   import org.melati.poem.Database;
9   import org.melati.poem.DefinitionSource;
10  import org.melati.poem.DisplayLevel;
11  import org.melati.poem.Field;
12  import org.melati.poem.JdbcPersistent;
13  import org.melati.poem.Persistent;
14  import org.melati.poem.PoemException;
15  import org.melati.poem.ReferencePoemType;
16  import org.melati.poem.Searchability;
17  import org.melati.poem.StringPoemType;
18  import org.melati.poem.UserTable;
19  import org.melati.poem.ValidationPoemException;
20  import org.paneris.jammyjoes.model.Affiliate;
21  import org.paneris.jammyjoes.model.DeliveryZone;
22  import org.paneris.jammyjoes.model.JammyjoesDatabaseTables;
23  import org.paneris.jammyjoes.model.ShopCurrency;
24  import org.paneris.jammyjoes.model.User;
25  
26  
27  /**
28   * Melati POEM generated base class for 
29  <code>Table</code> <code>User</code>.
30   *
31   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
32   */
33  
34  public class UserTableBase extends UserTable {
35  
36    private Column col_email = null;
37    private Column col_address = null;
38    private Column col_town = null;
39    private Column col_tel = null;
40    private Column col_postcode = null;
41    private Column col_country = null;
42    private Column col_currency = null;
43    private Column col_zone = null;
44    private Column col_affiliate = null;
45    private Column col_spam = 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 UserTableBase(
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_email =
77          new Column(this, "email",
78                     new StringPoemType(true, -1),
79                     DefinitionSource.dsd) { 
80            public Object getCooked(Persistent g)
81                throws AccessPoemException, PoemException {
82              return ((User)g).getEmail();
83            }
84  
85            public void setCooked(Persistent g, Object cooked)
86                throws AccessPoemException, ValidationPoemException {
87              ((User)g).setEmail((String)cooked);
88            }
89  
90            public Field asField(Persistent g) {
91              return ((User)g).getEmailField();
92            }
93  
94            protected DisplayLevel defaultDisplayLevel() {
95              return DisplayLevel.record;
96            }
97  
98            protected Searchability defaultSearchability() {
99              return Searchability.yes;
100           }
101 
102           protected int defaultDisplayOrder() {
103             return 100;
104           }
105 
106           protected String defaultDescription() {
107             return "The user's email address";
108           }
109 
110           public Object getRaw_unsafe(Persistent g)
111               throws AccessPoemException {
112             return ((User)g).getEmail_unsafe();
113           }
114 
115           public void setRaw_unsafe(Persistent g, Object raw)
116               throws AccessPoemException {
117             ((User)g).setEmail_unsafe((String)raw);
118           }
119 
120           public Object getRaw(Persistent g)
121               throws AccessPoemException {
122             return ((User)g).getEmail();
123           }
124 
125           public void setRaw(Persistent g, Object raw)
126               throws AccessPoemException {
127             ((User)g).setEmail((String)raw);
128           }
129         });
130 
131     defineColumn(col_address =
132         new Column(this, "address",
133                    new StringPoemType(true, -1),
134                    DefinitionSource.dsd) { 
135           public Object getCooked(Persistent g)
136               throws AccessPoemException, PoemException {
137             return ((User)g).getAddress();
138           }
139 
140           public void setCooked(Persistent g, Object cooked)
141               throws AccessPoemException, ValidationPoemException {
142             ((User)g).setAddress((String)cooked);
143           }
144 
145           public Field asField(Persistent g) {
146             return ((User)g).getAddressField();
147           }
148 
149           protected DisplayLevel defaultDisplayLevel() {
150             return DisplayLevel.record;
151           }
152 
153           protected String defaultDisplayName() {
154             return "Address";
155           }
156 
157           protected int defaultDisplayOrder() {
158             return 101;
159           }
160 
161           protected int defaultWidth() {
162             return 30;
163           }
164 
165           protected int defaultHeight() {
166             return 4;
167           }
168 
169           public Object getRaw_unsafe(Persistent g)
170               throws AccessPoemException {
171             return ((User)g).getAddress_unsafe();
172           }
173 
174           public void setRaw_unsafe(Persistent g, Object raw)
175               throws AccessPoemException {
176             ((User)g).setAddress_unsafe((String)raw);
177           }
178 
179           public Object getRaw(Persistent g)
180               throws AccessPoemException {
181             return ((User)g).getAddress();
182           }
183 
184           public void setRaw(Persistent g, Object raw)
185               throws AccessPoemException {
186             ((User)g).setAddress((String)raw);
187           }
188         });
189 
190     defineColumn(col_town =
191         new Column(this, "town",
192                    new StringPoemType(true, -1),
193                    DefinitionSource.dsd) { 
194           public Object getCooked(Persistent g)
195               throws AccessPoemException, PoemException {
196             return ((User)g).getTown();
197           }
198 
199           public void setCooked(Persistent g, Object cooked)
200               throws AccessPoemException, ValidationPoemException {
201             ((User)g).setTown((String)cooked);
202           }
203 
204           public Field asField(Persistent g) {
205             return ((User)g).getTownField();
206           }
207 
208           protected DisplayLevel defaultDisplayLevel() {
209             return DisplayLevel.record;
210           }
211 
212           protected String defaultDisplayName() {
213             return "Town / City";
214           }
215 
216           protected int defaultDisplayOrder() {
217             return 102;
218           }
219 
220           protected int defaultWidth() {
221             return 30;
222           }
223 
224           public Object getRaw_unsafe(Persistent g)
225               throws AccessPoemException {
226             return ((User)g).getTown_unsafe();
227           }
228 
229           public void setRaw_unsafe(Persistent g, Object raw)
230               throws AccessPoemException {
231             ((User)g).setTown_unsafe((String)raw);
232           }
233 
234           public Object getRaw(Persistent g)
235               throws AccessPoemException {
236             return ((User)g).getTown();
237           }
238 
239           public void setRaw(Persistent g, Object raw)
240               throws AccessPoemException {
241             ((User)g).setTown((String)raw);
242           }
243         });
244 
245     defineColumn(col_tel =
246         new Column(this, "tel",
247                    new StringPoemType(true, -1),
248                    DefinitionSource.dsd) { 
249           public Object getCooked(Persistent g)
250               throws AccessPoemException, PoemException {
251             return ((User)g).getTel();
252           }
253 
254           public void setCooked(Persistent g, Object cooked)
255               throws AccessPoemException, ValidationPoemException {
256             ((User)g).setTel((String)cooked);
257           }
258 
259           public Field asField(Persistent g) {
260             return ((User)g).getTelField();
261           }
262 
263           protected DisplayLevel defaultDisplayLevel() {
264             return DisplayLevel.record;
265           }
266 
267           protected String defaultDisplayName() {
268             return "Telephone";
269           }
270 
271           protected int defaultDisplayOrder() {
272             return 103;
273           }
274 
275           protected String defaultDescription() {
276             return "Order telephone number";
277           }
278 
279           public Object getRaw_unsafe(Persistent g)
280               throws AccessPoemException {
281             return ((User)g).getTel_unsafe();
282           }
283 
284           public void setRaw_unsafe(Persistent g, Object raw)
285               throws AccessPoemException {
286             ((User)g).setTel_unsafe((String)raw);
287           }
288 
289           public Object getRaw(Persistent g)
290               throws AccessPoemException {
291             return ((User)g).getTel();
292           }
293 
294           public void setRaw(Persistent g, Object raw)
295               throws AccessPoemException {
296             ((User)g).setTel((String)raw);
297           }
298         });
299 
300     defineColumn(col_postcode =
301         new Column(this, "postcode",
302                    new StringPoemType(true, -1),
303                    DefinitionSource.dsd) { 
304           public Object getCooked(Persistent g)
305               throws AccessPoemException, PoemException {
306             return ((User)g).getPostcode();
307           }
308 
309           public void setCooked(Persistent g, Object cooked)
310               throws AccessPoemException, ValidationPoemException {
311             ((User)g).setPostcode((String)cooked);
312           }
313 
314           public Field asField(Persistent g) {
315             return ((User)g).getPostcodeField();
316           }
317 
318           protected DisplayLevel defaultDisplayLevel() {
319             return DisplayLevel.record;
320           }
321 
322           protected String defaultDisplayName() {
323             return "Postcode";
324           }
325 
326           protected int defaultDisplayOrder() {
327             return 104;
328           }
329 
330           protected String defaultDescription() {
331             return "Order postcode";
332           }
333 
334           public Object getRaw_unsafe(Persistent g)
335               throws AccessPoemException {
336             return ((User)g).getPostcode_unsafe();
337           }
338 
339           public void setRaw_unsafe(Persistent g, Object raw)
340               throws AccessPoemException {
341             ((User)g).setPostcode_unsafe((String)raw);
342           }
343 
344           public Object getRaw(Persistent g)
345               throws AccessPoemException {
346             return ((User)g).getPostcode();
347           }
348 
349           public void setRaw(Persistent g, Object raw)
350               throws AccessPoemException {
351             ((User)g).setPostcode((String)raw);
352           }
353         });
354 
355     defineColumn(col_country =
356         new Column(this, "country",
357                    new StringPoemType(true, -1),
358                    DefinitionSource.dsd) { 
359           public Object getCooked(Persistent g)
360               throws AccessPoemException, PoemException {
361             return ((User)g).getCountry();
362           }
363 
364           public void setCooked(Persistent g, Object cooked)
365               throws AccessPoemException, ValidationPoemException {
366             ((User)g).setCountry((String)cooked);
367           }
368 
369           public Field asField(Persistent g) {
370             return ((User)g).getCountryField();
371           }
372 
373           protected DisplayLevel defaultDisplayLevel() {
374             return DisplayLevel.record;
375           }
376 
377           protected Searchability defaultSearchability() {
378             return Searchability.yes;
379           }
380 
381           protected String defaultDisplayName() {
382             return "Country";
383           }
384 
385           protected int defaultDisplayOrder() {
386             return 105;
387           }
388 
389           public Object getRaw_unsafe(Persistent g)
390               throws AccessPoemException {
391             return ((User)g).getCountry_unsafe();
392           }
393 
394           public void setRaw_unsafe(Persistent g, Object raw)
395               throws AccessPoemException {
396             ((User)g).setCountry_unsafe((String)raw);
397           }
398 
399           public Object getRaw(Persistent g)
400               throws AccessPoemException {
401             return ((User)g).getCountry();
402           }
403 
404           public void setRaw(Persistent g, Object raw)
405               throws AccessPoemException {
406             ((User)g).setCountry((String)raw);
407           }
408         });
409 
410     defineColumn(col_currency =
411         new Column(this, "currency",
412                    new ReferencePoemType(getJammyjoesDatabaseTables().
413                                              getShopCurrencyTable(), true),
414                    DefinitionSource.dsd) { 
415           public Object getCooked(Persistent g)
416               throws AccessPoemException, PoemException {
417             return ((User)g).getCurrency();
418           }
419 
420           public void setCooked(Persistent g, Object cooked)
421               throws AccessPoemException, ValidationPoemException {
422             ((User)g).setCurrency((ShopCurrency)cooked);
423           }
424 
425           public Field asField(Persistent g) {
426             return ((User)g).getCurrencyField();
427           }
428 
429           protected DisplayLevel defaultDisplayLevel() {
430             return DisplayLevel.record;
431           }
432 
433           protected int defaultDisplayOrder() {
434             return 106;
435           }
436 
437           protected String defaultDescription() {
438             return "The detault currency for this user";
439           }
440 
441           public Object getRaw_unsafe(Persistent g)
442               throws AccessPoemException {
443             return ((User)g).getCurrency_unsafe();
444           }
445 
446           public void setRaw_unsafe(Persistent g, Object raw)
447               throws AccessPoemException {
448             ((User)g).setCurrency_unsafe((Integer)raw);
449           }
450 
451           public Object getRaw(Persistent g)
452               throws AccessPoemException {
453             return ((User)g).getCurrencyTroid();
454           }
455 
456           public void setRaw(Persistent g, Object raw)
457               throws AccessPoemException {
458             ((User)g).setCurrencyTroid((Integer)raw);
459           }
460         });
461 
462     defineColumn(col_zone =
463         new Column(this, "zone",
464                    new ReferencePoemType(getJammyjoesDatabaseTables().
465                                              getDeliveryZoneTable(), true),
466                    DefinitionSource.dsd) { 
467           public Object getCooked(Persistent g)
468               throws AccessPoemException, PoemException {
469             return ((User)g).getZone();
470           }
471 
472           public void setCooked(Persistent g, Object cooked)
473               throws AccessPoemException, ValidationPoemException {
474             ((User)g).setZone((DeliveryZone)cooked);
475           }
476 
477           public Field asField(Persistent g) {
478             return ((User)g).getZoneField();
479           }
480 
481           protected DisplayLevel defaultDisplayLevel() {
482             return DisplayLevel.record;
483           }
484 
485           protected int defaultDisplayOrder() {
486             return 107;
487           }
488 
489           protected String defaultDescription() {
490             return "The delivery zone for this customer";
491           }
492 
493           public Object getRaw_unsafe(Persistent g)
494               throws AccessPoemException {
495             return ((User)g).getZone_unsafe();
496           }
497 
498           public void setRaw_unsafe(Persistent g, Object raw)
499               throws AccessPoemException {
500             ((User)g).setZone_unsafe((Integer)raw);
501           }
502 
503           public Object getRaw(Persistent g)
504               throws AccessPoemException {
505             return ((User)g).getZoneTroid();
506           }
507 
508           public void setRaw(Persistent g, Object raw)
509               throws AccessPoemException {
510             ((User)g).setZoneTroid((Integer)raw);
511           }
512         });
513 
514     defineColumn(col_affiliate =
515         new Column(this, "affiliate",
516                    new ReferencePoemType(getJammyjoesDatabaseTables().
517                                              getAffiliateTable(), true),
518                    DefinitionSource.dsd) { 
519           public Object getCooked(Persistent g)
520               throws AccessPoemException, PoemException {
521             return ((User)g).getAffiliate();
522           }
523 
524           public void setCooked(Persistent g, Object cooked)
525               throws AccessPoemException, ValidationPoemException {
526             ((User)g).setAffiliate((Affiliate)cooked);
527           }
528 
529           public Field asField(Persistent g) {
530             return ((User)g).getAffiliateField();
531           }
532 
533           protected DisplayLevel defaultDisplayLevel() {
534             return DisplayLevel.record;
535           }
536 
537           protected Searchability defaultSearchability() {
538             return Searchability.yes;
539           }
540 
541           protected int defaultDisplayOrder() {
542             return 108;
543           }
544 
545           protected String defaultDescription() {
546             return "The affiliate (if this user represents an affiliate)";
547           }
548 
549           public Object getRaw_unsafe(Persistent g)
550               throws AccessPoemException {
551             return ((User)g).getAffiliate_unsafe();
552           }
553 
554           public void setRaw_unsafe(Persistent g, Object raw)
555               throws AccessPoemException {
556             ((User)g).setAffiliate_unsafe((Integer)raw);
557           }
558 
559           public Object getRaw(Persistent g)
560               throws AccessPoemException {
561             return ((User)g).getAffiliateTroid();
562           }
563 
564           public void setRaw(Persistent g, Object raw)
565               throws AccessPoemException {
566             ((User)g).setAffiliateTroid((Integer)raw);
567           }
568         });
569 
570     defineColumn(col_spam =
571         new Column(this, "spam",
572                    new BooleanPoemType(true),
573                    DefinitionSource.dsd) { 
574           public Object getCooked(Persistent g)
575               throws AccessPoemException, PoemException {
576             return ((User)g).getSpam();
577           }
578 
579           public void setCooked(Persistent g, Object cooked)
580               throws AccessPoemException, ValidationPoemException {
581             ((User)g).setSpam((Boolean)cooked);
582           }
583 
584           public Field asField(Persistent g) {
585             return ((User)g).getSpamField();
586           }
587 
588           protected DisplayLevel defaultDisplayLevel() {
589             return DisplayLevel.record;
590           }
591 
592           protected Searchability defaultSearchability() {
593             return Searchability.no;
594           }
595 
596           protected String defaultDisplayName() {
597             return "Want Spam?";
598           }
599 
600           protected int defaultDisplayOrder() {
601             return 109;
602           }
603 
604           protected String defaultDescription() {
605             return "Does the user want to receive spam email?";
606           }
607 
608           public Object getRaw_unsafe(Persistent g)
609               throws AccessPoemException {
610             return ((User)g).getSpam_unsafe();
611           }
612 
613           public void setRaw_unsafe(Persistent g, Object raw)
614               throws AccessPoemException {
615             ((User)g).setSpam_unsafe((Boolean)raw);
616           }
617 
618           public Object getRaw(Persistent g)
619               throws AccessPoemException {
620             return ((User)g).getSpam();
621           }
622 
623           public void setRaw(Persistent g, Object raw)
624               throws AccessPoemException {
625             ((User)g).setSpam((Boolean)raw);
626           }
627         });
628   }
629 
630 
631  /**
632   * Retrieves the <code>Email</code> <code>Column</code> for this 
633   * <code>User</code> <code>Table</code>.
634   * 
635   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
636   * @return the email <code>Column</code>
637   */
638   public final Column getEmailColumn() {
639     return col_email;
640   }
641 
642 
643  /**
644   * Retrieves the <code>Address</code> <code>Column</code> for this 
645   * <code>User</code> <code>Table</code>.
646   * 
647   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
648   * @return the address <code>Column</code>
649   */
650   public final Column getAddressColumn() {
651     return col_address;
652   }
653 
654 
655  /**
656   * Retrieves the <code>Town</code> <code>Column</code> for this 
657   * <code>User</code> <code>Table</code>.
658   * 
659   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
660   * @return the town <code>Column</code>
661   */
662   public final Column getTownColumn() {
663     return col_town;
664   }
665 
666 
667  /**
668   * Retrieves the <code>Tel</code> <code>Column</code> for this 
669   * <code>User</code> <code>Table</code>.
670   * 
671   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
672   * @return the tel <code>Column</code>
673   */
674   public final Column getTelColumn() {
675     return col_tel;
676   }
677 
678 
679  /**
680   * Retrieves the <code>Postcode</code> <code>Column</code> for this 
681   * <code>User</code> <code>Table</code>.
682   * 
683   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
684   * @return the postcode <code>Column</code>
685   */
686   public final Column getPostcodeColumn() {
687     return col_postcode;
688   }
689 
690 
691  /**
692   * Retrieves the <code>Country</code> <code>Column</code> for this 
693   * <code>User</code> <code>Table</code>.
694   * 
695   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
696   * @return the country <code>Column</code>
697   */
698   public final Column getCountryColumn() {
699     return col_country;
700   }
701 
702 
703  /**
704   * Retrieves the <code>Currency</code> <code>Column</code> for this 
705   * <code>User</code> <code>Table</code>.
706   * 
707   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
708   * @return the currency <code>Column</code>
709   */
710   public final Column getCurrencyColumn() {
711     return col_currency;
712   }
713 
714 
715  /**
716   * Retrieves the <code>Zone</code> <code>Column</code> for this 
717   * <code>User</code> <code>Table</code>.
718   * 
719   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
720   * @return the zone <code>Column</code>
721   */
722   public final Column getZoneColumn() {
723     return col_zone;
724   }
725 
726 
727  /**
728   * Retrieves the <code>Affiliate</code> <code>Column</code> for this 
729   * <code>User</code> <code>Table</code>.
730   * 
731   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
732   * @return the affiliate <code>Column</code>
733   */
734   public final Column getAffiliateColumn() {
735     return col_affiliate;
736   }
737 
738 
739  /**
740   * Retrieves the <code>Spam</code> <code>Column</code> for this 
741   * <code>User</code> <code>Table</code>.
742   * 
743   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
744   * @return the spam <code>Column</code>
745   */
746   public final Column getSpamColumn() {
747     return col_spam;
748   }
749 
750 
751  /**
752   * Retrieve the <code>User</code> as a <code>org.melati.poem.User</code>.
753   *
754   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
755   * @param troid a Table Row Oject ID
756   * @return the <code>Persistent</code> identified by the <code>troid</code>
757   */
758   public org.melati.poem.User getUserObject(Integer troid) {
759     return (org.melati.poem.User)getObject(troid);
760   }
761 
762 
763  /**
764   * Retrieve the <code>User</code> 
765   * as a <code>org.melati.poem.User</code>.
766   *
767   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
768   * @param troid a Table Row Object ID
769   * @return the <code>Persistent</code> identified   */
770   public org.melati.poem.User getUserObject(int troid) {
771     return (org.melati.poem.User)getObject(troid);
772   }
773 
774   protected JdbcPersistent _newPersistent() {
775     return new User();
776   }
777   protected String defaultDescription() {
778     return "A JammyJoes User";
779   }
780 
781   protected String defaultCategory() {
782     return "User";
783   }
784 
785   protected int defaultDisplayOrder() {
786     return 2010;
787   }
788 }
789