1
2
3 package org.paneris.bibliomania.generated;
4
5
6 import org.melati.poem.AccessPoemException;
7 import org.melati.poem.Column;
8 import org.melati.poem.Database;
9 import org.melati.poem.DefinitionSource;
10 import org.melati.poem.DisplayLevel;
11 import org.melati.poem.Field;
12 import org.melati.poem.JdbcPersistent;
13 import org.melati.poem.Persistent;
14 import org.melati.poem.PoemException;
15 import org.melati.poem.ReferencePoemType;
16 import org.melati.poem.Searchability;
17 import org.melati.poem.StringPoemType;
18 import org.melati.poem.TroidPoemType;
19 import org.melati.poem.ValidationPoemException;
20 import org.paneris.bibliomania.BibliomaniaDatabaseTables;
21 import org.paneris.bibliomania.BibliomaniaTable;
22 import org.paneris.bibliomania.Country;
23 import org.paneris.bibliomania.DeliveryChargeBand;
24
25
26
27
28
29
30
31
32 public class CountryTableBase<T extends Country> extends BibliomaniaTable<T> {
33
34 private Column<Integer> col_id = null;
35 private Column<String> col_displayname = null;
36 private Column<Integer> col_deliverycharge = null;
37
38
39
40
41
42
43
44
45
46
47
48 public CountryTableBase(
49 Database database, String name,
50 DefinitionSource definitionSource) throws PoemException {
51 super(database, name, definitionSource);
52 }
53
54
55
56
57
58
59
60
61 public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
62 return (BibliomaniaDatabaseTables)getDatabase();
63 }
64
65
66
67
68
69
70
71 public void init() throws PoemException {
72 super.init();
73 defineColumn(col_id =
74 new Column<Integer>(this, "id",
75 new TroidPoemType(),
76 DefinitionSource.dsd) {
77 public Object getCooked(Persistent g)
78 throws AccessPoemException, PoemException {
79 return ((Country)g).getId();
80 }
81
82 public void setCooked(Persistent g, Object cooked)
83 throws AccessPoemException, ValidationPoemException {
84 ((Country)g).setId((Integer)cooked);
85 }
86
87 public Field<Integer> asField(Persistent g) {
88 return ((Country)g).getIdField();
89 }
90
91 public boolean defaultUserEditable() {
92 return false;
93 }
94
95 public boolean defaultUserCreateable() {
96 return false;
97 }
98
99 public DisplayLevel defaultDisplayLevel() {
100 return DisplayLevel.record;
101 }
102
103 public int defaultDisplayOrder() {
104 return 0;
105 }
106
107 public Object getRaw_unsafe(Persistent g)
108 throws AccessPoemException {
109 return ((Country)g).getId_unsafe();
110 }
111
112 public void setRaw_unsafe(Persistent g, Object raw)
113 throws AccessPoemException {
114 ((Country)g).setId_unsafe((Integer)raw);
115 }
116
117 public Object getRaw(Persistent g)
118 throws AccessPoemException {
119 return ((Country)g).getId();
120 }
121
122 public void setRaw(Persistent g, Object raw)
123 throws AccessPoemException {
124 ((Country)g).setId((Integer)raw);
125 }
126 });
127
128 defineColumn(col_displayname =
129 new Column<String>(this, "displayname",
130 new StringPoemType(false, -1),
131 DefinitionSource.dsd) {
132 public Object getCooked(Persistent g)
133 throws AccessPoemException, PoemException {
134 return ((Country)g).getDisplayname();
135 }
136
137 public void setCooked(Persistent g, Object cooked)
138 throws AccessPoemException, ValidationPoemException {
139 ((Country)g).setDisplayname((String)cooked);
140 }
141
142 public Field<String> asField(Persistent g) {
143 return ((Country)g).getDisplaynameField();
144 }
145
146 public DisplayLevel defaultDisplayLevel() {
147 return DisplayLevel.primary;
148 }
149
150 public Searchability defaultSearchability() {
151 return Searchability.primary;
152 }
153
154 public String defaultDisplayName() {
155 return "Display name";
156 }
157
158 public int defaultDisplayOrder() {
159 return 1;
160 }
161
162 public String defaultDescription() {
163 return "The country's name";
164 }
165
166 public Object getRaw_unsafe(Persistent g)
167 throws AccessPoemException {
168 return ((Country)g).getDisplayname_unsafe();
169 }
170
171 public void setRaw_unsafe(Persistent g, Object raw)
172 throws AccessPoemException {
173 ((Country)g).setDisplayname_unsafe((String)raw);
174 }
175
176 public Object getRaw(Persistent g)
177 throws AccessPoemException {
178 return ((Country)g).getDisplayname();
179 }
180
181 public void setRaw(Persistent g, Object raw)
182 throws AccessPoemException {
183 ((Country)g).setDisplayname((String)raw);
184 }
185 });
186
187 defineColumn(col_deliverycharge =
188 new Column<Integer>(this, "deliverycharge",
189 new ReferencePoemType(getBibliomaniaDatabaseTables().
190 getDeliveryChargeBandTable(), false),
191 DefinitionSource.dsd) {
192 public Object getCooked(Persistent g)
193 throws AccessPoemException, PoemException {
194 return ((Country)g).getDeliverycharge();
195 }
196
197 public void setCooked(Persistent g, Object cooked)
198 throws AccessPoemException, ValidationPoemException {
199 ((Country)g).setDeliverycharge((DeliveryChargeBand)cooked);
200 }
201
202 public Field<Integer> asField(Persistent g) {
203 return ((Country)g).getDeliverychargeField();
204 }
205
206 public DisplayLevel defaultDisplayLevel() {
207 return DisplayLevel.summary;
208 }
209
210 public Searchability defaultSearchability() {
211 return Searchability.yes;
212 }
213
214 public String defaultDisplayName() {
215 return "Delivery Charge Band";
216 }
217
218 public int defaultDisplayOrder() {
219 return 2;
220 }
221
222 public Object getRaw_unsafe(Persistent g)
223 throws AccessPoemException {
224 return ((Country)g).getDeliverycharge_unsafe();
225 }
226
227 public void setRaw_unsafe(Persistent g, Object raw)
228 throws AccessPoemException {
229 ((Country)g).setDeliverycharge_unsafe((Integer)raw);
230 }
231
232 public Object getRaw(Persistent g)
233 throws AccessPoemException {
234 return ((Country)g).getDeliverychargeTroid();
235 }
236
237 public void setRaw(Persistent g, Object raw)
238 throws AccessPoemException {
239 ((Country)g).setDeliverychargeTroid((Integer)raw);
240 }
241 });
242 }
243
244
245
246
247
248
249
250
251
252 public final Column<Integer> getIdColumn() {
253 return col_id;
254 }
255
256
257
258
259
260
261
262
263
264 public final Column<String> getDisplaynameColumn() {
265 return col_displayname;
266 }
267
268
269
270
271
272
273
274
275
276 public final Column<Integer> getDeliverychargeColumn() {
277 return col_deliverycharge;
278 }
279
280
281
282
283
284
285
286
287
288 public Country getCountryObject(Integer troid) {
289 return (Country)getObject(troid);
290 }
291
292
293
294
295
296
297
298
299
300 public Country getCountryObject(int troid) {
301 return (Country)getObject(troid);
302 }
303
304 protected JdbcPersistent _newPersistent() {
305 return new Country();
306 }
307 public String defaultDescription() {
308 return "A country where a user can live";
309 }
310
311 public boolean defaultRememberAllTroids() {
312 return true;
313 }
314
315 public String defaultCategory() {
316 return "User";
317 }
318
319 public int defaultDisplayOrder() {
320 return 2080;
321 }
322 }
323