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