1
2
3 package org.paneris.rimauresq.model.generated;
4
5 import java.math.BigDecimal;
6 import org.melati.poem.AccessPoemException;
7 import org.melati.poem.BigDecimalPoemType;
8 import org.melati.poem.Column;
9 import org.melati.poem.Database;
10 import org.melati.poem.DefinitionSource;
11 import org.melati.poem.DisplayLevel;
12 import org.melati.poem.Field;
13 import org.melati.poem.JdbcPersistent;
14 import org.melati.poem.Persistent;
15 import org.melati.poem.PoemException;
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.rimauresq.model.Product;
21 import org.paneris.rimauresq.model.RimauresqDatabaseTables;
22 import org.paneris.rimauresq.model.RimauresqTable;
23
24
25
26
27
28
29
30
31
32 public class ProductTableBase extends RimauresqTable {
33
34 private Column col_id = null;
35 private Column col_name = null;
36 private Column col_description = null;
37 private Column col_price = null;
38
39
40
41
42
43
44
45
46
47
48
49 public ProductTableBase(
50 Database database, String name,
51 DefinitionSource definitionSource) throws PoemException {
52 super(database, name, definitionSource);
53 }
54
55
56
57
58
59
60
61
62 public RimauresqDatabaseTables getRimauresqDatabaseTables() {
63 return (RimauresqDatabaseTables)getDatabase();
64 }
65
66 public void init() throws PoemException {
67 super.init();
68 defineColumn(col_id =
69 new Column(this, "id",
70 new TroidPoemType(),
71 DefinitionSource.dsd) {
72 public Object getCooked(Persistent g)
73 throws AccessPoemException, PoemException {
74 return ((Product)g).getId();
75 }
76
77 public void setCooked(Persistent g, Object cooked)
78 throws AccessPoemException, ValidationPoemException {
79 ((Product)g).setId((Integer)cooked);
80 }
81
82 public Field asField(Persistent g) {
83 return ((Product)g).getIdField();
84 }
85
86 protected boolean defaultUserEditable() {
87 return false;
88 }
89
90 protected boolean defaultUserCreateable() {
91 return false;
92 }
93
94 protected DisplayLevel defaultDisplayLevel() {
95 return DisplayLevel.summary;
96 }
97
98 protected Searchability defaultSearchability() {
99 return Searchability.primary;
100 }
101
102 protected int defaultDisplayOrder() {
103 return 0;
104 }
105
106 public Object getRaw_unsafe(Persistent g)
107 throws AccessPoemException {
108 return ((Product)g).getId_unsafe();
109 }
110
111 public void setRaw_unsafe(Persistent g, Object raw)
112 throws AccessPoemException {
113 ((Product)g).setId_unsafe((Integer)raw);
114 }
115
116 public Object getRaw(Persistent g)
117 throws AccessPoemException {
118 return ((Product)g).getId();
119 }
120
121 public void setRaw(Persistent g, Object raw)
122 throws AccessPoemException {
123 ((Product)g).setId((Integer)raw);
124 }
125 });
126
127 defineColumn(col_name =
128 new Column(this, "name",
129 new StringPoemType(false, -1),
130 DefinitionSource.dsd) {
131 public Object getCooked(Persistent g)
132 throws AccessPoemException, PoemException {
133 return ((Product)g).getName();
134 }
135
136 public void setCooked(Persistent g, Object cooked)
137 throws AccessPoemException, ValidationPoemException {
138 ((Product)g).setName((String)cooked);
139 }
140
141 public Field asField(Persistent g) {
142 return ((Product)g).getNameField();
143 }
144
145 protected DisplayLevel defaultDisplayLevel() {
146 return DisplayLevel.primary;
147 }
148
149 protected Searchability defaultSearchability() {
150 return Searchability.yes;
151 }
152
153 protected Integer defaultDisplayOrderPriority() {
154 return new Integer(0);
155 }
156
157 protected String defaultDisplayName() {
158 return "Item";
159 }
160
161 protected int defaultDisplayOrder() {
162 return 1;
163 }
164
165 protected String defaultDescription() {
166 return "Product name";
167 }
168
169 protected int defaultWidth() {
170 return 45;
171 }
172
173 protected int defaultHeight() {
174 return 5;
175 }
176
177 public Object getRaw_unsafe(Persistent g)
178 throws AccessPoemException {
179 return ((Product)g).getName_unsafe();
180 }
181
182 public void setRaw_unsafe(Persistent g, Object raw)
183 throws AccessPoemException {
184 ((Product)g).setName_unsafe((String)raw);
185 }
186
187 public Object getRaw(Persistent g)
188 throws AccessPoemException {
189 return ((Product)g).getName();
190 }
191
192 public void setRaw(Persistent g, Object raw)
193 throws AccessPoemException {
194 ((Product)g).setName((String)raw);
195 }
196 });
197
198 defineColumn(col_description =
199 new Column(this, "description",
200 new StringPoemType(true, -1),
201 DefinitionSource.dsd) {
202 public Object getCooked(Persistent g)
203 throws AccessPoemException, PoemException {
204 return ((Product)g).getDescription();
205 }
206
207 public void setCooked(Persistent g, Object cooked)
208 throws AccessPoemException, ValidationPoemException {
209 ((Product)g).setDescription((String)cooked);
210 }
211
212 public Field asField(Persistent g) {
213 return ((Product)g).getDescriptionField();
214 }
215
216 protected DisplayLevel defaultDisplayLevel() {
217 return DisplayLevel.record;
218 }
219
220 protected Searchability defaultSearchability() {
221 return Searchability.yes;
222 }
223
224 protected String defaultDisplayName() {
225 return "Description";
226 }
227
228 protected int defaultDisplayOrder() {
229 return 2;
230 }
231
232 protected String defaultDescription() {
233 return "Tasting note";
234 }
235
236 protected int defaultWidth() {
237 return 65;
238 }
239
240 protected int defaultHeight() {
241 return 5;
242 }
243
244 public Object getRaw_unsafe(Persistent g)
245 throws AccessPoemException {
246 return ((Product)g).getDescription_unsafe();
247 }
248
249 public void setRaw_unsafe(Persistent g, Object raw)
250 throws AccessPoemException {
251 ((Product)g).setDescription_unsafe((String)raw);
252 }
253
254 public Object getRaw(Persistent g)
255 throws AccessPoemException {
256 return ((Product)g).getDescription();
257 }
258
259 public void setRaw(Persistent g, Object raw)
260 throws AccessPoemException {
261 ((Product)g).setDescription((String)raw);
262 }
263 });
264
265 defineColumn(col_price =
266 new Column(this, "price",
267 new BigDecimalPoemType(true, 22, 2),
268 DefinitionSource.dsd) {
269 public Object getCooked(Persistent g)
270 throws AccessPoemException, PoemException {
271 return ((Product)g).getPrice();
272 }
273
274 public void setCooked(Persistent g, Object cooked)
275 throws AccessPoemException, ValidationPoemException {
276 ((Product)g).setPrice((BigDecimal)cooked);
277 }
278
279 public Field asField(Persistent g) {
280 return ((Product)g).getPriceField();
281 }
282
283 protected DisplayLevel defaultDisplayLevel() {
284 return DisplayLevel.record;
285 }
286
287 protected Searchability defaultSearchability() {
288 return Searchability.no;
289 }
290
291 protected String defaultDisplayName() {
292 return "Retail Price inc VAT";
293 }
294
295 protected int defaultDisplayOrder() {
296 return 3;
297 }
298
299 public Object getRaw_unsafe(Persistent g)
300 throws AccessPoemException {
301 return ((Product)g).getPrice_unsafe();
302 }
303
304 public void setRaw_unsafe(Persistent g, Object raw)
305 throws AccessPoemException {
306 ((Product)g).setPrice_unsafe((BigDecimal)raw);
307 }
308
309 public Object getRaw(Persistent g)
310 throws AccessPoemException {
311 return ((Product)g).getPrice();
312 }
313
314 public void setRaw(Persistent g, Object raw)
315 throws AccessPoemException {
316 ((Product)g).setPrice((BigDecimal)raw);
317 }
318 });
319 }
320
321
322
323
324
325
326
327
328
329 public final Column getIdColumn() {
330 return col_id;
331 }
332
333
334
335
336
337
338
339
340
341 public final Column getNameColumn() {
342 return col_name;
343 }
344
345
346
347
348
349
350
351
352
353 public final Column getDescriptionColumn() {
354 return col_description;
355 }
356
357
358
359
360
361
362
363
364
365 public final Column getPriceColumn() {
366 return col_price;
367 }
368
369
370
371
372
373
374
375
376
377 public Product getProductObject(Integer troid) {
378 return (Product)getObject(troid);
379 }
380
381
382
383
384
385
386
387
388
389 public Product getProductObject(int troid) {
390 return (Product)getObject(troid);
391 }
392
393 protected JdbcPersistent _newPersistent() {
394 return new Product();
395 }
396 protected String defaultDisplayName() {
397 return "Product";
398 }
399
400 protected String defaultDescription() {
401 return "Rimauresq Products";
402 }
403
404 protected boolean defaultRememberAllTroids() {
405 return true;
406 }
407
408 protected Integer defaultCacheLimit() {
409 return new Integer(999999999);
410 }
411
412 protected String defaultCategory() {
413 return "Data";
414 }
415
416 protected int defaultDisplayOrder() {
417 return 10;
418 }
419 }
420