View Javadoc

1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.paneris.bibliomania.generated;
4   
5   
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.Field;
12  import org.melati.poem.JdbcPersistent;
13  import org.melati.poem.Persistent;
14  import org.melati.poem.PoemException;
15  import org.melati.poem.Searchability;
16  import org.melati.poem.StringPoemType;
17  import org.melati.poem.TroidPoemType;
18  import org.melati.poem.ValidationPoemException;
19  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
20  import org.paneris.bibliomania.BibliomaniaTable;
21  import org.paneris.bibliomania.Publisher;
22  
23  
24  /**
25   * Melati POEM generated base class for <code>Table</code> <code>Publisher</code>.
26   *
27   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
28   */
29  
30  public class PublisherTableBase<T extends Publisher> extends BibliomaniaTable<T> {
31  
32    private Column<Integer> col_id = null;
33    private Column<String> col_name = null;
34    private Column<String> col_address = null;
35    private Column<String> col_contact = null;
36    private Column<String> col_email = null;
37    private Column<String> col_website = null;
38  
39   /**
40    * Constructor. 
41    * 
42    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
43    * @param database          the POEM database we are using
44    * @param name              the name of this <code>Table</code>
45    * @param definitionSource  which definition is being used
46    * @throws PoemException    if anything goes wrong
47    */
48  
49    public PublisherTableBase(
50        Database database, String name,
51        DefinitionSource definitionSource) throws PoemException {
52      super(database, name, definitionSource);
53    }
54  
55  
56   /**
57    * Get the database tables.
58    *
59    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
60    * @return the database tables
61    */
62    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
63      return (BibliomaniaDatabaseTables)getDatabase();
64    }
65  
66  
67   /**
68    * Initialise this table by defining its columns.
69    *
70    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
71    */
72    public void init() throws PoemException {
73      super.init();
74      defineColumn(col_id =
75          new Column<Integer>(this, "id",
76                     new TroidPoemType(),
77                     DefinitionSource.dsd) { 
78            public Object getCooked(Persistent g)
79                throws AccessPoemException, PoemException {
80              return ((Publisher)g).getId();
81            }
82  
83            public void setCooked(Persistent g, Object cooked)
84                throws AccessPoemException, ValidationPoemException {
85              ((Publisher)g).setId((Integer)cooked);
86            }
87  
88            public Field<Integer> asField(Persistent g) {
89              return ((Publisher)g).getIdField();
90            }
91  
92            public boolean defaultUserEditable() {
93              return false;
94            }
95  
96            public boolean defaultUserCreateable() {
97              return false;
98            }
99  
100           public DisplayLevel defaultDisplayLevel() {
101             return DisplayLevel.record;
102           }
103 
104           public Searchability defaultSearchability() {
105             return Searchability.no;
106           }
107 
108           public int defaultDisplayOrder() {
109             return 0;
110           }
111 
112           public Object getRaw_unsafe(Persistent g)
113               throws AccessPoemException {
114             return ((Publisher)g).getId_unsafe();
115           }
116 
117           public void setRaw_unsafe(Persistent g, Object raw)
118               throws AccessPoemException {
119             ((Publisher)g).setId_unsafe((Integer)raw);
120           }
121 
122           public Object getRaw(Persistent g)
123               throws AccessPoemException {
124             return ((Publisher)g).getId();
125           }
126 
127           public void setRaw(Persistent g, Object raw)
128               throws AccessPoemException {
129             ((Publisher)g).setId((Integer)raw);
130           }
131         });
132 
133     defineColumn(col_name =
134         new Column<String>(this, "name",
135                    new StringPoemType(false, -1),
136                    DefinitionSource.dsd) { 
137           public Object getCooked(Persistent g)
138               throws AccessPoemException, PoemException {
139             return ((Publisher)g).getName();
140           }
141 
142           public void setCooked(Persistent g, Object cooked)
143               throws AccessPoemException, ValidationPoemException {
144             ((Publisher)g).setName((String)cooked);
145           }
146 
147           public Field<String> asField(Persistent g) {
148             return ((Publisher)g).getNameField();
149           }
150 
151           public DisplayLevel defaultDisplayLevel() {
152             return DisplayLevel.primary;
153           }
154 
155           public Searchability defaultSearchability() {
156             return Searchability.yes;
157           }
158 
159           public String defaultDisplayName() {
160             return "Name";
161           }
162 
163           public int defaultDisplayOrder() {
164             return 1;
165           }
166 
167           public String defaultDescription() {
168             return "The full name of the Publisher";
169           }
170 
171           public boolean defaultUnique() {
172             return true;
173           }
174 
175           public int defaultWidth() {
176             return 20;
177           }
178 
179           public Object getRaw_unsafe(Persistent g)
180               throws AccessPoemException {
181             return ((Publisher)g).getName_unsafe();
182           }
183 
184           public void setRaw_unsafe(Persistent g, Object raw)
185               throws AccessPoemException {
186             ((Publisher)g).setName_unsafe((String)raw);
187           }
188 
189           public Object getRaw(Persistent g)
190               throws AccessPoemException {
191             return ((Publisher)g).getName();
192           }
193 
194           public void setRaw(Persistent g, Object raw)
195               throws AccessPoemException {
196             ((Publisher)g).setName((String)raw);
197           }
198         });
199 
200     defineColumn(col_address =
201         new Column<String>(this, "address",
202                    new StringPoemType(true, -1),
203                    DefinitionSource.dsd) { 
204           public Object getCooked(Persistent g)
205               throws AccessPoemException, PoemException {
206             return ((Publisher)g).getAddress();
207           }
208 
209           public void setCooked(Persistent g, Object cooked)
210               throws AccessPoemException, ValidationPoemException {
211             ((Publisher)g).setAddress((String)cooked);
212           }
213 
214           public Field<String> asField(Persistent g) {
215             return ((Publisher)g).getAddressField();
216           }
217 
218           public DisplayLevel defaultDisplayLevel() {
219             return DisplayLevel.record;
220           }
221 
222           public Searchability defaultSearchability() {
223             return Searchability.no;
224           }
225 
226           public String defaultDisplayName() {
227             return "Address";
228           }
229 
230           public int defaultDisplayOrder() {
231             return 2;
232           }
233 
234           public String defaultDescription() {
235             return "A postal address for the Publisher";
236           }
237 
238           public int defaultWidth() {
239             return 20;
240           }
241 
242           public int defaultHeight() {
243             return 5;
244           }
245 
246           public Object getRaw_unsafe(Persistent g)
247               throws AccessPoemException {
248             return ((Publisher)g).getAddress_unsafe();
249           }
250 
251           public void setRaw_unsafe(Persistent g, Object raw)
252               throws AccessPoemException {
253             ((Publisher)g).setAddress_unsafe((String)raw);
254           }
255 
256           public Object getRaw(Persistent g)
257               throws AccessPoemException {
258             return ((Publisher)g).getAddress();
259           }
260 
261           public void setRaw(Persistent g, Object raw)
262               throws AccessPoemException {
263             ((Publisher)g).setAddress((String)raw);
264           }
265         });
266 
267     defineColumn(col_contact =
268         new Column<String>(this, "contact",
269                    new StringPoemType(true, -1),
270                    DefinitionSource.dsd) { 
271           public Object getCooked(Persistent g)
272               throws AccessPoemException, PoemException {
273             return ((Publisher)g).getContact();
274           }
275 
276           public void setCooked(Persistent g, Object cooked)
277               throws AccessPoemException, ValidationPoemException {
278             ((Publisher)g).setContact((String)cooked);
279           }
280 
281           public Field<String> asField(Persistent g) {
282             return ((Publisher)g).getContactField();
283           }
284 
285           public DisplayLevel defaultDisplayLevel() {
286             return DisplayLevel.summary;
287           }
288 
289           public Searchability defaultSearchability() {
290             return Searchability.yes;
291           }
292 
293           public String defaultDisplayName() {
294             return "Contact Name";
295           }
296 
297           public int defaultDisplayOrder() {
298             return 3;
299           }
300 
301           public String defaultDescription() {
302             return "The person who will deal with queries";
303           }
304 
305           public boolean defaultUnique() {
306             return true;
307           }
308 
309           public int defaultWidth() {
310             return 20;
311           }
312 
313           public Object getRaw_unsafe(Persistent g)
314               throws AccessPoemException {
315             return ((Publisher)g).getContact_unsafe();
316           }
317 
318           public void setRaw_unsafe(Persistent g, Object raw)
319               throws AccessPoemException {
320             ((Publisher)g).setContact_unsafe((String)raw);
321           }
322 
323           public Object getRaw(Persistent g)
324               throws AccessPoemException {
325             return ((Publisher)g).getContact();
326           }
327 
328           public void setRaw(Persistent g, Object raw)
329               throws AccessPoemException {
330             ((Publisher)g).setContact((String)raw);
331           }
332         });
333 
334     defineColumn(col_email =
335         new Column<String>(this, "email",
336                    new StringPoemType(true, -1),
337                    DefinitionSource.dsd) { 
338           public Object getCooked(Persistent g)
339               throws AccessPoemException, PoemException {
340             return ((Publisher)g).getEmail();
341           }
342 
343           public void setCooked(Persistent g, Object cooked)
344               throws AccessPoemException, ValidationPoemException {
345             ((Publisher)g).setEmail((String)cooked);
346           }
347 
348           public Field<String> asField(Persistent g) {
349             return ((Publisher)g).getEmailField();
350           }
351 
352           public DisplayLevel defaultDisplayLevel() {
353             return DisplayLevel.record;
354           }
355 
356           public Searchability defaultSearchability() {
357             return Searchability.no;
358           }
359 
360           public int defaultDisplayOrder() {
361             return 4;
362           }
363 
364           public String defaultDescription() {
365             return "An email address used to contact this Publisher";
366           }
367 
368           public int defaultWidth() {
369             return 40;
370           }
371 
372           public Object getRaw_unsafe(Persistent g)
373               throws AccessPoemException {
374             return ((Publisher)g).getEmail_unsafe();
375           }
376 
377           public void setRaw_unsafe(Persistent g, Object raw)
378               throws AccessPoemException {
379             ((Publisher)g).setEmail_unsafe((String)raw);
380           }
381 
382           public Object getRaw(Persistent g)
383               throws AccessPoemException {
384             return ((Publisher)g).getEmail();
385           }
386 
387           public void setRaw(Persistent g, Object raw)
388               throws AccessPoemException {
389             ((Publisher)g).setEmail((String)raw);
390           }
391         });
392 
393     defineColumn(col_website =
394         new Column<String>(this, "website",
395                    new StringPoemType(true, -1),
396                    DefinitionSource.dsd) { 
397           public Object getCooked(Persistent g)
398               throws AccessPoemException, PoemException {
399             return ((Publisher)g).getWebsite();
400           }
401 
402           public void setCooked(Persistent g, Object cooked)
403               throws AccessPoemException, ValidationPoemException {
404             ((Publisher)g).setWebsite((String)cooked);
405           }
406 
407           public Field<String> asField(Persistent g) {
408             return ((Publisher)g).getWebsiteField();
409           }
410 
411           public DisplayLevel defaultDisplayLevel() {
412             return DisplayLevel.record;
413           }
414 
415           public Searchability defaultSearchability() {
416             return Searchability.no;
417           }
418 
419           public int defaultDisplayOrder() {
420             return 5;
421           }
422 
423           public String defaultDescription() {
424             return "The website for this Publisher, if they have one";
425           }
426 
427           public int defaultWidth() {
428             return 40;
429           }
430 
431           public Object getRaw_unsafe(Persistent g)
432               throws AccessPoemException {
433             return ((Publisher)g).getWebsite_unsafe();
434           }
435 
436           public void setRaw_unsafe(Persistent g, Object raw)
437               throws AccessPoemException {
438             ((Publisher)g).setWebsite_unsafe((String)raw);
439           }
440 
441           public Object getRaw(Persistent g)
442               throws AccessPoemException {
443             return ((Publisher)g).getWebsite();
444           }
445 
446           public void setRaw(Persistent g, Object raw)
447               throws AccessPoemException {
448             ((Publisher)g).setWebsite((String)raw);
449           }
450         });
451   }
452 
453 
454  /**
455   * Retrieves the <code>Id</code> <code>Column</code> for this 
456   * <code>Publisher</code> <code>Table</code>.
457   * 
458   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
459   * @return the id <code>Column</code>
460   */
461   public final Column<Integer> getIdColumn() {
462     return col_id;
463   }
464 
465 
466  /**
467   * Retrieves the <code>Name</code> <code>Column</code> for this 
468   * <code>Publisher</code> <code>Table</code>.
469   * 
470   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
471   * @return the name <code>Column</code>
472   */
473   public final Column<String> getNameColumn() {
474     return col_name;
475   }
476 
477 
478  /**
479   * Retrieves the <code>Address</code> <code>Column</code> for this 
480   * <code>Publisher</code> <code>Table</code>.
481   * 
482   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
483   * @return the address <code>Column</code>
484   */
485   public final Column<String> getAddressColumn() {
486     return col_address;
487   }
488 
489 
490  /**
491   * Retrieves the <code>Contact</code> <code>Column</code> for this 
492   * <code>Publisher</code> <code>Table</code>.
493   * 
494   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
495   * @return the contact <code>Column</code>
496   */
497   public final Column<String> getContactColumn() {
498     return col_contact;
499   }
500 
501 
502  /**
503   * Retrieves the <code>Email</code> <code>Column</code> for this 
504   * <code>Publisher</code> <code>Table</code>.
505   * 
506   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
507   * @return the email <code>Column</code>
508   */
509   public final Column<String> getEmailColumn() {
510     return col_email;
511   }
512 
513 
514  /**
515   * Retrieves the <code>Website</code> <code>Column</code> for this 
516   * <code>Publisher</code> <code>Table</code>.
517   * 
518   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
519   * @return the website <code>Column</code>
520   */
521   public final Column<String> getWebsiteColumn() {
522     return col_website;
523   }
524 
525 
526  /**
527   * Retrieve the <code>Publisher</code> as a <code>Publisher</code>.
528   *
529   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
530   * @param troid a Table Row Oject ID
531   * @return the <code>Persistent</code> identified by the <code>troid</code>
532   */
533   public Publisher getPublisherObject(Integer troid) {
534     return (Publisher)getObject(troid);
535   }
536 
537 
538  /**
539   * Retrieve the <code>Publisher</code> 
540   * as a <code>Publisher</code>.
541   *
542   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
543   * @param troid a Table Row Object ID
544   * @return the <code>Persistent</code> identified   */
545   public Publisher getPublisherObject(int troid) {
546     return (Publisher)getObject(troid);
547   }
548 
549   protected JdbcPersistent _newPersistent() {
550     return new Publisher();
551   }
552   public String defaultDisplayName() {
553     return "Publisher";
554   }
555 
556   public String defaultDescription() {
557     return "Product Publisher";
558   }
559 
560   public boolean defaultRememberAllTroids() {
561     return true;
562   }
563 
564   public String defaultCategory() {
565     return "Shop";
566   }
567 
568   public int defaultDisplayOrder() {
569     return 1210;
570   }
571 }
572