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