1
2
3 package org.melati.example.odmg.generated;
4
5
6 import org.melati.example.odmg.Child;
7 import org.melati.example.odmg.OdmgDatabaseTables;
8 import org.melati.example.odmg.OdmgTable;
9 import org.melati.example.odmg.Parent;
10 import org.melati.poem.AccessPoemException;
11 import org.melati.poem.Column;
12 import org.melati.poem.Database;
13 import org.melati.poem.DefinitionSource;
14 import org.melati.poem.Field;
15 import org.melati.poem.JdbcPersistent;
16 import org.melati.poem.Persistent;
17 import org.melati.poem.PoemException;
18 import org.melati.poem.ReferencePoemType;
19 import org.melati.poem.StringPoemType;
20 import org.melati.poem.TroidPoemType;
21 import org.melati.poem.ValidationPoemException;
22
23
24
25
26
27
28
29
30 public class ChildTableBase<T extends Child> extends OdmgTable<T> {
31
32 private Column<Integer> col_id = null;
33 private Column<String> col_name = null;
34 private Column<Integer> col_parent = null;
35
36
37
38
39
40
41
42
43
44
45
46 public ChildTableBase(
47 Database database, String name,
48 DefinitionSource definitionSource) throws PoemException {
49 super(database, name, definitionSource);
50 }
51
52
53
54
55
56
57
58
59 public OdmgDatabaseTables getOdmgDatabaseTables() {
60 return (OdmgDatabaseTables)getDatabase();
61 }
62
63
64
65
66
67
68
69 public void init() throws PoemException {
70 super.init();
71 defineColumn(col_id =
72 new Column<Integer>(this, "id",
73 new TroidPoemType(),
74 DefinitionSource.dsd) {
75 public Object getCooked(Persistent g)
76 throws AccessPoemException, PoemException {
77 return ((Child)g).getId();
78 }
79
80 public void setCooked(Persistent g, Object cooked)
81 throws AccessPoemException, ValidationPoemException {
82 ((Child)g).setId((Integer)cooked);
83 }
84
85 public Field<Integer> asField(Persistent g) {
86 return ((Child)g).getIdField();
87 }
88
89 public boolean defaultUserEditable() {
90 return false;
91 }
92
93 public boolean defaultUserCreateable() {
94 return false;
95 }
96
97 public int defaultDisplayOrder() {
98 return 0;
99 }
100
101 public Object getRaw_unsafe(Persistent g)
102 throws AccessPoemException {
103 return ((Child)g).getId_unsafe();
104 }
105
106 public void setRaw_unsafe(Persistent g, Object raw)
107 throws AccessPoemException {
108 ((Child)g).setId_unsafe((Integer)raw);
109 }
110
111 public Object getRaw(Persistent g)
112 throws AccessPoemException {
113 return ((Child)g).getId();
114 }
115
116 public void setRaw(Persistent g, Object raw)
117 throws AccessPoemException {
118 ((Child)g).setId((Integer)raw);
119 }
120 });
121
122 defineColumn(col_name =
123 new Column<String>(this, "name",
124 new StringPoemType(false, 60),
125 DefinitionSource.dsd) {
126 public Object getCooked(Persistent g)
127 throws AccessPoemException, PoemException {
128 return ((Child)g).getName();
129 }
130
131 public void setCooked(Persistent g, Object cooked)
132 throws AccessPoemException, ValidationPoemException {
133 ((Child)g).setName((String)cooked);
134 }
135
136 public Field<String> asField(Persistent g) {
137 return ((Child)g).getNameField();
138 }
139
140 public int defaultDisplayOrder() {
141 return 1;
142 }
143
144 public Object getRaw_unsafe(Persistent g)
145 throws AccessPoemException {
146 return ((Child)g).getName_unsafe();
147 }
148
149 public void setRaw_unsafe(Persistent g, Object raw)
150 throws AccessPoemException {
151 ((Child)g).setName_unsafe((String)raw);
152 }
153
154 public Object getRaw(Persistent g)
155 throws AccessPoemException {
156 return ((Child)g).getName();
157 }
158
159 public void setRaw(Persistent g, Object raw)
160 throws AccessPoemException {
161 ((Child)g).setName((String)raw);
162 }
163 });
164
165 defineColumn(col_parent =
166 new Column<Integer>(this, "parent",
167 new ReferencePoemType(getOdmgDatabaseTables().
168 getParentTable(), false),
169 DefinitionSource.dsd) {
170 public Object getCooked(Persistent g)
171 throws AccessPoemException, PoemException {
172 return ((Child)g).getParent();
173 }
174
175 public void setCooked(Persistent g, Object cooked)
176 throws AccessPoemException, ValidationPoemException {
177 ((Child)g).setParent((Parent)cooked);
178 }
179
180 public Field<Integer> asField(Persistent g) {
181 return ((Child)g).getParentField();
182 }
183
184 public int defaultDisplayOrder() {
185 return 2;
186 }
187
188 public Object getRaw_unsafe(Persistent g)
189 throws AccessPoemException {
190 return ((Child)g).getParent_unsafe();
191 }
192
193 public void setRaw_unsafe(Persistent g, Object raw)
194 throws AccessPoemException {
195 ((Child)g).setParent_unsafe((Integer)raw);
196 }
197
198 public Object getRaw(Persistent g)
199 throws AccessPoemException {
200 return ((Child)g).getParentTroid();
201 }
202
203 public void setRaw(Persistent g, Object raw)
204 throws AccessPoemException {
205 ((Child)g).setParentTroid((Integer)raw);
206 }
207 });
208 }
209
210
211
212
213
214
215
216
217
218 public final Column<Integer> getIdColumn() {
219 return col_id;
220 }
221
222
223
224
225
226
227
228
229
230 public final Column<String> getNameColumn() {
231 return col_name;
232 }
233
234
235
236
237
238
239
240
241
242 public final Column<Integer> getParentColumn() {
243 return col_parent;
244 }
245
246
247
248
249
250
251
252
253
254 public Child getChildObject(Integer troid) {
255 return (Child)getObject(troid);
256 }
257
258
259
260
261
262
263
264
265
266 public Child getChildObject(int troid) {
267 return (Child)getObject(troid);
268 }
269
270 protected JdbcPersistent _newPersistent() {
271 return new Child();
272 }
273 public int defaultDisplayOrder() {
274 return 1;
275 }
276 }
277