1
2
3 package org.melati.poem.test.generated;
4
5
6 import org.melati.poem.AccessPoemException;
7 import org.melati.poem.BooleanPoemType;
8 import org.melati.poem.Capability;
9 import org.melati.poem.Column;
10 import org.melati.poem.Database;
11 import org.melati.poem.DefinitionSource;
12 import org.melati.poem.DisplayLevel;
13 import org.melati.poem.Field;
14 import org.melati.poem.JdbcPersistent;
15 import org.melati.poem.Persistent;
16 import org.melati.poem.PoemException;
17 import org.melati.poem.ReferencePoemType;
18 import org.melati.poem.Searchability;
19 import org.melati.poem.StringPoemType;
20 import org.melati.poem.TroidPoemType;
21 import org.melati.poem.ValidationPoemException;
22 import org.melati.poem.test.EverythingDatabaseTables;
23 import org.melati.poem.test.EverythingTable;
24 import org.melati.poem.test.Protected;
25
26 import org.melati.poem.test.User;
27
28
29
30
31
32
33
34
35 public class ProtectedTableBase<T extends Protected> extends EverythingTable<T> {
36
37 private Column<Integer> col_id = null;
38 private Column<Integer> col_spy = null;
39 private Column<String> col_mission = null;
40 private Column<Integer> col_canRead = null;
41 private Column<Integer> col_canWrite = null;
42 private Column<Integer> col_canDelete = null;
43 private Column<Integer> col_canSelect = null;
44 private Column<Boolean> col_deleted = null;
45
46
47
48
49
50
51
52
53
54
55
56 public ProtectedTableBase(
57 Database database, String name,
58 DefinitionSource definitionSource) throws PoemException {
59 super(database, name, definitionSource);
60 }
61
62
63
64
65
66
67
68
69 public EverythingDatabaseTables getEverythingDatabaseTables() {
70 return (EverythingDatabaseTables)getDatabase();
71 }
72
73
74
75
76
77
78
79 public void init() throws PoemException {
80 super.init();
81 defineColumn(col_id =
82 new Column<Integer>(this, "id",
83 new TroidPoemType(),
84 DefinitionSource.dsd) {
85 public Object getCooked(Persistent g)
86 throws AccessPoemException, PoemException {
87 return ((Protected)g).getId();
88 }
89
90 public void setCooked(Persistent g, Object cooked)
91 throws AccessPoemException, ValidationPoemException {
92 ((Protected)g).setId((Integer)cooked);
93 }
94
95 public Field<Integer> asField(Persistent g) {
96 return ((Protected)g).getIdField();
97 }
98
99 public boolean defaultUserEditable() {
100 return false;
101 }
102
103 public boolean defaultUserCreateable() {
104 return false;
105 }
106
107 public DisplayLevel defaultDisplayLevel() {
108 return DisplayLevel.record;
109 }
110
111 public Searchability defaultSearchability() {
112 return Searchability.no;
113 }
114
115 public int defaultDisplayOrder() {
116 return 0;
117 }
118
119 public Object getRaw_unsafe(Persistent g)
120 throws AccessPoemException {
121 return ((Protected)g).getId_unsafe();
122 }
123
124 public void setRaw_unsafe(Persistent g, Object raw)
125 throws AccessPoemException {
126 ((Protected)g).setId_unsafe((Integer)raw);
127 }
128
129 public Object getRaw(Persistent g)
130 throws AccessPoemException {
131 return ((Protected)g).getId();
132 }
133
134 public void setRaw(Persistent g, Object raw)
135 throws AccessPoemException {
136 ((Protected)g).setId((Integer)raw);
137 }
138 });
139
140 defineColumn(col_spy =
141 new Column<Integer>(this, "spy",
142 new ReferencePoemType(getEverythingDatabaseTables().
143 getUserTable(), false),
144 DefinitionSource.dsd) {
145 public Object getCooked(Persistent g)
146 throws AccessPoemException, PoemException {
147 return ((Protected)g).getSpy();
148 }
149
150 public void setCooked(Persistent g, Object cooked)
151 throws AccessPoemException, ValidationPoemException {
152 ((Protected)g).setSpy((User)cooked);
153 }
154
155 public Field<Integer> asField(Persistent g) {
156 return ((Protected)g).getSpyField();
157 }
158
159 public DisplayLevel defaultDisplayLevel() {
160 return DisplayLevel.primary;
161 }
162
163 public Searchability defaultSearchability() {
164 return Searchability.primary;
165 }
166
167 public Integer defaultDisplayOrderPriority() {
168 return new Integer(1);
169 }
170
171 public int defaultDisplayOrder() {
172 return 1;
173 }
174
175 public String defaultDescription() {
176 return "Spy";
177 }
178
179 public Object getRaw_unsafe(Persistent g)
180 throws AccessPoemException {
181 return ((Protected)g).getSpy_unsafe();
182 }
183
184 public void setRaw_unsafe(Persistent g, Object raw)
185 throws AccessPoemException {
186 ((Protected)g).setSpy_unsafe((Integer)raw);
187 }
188
189 public Object getRaw(Persistent g)
190 throws AccessPoemException {
191 return ((Protected)g).getSpyTroid();
192 }
193
194 public void setRaw(Persistent g, Object raw)
195 throws AccessPoemException {
196 ((Protected)g).setSpyTroid((Integer)raw);
197 }
198 });
199
200 defineColumn(col_mission =
201 new Column<String>(this, "mission",
202 new StringPoemType(false, -1),
203 DefinitionSource.dsd) {
204 public Object getCooked(Persistent g)
205 throws AccessPoemException, PoemException {
206 return ((Protected)g).getMission();
207 }
208
209 public void setCooked(Persistent g, Object cooked)
210 throws AccessPoemException, ValidationPoemException {
211 ((Protected)g).setMission((String)cooked);
212 }
213
214 public Field<String> asField(Persistent g) {
215 return ((Protected)g).getMissionField();
216 }
217
218 public DisplayLevel defaultDisplayLevel() {
219 return DisplayLevel.primary;
220 }
221
222 public Searchability defaultSearchability() {
223 return Searchability.primary;
224 }
225
226 public Integer defaultDisplayOrderPriority() {
227 return new Integer(0);
228 }
229
230 public int defaultDisplayOrder() {
231 return 2;
232 }
233
234 public String defaultDescription() {
235 return "Secret mission";
236 }
237
238 public int defaultWidth() {
239 return 20;
240 }
241
242 public Object getRaw_unsafe(Persistent g)
243 throws AccessPoemException {
244 return ((Protected)g).getMission_unsafe();
245 }
246
247 public void setRaw_unsafe(Persistent g, Object raw)
248 throws AccessPoemException {
249 ((Protected)g).setMission_unsafe((String)raw);
250 }
251
252 public Object getRaw(Persistent g)
253 throws AccessPoemException {
254 return ((Protected)g).getMission();
255 }
256
257 public void setRaw(Persistent g, Object raw)
258 throws AccessPoemException {
259 ((Protected)g).setMission((String)raw);
260 }
261 });
262
263 defineColumn(col_canRead =
264 new Column<Integer>(this, "canRead",
265 new ReferencePoemType(getEverythingDatabaseTables().
266 getCapabilityTable(), true),
267 DefinitionSource.dsd) {
268 public Object getCooked(Persistent g)
269 throws AccessPoemException, PoemException {
270 return ((Protected)g).getCanRead();
271 }
272
273 public void setCooked(Persistent g, Object cooked)
274 throws AccessPoemException, ValidationPoemException {
275 ((Protected)g).setCanRead((Capability)cooked);
276 }
277
278 public Field<Integer> asField(Persistent g) {
279 return ((Protected)g).getCanReadField();
280 }
281
282 public DisplayLevel defaultDisplayLevel() {
283 return DisplayLevel.record;
284 }
285
286 public int defaultDisplayOrder() {
287 return 3;
288 }
289
290 public String defaultDescription() {
291 return "Capability required to read this row ";
292 }
293
294 public Object getRaw_unsafe(Persistent g)
295 throws AccessPoemException {
296 return ((Protected)g).getCanRead_unsafe();
297 }
298
299 public void setRaw_unsafe(Persistent g, Object raw)
300 throws AccessPoemException {
301 ((Protected)g).setCanRead_unsafe((Integer)raw);
302 }
303
304 public Object getRaw(Persistent g)
305 throws AccessPoemException {
306 return ((Protected)g).getCanReadTroid();
307 }
308
309 public void setRaw(Persistent g, Object raw)
310 throws AccessPoemException {
311 ((Protected)g).setCanReadTroid((Integer)raw);
312 }
313 });
314
315 defineColumn(col_canWrite =
316 new Column<Integer>(this, "canWrite",
317 new ReferencePoemType(getEverythingDatabaseTables().
318 getCapabilityTable(), false),
319 DefinitionSource.dsd) {
320 public Object getCooked(Persistent g)
321 throws AccessPoemException, PoemException {
322 return ((Protected)g).getCanWrite();
323 }
324
325 public void setCooked(Persistent g, Object cooked)
326 throws AccessPoemException, ValidationPoemException {
327 ((Protected)g).setCanWrite((Capability)cooked);
328 }
329
330 public Field<Integer> asField(Persistent g) {
331 return ((Protected)g).getCanWriteField();
332 }
333
334 public DisplayLevel defaultDisplayLevel() {
335 return DisplayLevel.record;
336 }
337
338 public int defaultDisplayOrder() {
339 return 4;
340 }
341
342 public String defaultDescription() {
343 return "Capability required to write this row ";
344 }
345
346 public Object getRaw_unsafe(Persistent g)
347 throws AccessPoemException {
348 return ((Protected)g).getCanWrite_unsafe();
349 }
350
351 public void setRaw_unsafe(Persistent g, Object raw)
352 throws AccessPoemException {
353 ((Protected)g).setCanWrite_unsafe((Integer)raw);
354 }
355
356 public Object getRaw(Persistent g)
357 throws AccessPoemException {
358 return ((Protected)g).getCanWriteTroid();
359 }
360
361 public void setRaw(Persistent g, Object raw)
362 throws AccessPoemException {
363 ((Protected)g).setCanWriteTroid((Integer)raw);
364 }
365 });
366
367 defineColumn(col_canDelete =
368 new Column<Integer>(this, "canDelete",
369 new ReferencePoemType(getEverythingDatabaseTables().
370 getCapabilityTable(), false),
371 DefinitionSource.dsd) {
372 public Object getCooked(Persistent g)
373 throws AccessPoemException, PoemException {
374 return ((Protected)g).getCanDelete();
375 }
376
377 public void setCooked(Persistent g, Object cooked)
378 throws AccessPoemException, ValidationPoemException {
379 ((Protected)g).setCanDelete((Capability)cooked);
380 }
381
382 public Field<Integer> asField(Persistent g) {
383 return ((Protected)g).getCanDeleteField();
384 }
385
386 public DisplayLevel defaultDisplayLevel() {
387 return DisplayLevel.record;
388 }
389
390 public int defaultDisplayOrder() {
391 return 5;
392 }
393
394 public String defaultDescription() {
395 return "Capability required to delete this row ";
396 }
397
398 public Object getRaw_unsafe(Persistent g)
399 throws AccessPoemException {
400 return ((Protected)g).getCanDelete_unsafe();
401 }
402
403 public void setRaw_unsafe(Persistent g, Object raw)
404 throws AccessPoemException {
405 ((Protected)g).setCanDelete_unsafe((Integer)raw);
406 }
407
408 public Object getRaw(Persistent g)
409 throws AccessPoemException {
410 return ((Protected)g).getCanDeleteTroid();
411 }
412
413 public void setRaw(Persistent g, Object raw)
414 throws AccessPoemException {
415 ((Protected)g).setCanDeleteTroid((Integer)raw);
416 }
417 });
418
419 defineColumn(col_canSelect =
420 new Column<Integer>(this, "canSelect",
421 new ReferencePoemType(getEverythingDatabaseTables().
422 getCapabilityTable(), true),
423 DefinitionSource.dsd) {
424 public Object getCooked(Persistent g)
425 throws AccessPoemException, PoemException {
426 return ((Protected)g).getCanSelect();
427 }
428
429 public void setCooked(Persistent g, Object cooked)
430 throws AccessPoemException, ValidationPoemException {
431 ((Protected)g).setCanSelect((Capability)cooked);
432 }
433
434 public Field<Integer> asField(Persistent g) {
435 return ((Protected)g).getCanSelectField();
436 }
437
438 public DisplayLevel defaultDisplayLevel() {
439 return DisplayLevel.record;
440 }
441
442 public int defaultDisplayOrder() {
443 return 6;
444 }
445
446 public String defaultDescription() {
447 return "Capability required to select this row ";
448 }
449
450 public Object getRaw_unsafe(Persistent g)
451 throws AccessPoemException {
452 return ((Protected)g).getCanSelect_unsafe();
453 }
454
455 public void setRaw_unsafe(Persistent g, Object raw)
456 throws AccessPoemException {
457 ((Protected)g).setCanSelect_unsafe((Integer)raw);
458 }
459
460 public Object getRaw(Persistent g)
461 throws AccessPoemException {
462 return ((Protected)g).getCanSelectTroid();
463 }
464
465 public void setRaw(Persistent g, Object raw)
466 throws AccessPoemException {
467 ((Protected)g).setCanSelectTroid((Integer)raw);
468 }
469 });
470
471 defineColumn(col_deleted =
472 new Column<Boolean>(this, "deleted",
473 new BooleanPoemType(false),
474 DefinitionSource.dsd) {
475 public Object getCooked(Persistent g)
476 throws AccessPoemException, PoemException {
477 return ((Protected)g).getDeleted();
478 }
479
480 public void setCooked(Persistent g, Object cooked)
481 throws AccessPoemException, ValidationPoemException {
482 ((Protected)g).setDeleted((Boolean)cooked);
483 }
484
485 public Field<Boolean> asField(Persistent g) {
486 return ((Protected)g).getDeletedField();
487 }
488
489 public DisplayLevel defaultDisplayLevel() {
490 return DisplayLevel.record;
491 }
492
493 public int defaultDisplayOrder() {
494 return 7;
495 }
496
497 public String defaultDescription() {
498 return "Whether this record is existant ";
499 }
500
501 public Object getRaw_unsafe(Persistent g)
502 throws AccessPoemException {
503 return ((Protected)g).getDeleted_unsafe();
504 }
505
506 public void setRaw_unsafe(Persistent g, Object raw)
507 throws AccessPoemException {
508 ((Protected)g).setDeleted_unsafe((Boolean)raw);
509 }
510
511 public Object getRaw(Persistent g)
512 throws AccessPoemException {
513 return ((Protected)g).getDeleted();
514 }
515
516 public void setRaw(Persistent g, Object raw)
517 throws AccessPoemException {
518 ((Protected)g).setDeleted((Boolean)raw);
519 }
520 });
521 }
522
523
524
525
526
527
528
529
530
531 public final Column<Integer> getIdColumn() {
532 return col_id;
533 }
534
535
536
537
538
539
540
541
542
543 public final Column<Integer> getSpyColumn() {
544 return col_spy;
545 }
546
547
548
549
550
551
552
553
554
555 public final Column<String> getMissionColumn() {
556 return col_mission;
557 }
558
559
560
561
562
563
564
565
566
567 public final Column<Integer> getCanReadColumn() {
568 return col_canRead;
569 }
570
571
572
573
574
575
576
577
578
579 public final Column<Integer> getCanWriteColumn() {
580 return col_canWrite;
581 }
582
583
584
585
586
587
588
589
590
591 public final Column<Integer> getCanDeleteColumn() {
592 return col_canDelete;
593 }
594
595
596
597
598
599
600
601
602
603 public final Column<Integer> getCanSelectColumn() {
604 return col_canSelect;
605 }
606
607
608
609
610
611
612
613
614
615 public final Column<Boolean> getDeletedColumn() {
616 return col_deleted;
617 }
618
619
620
621
622
623
624
625
626
627 public Protected getProtectedObject(Integer troid) {
628 return (Protected)getObject(troid);
629 }
630
631
632
633
634
635
636
637
638
639 public Protected getProtectedObject(int troid) {
640 return (Protected)getObject(troid);
641 }
642
643 protected JdbcPersistent _newPersistent() {
644 return new Protected();
645 }
646 public String defaultDescription() {
647 return "A protected table";
648 }
649
650 public String defaultCategory() {
651 return "Data";
652 }
653
654 public int defaultDisplayOrder() {
655 return 90;
656 }
657 }
658