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.DoublePoemType;
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.TroidPoemType;
18  import org.melati.poem.ValidationPoemException;
19  import org.melati.poem.test.DoubleField;
20  import org.melati.poem.test.EverythingDatabaseTables;
21  import org.melati.poem.test.EverythingTable;
22  
23  
24  /**
25   * Melati POEM generated base class for <code>Table</code> <code>DoubleField</code>.
26   *
27   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
28   */
29  
30  public class DoubleFieldTableBase<T extends DoubleField> extends EverythingTable<T> {
31  
32    private Column<Integer> col_id = null;
33    private Column<Double> col_doublefield = 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 DoubleFieldTableBase(
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 EverythingDatabaseTables getEverythingDatabaseTables() {
59      return (EverythingDatabaseTables)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 ((DoubleField)g).getId();
77            }
78  
79            public void setCooked(Persistent g, Object cooked)
80                throws AccessPoemException, ValidationPoemException {
81              ((DoubleField)g).setId((Integer)cooked);
82            }
83  
84            public Field<Integer> asField(Persistent g) {
85              return ((DoubleField)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.summary;
98            }
99  
100           public Searchability defaultSearchability() {
101             return Searchability.yes;
102           }
103 
104           public String defaultDisplayName() {
105             return "Id";
106           }
107 
108           public int defaultDisplayOrder() {
109             return 0;
110           }
111 
112           public boolean defaultIndexed() {
113             return true;
114           }
115 
116           public boolean defaultUnique() {
117             return true;
118           }
119 
120           public int defaultWidth() {
121             return 20;
122           }
123 
124           public int defaultHeight() {
125             return 1;
126           }
127 
128           public Object getRaw_unsafe(Persistent g)
129               throws AccessPoemException {
130             return ((DoubleField)g).getId_unsafe();
131           }
132 
133           public void setRaw_unsafe(Persistent g, Object raw)
134               throws AccessPoemException {
135             ((DoubleField)g).setId_unsafe((Integer)raw);
136           }
137 
138           public Object getRaw(Persistent g)
139               throws AccessPoemException {
140             return ((DoubleField)g).getId();
141           }
142 
143           public void setRaw(Persistent g, Object raw)
144               throws AccessPoemException {
145             ((DoubleField)g).setId((Integer)raw);
146           }
147         });
148 
149     defineColumn(col_doublefield =
150         new Column<Double>(this, "doublefield",
151                    new DoublePoemType(true),
152                    DefinitionSource.dsd) { 
153           public Object getCooked(Persistent g)
154               throws AccessPoemException, PoemException {
155             return ((DoubleField)g).getDoublefield();
156           }
157 
158           public void setCooked(Persistent g, Object cooked)
159               throws AccessPoemException, ValidationPoemException {
160             ((DoubleField)g).setDoublefield((Double)cooked);
161           }
162 
163           public Field<Double> asField(Persistent g) {
164             return ((DoubleField)g).getDoublefieldField();
165           }
166 
167           public DisplayLevel defaultDisplayLevel() {
168             return DisplayLevel.summary;
169           }
170 
171           public Searchability defaultSearchability() {
172             return Searchability.yes;
173           }
174 
175           public String defaultDisplayName() {
176             return "Double Field";
177           }
178 
179           public int defaultDisplayOrder() {
180             return 6;
181           }
182 
183           public int defaultWidth() {
184             return 20;
185           }
186 
187           public int defaultHeight() {
188             return 1;
189           }
190 
191           public Object getRaw_unsafe(Persistent g)
192               throws AccessPoemException {
193             return ((DoubleField)g).getDoublefield_unsafe();
194           }
195 
196           public void setRaw_unsafe(Persistent g, Object raw)
197               throws AccessPoemException {
198             ((DoubleField)g).setDoublefield_unsafe((Double)raw);
199           }
200 
201           public Object getRaw(Persistent g)
202               throws AccessPoemException {
203             return ((DoubleField)g).getDoublefield();
204           }
205 
206           public void setRaw(Persistent g, Object raw)
207               throws AccessPoemException {
208             ((DoubleField)g).setDoublefield((Double)raw);
209           }
210         });
211   }
212 
213 
214  /**
215   * Retrieves the <code>Id</code> <code>Column</code> for this 
216   * <code>DoubleField</code> <code>Table</code>.
217   * 
218   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
219   * @return the id <code>Column</code>
220   */
221   public final Column<Integer> getIdColumn() {
222     return col_id;
223   }
224 
225 
226  /**
227   * Retrieves the <code>Doublefield</code> <code>Column</code> for this 
228   * <code>DoubleField</code> <code>Table</code>.
229   * 
230   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
231   * @return the doublefield <code>Column</code>
232   */
233   public final Column<Double> getDoublefieldColumn() {
234     return col_doublefield;
235   }
236 
237 
238  /**
239   * Retrieve the <code>DoubleField</code> as a <code>DoubleField</code>.
240   *
241   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
242   * @param troid a Table Row Object ID
243   * @return the <code>Persistent</code> identified by the <code>troid</code>
244   */
245   public DoubleField getDoubleFieldObject(Integer troid) {
246     return (DoubleField)getObject(troid);
247   }
248 
249 
250  /**
251   * Retrieve the <code>DoubleField</code> 
252   * as a <code>DoubleField</code>.
253   *
254   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
255   * @param troid a Table Row Object ID
256   * @return the <code>Persistent</code> identified   */
257   public DoubleField getDoubleFieldObject(int troid) {
258     return (DoubleField)getObject(troid);
259   }
260 
261   protected JdbcPersistent _newPersistent() {
262     return new DoubleField();
263   }
264   public String defaultDisplayName() {
265     return "Double Field";
266   }
267 
268   public String defaultDescription() {
269     return "A table with only a double field in it";
270   }
271 
272   public Integer defaultCacheLimit() {
273     return new Integer(100);
274   }
275 
276   public String defaultCategory() {
277     return "Normal";
278   }
279 
280   public int defaultDisplayOrder() {
281     return 22;
282   }
283 }
284