1
2
3 package org.melati.example.contacts.generated;
4
5 import java.sql.Date;
6 import org.melati.example.contacts.Contact;
7 import org.melati.example.contacts.ContactsDatabaseTables;
8 import org.melati.example.contacts.ContactsTable;
9 import org.melati.poem.AccessPoemException;
10 import org.melati.poem.Column;
11 import org.melati.poem.Database;
12 import org.melati.poem.DatePoemType;
13 import org.melati.poem.DefinitionSource;
14 import org.melati.poem.DisplayLevel;
15 import org.melati.poem.Field;
16 import org.melati.poem.IntegerPoemType;
17 import org.melati.poem.JdbcPersistent;
18 import org.melati.poem.Persistent;
19 import org.melati.poem.PoemException;
20 import org.melati.poem.ReferencePoemType;
21 import org.melati.poem.Searchability;
22 import org.melati.poem.StringPoemType;
23 import org.melati.poem.TroidPoemType;
24 import org.melati.poem.User;
25 import org.melati.poem.ValidationPoemException;
26
27
28
29
30
31
32
33
34
35 public class ContactTableBase extends ContactsTable {
36
37 private Column col_id = null;
38 private Column col_name = null;
39 private Column col_owner = null;
40 private Column col_address = null;
41 private Column col_updates = null;
42 private Column col_lastupdated = null;
43 private Column col_lastupdateuser = null;
44
45
46
47
48
49
50
51
52
53
54
55 public ContactTableBase(
56 Database database, String name,
57 DefinitionSource definitionSource) throws PoemException {
58 super(database, name, definitionSource);
59 }
60
61
62
63
64
65
66
67
68 public ContactsDatabaseTables getContactsDatabaseTables() {
69 return (ContactsDatabaseTables)getDatabase();
70 }
71
72 public void init() throws PoemException {
73 super.init();
74 defineColumn(col_id =
75 new Column(this, "id",
76 new TroidPoemType(),
77 DefinitionSource.dsd) {
78 public Object getCooked(Persistent g)
79 throws AccessPoemException, PoemException {
80 return ((Contact)g).getId();
81 }
82
83 public void setCooked(Persistent g, Object cooked)
84 throws AccessPoemException, ValidationPoemException {
85 ((Contact)g).setId((Integer)cooked);
86 }
87
88 public Field asField(Persistent g) {
89 return ((Contact)g).getIdField();
90 }
91
92 protected boolean defaultUserEditable() {
93 return false;
94 }
95
96 protected boolean defaultUserCreateable() {
97 return false;
98 }
99
100 protected DisplayLevel defaultDisplayLevel() {
101 return DisplayLevel.record;
102 }
103
104 protected Searchability defaultSearchability() {
105 return Searchability.no;
106 }
107
108 protected int defaultDisplayOrder() {
109 return 0;
110 }
111
112 public Object getRaw_unsafe(Persistent g)
113 throws AccessPoemException {
114 return ((Contact)g).getId_unsafe();
115 }
116
117 public void setRaw_unsafe(Persistent g, Object raw)
118 throws AccessPoemException {
119 ((Contact)g).setId_unsafe((Integer)raw);
120 }
121
122 public Object getRaw(Persistent g)
123 throws AccessPoemException {
124 return ((Contact)g).getId();
125 }
126
127 public void setRaw(Persistent g, Object raw)
128 throws AccessPoemException {
129 ((Contact)g).setId((Integer)raw);
130 }
131 });
132
133 defineColumn(col_name =
134 new Column(this, "name",
135 new StringPoemType(false, -1),
136 DefinitionSource.dsd) {
137 public Object getCooked(Persistent g)
138 throws AccessPoemException, PoemException {
139 return ((Contact)g).getName();
140 }
141
142 public void setCooked(Persistent g, Object cooked)
143 throws AccessPoemException, ValidationPoemException {
144 ((Contact)g).setName((String)cooked);
145 }
146
147 public Field asField(Persistent g) {
148 return ((Contact)g).getNameField();
149 }
150
151 protected DisplayLevel defaultDisplayLevel() {
152 return DisplayLevel.primary;
153 }
154
155 protected Searchability defaultSearchability() {
156 return Searchability.primary;
157 }
158
159 protected Integer defaultDisplayOrderPriority() {
160 return new Integer(0);
161 }
162
163 protected int defaultDisplayOrder() {
164 return 1;
165 }
166
167 protected String defaultDescription() {
168 return "Contact Name";
169 }
170
171 protected int defaultWidth() {
172 return 20;
173 }
174
175 public Object getRaw_unsafe(Persistent g)
176 throws AccessPoemException {
177 return ((Contact)g).getName_unsafe();
178 }
179
180 public void setRaw_unsafe(Persistent g, Object raw)
181 throws AccessPoemException {
182 ((Contact)g).setName_unsafe((String)raw);
183 }
184
185 public Object getRaw(Persistent g)
186 throws AccessPoemException {
187 return ((Contact)g).getName();
188 }
189
190 public void setRaw(Persistent g, Object raw)
191 throws AccessPoemException {
192 ((Contact)g).setName((String)raw);
193 }
194 });
195
196 defineColumn(col_owner =
197 new Column(this, "owner",
198 new ReferencePoemType(getContactsDatabaseTables().
199 getContactTable(), true),
200 DefinitionSource.dsd) {
201 public Object getCooked(Persistent g)
202 throws AccessPoemException, PoemException {
203 return ((Contact)g).getOwner();
204 }
205
206 public void setCooked(Persistent g, Object cooked)
207 throws AccessPoemException, ValidationPoemException {
208 ((Contact)g).setOwner((Contact)cooked);
209 }
210
211 public Field asField(Persistent g) {
212 return ((Contact)g).getOwnerField();
213 }
214
215 protected DisplayLevel defaultDisplayLevel() {
216 return DisplayLevel.summary;
217 }
218
219 protected Searchability defaultSearchability() {
220 return Searchability.yes;
221 }
222
223 protected Integer defaultDisplayOrderPriority() {
224 return new Integer(1);
225 }
226
227 protected int defaultDisplayOrder() {
228 return 2;
229 }
230
231 protected String defaultDescription() {
232 return "Contact who owns this contact";
233 }
234
235 public Object getRaw_unsafe(Persistent g)
236 throws AccessPoemException {
237 return ((Contact)g).getOwner_unsafe();
238 }
239
240 public void setRaw_unsafe(Persistent g, Object raw)
241 throws AccessPoemException {
242 ((Contact)g).setOwner_unsafe((Integer)raw);
243 }
244
245 public Object getRaw(Persistent g)
246 throws AccessPoemException {
247 return ((Contact)g).getOwnerTroid();
248 }
249
250 public void setRaw(Persistent g, Object raw)
251 throws AccessPoemException {
252 ((Contact)g).setOwnerTroid((Integer)raw);
253 }
254 });
255
256 defineColumn(col_address =
257 new Column(this, "address",
258 new StringPoemType(false, -1),
259 DefinitionSource.dsd) {
260 public Object getCooked(Persistent g)
261 throws AccessPoemException, PoemException {
262 return ((Contact)g).getAddress();
263 }
264
265 public void setCooked(Persistent g, Object cooked)
266 throws AccessPoemException, ValidationPoemException {
267 ((Contact)g).setAddress((String)cooked);
268 }
269
270 public Field asField(Persistent g) {
271 return ((Contact)g).getAddressField();
272 }
273
274 protected DisplayLevel defaultDisplayLevel() {
275 return DisplayLevel.record;
276 }
277
278 protected Searchability defaultSearchability() {
279 return Searchability.no;
280 }
281
282 protected int defaultDisplayOrder() {
283 return 3;
284 }
285
286 protected String defaultDescription() {
287 return "Contact Address";
288 }
289
290 protected int defaultWidth() {
291 return 40;
292 }
293
294 protected int defaultHeight() {
295 return 5;
296 }
297
298 public Object getRaw_unsafe(Persistent g)
299 throws AccessPoemException {
300 return ((Contact)g).getAddress_unsafe();
301 }
302
303 public void setRaw_unsafe(Persistent g, Object raw)
304 throws AccessPoemException {
305 ((Contact)g).setAddress_unsafe((String)raw);
306 }
307
308 public Object getRaw(Persistent g)
309 throws AccessPoemException {
310 return ((Contact)g).getAddress();
311 }
312
313 public void setRaw(Persistent g, Object raw)
314 throws AccessPoemException {
315 ((Contact)g).setAddress((String)raw);
316 }
317 });
318
319 defineColumn(col_updates =
320 new Column(this, "updates",
321 new IntegerPoemType(false),
322 DefinitionSource.dsd) {
323 public Object getCooked(Persistent g)
324 throws AccessPoemException, PoemException {
325 return ((Contact)g).getUpdates();
326 }
327
328 public void setCooked(Persistent g, Object cooked)
329 throws AccessPoemException, ValidationPoemException {
330 ((Contact)g).setUpdates((Integer)cooked);
331 }
332
333 public Field asField(Persistent g) {
334 return ((Contact)g).getUpdatesField();
335 }
336
337 protected boolean defaultUserEditable() {
338 return false;
339 }
340
341 protected boolean defaultUserCreateable() {
342 return false;
343 }
344
345 protected DisplayLevel defaultDisplayLevel() {
346 return DisplayLevel.record;
347 }
348
349 protected Searchability defaultSearchability() {
350 return Searchability.no;
351 }
352
353 protected int defaultDisplayOrder() {
354 return 4;
355 }
356
357 protected String defaultDescription() {
358 return "How many times has this record been updated?";
359 }
360
361 protected int defaultWidth() {
362 return 5;
363 }
364
365 public Object getRaw_unsafe(Persistent g)
366 throws AccessPoemException {
367 return ((Contact)g).getUpdates_unsafe();
368 }
369
370 public void setRaw_unsafe(Persistent g, Object raw)
371 throws AccessPoemException {
372 ((Contact)g).setUpdates_unsafe((Integer)raw);
373 }
374
375 public Object getRaw(Persistent g)
376 throws AccessPoemException {
377 return ((Contact)g).getUpdates();
378 }
379
380 public void setRaw(Persistent g, Object raw)
381 throws AccessPoemException {
382 ((Contact)g).setUpdates((Integer)raw);
383 }
384 });
385
386 defineColumn(col_lastupdated =
387 new Column(this, "lastupdated",
388 new DatePoemType(false),
389 DefinitionSource.dsd) {
390 public Object getCooked(Persistent g)
391 throws AccessPoemException, PoemException {
392 return ((Contact)g).getLastupdated();
393 }
394
395 public void setCooked(Persistent g, Object cooked)
396 throws AccessPoemException, ValidationPoemException {
397 ((Contact)g).setLastupdated((Date)cooked);
398 }
399
400 public Field asField(Persistent g) {
401 return ((Contact)g).getLastupdatedField();
402 }
403
404 protected boolean defaultUserEditable() {
405 return false;
406 }
407
408 protected boolean defaultUserCreateable() {
409 return false;
410 }
411
412 protected DisplayLevel defaultDisplayLevel() {
413 return DisplayLevel.record;
414 }
415
416 protected Searchability defaultSearchability() {
417 return Searchability.no;
418 }
419
420 protected int defaultDisplayOrder() {
421 return 5;
422 }
423
424 protected String defaultDescription() {
425 return "When was this last updated?";
426 }
427
428 protected String defaultRenderinfo() {
429 return "org.melati.poem.DatePoemType-dropdown";
430 }
431
432 public Object getRaw_unsafe(Persistent g)
433 throws AccessPoemException {
434 return ((Contact)g).getLastupdated_unsafe();
435 }
436
437 public void setRaw_unsafe(Persistent g, Object raw)
438 throws AccessPoemException {
439 ((Contact)g).setLastupdated_unsafe((Date)raw);
440 }
441
442 public Object getRaw(Persistent g)
443 throws AccessPoemException {
444 return ((Contact)g).getLastupdated();
445 }
446
447 public void setRaw(Persistent g, Object raw)
448 throws AccessPoemException {
449 ((Contact)g).setLastupdated((Date)raw);
450 }
451 });
452
453 defineColumn(col_lastupdateuser =
454 new Column(this, "lastupdateuser",
455 new ReferencePoemType(getContactsDatabaseTables().
456 getUserTable(), false),
457 DefinitionSource.dsd) {
458 public Object getCooked(Persistent g)
459 throws AccessPoemException, PoemException {
460 return ((Contact)g).getLastupdateuser();
461 }
462
463 public void setCooked(Persistent g, Object cooked)
464 throws AccessPoemException, ValidationPoemException {
465 ((Contact)g).setLastupdateuser((User)cooked);
466 }
467
468 public Field asField(Persistent g) {
469 return ((Contact)g).getLastupdateuserField();
470 }
471
472 protected boolean defaultUserEditable() {
473 return false;
474 }
475
476 protected boolean defaultUserCreateable() {
477 return false;
478 }
479
480 protected DisplayLevel defaultDisplayLevel() {
481 return DisplayLevel.record;
482 }
483
484 protected Searchability defaultSearchability() {
485 return Searchability.yes;
486 }
487
488 protected int defaultDisplayOrder() {
489 return 6;
490 }
491
492 protected String defaultDescription() {
493 return "Who last updated this?";
494 }
495
496 public Object getRaw_unsafe(Persistent g)
497 throws AccessPoemException {
498 return ((Contact)g).getLastupdateuser_unsafe();
499 }
500
501 public void setRaw_unsafe(Persistent g, Object raw)
502 throws AccessPoemException {
503 ((Contact)g).setLastupdateuser_unsafe((Integer)raw);
504 }
505
506 public Object getRaw(Persistent g)
507 throws AccessPoemException {
508 return ((Contact)g).getLastupdateuserTroid();
509 }
510
511 public void setRaw(Persistent g, Object raw)
512 throws AccessPoemException {
513 ((Contact)g).setLastupdateuserTroid((Integer)raw);
514 }
515 });
516 }
517
518
519
520
521
522
523
524
525
526 public final Column getIdColumn() {
527 return col_id;
528 }
529
530
531
532
533
534
535
536
537
538 public final Column getNameColumn() {
539 return col_name;
540 }
541
542
543
544
545
546
547
548
549
550 public final Column getOwnerColumn() {
551 return col_owner;
552 }
553
554
555
556
557
558
559
560
561
562 public final Column getAddressColumn() {
563 return col_address;
564 }
565
566
567
568
569
570
571
572
573
574 public final Column getUpdatesColumn() {
575 return col_updates;
576 }
577
578
579
580
581
582
583
584
585
586 public final Column getLastupdatedColumn() {
587 return col_lastupdated;
588 }
589
590
591
592
593
594
595
596
597
598 public final Column getLastupdateuserColumn() {
599 return col_lastupdateuser;
600 }
601
602
603
604
605
606
607
608
609
610 public Contact getContactObject(Integer troid) {
611 return (Contact)getObject(troid);
612 }
613
614
615
616
617
618
619
620
621
622 public Contact getContactObject(int troid) {
623 return (Contact)getObject(troid);
624 }
625
626 protected JdbcPersistent _newPersistent() {
627 return new Contact();
628 }
629 protected String defaultDescription() {
630 return "A Contact";
631 }
632
633 protected String defaultCategory() {
634 return "Data";
635 }
636
637 protected int defaultDisplayOrder() {
638 return 10;
639 }
640 }
641