1 package org.paneris.bibliomania;
2
3
4 import java.sql.ResultSet;
5
6 import org.paneris.bibliomania.generated.BoardTypeTableBase;
7 import org.melati.poem.DefinitionSource;
8 import org.melati.poem.Database;
9 import org.melati.poem.PoemException;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public class BoardTypeTable<T extends BoardType> extends BoardTypeTableBase<BoardType> {
26
27
28
29
30
31
32
33
34
35
36 public BoardTypeTable(
37 Database database, String name,
38 DefinitionSource definitionSource) throws PoemException {
39 super(database, name, definitionSource);
40 }
41
42
43
44 protected BoardType general;
45 protected BoardType sectionGroup;
46 protected BoardType section;
47 protected BoardType author;
48 protected BoardType book;
49 protected BoardType chapter;
50
51
52
53
54 public synchronized void unifyWithDB(ResultSet colDescs)
55 throws PoemException {
56 super.unifyWithDB(colDescs,"id");
57 general = ensure("General","Top level boards");
58 sectionGroup = ensure("SectionGroup","SectionGroup messageboard");
59 section = ensure("Section","Section messageboard");
60 author = ensure("Author","Author messageboard");
61 book = ensure("Book","Book messageboard");
62 chapter = ensure("Chapter","Chapter messageboard");
63 }
64
65
66 public BoardType ensure(String type, String description) {
67 BoardType t = (BoardType)newPersistent();
68 t.setType(type);
69 t.setDescription(description);
70
71 return (BoardType)getTypeColumn().ensure(t);
72 }
73
74
75 public BoardType general() {
76 return general;
77 }
78
79 public BoardType sectionGroup() {
80 return sectionGroup;
81 }
82
83 public BoardType section() {
84 return section;
85 }
86
87 public BoardType author() {
88 return author;
89 }
90
91 public BoardType book() {
92 return book;
93 }
94
95 public BoardType chapter() {
96 return chapter;
97 }
98
99
100 }
101