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 java.sql.Timestamp;
7   import org.melati.poem.AccessPoemException;
8   import org.melati.poem.Column;
9   import org.melati.poem.Database;
10  import org.melati.poem.DefinitionSource;
11  import org.melati.poem.DisplayLevel;
12  import org.melati.poem.Field;
13  import org.melati.poem.JdbcPersistent;
14  import org.melati.poem.Persistent;
15  import org.melati.poem.PoemException;
16  import org.melati.poem.Searchability;
17  import org.melati.poem.TimestampPoemType;
18  import org.melati.poem.TroidPoemType;
19  import org.melati.poem.ValidationPoemException;
20  import org.melati.poem.test.EverythingDatabaseTables;
21  import org.melati.poem.test.EverythingTable;
22  import org.melati.poem.test.TimestampField;
23  
24  
25  /**
26   * Melati POEM generated base class for <code>Table</code> <code>TimestampField</code>.
27   *
28   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
29   */
30  
31  public class TimestampFieldTableBase<T extends TimestampField> extends EverythingTable<T> {
32  
33    private Column<Integer> col_id = null;
34    private Column<Timestamp> col_timestampfield = 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 TimestampFieldTableBase(
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 ((TimestampField)g).getId();
78            }
79  
80            public void setCooked(Persistent g, Object cooked)
81                throws AccessPoemException, ValidationPoemException {
82              ((TimestampField)g).setId((Integer)cooked);
83            }
84  
85            public Field<Integer> asField(Persistent g) {
86              return ((TimestampField)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 ((TimestampField)g).getId_unsafe();
132           }
133 
134           public void setRaw_unsafe(Persistent g, Object raw)
135               throws AccessPoemException {
136             ((TimestampField)g).setId_unsafe((Integer)raw);
137           }
138 
139           public Object getRaw(Persistent g)
140               throws AccessPoemException {
141             return ((TimestampField)g).getId();
142           }
143 
144           public void setRaw(Persistent g, Object raw)
145               throws AccessPoemException {
146             ((TimestampField)g).setId((Integer)raw);
147           }
148         });
149 
150     defineColumn(col_timestampfield =
151         new Column<Timestamp>(this, "timestampfield",
152                    new TimestampPoemType(true),
153                    DefinitionSource.dsd) { 
154           public Object getCooked(Persistent g)
155               throws AccessPoemException, PoemException {
156             return ((TimestampField)g).getTimestampfield();
157           }
158 
159           public void setCooked(Persistent g, Object cooked)
160               throws AccessPoemException, ValidationPoemException {
161             ((TimestampField)g).setTimestampfield((Timestamp)cooked);
162           }
163 
164           public Field<Timestamp> asField(Persistent g) {
165             return ((TimestampField)g).getTimestampfieldField();
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 "Timestamp Field";
178           }
179 
180           public int defaultDisplayOrder() {
181             return 10;
182           }
183 
184           public int defaultWidth() {
185             return 20;
186           }
187 
188           public int defaultHeight() {
189             return 1;
190           }
191 
192           public Object getRaw_unsafe(Persistent g)
193               throws AccessPoemException {
194             return ((TimestampField)g).getTimestampfield_unsafe();
195           }
196 
197           public void setRaw_unsafe(Persistent g, Object raw)
198               throws AccessPoemException {
199             ((TimestampField)g).setTimestampfield_unsafe((Timestamp)raw);
200           }
201 
202           public Object getRaw(Persistent g)
203               throws AccessPoemException {
204             return ((TimestampField)g).getTimestampfield();
205           }
206 
207           public void setRaw(Persistent g, Object raw)
208               throws AccessPoemException {
209             ((TimestampField)g).setTimestampfield((Timestamp)raw);
210           }
211         });
212   }
213 
214 
215  /**
216   * Retrieves the <code>Id</code> <code>Column</code> for this 
217   * <code>TimestampField</code> <code>Table</code>.
218   * 
219   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
220   * @return the id <code>Column</code>
221   */
222   public final Column<Integer> getIdColumn() {
223     return col_id;
224   }
225 
226 
227  /**
228   * Retrieves the <code>Timestampfield</code> <code>Column</code> for this 
229   * <code>TimestampField</code> <code>Table</code>.
230   * 
231   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
232   * @return the timestampfield <code>Column</code>
233   */
234   public final Column<Timestamp> getTimestampfieldColumn() {
235     return col_timestampfield;
236   }
237 
238 
239  /**
240   * Retrieve the <code>TimestampField</code> as a <code>TimestampField</code>.
241   *
242   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
243   * @param troid a Table Row Object ID
244   * @return the <code>Persistent</code> identified by the <code>troid</code>
245   */
246   public TimestampField getTimestampFieldObject(Integer troid) {
247     return (TimestampField)getObject(troid);
248   }
249 
250 
251  /**
252   * Retrieve the <code>TimestampField</code> 
253   * as a <code>TimestampField</code>.
254   *
255   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
256   * @param troid a Table Row Object ID
257   * @return the <code>Persistent</code> identified   */
258   public TimestampField getTimestampFieldObject(int troid) {
259     return (TimestampField)getObject(troid);
260   }
261 
262   protected JdbcPersistent _newPersistent() {
263     return new TimestampField();
264   }
265   public String defaultDisplayName() {
266     return "Timestamp  Field";
267   }
268 
269   public String defaultDescription() {
270     return "A table with only a timestamp field in it";
271   }
272 
273   public Integer defaultCacheLimit() {
274     return new Integer(100);
275   }
276 
277   public String defaultCategory() {
278     return "Normal";
279   }
280 
281   public int defaultDisplayOrder() {
282     return 32;
283   }
284 }
285