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.Searchability;
16  import org.melati.poem.StringPoemType;
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.Download;
22  
23  
24  /**
25   * Melati POEM generated base class for <code>Table</code> <code>Download</code>.
26   *
27   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
28   */
29  
30  public class DownloadTableBase<T extends Download> extends BibliomaniaTable<T> {
31  
32    private Column<Integer> col_id = null;
33    private Column<String> col_filename = 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 DownloadTableBase(
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 BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
59      return (BibliomaniaDatabaseTables)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 ((Download)g).getId();
77            }
78  
79            public void setCooked(Persistent g, Object cooked)
80                throws AccessPoemException, ValidationPoemException {
81              ((Download)g).setId((Integer)cooked);
82            }
83  
84            public Field<Integer> asField(Persistent g) {
85              return ((Download)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.no;
102           }
103 
104           public int defaultDisplayOrder() {
105             return 0;
106           }
107 
108           public Object getRaw_unsafe(Persistent g)
109               throws AccessPoemException {
110             return ((Download)g).getId_unsafe();
111           }
112 
113           public void setRaw_unsafe(Persistent g, Object raw)
114               throws AccessPoemException {
115             ((Download)g).setId_unsafe((Integer)raw);
116           }
117 
118           public Object getRaw(Persistent g)
119               throws AccessPoemException {
120             return ((Download)g).getId();
121           }
122 
123           public void setRaw(Persistent g, Object raw)
124               throws AccessPoemException {
125             ((Download)g).setId((Integer)raw);
126           }
127         });
128 
129     defineColumn(col_filename =
130         new Column<String>(this, "filename",
131                    new StringPoemType(true, -1),
132                    DefinitionSource.dsd) { 
133           public Object getCooked(Persistent g)
134               throws AccessPoemException, PoemException {
135             return ((Download)g).getFilename();
136           }
137 
138           public void setCooked(Persistent g, Object cooked)
139               throws AccessPoemException, ValidationPoemException {
140             ((Download)g).setFilename((String)cooked);
141           }
142 
143           public Field<String> asField(Persistent g) {
144             return ((Download)g).getFilenameField();
145           }
146 
147           public DisplayLevel defaultDisplayLevel() {
148             return DisplayLevel.primary;
149           }
150 
151           public Searchability defaultSearchability() {
152             return Searchability.yes;
153           }
154 
155           public String defaultDisplayName() {
156             return "File Name";
157           }
158 
159           public int defaultDisplayOrder() {
160             return 1;
161           }
162 
163           public String defaultDescription() {
164             return "A file which can be downloaded";
165           }
166 
167           public int defaultWidth() {
168             return 40;
169           }
170 
171           public Object getRaw_unsafe(Persistent g)
172               throws AccessPoemException {
173             return ((Download)g).getFilename_unsafe();
174           }
175 
176           public void setRaw_unsafe(Persistent g, Object raw)
177               throws AccessPoemException {
178             ((Download)g).setFilename_unsafe((String)raw);
179           }
180 
181           public Object getRaw(Persistent g)
182               throws AccessPoemException {
183             return ((Download)g).getFilename();
184           }
185 
186           public void setRaw(Persistent g, Object raw)
187               throws AccessPoemException {
188             ((Download)g).setFilename((String)raw);
189           }
190         });
191   }
192 
193 
194  /**
195   * Retrieves the <code>Id</code> <code>Column</code> for this 
196   * <code>Download</code> <code>Table</code>.
197   * 
198   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
199   * @return the id <code>Column</code>
200   */
201   public final Column<Integer> getIdColumn() {
202     return col_id;
203   }
204 
205 
206  /**
207   * Retrieves the <code>Filename</code> <code>Column</code> for this 
208   * <code>Download</code> <code>Table</code>.
209   * 
210   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
211   * @return the filename <code>Column</code>
212   */
213   public final Column<String> getFilenameColumn() {
214     return col_filename;
215   }
216 
217 
218  /**
219   * Retrieve the <code>Download</code> as a <code>Download</code>.
220   *
221   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
222   * @param troid a Table Row Oject ID
223   * @return the <code>Persistent</code> identified by the <code>troid</code>
224   */
225   public Download getDownloadObject(Integer troid) {
226     return (Download)getObject(troid);
227   }
228 
229 
230  /**
231   * Retrieve the <code>Download</code> 
232   * as a <code>Download</code>.
233   *
234   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
235   * @param troid a Table Row Object ID
236   * @return the <code>Persistent</code> identified   */
237   public Download getDownloadObject(int troid) {
238     return (Download)getObject(troid);
239   }
240 
241   protected JdbcPersistent _newPersistent() {
242     return new Download();
243   }
244   public String defaultDisplayName() {
245     return "Download";
246   }
247 
248   public String defaultDescription() {
249     return "A downloadable file";
250   }
251 
252   public Integer defaultCacheLimit() {
253     return new Integer(999999999);
254   }
255 
256   public String defaultCategory() {
257     return "Shop";
258   }
259 
260   public int defaultDisplayOrder() {
261     return 1240;
262   }
263 }
264