View Javadoc

1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.paneris.bibliomania.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.ReferencePoemType;
16  import org.melati.poem.Searchability;
17  import org.melati.poem.TroidPoemType;
18  import org.melati.poem.ValidationPoemException;
19  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
20  import org.paneris.bibliomania.BibliomaniaTable;
21  import org.paneris.bibliomania.Campaign;
22  import org.paneris.bibliomania.CampaignUser;
23  // FIXME extended table 
24  import org.paneris.bibliomania.User;
25  
26  
27  /**
28   * Melati POEM generated base class for <code>Table</code> <code>CampaignUser</code>.
29   *
30   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
31   */
32  
33  public class CampaignUserTableBase<T extends CampaignUser> extends BibliomaniaTable<T> {
34  
35    private Column<Integer> col_id = null;
36    private Column<Integer> col_campaign = null;
37    private Column<Integer> col_user = 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 CampaignUserTableBase(
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 BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
63      return (BibliomaniaDatabaseTables)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 ((CampaignUser)g).getId();
81            }
82  
83            public void setCooked(Persistent g, Object cooked)
84                throws AccessPoemException, ValidationPoemException {
85              ((CampaignUser)g).setId((Integer)cooked);
86            }
87  
88            public Field<Integer> asField(Persistent g) {
89              return ((CampaignUser)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 int defaultDisplayOrder() {
105             return 0;
106           }
107 
108           public Object getRaw_unsafe(Persistent g)
109               throws AccessPoemException {
110             return ((CampaignUser)g).getId_unsafe();
111           }
112 
113           public void setRaw_unsafe(Persistent g, Object raw)
114               throws AccessPoemException {
115             ((CampaignUser)g).setId_unsafe((Integer)raw);
116           }
117 
118           public Object getRaw(Persistent g)
119               throws AccessPoemException {
120             return ((CampaignUser)g).getId();
121           }
122 
123           public void setRaw(Persistent g, Object raw)
124               throws AccessPoemException {
125             ((CampaignUser)g).setId((Integer)raw);
126           }
127         });
128 
129     defineColumn(col_campaign =
130         new Column<Integer>(this, "campaign",
131                    new ReferencePoemType(getBibliomaniaDatabaseTables().
132                                              getCampaignTable(), false),
133                    DefinitionSource.dsd) { 
134           public Object getCooked(Persistent g)
135               throws AccessPoemException, PoemException {
136             return ((CampaignUser)g).getCampaign();
137           }
138 
139           public void setCooked(Persistent g, Object cooked)
140               throws AccessPoemException, ValidationPoemException {
141             ((CampaignUser)g).setCampaign((Campaign)cooked);
142           }
143 
144           public Field<Integer> asField(Persistent g) {
145             return ((CampaignUser)g).getCampaignField();
146           }
147 
148           public DisplayLevel defaultDisplayLevel() {
149             return DisplayLevel.summary;
150           }
151 
152           public Searchability defaultSearchability() {
153             return Searchability.primary;
154           }
155 
156           public String defaultDisplayName() {
157             return "Campaign";
158           }
159 
160           public int defaultDisplayOrder() {
161             return 1;
162           }
163 
164           public boolean defaultIndexed() {
165             return true;
166           }
167 
168           public Object getRaw_unsafe(Persistent g)
169               throws AccessPoemException {
170             return ((CampaignUser)g).getCampaign_unsafe();
171           }
172 
173           public void setRaw_unsafe(Persistent g, Object raw)
174               throws AccessPoemException {
175             ((CampaignUser)g).setCampaign_unsafe((Integer)raw);
176           }
177 
178           public Object getRaw(Persistent g)
179               throws AccessPoemException {
180             return ((CampaignUser)g).getCampaignTroid();
181           }
182 
183           public void setRaw(Persistent g, Object raw)
184               throws AccessPoemException {
185             ((CampaignUser)g).setCampaignTroid((Integer)raw);
186           }
187         });
188 
189     defineColumn(col_user =
190         new Column<Integer>(this, "user",
191                    new ReferencePoemType(getBibliomaniaDatabaseTables().
192                                              getUserTable(), false),
193                    DefinitionSource.dsd) { 
194           public Object getCooked(Persistent g)
195               throws AccessPoemException, PoemException {
196             return ((CampaignUser)g).getUser();
197           }
198 
199           public void setCooked(Persistent g, Object cooked)
200               throws AccessPoemException, ValidationPoemException {
201             ((CampaignUser)g).setUser((User)cooked);
202           }
203 
204           public Field<Integer> asField(Persistent g) {
205             return ((CampaignUser)g).getUserField();
206           }
207 
208           public DisplayLevel defaultDisplayLevel() {
209             return DisplayLevel.summary;
210           }
211 
212           public Searchability defaultSearchability() {
213             return Searchability.yes;
214           }
215 
216           public String defaultDisplayName() {
217             return "User";
218           }
219 
220           public int defaultDisplayOrder() {
221             return 2;
222           }
223 
224           public boolean defaultIndexed() {
225             return true;
226           }
227 
228           public String defaultRenderinfo() {
229             return "SelectionWindow";
230           }
231 
232           public Object getRaw_unsafe(Persistent g)
233               throws AccessPoemException {
234             return ((CampaignUser)g).getUser_unsafe();
235           }
236 
237           public void setRaw_unsafe(Persistent g, Object raw)
238               throws AccessPoemException {
239             ((CampaignUser)g).setUser_unsafe((Integer)raw);
240           }
241 
242           public Object getRaw(Persistent g)
243               throws AccessPoemException {
244             return ((CampaignUser)g).getUserTroid();
245           }
246 
247           public void setRaw(Persistent g, Object raw)
248               throws AccessPoemException {
249             ((CampaignUser)g).setUserTroid((Integer)raw);
250           }
251         });
252   }
253 
254 
255  /**
256   * Retrieves the <code>Id</code> <code>Column</code> for this 
257   * <code>CampaignUser</code> <code>Table</code>.
258   * 
259   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
260   * @return the id <code>Column</code>
261   */
262   public final Column<Integer> getIdColumn() {
263     return col_id;
264   }
265 
266 
267  /**
268   * Retrieves the <code>Campaign</code> <code>Column</code> for this 
269   * <code>CampaignUser</code> <code>Table</code>.
270   * 
271   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
272   * @return the campaign <code>Column</code>
273   */
274   public final Column<Integer> getCampaignColumn() {
275     return col_campaign;
276   }
277 
278 
279  /**
280   * Retrieves the <code>User</code> <code>Column</code> for this 
281   * <code>CampaignUser</code> <code>Table</code>.
282   * 
283   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
284   * @return the user <code>Column</code>
285   */
286   public final Column<Integer> getUserColumn() {
287     return col_user;
288   }
289 
290 
291  /**
292   * Retrieve the <code>CampaignUser</code> as a <code>CampaignUser</code>.
293   *
294   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
295   * @param troid a Table Row Oject ID
296   * @return the <code>Persistent</code> identified by the <code>troid</code>
297   */
298   public CampaignUser getCampaignUserObject(Integer troid) {
299     return (CampaignUser)getObject(troid);
300   }
301 
302 
303  /**
304   * Retrieve the <code>CampaignUser</code> 
305   * as a <code>CampaignUser</code>.
306   *
307   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
308   * @param troid a Table Row Object ID
309   * @return the <code>Persistent</code> identified   */
310   public CampaignUser getCampaignUserObject(int troid) {
311     return (CampaignUser)getObject(troid);
312   }
313 
314   protected JdbcPersistent _newPersistent() {
315     return new CampaignUser();
316   }
317   public String defaultDescription() {
318     return "A user in a Campaign";
319   }
320 
321   public boolean defaultRememberAllTroids() {
322     return true;
323   }
324 
325   public String defaultCategory() {
326     return "User";
327   }
328 
329   public int defaultDisplayOrder() {
330     return 2110;
331   }
332 }
333