View Javadoc
1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.melati.poem.test.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.melati.poem.test.EverythingDatabaseTables;
20  import org.melati.poem.test.EverythingTable;
21  import org.melati.poem.test.StringField;
22  
23  
24  /**
25   * Melati POEM generated base class for <code>Table</code> <code>StringField</code>.
26   *
27   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
28   */
29  
30  public class StringFieldTableBase<T extends StringField> extends EverythingTable<T> {
31  
32    private Column<Integer> col_id = null;
33    private Column<String> col_stringfield = null;
34    private Column<String> col_unlimited = null;
35  
36   /**
37    * Constructor. 
38    * 
39    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
40    * @param database          the POEM database we are using
41    * @param name              the name of this <code>Table</code>
42    * @param definitionSource  which definition is being used
43    * @throws PoemException    if anything goes wrong
44    */
45  
46    public StringFieldTableBase(
47        Database database, String name,
48        DefinitionSource definitionSource) throws PoemException {
49      super(database, name, definitionSource);
50    }
51  
52  
53   /**
54    * Get the database tables.
55    *
56    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
57    * @return the database tables
58    */
59    public EverythingDatabaseTables getEverythingDatabaseTables() {
60      return (EverythingDatabaseTables)getDatabase();
61    }
62  
63  
64   /**
65    * Initialise this table by defining its columns.
66    *
67    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
68    */
69    public void init() throws PoemException {
70      super.init();
71      defineColumn(col_id =
72          new Column<Integer>(this, "id",
73                     new TroidPoemType(),
74                     DefinitionSource.dsd) { 
75            public Object getCooked(Persistent g)
76                throws AccessPoemException, PoemException {
77              return ((StringField)g).getId();
78            }
79  
80            public void setCooked(Persistent g, Object cooked)
81                throws AccessPoemException, ValidationPoemException {
82              ((StringField)g).setId((Integer)cooked);
83            }
84  
85            public Field<Integer> asField(Persistent g) {
86              return ((StringField)g).getIdField();
87            }
88  
89            public boolean defaultUserEditable() {
90              return false;
91            }
92  
93            public boolean defaultUserCreateable() {
94              return false;
95            }
96  
97            public DisplayLevel defaultDisplayLevel() {
98              return DisplayLevel.summary;
99            }
100 
101           public Searchability defaultSearchability() {
102             return Searchability.yes;
103           }
104 
105           public String defaultDisplayName() {
106             return "Id";
107           }
108 
109           public int defaultDisplayOrder() {
110             return 0;
111           }
112 
113           public boolean defaultIndexed() {
114             return true;
115           }
116 
117           public boolean defaultUnique() {
118             return true;
119           }
120 
121           public int defaultWidth() {
122             return 20;
123           }
124 
125           public int defaultHeight() {
126             return 1;
127           }
128 
129           public Object getRaw_unsafe(Persistent g)
130               throws AccessPoemException {
131             return ((StringField)g).getId_unsafe();
132           }
133 
134           public void setRaw_unsafe(Persistent g, Object raw)
135               throws AccessPoemException {
136             ((StringField)g).setId_unsafe((Integer)raw);
137           }
138 
139           public Object getRaw(Persistent g)
140               throws AccessPoemException {
141             return ((StringField)g).getId();
142           }
143 
144           public void setRaw(Persistent g, Object raw)
145               throws AccessPoemException {
146             ((StringField)g).setId((Integer)raw);
147           }
148         });
149 
150     defineColumn(col_stringfield =
151         new Column<String>(this, "stringfield",
152                    new StringPoemType(true, 23),
153                    DefinitionSource.dsd) { 
154           public Object getCooked(Persistent g)
155               throws AccessPoemException, PoemException {
156             return ((StringField)g).getStringfield();
157           }
158 
159           public void setCooked(Persistent g, Object cooked)
160               throws AccessPoemException, ValidationPoemException {
161             ((StringField)g).setStringfield((String)cooked);
162           }
163 
164           public Field<String> asField(Persistent g) {
165             return ((StringField)g).getStringfieldField();
166           }
167 
168           public DisplayLevel defaultDisplayLevel() {
169             return DisplayLevel.summary;
170           }
171 
172           public Searchability defaultSearchability() {
173             return Searchability.yes;
174           }
175 
176           public String defaultDisplayName() {
177             return "String Field";
178           }
179 
180           public int defaultDisplayOrder() {
181             return 2;
182           }
183 
184           public int defaultWidth() {
185             return 20;
186           }
187 
188           public int defaultHeight() {
189             return 3;
190           }
191 
192           public Object getRaw_unsafe(Persistent g)
193               throws AccessPoemException {
194             return ((StringField)g).getStringfield_unsafe();
195           }
196 
197           public void setRaw_unsafe(Persistent g, Object raw)
198               throws AccessPoemException {
199             ((StringField)g).setStringfield_unsafe((String)raw);
200           }
201 
202           public Object getRaw(Persistent g)
203               throws AccessPoemException {
204             return ((StringField)g).getStringfield();
205           }
206 
207           public void setRaw(Persistent g, Object raw)
208               throws AccessPoemException {
209             ((StringField)g).setStringfield((String)raw);
210           }
211         });
212 
213     defineColumn(col_unlimited =
214         new Column<String>(this, "unlimited",
215                    new StringPoemType(true, -1),
216                    DefinitionSource.dsd) { 
217           public Object getCooked(Persistent g)
218               throws AccessPoemException, PoemException {
219             return ((StringField)g).getUnlimited();
220           }
221 
222           public void setCooked(Persistent g, Object cooked)
223               throws AccessPoemException, ValidationPoemException {
224             ((StringField)g).setUnlimited((String)cooked);
225           }
226 
227           public Field<String> asField(Persistent g) {
228             return ((StringField)g).getUnlimitedField();
229           }
230 
231           public DisplayLevel defaultDisplayLevel() {
232             return DisplayLevel.summary;
233           }
234 
235           public Searchability defaultSearchability() {
236             return Searchability.yes;
237           }
238 
239           public String defaultDisplayName() {
240             return "Unlimited String Field";
241           }
242 
243           public int defaultDisplayOrder() {
244             return 3;
245           }
246 
247           public int defaultWidth() {
248             return 20;
249           }
250 
251           public int defaultHeight() {
252             return 3;
253           }
254 
255           public Object getRaw_unsafe(Persistent g)
256               throws AccessPoemException {
257             return ((StringField)g).getUnlimited_unsafe();
258           }
259 
260           public void setRaw_unsafe(Persistent g, Object raw)
261               throws AccessPoemException {
262             ((StringField)g).setUnlimited_unsafe((String)raw);
263           }
264 
265           public Object getRaw(Persistent g)
266               throws AccessPoemException {
267             return ((StringField)g).getUnlimited();
268           }
269 
270           public void setRaw(Persistent g, Object raw)
271               throws AccessPoemException {
272             ((StringField)g).setUnlimited((String)raw);
273           }
274         });
275   }
276 
277 
278  /**
279   * Retrieves the <code>Id</code> <code>Column</code> for this 
280   * <code>StringField</code> <code>Table</code>.
281   * 
282   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
283   * @return the id <code>Column</code>
284   */
285   public final Column<Integer> getIdColumn() {
286     return col_id;
287   }
288 
289 
290  /**
291   * Retrieves the <code>Stringfield</code> <code>Column</code> for this 
292   * <code>StringField</code> <code>Table</code>.
293   * 
294   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
295   * @return the stringfield <code>Column</code>
296   */
297   public final Column<String> getStringfieldColumn() {
298     return col_stringfield;
299   }
300 
301 
302  /**
303   * Retrieves the <code>Unlimited</code> <code>Column</code> for this 
304   * <code>StringField</code> <code>Table</code>.
305   * 
306   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
307   * @return the unlimited <code>Column</code>
308   */
309   public final Column<String> getUnlimitedColumn() {
310     return col_unlimited;
311   }
312 
313 
314  /**
315   * Retrieve the <code>StringField</code> as a <code>StringField</code>.
316   *
317   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
318   * @param troid a Table Row Object ID
319   * @return the <code>Persistent</code> identified by the <code>troid</code>
320   */
321   public StringField getStringFieldObject(Integer troid) {
322     return (StringField)getObject(troid);
323   }
324 
325 
326  /**
327   * Retrieve the <code>StringField</code> 
328   * as a <code>StringField</code>.
329   *
330   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
331   * @param troid a Table Row Object ID
332   * @return the <code>Persistent</code> identified   */
333   public StringField getStringFieldObject(int troid) {
334     return (StringField)getObject(troid);
335   }
336 
337   protected JdbcPersistent _newPersistent() {
338     return new StringField();
339   }
340   public String defaultDisplayName() {
341     return "String Field";
342   }
343 
344   public String defaultDescription() {
345     return "A table with only a string field in it";
346   }
347 
348   public Integer defaultCacheLimit() {
349     return new Integer(100);
350   }
351 
352   public String defaultCategory() {
353     return "Normal";
354   }
355 
356   public int defaultDisplayOrder() {
357     return 12;
358   }
359 }
360