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 java.sql.Timestamp;
6   import org.melati.poem.AccessPoemException;
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.DoublePoemType;
12  import org.melati.poem.Field;
13  import org.melati.poem.IntegerPoemType;
14  import org.melati.poem.JdbcPersistent;
15  import org.melati.poem.Persistent;
16  import org.melati.poem.PoemException;
17  import org.melati.poem.Searchability;
18  import org.melati.poem.StringPoemType;
19  import org.melati.poem.TimestampPoemType;
20  import org.melati.poem.TroidPoemType;
21  import org.melati.poem.ValidationPoemException;
22  import org.paneris.jammyjoes.model.Affiliate;
23  import org.paneris.jammyjoes.model.JammyjoesDatabaseTables;
24  import org.paneris.jammyjoes.model.JammyjoesTable;
25  
26  
27  /**
28   * Melati POEM generated base class for 
29  <code>Table</code> <code>Affiliate</code>.
30   *
31   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
32   */
33  
34  public class AffiliateTableBase extends JammyjoesTable {
35  
36    private Column col_id = null;
37    private Column col_company = null;
38    private Column col_payee = null;
39    private Column col_percentage = null;
40    private Column col_cookiedays = null;
41    private Column col_registration = null;
42  
43   /**
44    * Constructor. 
45    * 
46    * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
47    * @param database          the POEM database we are using
48    * @param name              the name of this <code>Table</code>
49    * @param definitionSource  which definition is being used
50    * @throws PoemException    if anything goes wrong
51    */
52  
53    public AffiliateTableBase(
54        Database database, String name,
55        DefinitionSource definitionSource) throws PoemException {
56      super(database, name, definitionSource);
57    }
58  
59  
60   /**
61    * Get the database tables.
62    *
63    * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
64    * @return the database tables
65    */
66    public JammyjoesDatabaseTables getJammyjoesDatabaseTables() {
67      return (JammyjoesDatabaseTables)getDatabase();
68    }
69  
70    public void init() throws PoemException {
71      super.init();
72      defineColumn(col_id =
73          new Column(this, "id",
74                     new TroidPoemType(),
75                     DefinitionSource.dsd) { 
76            public Object getCooked(Persistent g)
77                throws AccessPoemException, PoemException {
78              return ((Affiliate)g).getId();
79            }
80  
81            public void setCooked(Persistent g, Object cooked)
82                throws AccessPoemException, ValidationPoemException {
83              ((Affiliate)g).setId((Integer)cooked);
84            }
85  
86            public Field asField(Persistent g) {
87              return ((Affiliate)g).getIdField();
88            }
89  
90            protected boolean defaultUserEditable() {
91              return false;
92            }
93  
94            protected boolean defaultUserCreateable() {
95              return false;
96            }
97  
98            protected DisplayLevel defaultDisplayLevel() {
99              return DisplayLevel.record;
100           }
101 
102           protected Searchability defaultSearchability() {
103             return Searchability.no;
104           }
105 
106           protected int defaultDisplayOrder() {
107             return 0;
108           }
109 
110           public Object getRaw_unsafe(Persistent g)
111               throws AccessPoemException {
112             return ((Affiliate)g).getId_unsafe();
113           }
114 
115           public void setRaw_unsafe(Persistent g, Object raw)
116               throws AccessPoemException {
117             ((Affiliate)g).setId_unsafe((Integer)raw);
118           }
119 
120           public Object getRaw(Persistent g)
121               throws AccessPoemException {
122             return ((Affiliate)g).getId();
123           }
124 
125           public void setRaw(Persistent g, Object raw)
126               throws AccessPoemException {
127             ((Affiliate)g).setId((Integer)raw);
128           }
129         });
130 
131     defineColumn(col_company =
132         new Column(this, "company",
133                    new StringPoemType(false, -1),
134                    DefinitionSource.dsd) { 
135           public Object getCooked(Persistent g)
136               throws AccessPoemException, PoemException {
137             return ((Affiliate)g).getCompany();
138           }
139 
140           public void setCooked(Persistent g, Object cooked)
141               throws AccessPoemException, ValidationPoemException {
142             ((Affiliate)g).setCompany((String)cooked);
143           }
144 
145           public Field asField(Persistent g) {
146             return ((Affiliate)g).getCompanyField();
147           }
148 
149           protected DisplayLevel defaultDisplayLevel() {
150             return DisplayLevel.primary;
151           }
152 
153           protected Searchability defaultSearchability() {
154             return Searchability.yes;
155           }
156 
157           protected String defaultDisplayName() {
158             return "Company";
159           }
160 
161           protected int defaultDisplayOrder() {
162             return 1;
163           }
164 
165           protected String defaultDescription() {
166             return "The Affiliate's Company Name";
167           }
168 
169           protected boolean defaultUnique() {
170             return true;
171           }
172 
173           protected int defaultWidth() {
174             return 40;
175           }
176 
177           public Object getRaw_unsafe(Persistent g)
178               throws AccessPoemException {
179             return ((Affiliate)g).getCompany_unsafe();
180           }
181 
182           public void setRaw_unsafe(Persistent g, Object raw)
183               throws AccessPoemException {
184             ((Affiliate)g).setCompany_unsafe((String)raw);
185           }
186 
187           public Object getRaw(Persistent g)
188               throws AccessPoemException {
189             return ((Affiliate)g).getCompany();
190           }
191 
192           public void setRaw(Persistent g, Object raw)
193               throws AccessPoemException {
194             ((Affiliate)g).setCompany((String)raw);
195           }
196         });
197 
198     defineColumn(col_payee =
199         new Column(this, "payee",
200                    new StringPoemType(false, -1),
201                    DefinitionSource.dsd) { 
202           public Object getCooked(Persistent g)
203               throws AccessPoemException, PoemException {
204             return ((Affiliate)g).getPayee();
205           }
206 
207           public void setCooked(Persistent g, Object cooked)
208               throws AccessPoemException, ValidationPoemException {
209             ((Affiliate)g).setPayee((String)cooked);
210           }
211 
212           public Field asField(Persistent g) {
213             return ((Affiliate)g).getPayeeField();
214           }
215 
216           protected Searchability defaultSearchability() {
217             return Searchability.yes;
218           }
219 
220           protected String defaultDisplayName() {
221             return "Payee";
222           }
223 
224           protected int defaultDisplayOrder() {
225             return 2;
226           }
227 
228           protected String defaultDescription() {
229             return "The Payee (for cheques)";
230           }
231 
232           protected int defaultWidth() {
233             return 40;
234           }
235 
236           public Object getRaw_unsafe(Persistent g)
237               throws AccessPoemException {
238             return ((Affiliate)g).getPayee_unsafe();
239           }
240 
241           public void setRaw_unsafe(Persistent g, Object raw)
242               throws AccessPoemException {
243             ((Affiliate)g).setPayee_unsafe((String)raw);
244           }
245 
246           public Object getRaw(Persistent g)
247               throws AccessPoemException {
248             return ((Affiliate)g).getPayee();
249           }
250 
251           public void setRaw(Persistent g, Object raw)
252               throws AccessPoemException {
253             ((Affiliate)g).setPayee((String)raw);
254           }
255         });
256 
257     defineColumn(col_percentage =
258         new Column(this, "percentage",
259                    new DoublePoemType(false),
260                    DefinitionSource.dsd) { 
261           public Object getCooked(Persistent g)
262               throws AccessPoemException, PoemException {
263             return ((Affiliate)g).getPercentage();
264           }
265 
266           public void setCooked(Persistent g, Object cooked)
267               throws AccessPoemException, ValidationPoemException {
268             ((Affiliate)g).setPercentage((Double)cooked);
269           }
270 
271           public Field asField(Persistent g) {
272             return ((Affiliate)g).getPercentageField();
273           }
274 
275           protected DisplayLevel defaultDisplayLevel() {
276             return DisplayLevel.record;
277           }
278 
279           protected Searchability defaultSearchability() {
280             return Searchability.no;
281           }
282 
283           protected String defaultDisplayName() {
284             return "Percentage";
285           }
286 
287           protected int defaultDisplayOrder() {
288             return 3;
289           }
290 
291           protected String defaultDescription() {
292             return "The percentage of sales for this Affiliate";
293           }
294 
295           public Object getRaw_unsafe(Persistent g)
296               throws AccessPoemException {
297             return ((Affiliate)g).getPercentage_unsafe();
298           }
299 
300           public void setRaw_unsafe(Persistent g, Object raw)
301               throws AccessPoemException {
302             ((Affiliate)g).setPercentage_unsafe((Double)raw);
303           }
304 
305           public Object getRaw(Persistent g)
306               throws AccessPoemException {
307             return ((Affiliate)g).getPercentage();
308           }
309 
310           public void setRaw(Persistent g, Object raw)
311               throws AccessPoemException {
312             ((Affiliate)g).setPercentage((Double)raw);
313           }
314         });
315 
316     defineColumn(col_cookiedays =
317         new Column(this, "cookiedays",
318                    new IntegerPoemType(false),
319                    DefinitionSource.dsd) { 
320           public Object getCooked(Persistent g)
321               throws AccessPoemException, PoemException {
322             return ((Affiliate)g).getCookiedays();
323           }
324 
325           public void setCooked(Persistent g, Object cooked)
326               throws AccessPoemException, ValidationPoemException {
327             ((Affiliate)g).setCookiedays((Integer)cooked);
328           }
329 
330           public Field asField(Persistent g) {
331             return ((Affiliate)g).getCookiedaysField();
332           }
333 
334           protected DisplayLevel defaultDisplayLevel() {
335             return DisplayLevel.record;
336           }
337 
338           protected Searchability defaultSearchability() {
339             return Searchability.no;
340           }
341 
342           protected String defaultDisplayName() {
343             return "Cookie Days";
344           }
345 
346           protected int defaultDisplayOrder() {
347             return 4;
348           }
349 
350           protected String defaultDescription() {
351             return "The number of days to set a cookie for for this Affiliate";
352           }
353 
354           public Object getRaw_unsafe(Persistent g)
355               throws AccessPoemException {
356             return ((Affiliate)g).getCookiedays_unsafe();
357           }
358 
359           public void setRaw_unsafe(Persistent g, Object raw)
360               throws AccessPoemException {
361             ((Affiliate)g).setCookiedays_unsafe((Integer)raw);
362           }
363 
364           public Object getRaw(Persistent g)
365               throws AccessPoemException {
366             return ((Affiliate)g).getCookiedays();
367           }
368 
369           public void setRaw(Persistent g, Object raw)
370               throws AccessPoemException {
371             ((Affiliate)g).setCookiedays((Integer)raw);
372           }
373         });
374 
375     defineColumn(col_registration =
376         new Column(this, "registration",
377                    new TimestampPoemType(false),
378                    DefinitionSource.dsd) { 
379           public Object getCooked(Persistent g)
380               throws AccessPoemException, PoemException {
381             return ((Affiliate)g).getRegistration();
382           }
383 
384           public void setCooked(Persistent g, Object cooked)
385               throws AccessPoemException, ValidationPoemException {
386             ((Affiliate)g).setRegistration((Timestamp)cooked);
387           }
388 
389           public Field asField(Persistent g) {
390             return ((Affiliate)g).getRegistrationField();
391           }
392 
393           protected DisplayLevel defaultDisplayLevel() {
394             return DisplayLevel.record;
395           }
396 
397           protected String defaultDisplayName() {
398             return "Date of Registration";
399           }
400 
401           protected int defaultDisplayOrder() {
402             return 5;
403           }
404 
405           protected String defaultDescription() {
406             return "The date when this Affiliate Registered";
407           }
408 
409           public Object getRaw_unsafe(Persistent g)
410               throws AccessPoemException {
411             return ((Affiliate)g).getRegistration_unsafe();
412           }
413 
414           public void setRaw_unsafe(Persistent g, Object raw)
415               throws AccessPoemException {
416             ((Affiliate)g).setRegistration_unsafe((Timestamp)raw);
417           }
418 
419           public Object getRaw(Persistent g)
420               throws AccessPoemException {
421             return ((Affiliate)g).getRegistration();
422           }
423 
424           public void setRaw(Persistent g, Object raw)
425               throws AccessPoemException {
426             ((Affiliate)g).setRegistration((Timestamp)raw);
427           }
428         });
429   }
430 
431 
432  /**
433   * Retrieves the <code>Id</code> <code>Column</code> for this 
434   * <code>Affiliate</code> <code>Table</code>.
435   * 
436   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
437   * @return the id <code>Column</code>
438   */
439   public final Column getIdColumn() {
440     return col_id;
441   }
442 
443 
444  /**
445   * Retrieves the <code>Company</code> <code>Column</code> for this 
446   * <code>Affiliate</code> <code>Table</code>.
447   * 
448   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
449   * @return the company <code>Column</code>
450   */
451   public final Column getCompanyColumn() {
452     return col_company;
453   }
454 
455 
456  /**
457   * Retrieves the <code>Payee</code> <code>Column</code> for this 
458   * <code>Affiliate</code> <code>Table</code>.
459   * 
460   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
461   * @return the payee <code>Column</code>
462   */
463   public final Column getPayeeColumn() {
464     return col_payee;
465   }
466 
467 
468  /**
469   * Retrieves the <code>Percentage</code> <code>Column</code> for this 
470   * <code>Affiliate</code> <code>Table</code>.
471   * 
472   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
473   * @return the percentage <code>Column</code>
474   */
475   public final Column getPercentageColumn() {
476     return col_percentage;
477   }
478 
479 
480  /**
481   * Retrieves the <code>Cookiedays</code> <code>Column</code> for this 
482   * <code>Affiliate</code> <code>Table</code>.
483   * 
484   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
485   * @return the cookiedays <code>Column</code>
486   */
487   public final Column getCookiedaysColumn() {
488     return col_cookiedays;
489   }
490 
491 
492  /**
493   * Retrieves the <code>Registration</code> <code>Column</code> for this 
494   * <code>Affiliate</code> <code>Table</code>.
495   * 
496   * @generator org.melati.poem.prepro.FieldDef#generateColAccessor 
497   * @return the registration <code>Column</code>
498   */
499   public final Column getRegistrationColumn() {
500     return col_registration;
501   }
502 
503 
504  /**
505   * Retrieve the <code>Affiliate</code> as a <code>Affiliate</code>.
506   *
507   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
508   * @param troid a Table Row Oject ID
509   * @return the <code>Persistent</code> identified by the <code>troid</code>
510   */
511   public Affiliate getAffiliateObject(Integer troid) {
512     return (Affiliate)getObject(troid);
513   }
514 
515 
516  /**
517   * Retrieve the <code>Affiliate</code> 
518   * as a <code>Affiliate</code>.
519   *
520   * @generator org.melati.poem.prepro.TableDef#generateTableBaseJava 
521   * @param troid a Table Row Object ID
522   * @return the <code>Persistent</code> identified   */
523   public Affiliate getAffiliateObject(int troid) {
524     return (Affiliate)getObject(troid);
525   }
526 
527   protected JdbcPersistent _newPersistent() {
528     return new Affiliate();
529   }
530   protected String defaultDisplayName() {
531     return "Affiliate";
532   }
533 
534   protected String defaultDescription() {
535     return "A JammyJoes Affiliate";
536   }
537 
538   protected boolean defaultRememberAllTroids() {
539     return true;
540   }
541 
542   protected String defaultCategory() {
543     return "Data";
544   }
545 
546   protected int defaultDisplayOrder() {
547     return 80;
548   }
549 }
550