View Javadoc
1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.melati.example.contacts.generated;
4   
5   
6   import org.melati.example.contacts.Category;
7   import org.melati.example.contacts.Contact;
8   import org.melati.example.contacts.ContactCategory;
9   import org.melati.example.contacts.ContactsDatabaseTables;
10  import org.melati.example.contacts.ContactsTable;
11  import org.melati.poem.AccessPoemException;
12  import org.melati.poem.Column;
13  import org.melati.poem.Database;
14  import org.melati.poem.DefinitionSource;
15  import org.melati.poem.DisplayLevel;
16  import org.melati.poem.Field;
17  import org.melati.poem.JdbcPersistent;
18  import org.melati.poem.Persistent;
19  import org.melati.poem.PoemException;
20  import org.melati.poem.ReferencePoemType;
21  import org.melati.poem.Searchability;
22  import org.melati.poem.StandardIntegrityFix;
23  import org.melati.poem.TroidPoemType;
24  import org.melati.poem.ValidationPoemException;
25  
26  
27  /**
28   * Melati POEM generated base class for <code>Table</code> <code>ContactCategory</code>.
29   *
30   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
31   */
32  
33  public class ContactCategoryTableBase<T extends ContactCategory> extends ContactsTable<T> {
34  
35    private Column<Integer> col_id = null;
36    private Column<Integer> col_category = null;
37    private Column<Integer> col_contact = null;
38  
39   /**
40    * Constructor. 
41    * 
42    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
43    * @param database          the POEM database we are using
44    * @param name              the name of this <code>Table</code>
45    * @param definitionSource  which definition is being used
46    * @throws PoemException    if anything goes wrong
47    */
48  
49    public ContactCategoryTableBase(
50        Database database, String name,
51        DefinitionSource definitionSource) throws PoemException {
52      super(database, name, definitionSource);
53    }
54  
55  
56   /**
57    * Get the database tables.
58    *
59    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
60    * @return the database tables
61    */
62    public ContactsDatabaseTables getContactsDatabaseTables() {
63      return (ContactsDatabaseTables)getDatabase();
64    }
65  
66  
67   /**
68    * Initialise this table by defining its columns.
69    *
70    * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
71    */
72    public void init() throws PoemException {
73      super.init();
74      defineColumn(col_id =
75          new Column<Integer>(this, "id",
76                     new TroidPoemType(),
77                     DefinitionSource.dsd) { 
78            public Object getCooked(Persistent g)
79                throws AccessPoemException, PoemException {
80              return ((ContactCategory)g).getId();
81            }
82  
83            public void setCooked(Persistent g, Object cooked)
84                throws AccessPoemException, ValidationPoemException {
85              ((ContactCategory)g).setId((Integer)cooked);
86            }
87  
88            public Field<Integer> asField(Persistent g) {
89              return ((ContactCategory)g).getIdField();
90            }
91  
92            public boolean defaultUserEditable() {
93              return false;
94            }
95  
96            public boolean defaultUserCreateable() {
97              return false;
98            }
99  
100           public DisplayLevel defaultDisplayLevel() {
101             return DisplayLevel.record;
102           }
103 
104           public Searchability defaultSearchability() {
105             return Searchability.no;
106           }
107 
108           public int defaultDisplayOrder() {
109             return 0;
110           }
111 
112           public Object getRaw_unsafe(Persistent g)
113               throws AccessPoemException {
114             return ((ContactCategory)g).getId_unsafe();
115           }
116 
117           public void setRaw_unsafe(Persistent g, Object raw)
118               throws AccessPoemException {
119             ((ContactCategory)g).setId_unsafe((Integer)raw);
120           }
121 
122           public Object getRaw(Persistent g)
123               throws AccessPoemException {
124             return ((ContactCategory)g).getId();
125           }
126 
127           public void setRaw(Persistent g, Object raw)
128               throws AccessPoemException {
129             ((ContactCategory)g).setId((Integer)raw);
130           }
131         });
132 
133     defineColumn(col_category =
134         new Column<Integer>(this, "category",
135                    new ReferencePoemType(getContactsDatabaseTables().
136                                              getCategoryTable(), false),
137                    DefinitionSource.dsd) { 
138           public Object getCooked(Persistent g)
139               throws AccessPoemException, PoemException {
140             return ((ContactCategory)g).getCategory();
141           }
142 
143           public void setCooked(Persistent g, Object cooked)
144               throws AccessPoemException, ValidationPoemException {
145             ((ContactCategory)g).setCategory((Category)cooked);
146           }
147 
148           public Field<Integer> asField(Persistent g) {
149             return ((ContactCategory)g).getCategoryField();
150           }
151 
152           public DisplayLevel defaultDisplayLevel() {
153             return DisplayLevel.primary;
154           }
155 
156           public Searchability defaultSearchability() {
157             return Searchability.primary;
158           }
159 
160           public Integer defaultDisplayOrderPriority() {
161             return new Integer(0);
162           }
163 
164           public int defaultDisplayOrder() {
165             return 1;
166           }
167 
168           public String defaultDescription() {
169             return "Category";
170           }
171 
172           public Object getRaw_unsafe(Persistent g)
173               throws AccessPoemException {
174             return ((ContactCategory)g).getCategory_unsafe();
175           }
176 
177           public void setRaw_unsafe(Persistent g, Object raw)
178               throws AccessPoemException {
179             ((ContactCategory)g).setCategory_unsafe((Integer)raw);
180           }
181 
182           public Object getRaw(Persistent g)
183               throws AccessPoemException {
184             return ((ContactCategory)g).getCategoryTroid();
185           }
186 
187           public void setRaw(Persistent g, Object raw)
188               throws AccessPoemException {
189             ((ContactCategory)g).setCategoryTroid((Integer)raw);
190           }
191 
192           public StandardIntegrityFix defaultIntegrityFix() {
193             return StandardIntegrityFix.delete;
194           }
195         });
196 
197     defineColumn(col_contact =
198         new Column<Integer>(this, "contact",
199                    new ReferencePoemType(getContactsDatabaseTables().
200                                              getContactTable(), false),
201                    DefinitionSource.dsd) { 
202           public Object getCooked(Persistent g)
203               throws AccessPoemException, PoemException {
204             return ((ContactCategory)g).getContact();
205           }
206 
207           public void setCooked(Persistent g, Object cooked)
208               throws AccessPoemException, ValidationPoemException {
209             ((ContactCategory)g).setContact((Contact)cooked);
210           }
211 
212           public Field<Integer> asField(Persistent g) {
213             return ((ContactCategory)g).getContactField();
214           }
215 
216           public DisplayLevel defaultDisplayLevel() {
217             return DisplayLevel.summary;
218           }
219 
220           public Searchability defaultSearchability() {
221             return Searchability.yes;
222           }
223 
224           public Integer defaultDisplayOrderPriority() {
225             return new Integer(1);
226           }
227 
228           public int defaultDisplayOrder() {
229             return 2;
230           }
231 
232           public String defaultDescription() {
233             return "Contact";
234           }
235 
236           public Object getRaw_unsafe(Persistent g)
237               throws AccessPoemException {
238             return ((ContactCategory)g).getContact_unsafe();
239           }
240 
241           public void setRaw_unsafe(Persistent g, Object raw)
242               throws AccessPoemException {
243             ((ContactCategory)g).setContact_unsafe((Integer)raw);
244           }
245 
246           public Object getRaw(Persistent g)
247               throws AccessPoemException {
248             return ((ContactCategory)g).getContactTroid();
249           }
250 
251           public void setRaw(Persistent g, Object raw)
252               throws AccessPoemException {
253             ((ContactCategory)g).setContactTroid((Integer)raw);
254           }
255 
256           public StandardIntegrityFix defaultIntegrityFix() {
257             return StandardIntegrityFix.delete;
258           }
259         });
260   }
261 
262 
263  /**
264   * Retrieves the <code>Id</code> <code>Column</code> for this 
265   * <code>ContactCategory</code> <code>Table</code>.
266   * 
267   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
268   * @return the id <code>Column</code>
269   */
270   public final Column<Integer> getIdColumn() {
271     return col_id;
272   }
273 
274 
275  /**
276   * Retrieves the <code>Category</code> <code>Column</code> for this 
277   * <code>ContactCategory</code> <code>Table</code>.
278   * 
279   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
280   * @return the category <code>Column</code>
281   */
282   public final Column<Integer> getCategoryColumn() {
283     return col_category;
284   }
285 
286 
287  /**
288   * Retrieves the <code>Contact</code> <code>Column</code> for this 
289   * <code>ContactCategory</code> <code>Table</code>.
290   * 
291   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
292   * @return the contact <code>Column</code>
293   */
294   public final Column<Integer> getContactColumn() {
295     return col_contact;
296   }
297 
298 
299  /**
300   * Retrieve the <code>ContactCategory</code> as a <code>ContactCategory</code>.
301   *
302   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
303   * @param troid a Table Row Object ID
304   * @return the <code>Persistent</code> identified by the <code>troid</code>
305   */
306   public ContactCategory getContactCategoryObject(Integer troid) {
307     return (ContactCategory)getObject(troid);
308   }
309 
310 
311  /**
312   * Retrieve the <code>ContactCategory</code> 
313   * as a <code>ContactCategory</code>.
314   *
315   * See org.melati.poem.prepro.TableDef#generateTableBaseJava 
316   * @param troid a Table Row Object ID
317   * @return the <code>Persistent</code> identified   */
318   public ContactCategory getContactCategoryObject(int troid) {
319     return (ContactCategory)getObject(troid);
320   }
321 
322   protected JdbcPersistent _newPersistent() {
323     return new ContactCategory();
324   }
325   public String defaultDescription() {
326     return "Contacts Categories";
327   }
328 
329   public String defaultCategory() {
330     return "Data";
331   }
332 
333   public int defaultDisplayOrder() {
334     return 10;
335   }
336 }
337