1
2
3 package org.paneris.bibliomania.generated;
4
5
6 import org.melati.poem.AccessPoemException;
7 import org.melati.poem.Capability;
8 import org.melati.poem.Column;
9 import org.melati.poem.Database;
10 import org.melati.poem.DefinitionSource;
11 import org.melati.poem.DisplayLevel;
12 import org.melati.poem.Field;
13 import org.melati.poem.JdbcPersistent;
14 import org.melati.poem.Persistent;
15 import org.melati.poem.PoemException;
16 import org.melati.poem.ReferencePoemType;
17 import org.melati.poem.Searchability;
18 import org.melati.poem.StringPoemType;
19 import org.melati.poem.TroidPoemType;
20 import org.melati.poem.ValidationPoemException;
21 import org.paneris.bibliomania.BibliomaniaDatabaseTables;
22 import org.paneris.bibliomania.Section;
23 import org.paneris.bibliomania.SectionGroup;
24 import org.paneris.bibliomania.UnitTable;
25
26
27
28
29
30
31
32
33 public class SectionTableBase<T extends Section> extends UnitTable<T> {
34
35 private Column<Integer> col_id = null;
36 private Column<String> col_displayname = null;
37 private Column<Integer> col_group = null;
38 private Column<Integer> col_defaultcanreadcontent = null;
39
40
41
42
43
44
45
46
47
48
49
50 public SectionTableBase(
51 Database database, String name,
52 DefinitionSource definitionSource) throws PoemException {
53 super(database, name, definitionSource);
54 }
55
56
57
58
59
60
61
62
63 public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
64 return (BibliomaniaDatabaseTables)getDatabase();
65 }
66
67
68
69
70
71
72
73 public void init() throws PoemException {
74 super.init();
75 defineColumn(col_id =
76 new Column<Integer>(this, "id",
77 new TroidPoemType(),
78 DefinitionSource.dsd) {
79 public Object getCooked(Persistent g)
80 throws AccessPoemException, PoemException {
81 return ((Section)g).getId();
82 }
83
84 public void setCooked(Persistent g, Object cooked)
85 throws AccessPoemException, ValidationPoemException {
86 ((Section)g).setId((Integer)cooked);
87 }
88
89 public Field<Integer> asField(Persistent g) {
90 return ((Section)g).getIdField();
91 }
92
93 public boolean defaultUserEditable() {
94 return false;
95 }
96
97 public boolean defaultUserCreateable() {
98 return false;
99 }
100
101 public int defaultDisplayOrder() {
102 return 0;
103 }
104
105 public Object getRaw_unsafe(Persistent g)
106 throws AccessPoemException {
107 return ((Section)g).getId_unsafe();
108 }
109
110 public void setRaw_unsafe(Persistent g, Object raw)
111 throws AccessPoemException {
112 ((Section)g).setId_unsafe((Integer)raw);
113 }
114
115 public Object getRaw(Persistent g)
116 throws AccessPoemException {
117 return ((Section)g).getId();
118 }
119
120 public void setRaw(Persistent g, Object raw)
121 throws AccessPoemException {
122 ((Section)g).setId((Integer)raw);
123 }
124 });
125
126 defineColumn(col_displayname =
127 new Column<String>(this, "displayname",
128 new StringPoemType(false, -1),
129 DefinitionSource.dsd) {
130 public Object getCooked(Persistent g)
131 throws AccessPoemException, PoemException {
132 return ((Section)g).getDisplayname();
133 }
134
135 public void setCooked(Persistent g, Object cooked)
136 throws AccessPoemException, ValidationPoemException {
137 ((Section)g).setDisplayname((String)cooked);
138 }
139
140 public Field<String> asField(Persistent g) {
141 return ((Section)g).getDisplaynameField();
142 }
143
144 public DisplayLevel defaultDisplayLevel() {
145 return DisplayLevel.primary;
146 }
147
148 public Integer defaultDisplayOrderPriority() {
149 return new Integer(1);
150 }
151
152 public String defaultDisplayName() {
153 return "Display name";
154 }
155
156 public int defaultDisplayOrder() {
157 return 1;
158 }
159
160 public String defaultDescription() {
161 return "A human-readable name for the section";
162 }
163
164 public boolean defaultUnique() {
165 return true;
166 }
167
168 public Object getRaw_unsafe(Persistent g)
169 throws AccessPoemException {
170 return ((Section)g).getDisplayname_unsafe();
171 }
172
173 public void setRaw_unsafe(Persistent g, Object raw)
174 throws AccessPoemException {
175 ((Section)g).setDisplayname_unsafe((String)raw);
176 }
177
178 public Object getRaw(Persistent g)
179 throws AccessPoemException {
180 return ((Section)g).getDisplayname();
181 }
182
183 public void setRaw(Persistent g, Object raw)
184 throws AccessPoemException {
185 ((Section)g).setDisplayname((String)raw);
186 }
187 });
188
189 defineColumn(col_group =
190 new Column<Integer>(this, "group",
191 new ReferencePoemType(getBibliomaniaDatabaseTables().
192 getSectionGroupTable(), false),
193 DefinitionSource.dsd) {
194 public Object getCooked(Persistent g)
195 throws AccessPoemException, PoemException {
196 return ((Section)g).getGroup();
197 }
198
199 public void setCooked(Persistent g, Object cooked)
200 throws AccessPoemException, ValidationPoemException {
201 ((Section)g).setGroup((SectionGroup)cooked);
202 }
203
204 public Field<Integer> asField(Persistent g) {
205 return ((Section)g).getGroupField();
206 }
207
208 public Searchability defaultSearchability() {
209 return Searchability.primary;
210 }
211
212 public Integer defaultDisplayOrderPriority() {
213 return new Integer(0);
214 }
215
216 public int defaultDisplayOrder() {
217 return 2;
218 }
219
220 public String defaultDescription() {
221 return "The group in which the category belongs";
222 }
223
224 public Object getRaw_unsafe(Persistent g)
225 throws AccessPoemException {
226 return ((Section)g).getGroup_unsafe();
227 }
228
229 public void setRaw_unsafe(Persistent g, Object raw)
230 throws AccessPoemException {
231 ((Section)g).setGroup_unsafe((Integer)raw);
232 }
233
234 public Object getRaw(Persistent g)
235 throws AccessPoemException {
236 return ((Section)g).getGroupTroid();
237 }
238
239 public void setRaw(Persistent g, Object raw)
240 throws AccessPoemException {
241 ((Section)g).setGroupTroid((Integer)raw);
242 }
243 });
244
245 defineColumn(col_defaultcanreadcontent =
246 new Column<Integer>(this, "defaultcanreadcontent",
247 new ReferencePoemType(getBibliomaniaDatabaseTables().
248 getCapabilityTable(), true),
249 DefinitionSource.dsd) {
250 public Object getCooked(Persistent g)
251 throws AccessPoemException, PoemException {
252 return ((Section)g).getDefaultcanreadcontent();
253 }
254
255 public void setCooked(Persistent g, Object cooked)
256 throws AccessPoemException, ValidationPoemException {
257 ((Section)g).setDefaultcanreadcontent((Capability)cooked);
258 }
259
260 public Field<Integer> asField(Persistent g) {
261 return ((Section)g).getDefaultcanreadcontentField();
262 }
263
264 public DisplayLevel defaultDisplayLevel() {
265 return DisplayLevel.record;
266 }
267
268 public Searchability defaultSearchability() {
269 return Searchability.no;
270 }
271
272 public String defaultDisplayName() {
273 return "Default `Read content' capability";
274 }
275
276 public int defaultDisplayOrder() {
277 return 3;
278 }
279
280 public String defaultDescription() {
281 return "The capability required for reading books in the section, unless overridden in the book itself";
282 }
283
284 public Object getRaw_unsafe(Persistent g)
285 throws AccessPoemException {
286 return ((Section)g).getDefaultcanreadcontent_unsafe();
287 }
288
289 public void setRaw_unsafe(Persistent g, Object raw)
290 throws AccessPoemException {
291 ((Section)g).setDefaultcanreadcontent_unsafe((Integer)raw);
292 }
293
294 public Object getRaw(Persistent g)
295 throws AccessPoemException {
296 return ((Section)g).getDefaultcanreadcontentTroid();
297 }
298
299 public void setRaw(Persistent g, Object raw)
300 throws AccessPoemException {
301 ((Section)g).setDefaultcanreadcontentTroid((Integer)raw);
302 }
303 });
304 }
305
306
307
308
309
310
311
312
313
314 public final Column<Integer> getIdColumn() {
315 return col_id;
316 }
317
318
319
320
321
322
323
324
325
326 public final Column<String> getDisplaynameColumn() {
327 return col_displayname;
328 }
329
330
331
332
333
334
335
336
337
338 public final Column<Integer> getGroupColumn() {
339 return col_group;
340 }
341
342
343
344
345
346
347
348
349
350 public final Column<Integer> getDefaultcanreadcontentColumn() {
351 return col_defaultcanreadcontent;
352 }
353
354
355
356
357
358
359
360
361
362 public Section getSectionObject(Integer troid) {
363 return (Section)getObject(troid);
364 }
365
366
367
368
369
370
371
372
373
374 public Section getSectionObject(int troid) {
375 return (Section)getObject(troid);
376 }
377
378 protected JdbcPersistent _newPersistent() {
379 return new Section();
380 }
381 public String defaultDescription() {
382 return "A category under which a book or other work can fall";
383 }
384
385 public boolean defaultRememberAllTroids() {
386 return true;
387 }
388
389 public int defaultDisplayOrder() {
390 return 200;
391 }
392 }
393