View Javadoc

1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.paneris.melati.site.model.generated;
4   
5   import org.melati.poem.AccessPoemException;
6   import org.melati.poem.Column;
7   import org.melati.poem.Database;
8   import org.melati.poem.DefinitionSource;
9   import org.melati.poem.DisplayLevel;
10  import org.melati.poem.Field;
11  import org.melati.poem.IntegerPoemType;
12  import org.melati.poem.JdbcPersistent;
13  import org.melati.poem.Persistent;
14  import org.melati.poem.PoemException;
15  import org.melati.poem.Searchability;
16  import org.melati.poem.StringPoemType;
17  import org.melati.poem.TroidPoemType;
18  import org.melati.poem.ValidationPoemException;
19  import org.paneris.melati.site.model.SiteDatabaseTables;
20  import org.paneris.melati.site.model.UploadedFileTable;
21  import org.paneris.melati.site.model.UploadedImage;
22  
23  
24  /**
25   * Melati POEM generated base class for 
26  <code>Table</code> <code>UploadedImage</code>.
27   *
28   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
29   */
30  
31  public class UploadedImageTableBase extends UploadedFileTable {
32  
33    private Column col_id = null;
34    private Column col_url = null;
35    private Column col_height = null;
36    private Column col_width = null;
37  
38   /**
39    * Constructor. 
40    * 
41    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
42    * @param database          the POEM database we are using
43    * @param name              the name of this <code>Table</code>
44    * @param definitionSource  which definition is being used
45    * @throws PoemException    if anything goes wrong
46    */
47  
48    public UploadedImageTableBase(
49        Database database, String name,
50        DefinitionSource definitionSource) throws PoemException {
51      super(database, name, definitionSource);
52    }
53  
54  
55   /**
56    * Get the database tables.
57    *
58    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
59    * @return the database tables
60    */
61    public SiteDatabaseTables getSiteDatabaseTables() {
62      return (SiteDatabaseTables)getDatabase();
63    }
64  
65    public void init() throws PoemException {
66      super.init();
67      defineColumn(col_id =
68          new Column(this, "id",
69                     new TroidPoemType(),
70                     DefinitionSource.dsd) { 
71            public Object getCooked(Persistent g)
72                throws AccessPoemException, PoemException {
73              return ((UploadedImage)g).getId();
74            }
75  
76            public void setCooked(Persistent g, Object cooked)
77                throws AccessPoemException, ValidationPoemException {
78              ((UploadedImage)g).setId((Integer)cooked);
79            }
80  
81            public Field asField(Persistent g) {
82              return ((UploadedImage)g).getIdField();
83            }
84  
85            protected boolean defaultUserEditable() {
86              return false;
87            }
88  
89            protected boolean defaultUserCreateable() {
90              return false;
91            }
92  
93            protected DisplayLevel defaultDisplayLevel() {
94              return DisplayLevel.record;
95            }
96  
97            protected int defaultDisplayOrder() {
98              return 0;
99            }
100 
101           public Object getRaw_unsafe(Persistent g)
102               throws AccessPoemException {
103             return ((UploadedImage)g).getId_unsafe();
104           }
105 
106           public void setRaw_unsafe(Persistent g, Object raw)
107               throws AccessPoemException {
108             ((UploadedImage)g).setId_unsafe((Integer)raw);
109           }
110 
111           public Object getRaw(Persistent g)
112               throws AccessPoemException {
113             return ((UploadedImage)g).getId();
114           }
115 
116           public void setRaw(Persistent g, Object raw)
117               throws AccessPoemException {
118             ((UploadedImage)g).setId((Integer)raw);
119           }
120         });
121 
122     defineColumn(col_url =
123         new Column(this, "url",
124                    new StringPoemType(false, -1),
125                    DefinitionSource.dsd) { 
126           public Object getCooked(Persistent g)
127               throws AccessPoemException, PoemException {
128             return ((UploadedImage)g).getUrl();
129           }
130 
131           public void setCooked(Persistent g, Object cooked)
132               throws AccessPoemException, ValidationPoemException {
133             ((UploadedImage)g).setUrl((String)cooked);
134           }
135 
136           public Field asField(Persistent g) {
137             return ((UploadedImage)g).getUrlField();
138           }
139 
140           protected DisplayLevel defaultDisplayLevel() {
141             return DisplayLevel.primary;
142           }
143 
144           protected Searchability defaultSearchability() {
145             return Searchability.yes;
146           }
147 
148           protected Integer defaultDisplayOrderPriority() {
149             return new Integer(0);
150           }
151 
152           protected int defaultDisplayOrder() {
153             return 1;
154           }
155 
156           protected String defaultDescription() {
157             return "The name of the file, as uploaded";
158           }
159 
160           protected int defaultWidth() {
161             return 40;
162           }
163 
164           protected String defaultRenderinfo() {
165             return "ImageUpload";
166           }
167 
168           public Object getRaw_unsafe(Persistent g)
169               throws AccessPoemException {
170             return ((UploadedImage)g).getUrl_unsafe();
171           }
172 
173           public void setRaw_unsafe(Persistent g, Object raw)
174               throws AccessPoemException {
175             ((UploadedImage)g).setUrl_unsafe((String)raw);
176           }
177 
178           public Object getRaw(Persistent g)
179               throws AccessPoemException {
180             return ((UploadedImage)g).getUrl();
181           }
182 
183           public void setRaw(Persistent g, Object raw)
184               throws AccessPoemException {
185             ((UploadedImage)g).setUrl((String)raw);
186           }
187         });
188 
189     defineColumn(col_height =
190         new Column(this, "height",
191                    new IntegerPoemType(true),
192                    DefinitionSource.dsd) { 
193           public Object getCooked(Persistent g)
194               throws AccessPoemException, PoemException {
195             return ((UploadedImage)g).getHeight();
196           }
197 
198           public void setCooked(Persistent g, Object cooked)
199               throws AccessPoemException, ValidationPoemException {
200             ((UploadedImage)g).setHeight((Integer)cooked);
201           }
202 
203           public Field asField(Persistent g) {
204             return ((UploadedImage)g).getHeightField();
205           }
206 
207           protected DisplayLevel defaultDisplayLevel() {
208             return DisplayLevel.record;
209           }
210 
211           protected Searchability defaultSearchability() {
212             return Searchability.no;
213           }
214 
215           protected int defaultDisplayOrder() {
216             return 2;
217           }
218 
219           protected String defaultDescription() {
220             return "The height of this file if it is an image";
221           }
222 
223           public Object getRaw_unsafe(Persistent g)
224               throws AccessPoemException {
225             return ((UploadedImage)g).getHeight_unsafe();
226           }
227 
228           public void setRaw_unsafe(Persistent g, Object raw)
229               throws AccessPoemException {
230             ((UploadedImage)g).setHeight_unsafe((Integer)raw);
231           }
232 
233           public Object getRaw(Persistent g)
234               throws AccessPoemException {
235             return ((UploadedImage)g).getHeight();
236           }
237 
238           public void setRaw(Persistent g, Object raw)
239               throws AccessPoemException {
240             ((UploadedImage)g).setHeight((Integer)raw);
241           }
242         });
243 
244     defineColumn(col_width =
245         new Column(this, "width",
246                    new IntegerPoemType(true),
247                    DefinitionSource.dsd) { 
248           public Object getCooked(Persistent g)
249               throws AccessPoemException, PoemException {
250             return ((UploadedImage)g).getWidth();
251           }
252 
253           public void setCooked(Persistent g, Object cooked)
254               throws AccessPoemException, ValidationPoemException {
255             ((UploadedImage)g).setWidth((Integer)cooked);
256           }
257 
258           public Field asField(Persistent g) {
259             return ((UploadedImage)g).getWidthField();
260           }
261 
262           protected DisplayLevel defaultDisplayLevel() {
263             return DisplayLevel.record;
264           }
265 
266           protected Searchability defaultSearchability() {
267             return Searchability.no;
268           }
269 
270           protected int defaultDisplayOrder() {
271             return 3;
272           }
273 
274           protected String defaultDescription() {
275             return "The width of this file if it is an image";
276           }
277 
278           public Object getRaw_unsafe(Persistent g)
279               throws AccessPoemException {
280             return ((UploadedImage)g).getWidth_unsafe();
281           }
282 
283           public void setRaw_unsafe(Persistent g, Object raw)
284               throws AccessPoemException {
285             ((UploadedImage)g).setWidth_unsafe((Integer)raw);
286           }
287 
288           public Object getRaw(Persistent g)
289               throws AccessPoemException {
290             return ((UploadedImage)g).getWidth();
291           }
292 
293           public void setRaw(Persistent g, Object raw)
294               throws AccessPoemException {
295             ((UploadedImage)g).setWidth((Integer)raw);
296           }
297         });
298   }
299 
300 
301  /**
302   * Retrieves the <code>Id</code> <code>Column</code> for this 
303   * <code>UploadedImage</code> <code>Table</code>.
304   * 
305   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
306   * @return the id <code>Column</code>
307   */
308   public final Column getIdColumn() {
309     return col_id;
310   }
311 
312 
313  /**
314   * Retrieves the <code>Url</code> <code>Column</code> for this 
315   * <code>UploadedImage</code> <code>Table</code>.
316   * 
317   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
318   * @return the url <code>Column</code>
319   */
320   public final Column getUrlColumn() {
321     return col_url;
322   }
323 
324 
325  /**
326   * Retrieves the <code>Height</code> <code>Column</code> for this 
327   * <code>UploadedImage</code> <code>Table</code>.
328   * 
329   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
330   * @return the height <code>Column</code>
331   */
332   public final Column getHeightColumn() {
333     return col_height;
334   }
335 
336 
337  /**
338   * Retrieves the <code>Width</code> <code>Column</code> for this 
339   * <code>UploadedImage</code> <code>Table</code>.
340   * 
341   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
342   * @return the width <code>Column</code>
343   */
344   public final Column getWidthColumn() {
345     return col_width;
346   }
347 
348 
349  /**
350   * Retrieve the <code>UploadedImage</code> as a <code>UploadedImage</code>.
351   *
352   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
353   * @param troid a Table Row Oject ID
354   * @return the <code>Persistent</code> identified by the <code>troid</code>
355   */
356   public UploadedImage getUploadedImageObject(Integer troid) {
357     return (UploadedImage)getObject(troid);
358   }
359 
360 
361  /**
362   * Retrieve the <code>UploadedImage</code> 
363   * as a <code>UploadedImage</code>.
364   *
365   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
366   * @param troid a Table Row Object ID
367   * @return the <code>Persistent</code> identified   */
368   public UploadedImage getUploadedImageObject(int troid) {
369     return (UploadedImage)getObject(troid);
370   }
371 
372   protected JdbcPersistent _newPersistent() {
373     return new UploadedImage();
374   }
375   protected String defaultDisplayName() {
376     return "Uploaded Image";
377   }
378 
379   protected String defaultDescription() {
380     return "An image uploaded by a user";
381   }
382 
383   protected boolean defaultRememberAllTroids() {
384     return true;
385   }
386 
387   protected Integer defaultCacheLimit() {
388     return new Integer(999999999);
389   }
390 
391   protected String defaultCategory() {
392     return "Data";
393   }
394 
395   protected int defaultDisplayOrder() {
396     return 310;
397   }
398 }
399