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.StandardIntegrityFix; |
18 | |
import org.melati.poem.TroidPoemType; |
19 | |
import org.melati.poem.ValidationPoemException; |
20 | |
import org.paneris.bibliomania.Author; |
21 | |
import org.paneris.bibliomania.BibliomaniaDatabaseTables; |
22 | |
import org.paneris.bibliomania.BibliomaniaTable; |
23 | |
import org.paneris.bibliomania.Book; |
24 | |
import org.paneris.bibliomania.Product; |
25 | |
import org.paneris.bibliomania.ProductAssociation; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public class ProductAssociationTableBase<T extends ProductAssociation> extends BibliomaniaTable<T> { |
35 | |
|
36 | 2 | private Column<Integer> col_id = null; |
37 | 2 | private Column<Integer> col_product = null; |
38 | 2 | private Column<Integer> col_book = null; |
39 | 2 | private Column<Integer> col_author = null; |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
public ProductAssociationTableBase( |
52 | |
Database database, String name, |
53 | |
DefinitionSource definitionSource) throws PoemException { |
54 | 2 | super(database, name, definitionSource); |
55 | 2 | } |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { |
65 | 6 | return (BibliomaniaDatabaseTables)getDatabase(); |
66 | |
} |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
public void init() throws PoemException { |
75 | 2 | super.init(); |
76 | 2 | defineColumn(col_id = |
77 | |
new Column<Integer>(this, "id", |
78 | |
new TroidPoemType(), |
79 | 2 | DefinitionSource.dsd) { |
80 | |
public Object getCooked(Persistent g) |
81 | |
throws AccessPoemException, PoemException { |
82 | 0 | return ((ProductAssociation)g).getId(); |
83 | |
} |
84 | |
|
85 | |
public void setCooked(Persistent g, Object cooked) |
86 | |
throws AccessPoemException, ValidationPoemException { |
87 | 0 | ((ProductAssociation)g).setId((Integer)cooked); |
88 | 0 | } |
89 | |
|
90 | |
public Field<Integer> asField(Persistent g) { |
91 | 0 | return ((ProductAssociation)g).getIdField(); |
92 | |
} |
93 | |
|
94 | |
public boolean defaultUserEditable() { |
95 | 0 | return false; |
96 | |
} |
97 | |
|
98 | |
public boolean defaultUserCreateable() { |
99 | 0 | return false; |
100 | |
} |
101 | |
|
102 | |
public DisplayLevel defaultDisplayLevel() { |
103 | 0 | return DisplayLevel.record; |
104 | |
} |
105 | |
|
106 | |
public int defaultDisplayOrder() { |
107 | 0 | return 0; |
108 | |
} |
109 | |
|
110 | |
public Object getRaw_unsafe(Persistent g) |
111 | |
throws AccessPoemException { |
112 | 0 | return ((ProductAssociation)g).getId_unsafe(); |
113 | |
} |
114 | |
|
115 | |
public void setRaw_unsafe(Persistent g, Object raw) |
116 | |
throws AccessPoemException { |
117 | 0 | ((ProductAssociation)g).setId_unsafe((Integer)raw); |
118 | 0 | } |
119 | |
|
120 | |
public Object getRaw(Persistent g) |
121 | |
throws AccessPoemException { |
122 | 0 | return ((ProductAssociation)g).getId(); |
123 | |
} |
124 | |
|
125 | |
public void setRaw(Persistent g, Object raw) |
126 | |
throws AccessPoemException { |
127 | 0 | ((ProductAssociation)g).setId((Integer)raw); |
128 | 0 | } |
129 | |
}); |
130 | |
|
131 | 2 | defineColumn(col_product = |
132 | |
new Column<Integer>(this, "product", |
133 | |
new ReferencePoemType(getBibliomaniaDatabaseTables(). |
134 | |
getProductTable(), false), |
135 | 2 | DefinitionSource.dsd) { |
136 | |
public Object getCooked(Persistent g) |
137 | |
throws AccessPoemException, PoemException { |
138 | 0 | return ((ProductAssociation)g).getProduct(); |
139 | |
} |
140 | |
|
141 | |
public void setCooked(Persistent g, Object cooked) |
142 | |
throws AccessPoemException, ValidationPoemException { |
143 | 0 | ((ProductAssociation)g).setProduct((Product)cooked); |
144 | 0 | } |
145 | |
|
146 | |
public Field<Integer> asField(Persistent g) { |
147 | 0 | return ((ProductAssociation)g).getProductField(); |
148 | |
} |
149 | |
|
150 | |
public Searchability defaultSearchability() { |
151 | 0 | return Searchability.primary; |
152 | |
} |
153 | |
|
154 | |
public Integer defaultDisplayOrderPriority() { |
155 | 0 | return new Integer(1); |
156 | |
} |
157 | |
|
158 | |
public int defaultDisplayOrder() { |
159 | 0 | return 1; |
160 | |
} |
161 | |
|
162 | |
public String defaultDescription() { |
163 | 0 | return "The related shop item"; |
164 | |
} |
165 | |
|
166 | |
public boolean defaultIndexed() { |
167 | 0 | return true; |
168 | |
} |
169 | |
|
170 | |
public Object getRaw_unsafe(Persistent g) |
171 | |
throws AccessPoemException { |
172 | 0 | return ((ProductAssociation)g).getProduct_unsafe(); |
173 | |
} |
174 | |
|
175 | |
public void setRaw_unsafe(Persistent g, Object raw) |
176 | |
throws AccessPoemException { |
177 | 0 | ((ProductAssociation)g).setProduct_unsafe((Integer)raw); |
178 | 0 | } |
179 | |
|
180 | |
public Object getRaw(Persistent g) |
181 | |
throws AccessPoemException { |
182 | 0 | return ((ProductAssociation)g).getProductTroid(); |
183 | |
} |
184 | |
|
185 | |
public void setRaw(Persistent g, Object raw) |
186 | |
throws AccessPoemException { |
187 | 0 | ((ProductAssociation)g).setProductTroid((Integer)raw); |
188 | 0 | } |
189 | |
|
190 | |
public StandardIntegrityFix defaultIntegrityFix() { |
191 | 0 | return StandardIntegrityFix.delete; |
192 | |
} |
193 | |
}); |
194 | |
|
195 | 2 | defineColumn(col_book = |
196 | |
new Column<Integer>(this, "book", |
197 | |
new ReferencePoemType(getBibliomaniaDatabaseTables(). |
198 | |
getBookTable(), true), |
199 | 2 | DefinitionSource.dsd) { |
200 | |
public Object getCooked(Persistent g) |
201 | |
throws AccessPoemException, PoemException { |
202 | 0 | return ((ProductAssociation)g).getBook(); |
203 | |
} |
204 | |
|
205 | |
public void setCooked(Persistent g, Object cooked) |
206 | |
throws AccessPoemException, ValidationPoemException { |
207 | 0 | ((ProductAssociation)g).setBook((Book)cooked); |
208 | 0 | } |
209 | |
|
210 | |
public Field<Integer> asField(Persistent g) { |
211 | 0 | return ((ProductAssociation)g).getBookField(); |
212 | |
} |
213 | |
|
214 | |
public Searchability defaultSearchability() { |
215 | 0 | return Searchability.primary; |
216 | |
} |
217 | |
|
218 | |
public Integer defaultDisplayOrderPriority() { |
219 | 0 | return new Integer(1); |
220 | |
} |
221 | |
|
222 | |
public int defaultDisplayOrder() { |
223 | 0 | return 2; |
224 | |
} |
225 | |
|
226 | |
public String defaultDescription() { |
227 | 0 | return "The book this product is related to"; |
228 | |
} |
229 | |
|
230 | |
public boolean defaultIndexed() { |
231 | 0 | return true; |
232 | |
} |
233 | |
|
234 | |
public String defaultRenderinfo() { |
235 | 0 | return "SelectionWindow"; |
236 | |
} |
237 | |
|
238 | |
public Object getRaw_unsafe(Persistent g) |
239 | |
throws AccessPoemException { |
240 | 0 | return ((ProductAssociation)g).getBook_unsafe(); |
241 | |
} |
242 | |
|
243 | |
public void setRaw_unsafe(Persistent g, Object raw) |
244 | |
throws AccessPoemException { |
245 | 0 | ((ProductAssociation)g).setBook_unsafe((Integer)raw); |
246 | 0 | } |
247 | |
|
248 | |
public Object getRaw(Persistent g) |
249 | |
throws AccessPoemException { |
250 | 0 | return ((ProductAssociation)g).getBookTroid(); |
251 | |
} |
252 | |
|
253 | |
public void setRaw(Persistent g, Object raw) |
254 | |
throws AccessPoemException { |
255 | 0 | ((ProductAssociation)g).setBookTroid((Integer)raw); |
256 | 0 | } |
257 | |
|
258 | |
public StandardIntegrityFix defaultIntegrityFix() { |
259 | 0 | return StandardIntegrityFix.delete; |
260 | |
} |
261 | |
}); |
262 | |
|
263 | 2 | defineColumn(col_author = |
264 | |
new Column<Integer>(this, "author", |
265 | |
new ReferencePoemType(getBibliomaniaDatabaseTables(). |
266 | |
getAuthorTable(), true), |
267 | 2 | DefinitionSource.dsd) { |
268 | |
public Object getCooked(Persistent g) |
269 | |
throws AccessPoemException, PoemException { |
270 | 0 | return ((ProductAssociation)g).getAuthor(); |
271 | |
} |
272 | |
|
273 | |
public void setCooked(Persistent g, Object cooked) |
274 | |
throws AccessPoemException, ValidationPoemException { |
275 | 0 | ((ProductAssociation)g).setAuthor((Author)cooked); |
276 | 0 | } |
277 | |
|
278 | |
public Field<Integer> asField(Persistent g) { |
279 | 0 | return ((ProductAssociation)g).getAuthorField(); |
280 | |
} |
281 | |
|
282 | |
public Searchability defaultSearchability() { |
283 | 0 | return Searchability.primary; |
284 | |
} |
285 | |
|
286 | |
public Integer defaultDisplayOrderPriority() { |
287 | 0 | return new Integer(1); |
288 | |
} |
289 | |
|
290 | |
public int defaultDisplayOrder() { |
291 | 0 | return 3; |
292 | |
} |
293 | |
|
294 | |
public String defaultDescription() { |
295 | 0 | return "The author this product is related to"; |
296 | |
} |
297 | |
|
298 | |
public boolean defaultIndexed() { |
299 | 0 | return true; |
300 | |
} |
301 | |
|
302 | |
public String defaultRenderinfo() { |
303 | 0 | return "SelectionWindow"; |
304 | |
} |
305 | |
|
306 | |
public Object getRaw_unsafe(Persistent g) |
307 | |
throws AccessPoemException { |
308 | 0 | return ((ProductAssociation)g).getAuthor_unsafe(); |
309 | |
} |
310 | |
|
311 | |
public void setRaw_unsafe(Persistent g, Object raw) |
312 | |
throws AccessPoemException { |
313 | 0 | ((ProductAssociation)g).setAuthor_unsafe((Integer)raw); |
314 | 0 | } |
315 | |
|
316 | |
public Object getRaw(Persistent g) |
317 | |
throws AccessPoemException { |
318 | 0 | return ((ProductAssociation)g).getAuthorTroid(); |
319 | |
} |
320 | |
|
321 | |
public void setRaw(Persistent g, Object raw) |
322 | |
throws AccessPoemException { |
323 | 0 | ((ProductAssociation)g).setAuthorTroid((Integer)raw); |
324 | 0 | } |
325 | |
|
326 | |
public StandardIntegrityFix defaultIntegrityFix() { |
327 | 0 | return StandardIntegrityFix.delete; |
328 | |
} |
329 | |
}); |
330 | 2 | } |
331 | |
|
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
public final Column<Integer> getIdColumn() { |
341 | 0 | return col_id; |
342 | |
} |
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
public final Column<Integer> getProductColumn() { |
353 | 0 | return col_product; |
354 | |
} |
355 | |
|
356 | |
|
357 | |
|
358 | |
|
359 | |
|
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
public final Column<Integer> getBookColumn() { |
365 | 0 | return col_book; |
366 | |
} |
367 | |
|
368 | |
|
369 | |
|
370 | |
|
371 | |
|
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | |
public final Column<Integer> getAuthorColumn() { |
377 | 1 | return col_author; |
378 | |
} |
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
public ProductAssociation getProductAssociationObject(Integer troid) { |
389 | 0 | return (ProductAssociation)getObject(troid); |
390 | |
} |
391 | |
|
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
public ProductAssociation getProductAssociationObject(int troid) { |
401 | 0 | return (ProductAssociation)getObject(troid); |
402 | |
} |
403 | |
|
404 | |
protected JdbcPersistent _newPersistent() { |
405 | 0 | return new ProductAssociation(); |
406 | |
} |
407 | |
public String defaultDisplayName() { |
408 | 0 | return "Product Associations"; |
409 | |
} |
410 | |
|
411 | |
public String defaultDescription() { |
412 | 0 | return "Book and/or Author associated with a product"; |
413 | |
} |
414 | |
|
415 | |
public String defaultCategory() { |
416 | 0 | return "Shop"; |
417 | |
} |
418 | |
|
419 | |
public int defaultDisplayOrder() { |
420 | 0 | return 1200; |
421 | |
} |
422 | |
} |
423 | |
|