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.ReferencePoemType;
16  import org.melati.poem.Searchability;
17  import org.melati.poem.StandardIntegrityFix;
18  import org.melati.poem.TroidPoemType;
19  import org.melati.poem.ValidationPoemException;
20  import org.paneris.bibliomania.Author;
21  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
22  import org.paneris.bibliomania.BibliomaniaTable;
23  import org.paneris.bibliomania.Book;
24  import org.paneris.bibliomania.Product;
25  import org.paneris.bibliomania.ProductAssociation;
26  
27  
28  /**
29   * Melati POEM generated base class for <code>Table</code> <code>ProductAssociation</code>.
30   *
31   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
32   */
33  
34  public class ProductAssociationTableBase<T extends ProductAssociation> extends BibliomaniaTable<T> {
35  
36    private Column<Integer> col_id = null;
37    private Column<Integer> col_product = null;
38    private Column<Integer> col_book = null;
39    private Column<Integer> col_author = null;
40  
41   /**
42    * Constructor. 
43    * 
44    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
45    * @param database          the POEM database we are using
46    * @param name              the name of this <code>Table</code>
47    * @param definitionSource  which definition is being used
48    * @throws PoemException    if anything goes wrong
49    */
50  
51    public ProductAssociationTableBase(
52        Database database, String name,
53        DefinitionSource definitionSource) throws PoemException {
54      super(database, name, definitionSource);
55    }
56  
57  
58   /**
59    * Get the database tables.
60    *
61    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
62    * @return the database tables
63    */
64    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
65      return (BibliomaniaDatabaseTables)getDatabase();
66    }
67  
68  
69   /**
70    * Initialise this table by defining its columns.
71    *
72    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
73    */
74    public void init() throws PoemException {
75      super.init();
76      defineColumn(col_id =
77          new Column<Integer>(this, "id",
78                     new TroidPoemType(),
79                     DefinitionSource.dsd) { 
80            public Object getCooked(Persistent g)
81                throws AccessPoemException, PoemException {
82              return ((ProductAssociation)g).getId();
83            }
84  
85            public void setCooked(Persistent g, Object cooked)
86                throws AccessPoemException, ValidationPoemException {
87              ((ProductAssociation)g).setId((Integer)cooked);
88            }
89  
90            public Field<Integer> asField(Persistent g) {
91              return ((ProductAssociation)g).getIdField();
92            }
93  
94            public boolean defaultUserEditable() {
95              return false;
96            }
97  
98            public boolean defaultUserCreateable() {
99              return false;
100           }
101 
102           public DisplayLevel defaultDisplayLevel() {
103             return DisplayLevel.record;
104           }
105 
106           public int defaultDisplayOrder() {
107             return 0;
108           }
109 
110           public Object getRaw_unsafe(Persistent g)
111               throws AccessPoemException {
112             return ((ProductAssociation)g).getId_unsafe();
113           }
114 
115           public void setRaw_unsafe(Persistent g, Object raw)
116               throws AccessPoemException {
117             ((ProductAssociation)g).setId_unsafe((Integer)raw);
118           }
119 
120           public Object getRaw(Persistent g)
121               throws AccessPoemException {
122             return ((ProductAssociation)g).getId();
123           }
124 
125           public void setRaw(Persistent g, Object raw)
126               throws AccessPoemException {
127             ((ProductAssociation)g).setId((Integer)raw);
128           }
129         });
130 
131     defineColumn(col_product =
132         new Column<Integer>(this, "product",
133                    new ReferencePoemType(getBibliomaniaDatabaseTables().
134                                              getProductTable(), false),
135                    DefinitionSource.dsd) { 
136           public Object getCooked(Persistent g)
137               throws AccessPoemException, PoemException {
138             return ((ProductAssociation)g).getProduct();
139           }
140 
141           public void setCooked(Persistent g, Object cooked)
142               throws AccessPoemException, ValidationPoemException {
143             ((ProductAssociation)g).setProduct((Product)cooked);
144           }
145 
146           public Field<Integer> asField(Persistent g) {
147             return ((ProductAssociation)g).getProductField();
148           }
149 
150           public Searchability defaultSearchability() {
151             return Searchability.primary;
152           }
153 
154           public Integer defaultDisplayOrderPriority() {
155             return new Integer(1);
156           }
157 
158           public int defaultDisplayOrder() {
159             return 1;
160           }
161 
162           public String defaultDescription() {
163             return "The related shop item";
164           }
165 
166           public boolean defaultIndexed() {
167             return true;
168           }
169 
170           public Object getRaw_unsafe(Persistent g)
171               throws AccessPoemException {
172             return ((ProductAssociation)g).getProduct_unsafe();
173           }
174 
175           public void setRaw_unsafe(Persistent g, Object raw)
176               throws AccessPoemException {
177             ((ProductAssociation)g).setProduct_unsafe((Integer)raw);
178           }
179 
180           public Object getRaw(Persistent g)
181               throws AccessPoemException {
182             return ((ProductAssociation)g).getProductTroid();
183           }
184 
185           public void setRaw(Persistent g, Object raw)
186               throws AccessPoemException {
187             ((ProductAssociation)g).setProductTroid((Integer)raw);
188           }
189 
190           public StandardIntegrityFix defaultIntegrityFix() {
191             return StandardIntegrityFix.delete;
192           }
193         });
194 
195     defineColumn(col_book =
196         new Column<Integer>(this, "book",
197                    new ReferencePoemType(getBibliomaniaDatabaseTables().
198                                              getBookTable(), true),
199                    DefinitionSource.dsd) { 
200           public Object getCooked(Persistent g)
201               throws AccessPoemException, PoemException {
202             return ((ProductAssociation)g).getBook();
203           }
204 
205           public void setCooked(Persistent g, Object cooked)
206               throws AccessPoemException, ValidationPoemException {
207             ((ProductAssociation)g).setBook((Book)cooked);
208           }
209 
210           public Field<Integer> asField(Persistent g) {
211             return ((ProductAssociation)g).getBookField();
212           }
213 
214           public Searchability defaultSearchability() {
215             return Searchability.primary;
216           }
217 
218           public Integer defaultDisplayOrderPriority() {
219             return new Integer(1);
220           }
221 
222           public int defaultDisplayOrder() {
223             return 2;
224           }
225 
226           public String defaultDescription() {
227             return "The book this product is related to";
228           }
229 
230           public boolean defaultIndexed() {
231             return true;
232           }
233 
234           public String defaultRenderinfo() {
235             return "SelectionWindow";
236           }
237 
238           public Object getRaw_unsafe(Persistent g)
239               throws AccessPoemException {
240             return ((ProductAssociation)g).getBook_unsafe();
241           }
242 
243           public void setRaw_unsafe(Persistent g, Object raw)
244               throws AccessPoemException {
245             ((ProductAssociation)g).setBook_unsafe((Integer)raw);
246           }
247 
248           public Object getRaw(Persistent g)
249               throws AccessPoemException {
250             return ((ProductAssociation)g).getBookTroid();
251           }
252 
253           public void setRaw(Persistent g, Object raw)
254               throws AccessPoemException {
255             ((ProductAssociation)g).setBookTroid((Integer)raw);
256           }
257 
258           public StandardIntegrityFix defaultIntegrityFix() {
259             return StandardIntegrityFix.delete;
260           }
261         });
262 
263     defineColumn(col_author =
264         new Column<Integer>(this, "author",
265                    new ReferencePoemType(getBibliomaniaDatabaseTables().
266                                              getAuthorTable(), true),
267                    DefinitionSource.dsd) { 
268           public Object getCooked(Persistent g)
269               throws AccessPoemException, PoemException {
270             return ((ProductAssociation)g).getAuthor();
271           }
272 
273           public void setCooked(Persistent g, Object cooked)
274               throws AccessPoemException, ValidationPoemException {
275             ((ProductAssociation)g).setAuthor((Author)cooked);
276           }
277 
278           public Field<Integer> asField(Persistent g) {
279             return ((ProductAssociation)g).getAuthorField();
280           }
281 
282           public Searchability defaultSearchability() {
283             return Searchability.primary;
284           }
285 
286           public Integer defaultDisplayOrderPriority() {
287             return new Integer(1);
288           }
289 
290           public int defaultDisplayOrder() {
291             return 3;
292           }
293 
294           public String defaultDescription() {
295             return "The author this product is related to";
296           }
297 
298           public boolean defaultIndexed() {
299             return true;
300           }
301 
302           public String defaultRenderinfo() {
303             return "SelectionWindow";
304           }
305 
306           public Object getRaw_unsafe(Persistent g)
307               throws AccessPoemException {
308             return ((ProductAssociation)g).getAuthor_unsafe();
309           }
310 
311           public void setRaw_unsafe(Persistent g, Object raw)
312               throws AccessPoemException {
313             ((ProductAssociation)g).setAuthor_unsafe((Integer)raw);
314           }
315 
316           public Object getRaw(Persistent g)
317               throws AccessPoemException {
318             return ((ProductAssociation)g).getAuthorTroid();
319           }
320 
321           public void setRaw(Persistent g, Object raw)
322               throws AccessPoemException {
323             ((ProductAssociation)g).setAuthorTroid((Integer)raw);
324           }
325 
326           public StandardIntegrityFix defaultIntegrityFix() {
327             return StandardIntegrityFix.delete;
328           }
329         });
330   }
331 
332 
333  /**
334   * Retrieves the <code>Id</code> <code>Column</code> for this 
335   * <code>ProductAssociation</code> <code>Table</code>.
336   * 
337   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
338   * @return the id <code>Column</code>
339   */
340   public final Column<Integer> getIdColumn() {
341     return col_id;
342   }
343 
344 
345  /**
346   * Retrieves the <code>Product</code> <code>Column</code> for this 
347   * <code>ProductAssociation</code> <code>Table</code>.
348   * 
349   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
350   * @return the product <code>Column</code>
351   */
352   public final Column<Integer> getProductColumn() {
353     return col_product;
354   }
355 
356 
357  /**
358   * Retrieves the <code>Book</code> <code>Column</code> for this 
359   * <code>ProductAssociation</code> <code>Table</code>.
360   * 
361   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
362   * @return the book <code>Column</code>
363   */
364   public final Column<Integer> getBookColumn() {
365     return col_book;
366   }
367 
368 
369  /**
370   * Retrieves the <code>Author</code> <code>Column</code> for this 
371   * <code>ProductAssociation</code> <code>Table</code>.
372   * 
373   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
374   * @return the author <code>Column</code>
375   */
376   public final Column<Integer> getAuthorColumn() {
377     return col_author;
378   }
379 
380 
381  /**
382   * Retrieve the <code>ProductAssociation</code> as a <code>ProductAssociation</code>.
383   *
384   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
385   * @param troid a Table Row Oject ID
386   * @return the <code>Persistent</code> identified by the <code>troid</code>
387   */
388   public ProductAssociation getProductAssociationObject(Integer troid) {
389     return (ProductAssociation)getObject(troid);
390   }
391 
392 
393  /**
394   * Retrieve the <code>ProductAssociation</code> 
395   * as a <code>ProductAssociation</code>.
396   *
397   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
398   * @param troid a Table Row Object ID
399   * @return the <code>Persistent</code> identified   */
400   public ProductAssociation getProductAssociationObject(int troid) {
401     return (ProductAssociation)getObject(troid);
402   }
403 
404   protected JdbcPersistent _newPersistent() {
405     return new ProductAssociation();
406   }
407   public String defaultDisplayName() {
408     return "Product Associations";
409   }
410 
411   public String defaultDescription() {
412     return "Book and/or Author associated with a product";
413   }
414 
415   public String defaultCategory() {
416     return "Shop";
417   }
418 
419   public int defaultDisplayOrder() {
420     return 1200;
421   }
422 }
423