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.Sex;
22  
23  
24  /**
25   * Melati POEM generated base class for <code>Table</code> <code>Sex</code>.
26   *
27   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
28   */
29  
30  public class SexTableBase<T extends Sex> extends BibliomaniaTable<T> {
31  
32    private Column<Integer> col_id = null;
33    private Column<String> col_displayname = 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 SexTableBase(
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 ((Sex)g).getId();
77            }
78  
79            public void setCooked(Persistent g, Object cooked)
80                throws AccessPoemException, ValidationPoemException {
81              ((Sex)g).setId((Integer)cooked);
82            }
83  
84            public Field<Integer> asField(Persistent g) {
85              return ((Sex)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.record;
98            }
99  
100           public int defaultDisplayOrder() {
101             return 0;
102           }
103 
104           public Object getRaw_unsafe(Persistent g)
105               throws AccessPoemException {
106             return ((Sex)g).getId_unsafe();
107           }
108 
109           public void setRaw_unsafe(Persistent g, Object raw)
110               throws AccessPoemException {
111             ((Sex)g).setId_unsafe((Integer)raw);
112           }
113 
114           public Object getRaw(Persistent g)
115               throws AccessPoemException {
116             return ((Sex)g).getId();
117           }
118 
119           public void setRaw(Persistent g, Object raw)
120               throws AccessPoemException {
121             ((Sex)g).setId((Integer)raw);
122           }
123         });
124 
125     defineColumn(col_displayname =
126         new Column<String>(this, "displayname",
127                    new StringPoemType(false, -1),
128                    DefinitionSource.dsd) { 
129           public Object getCooked(Persistent g)
130               throws AccessPoemException, PoemException {
131             return ((Sex)g).getDisplayname();
132           }
133 
134           public void setCooked(Persistent g, Object cooked)
135               throws AccessPoemException, ValidationPoemException {
136             ((Sex)g).setDisplayname((String)cooked);
137           }
138 
139           public Field<String> asField(Persistent g) {
140             return ((Sex)g).getDisplaynameField();
141           }
142 
143           public DisplayLevel defaultDisplayLevel() {
144             return DisplayLevel.primary;
145           }
146 
147           public Searchability defaultSearchability() {
148             return Searchability.primary;
149           }
150 
151           public String defaultDisplayName() {
152             return "Display name";
153           }
154 
155           public int defaultDisplayOrder() {
156             return 1;
157           }
158 
159           public String defaultDescription() {
160             return "The sex's name";
161           }
162 
163           public Object getRaw_unsafe(Persistent g)
164               throws AccessPoemException {
165             return ((Sex)g).getDisplayname_unsafe();
166           }
167 
168           public void setRaw_unsafe(Persistent g, Object raw)
169               throws AccessPoemException {
170             ((Sex)g).setDisplayname_unsafe((String)raw);
171           }
172 
173           public Object getRaw(Persistent g)
174               throws AccessPoemException {
175             return ((Sex)g).getDisplayname();
176           }
177 
178           public void setRaw(Persistent g, Object raw)
179               throws AccessPoemException {
180             ((Sex)g).setDisplayname((String)raw);
181           }
182         });
183   }
184 
185 
186  /**
187   * Retrieves the <code>Id</code> <code>Column</code> for this 
188   * <code>Sex</code> <code>Table</code>.
189   * 
190   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
191   * @return the id <code>Column</code>
192   */
193   public final Column<Integer> getIdColumn() {
194     return col_id;
195   }
196 
197 
198  /**
199   * Retrieves the <code>Displayname</code> <code>Column</code> for this 
200   * <code>Sex</code> <code>Table</code>.
201   * 
202   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
203   * @return the displayname <code>Column</code>
204   */
205   public final Column<String> getDisplaynameColumn() {
206     return col_displayname;
207   }
208 
209 
210  /**
211   * Retrieve the <code>Sex</code> as a <code>Sex</code>.
212   *
213   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
214   * @param troid a Table Row Oject ID
215   * @return the <code>Persistent</code> identified by the <code>troid</code>
216   */
217   public Sex getSexObject(Integer troid) {
218     return (Sex)getObject(troid);
219   }
220 
221 
222  /**
223   * Retrieve the <code>Sex</code> 
224   * as a <code>Sex</code>.
225   *
226   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
227   * @param troid a Table Row Object ID
228   * @return the <code>Persistent</code> identified   */
229   public Sex getSexObject(int troid) {
230     return (Sex)getObject(troid);
231   }
232 
233   protected JdbcPersistent _newPersistent() {
234     return new Sex();
235   }
236   public String defaultDescription() {
237     return "A sex of which a user can be";
238   }
239 
240   public boolean defaultRememberAllTroids() {
241     return true;
242   }
243 
244   public String defaultCategory() {
245     return "User";
246   }
247 
248   public int defaultDisplayOrder() {
249     return 2090;
250   }
251 }
252