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.JdbcPersistent;
12  import org.melati.poem.Persistent;
13  import org.melati.poem.PoemException;
14  import org.melati.poem.Searchability;
15  import org.melati.poem.StringPoemType;
16  import org.melati.poem.TroidPoemType;
17  import org.melati.poem.ValidationPoemException;
18  import org.paneris.melati.site.model.SiteDatabaseTables;
19  import org.paneris.melati.site.model.Template;
20  import org.paneris.melati.site.model.UploadedFileTable;
21  
22  
23  /**
24   * Melati POEM generated base class for 
25  <code>Table</code> <code>Template</code>.
26   *
27   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
28   */
29  
30  public class TemplateTableBase extends UploadedFileTable {
31  
32    private Column col_id = null;
33    private Column col_url = 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 TemplateTableBase(
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 SiteDatabaseTables getSiteDatabaseTables() {
59      return (SiteDatabaseTables)getDatabase();
60    }
61  
62    public void init() throws PoemException {
63      super.init();
64      defineColumn(col_id =
65          new Column(this, "id",
66                     new TroidPoemType(),
67                     DefinitionSource.dsd) { 
68            public Object getCooked(Persistent g)
69                throws AccessPoemException, PoemException {
70              return ((Template)g).getId();
71            }
72  
73            public void setCooked(Persistent g, Object cooked)
74                throws AccessPoemException, ValidationPoemException {
75              ((Template)g).setId((Integer)cooked);
76            }
77  
78            public Field asField(Persistent g) {
79              return ((Template)g).getIdField();
80            }
81  
82            protected boolean defaultUserEditable() {
83              return false;
84            }
85  
86            protected boolean defaultUserCreateable() {
87              return false;
88            }
89  
90            protected DisplayLevel defaultDisplayLevel() {
91              return DisplayLevel.record;
92            }
93  
94            protected int defaultDisplayOrder() {
95              return 0;
96            }
97  
98            public Object getRaw_unsafe(Persistent g)
99                throws AccessPoemException {
100             return ((Template)g).getId_unsafe();
101           }
102 
103           public void setRaw_unsafe(Persistent g, Object raw)
104               throws AccessPoemException {
105             ((Template)g).setId_unsafe((Integer)raw);
106           }
107 
108           public Object getRaw(Persistent g)
109               throws AccessPoemException {
110             return ((Template)g).getId();
111           }
112 
113           public void setRaw(Persistent g, Object raw)
114               throws AccessPoemException {
115             ((Template)g).setId((Integer)raw);
116           }
117         });
118 
119     defineColumn(col_url =
120         new Column(this, "url",
121                    new StringPoemType(false, -1),
122                    DefinitionSource.dsd) { 
123           public Object getCooked(Persistent g)
124               throws AccessPoemException, PoemException {
125             return ((Template)g).getUrl();
126           }
127 
128           public void setCooked(Persistent g, Object cooked)
129               throws AccessPoemException, ValidationPoemException {
130             ((Template)g).setUrl((String)cooked);
131           }
132 
133           public Field asField(Persistent g) {
134             return ((Template)g).getUrlField();
135           }
136 
137           protected DisplayLevel defaultDisplayLevel() {
138             return DisplayLevel.primary;
139           }
140 
141           protected Searchability defaultSearchability() {
142             return Searchability.yes;
143           }
144 
145           protected Integer defaultDisplayOrderPriority() {
146             return new Integer(0);
147           }
148 
149           protected int defaultDisplayOrder() {
150             return 1;
151           }
152 
153           protected String defaultDescription() {
154             return "Key by which template engine can locate template, no need for extension";
155           }
156 
157           protected int defaultWidth() {
158             return 40;
159           }
160 
161           protected String defaultRenderinfo() {
162             return "UploadURL";
163           }
164 
165           public Object getRaw_unsafe(Persistent g)
166               throws AccessPoemException {
167             return ((Template)g).getUrl_unsafe();
168           }
169 
170           public void setRaw_unsafe(Persistent g, Object raw)
171               throws AccessPoemException {
172             ((Template)g).setUrl_unsafe((String)raw);
173           }
174 
175           public Object getRaw(Persistent g)
176               throws AccessPoemException {
177             return ((Template)g).getUrl();
178           }
179 
180           public void setRaw(Persistent g, Object raw)
181               throws AccessPoemException {
182             ((Template)g).setUrl((String)raw);
183           }
184         });
185   }
186 
187 
188  /**
189   * Retrieves the <code>Id</code> <code>Column</code> for this 
190   * <code>Template</code> <code>Table</code>.
191   * 
192   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
193   * @return the id <code>Column</code>
194   */
195   public final Column getIdColumn() {
196     return col_id;
197   }
198 
199 
200  /**
201   * Retrieves the <code>Url</code> <code>Column</code> for this 
202   * <code>Template</code> <code>Table</code>.
203   * 
204   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
205   * @return the url <code>Column</code>
206   */
207   public final Column getUrlColumn() {
208     return col_url;
209   }
210 
211 
212  /**
213   * Retrieve the <code>Template</code> as a <code>Template</code>.
214   *
215   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
216   * @param troid a Table Row Oject ID
217   * @return the <code>Persistent</code> identified by the <code>troid</code>
218   */
219   public Template getTemplateObject(Integer troid) {
220     return (Template)getObject(troid);
221   }
222 
223 
224  /**
225   * Retrieve the <code>Template</code> 
226   * as a <code>Template</code>.
227   *
228   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
229   * @param troid a Table Row Object ID
230   * @return the <code>Persistent</code> identified   */
231   public Template getTemplateObject(int troid) {
232     return (Template)getObject(troid);
233   }
234 
235   protected JdbcPersistent _newPersistent() {
236     return new Template();
237   }
238   protected String defaultDisplayName() {
239     return "Template";
240   }
241 
242   protected String defaultDescription() {
243     return "A page template, used to control HTML fragment layout";
244   }
245 
246   protected boolean defaultRememberAllTroids() {
247     return true;
248   }
249 
250   protected String defaultCategory() {
251     return "Data";
252   }
253 
254   protected int defaultDisplayOrder() {
255     return 600;
256   }
257 }
258