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