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.StringPoemType;
16  import org.melati.poem.TroidPoemType;
17  import org.melati.poem.ValidationPoemException;
18  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
19  import org.paneris.bibliomania.BibliomaniaTable;
20  import org.paneris.bibliomania.BookFormat;
21  
22  
23  /**
24   * Melati POEM generated base class for <code>Table</code> <code>BookFormat</code>.
25   *
26   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
27   */
28  
29  public class BookFormatTableBase<T extends BookFormat> extends BibliomaniaTable<T> {
30  
31    private Column<Integer> col_id = null;
32    private Column<String> col_displayname = null;
33    private Column<String> col_descriptionregexp = null;
34  
35   /**
36    * Constructor. 
37    * 
38    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
39    * @param database          the POEM database we are using
40    * @param name              the name of this <code>Table</code>
41    * @param definitionSource  which definition is being used
42    * @throws PoemException    if anything goes wrong
43    */
44  
45    public BookFormatTableBase(
46        Database database, String name,
47        DefinitionSource definitionSource) throws PoemException {
48      super(database, name, definitionSource);
49    }
50  
51  
52   /**
53    * Get the database tables.
54    *
55    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
56    * @return the database tables
57    */
58    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
59      return (BibliomaniaDatabaseTables)getDatabase();
60    }
61  
62  
63   /**
64    * Initialise this table by defining its columns.
65    *
66    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
67    */
68    public void init() throws PoemException {
69      super.init();
70      defineColumn(col_id =
71          new Column<Integer>(this, "id",
72                     new TroidPoemType(),
73                     DefinitionSource.dsd) { 
74            public Object getCooked(Persistent g)
75                throws AccessPoemException, PoemException {
76              return ((BookFormat)g).getId();
77            }
78  
79            public void setCooked(Persistent g, Object cooked)
80                throws AccessPoemException, ValidationPoemException {
81              ((BookFormat)g).setId((Integer)cooked);
82            }
83  
84            public Field<Integer> asField(Persistent g) {
85              return ((BookFormat)g).getIdField();
86            }
87  
88            public boolean defaultUserEditable() {
89              return false;
90            }
91  
92            public boolean defaultUserCreateable() {
93              return false;
94            }
95  
96            public DisplayLevel defaultDisplayLevel() {
97              return DisplayLevel.record;
98            }
99  
100           public int defaultDisplayOrder() {
101             return 0;
102           }
103 
104           public Object getRaw_unsafe(Persistent g)
105               throws AccessPoemException {
106             return ((BookFormat)g).getId_unsafe();
107           }
108 
109           public void setRaw_unsafe(Persistent g, Object raw)
110               throws AccessPoemException {
111             ((BookFormat)g).setId_unsafe((Integer)raw);
112           }
113 
114           public Object getRaw(Persistent g)
115               throws AccessPoemException {
116             return ((BookFormat)g).getId();
117           }
118 
119           public void setRaw(Persistent g, Object raw)
120               throws AccessPoemException {
121             ((BookFormat)g).setId((Integer)raw);
122           }
123         });
124 
125     defineColumn(col_displayname =
126         new Column<String>(this, "displayname",
127                    new StringPoemType(false, -1),
128                    DefinitionSource.dsd) { 
129           public Object getCooked(Persistent g)
130               throws AccessPoemException, PoemException {
131             return ((BookFormat)g).getDisplayname();
132           }
133 
134           public void setCooked(Persistent g, Object cooked)
135               throws AccessPoemException, ValidationPoemException {
136             ((BookFormat)g).setDisplayname((String)cooked);
137           }
138 
139           public Field<String> asField(Persistent g) {
140             return ((BookFormat)g).getDisplaynameField();
141           }
142 
143           public DisplayLevel defaultDisplayLevel() {
144             return DisplayLevel.primary;
145           }
146 
147           public String defaultDisplayName() {
148             return "Display name";
149           }
150 
151           public int defaultDisplayOrder() {
152             return 1;
153           }
154 
155           public String defaultDescription() {
156             return "A name for the format";
157           }
158 
159           public Object getRaw_unsafe(Persistent g)
160               throws AccessPoemException {
161             return ((BookFormat)g).getDisplayname_unsafe();
162           }
163 
164           public void setRaw_unsafe(Persistent g, Object raw)
165               throws AccessPoemException {
166             ((BookFormat)g).setDisplayname_unsafe((String)raw);
167           }
168 
169           public Object getRaw(Persistent g)
170               throws AccessPoemException {
171             return ((BookFormat)g).getDisplayname();
172           }
173 
174           public void setRaw(Persistent g, Object raw)
175               throws AccessPoemException {
176             ((BookFormat)g).setDisplayname((String)raw);
177           }
178         });
179 
180     defineColumn(col_descriptionregexp =
181         new Column<String>(this, "descriptionregexp",
182                    new StringPoemType(false, -1),
183                    DefinitionSource.dsd) { 
184           public Object getCooked(Persistent g)
185               throws AccessPoemException, PoemException {
186             return ((BookFormat)g).getDescriptionregexp();
187           }
188 
189           public void setCooked(Persistent g, Object cooked)
190               throws AccessPoemException, ValidationPoemException {
191             ((BookFormat)g).setDescriptionregexp((String)cooked);
192           }
193 
194           public Field<String> asField(Persistent g) {
195             return ((BookFormat)g).getDescriptionregexpField();
196           }
197 
198           public String defaultDisplayName() {
199             return "Description regexp";
200           }
201 
202           public int defaultDisplayOrder() {
203             return 2;
204           }
205 
206           public String defaultDescription() {
207             return "A regular expression pattern for matching the different ways bookshops describe the format";
208           }
209 
210           public Object getRaw_unsafe(Persistent g)
211               throws AccessPoemException {
212             return ((BookFormat)g).getDescriptionregexp_unsafe();
213           }
214 
215           public void setRaw_unsafe(Persistent g, Object raw)
216               throws AccessPoemException {
217             ((BookFormat)g).setDescriptionregexp_unsafe((String)raw);
218           }
219 
220           public Object getRaw(Persistent g)
221               throws AccessPoemException {
222             return ((BookFormat)g).getDescriptionregexp();
223           }
224 
225           public void setRaw(Persistent g, Object raw)
226               throws AccessPoemException {
227             ((BookFormat)g).setDescriptionregexp((String)raw);
228           }
229         });
230   }
231 
232 
233  /**
234   * Retrieves the <code>Id</code> <code>Column</code> for this 
235   * <code>BookFormat</code> <code>Table</code>.
236   * 
237   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
238   * @return the id <code>Column</code>
239   */
240   public final Column<Integer> getIdColumn() {
241     return col_id;
242   }
243 
244 
245  /**
246   * Retrieves the <code>Displayname</code> <code>Column</code> for this 
247   * <code>BookFormat</code> <code>Table</code>.
248   * 
249   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
250   * @return the displayname <code>Column</code>
251   */
252   public final Column<String> getDisplaynameColumn() {
253     return col_displayname;
254   }
255 
256 
257  /**
258   * Retrieves the <code>Descriptionregexp</code> <code>Column</code> for this 
259   * <code>BookFormat</code> <code>Table</code>.
260   * 
261   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
262   * @return the descriptionregexp <code>Column</code>
263   */
264   public final Column<String> getDescriptionregexpColumn() {
265     return col_descriptionregexp;
266   }
267 
268 
269  /**
270   * Retrieve the <code>BookFormat</code> as a <code>BookFormat</code>.
271   *
272   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
273   * @param troid a Table Row Oject ID
274   * @return the <code>Persistent</code> identified by the <code>troid</code>
275   */
276   public BookFormat getBookFormatObject(Integer troid) {
277     return (BookFormat)getObject(troid);
278   }
279 
280 
281  /**
282   * Retrieve the <code>BookFormat</code> 
283   * as a <code>BookFormat</code>.
284   *
285   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
286   * @param troid a Table Row Object ID
287   * @return the <code>Persistent</code> identified   */
288   public BookFormat getBookFormatObject(int troid) {
289     return (BookFormat)getObject(troid);
290   }
291 
292   protected JdbcPersistent _newPersistent() {
293     return new BookFormat();
294   }
295   public String defaultDisplayName() {
296     return "Book format";
297   }
298 
299   public String defaultDescription() {
300     return "The format of a book stocked by a shop";
301   }
302 
303   public boolean defaultRememberAllTroids() {
304     return true;
305   }
306 
307   public Integer defaultCacheLimit() {
308     return new Integer(999999999);
309   }
310 
311   public String defaultCategory() {
312     return "Comparison Shopper";
313   }
314 
315   public int defaultDisplayOrder() {
316     return 1310;
317   }
318 }
319