Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DownloadBase |
|
| 1.3333333333333333;1.333 |
1 | // Do not edit this file! It was generated by Melati POEM's DSD preprocessor. | |
2 | ||
3 | package org.paneris.bibliomania.generated; | |
4 | ||
5 | ||
6 | import java.util.Collections; | |
7 | import java.util.Enumeration; | |
8 | import java.util.List; | |
9 | import org.melati.poem.AccessPoemException; | |
10 | import org.melati.poem.CachedSelection; | |
11 | import org.melati.poem.Column; | |
12 | import org.melati.poem.Field; | |
13 | import org.melati.poem.JdbcPersistent; | |
14 | import org.melati.poem.ValidationPoemException; | |
15 | import org.melati.poem.util.EmptyEnumeration; | |
16 | import org.paneris.bibliomania.BibliomaniaDatabaseTables; | |
17 | import org.paneris.bibliomania.Download; | |
18 | import org.paneris.bibliomania.DownloadEvent; | |
19 | import org.paneris.bibliomania.DownloadTable; | |
20 | import org.paneris.bibliomania.Product; | |
21 | ||
22 | ||
23 | /** | |
24 | * Melati POEM generated abstract base class for a <code>Persistent</code> | |
25 | * <code>Download</code> Object. | |
26 | * | |
27 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
28 | */ | |
29 | 0 | public abstract class DownloadBase extends JdbcPersistent { |
30 | ||
31 | ||
32 | /** | |
33 | * Retrieves the Database object. | |
34 | * | |
35 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
36 | * @return the database | |
37 | */ | |
38 | public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { | |
39 | 0 | return (BibliomaniaDatabaseTables)getDatabase(); |
40 | } | |
41 | ||
42 | ||
43 | /** | |
44 | * Retrieves the <code>DownloadTable</code> table | |
45 | * which this <code>Persistent</code> is from. | |
46 | * | |
47 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
48 | * @return the DownloadTable | |
49 | */ | |
50 | @SuppressWarnings("unchecked") | |
51 | public DownloadTable<Download> getDownloadTable() { | |
52 | 0 | return (DownloadTable<Download>)getTable(); |
53 | } | |
54 | ||
55 | @SuppressWarnings("unchecked") | |
56 | private DownloadTable<Download> _getDownloadTable() { | |
57 | 0 | return (DownloadTable<Download>)getTable(); |
58 | } | |
59 | ||
60 | // Fields in this table | |
61 | /** | |
62 | * id | |
63 | */ | |
64 | protected Integer id; | |
65 | /** | |
66 | * File Name - A file which can be downloaded | |
67 | */ | |
68 | protected String filename; | |
69 | ||
70 | ||
71 | /** | |
72 | * Retrieves the <code>Id</code> value, without locking, | |
73 | * for this <code>Download</code> <code>Persistent</code>. | |
74 | * | |
75 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
76 | * @return the Integer id | |
77 | */ | |
78 | public Integer getId_unsafe() { | |
79 | 0 | return id; |
80 | } | |
81 | ||
82 | ||
83 | /** | |
84 | * Sets the <code>Id</code> value directly, without checking, | |
85 | * for this Download <code>Persistent</code>. | |
86 | * | |
87 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
88 | * @param cooked the pre-validated value to set | |
89 | */ | |
90 | public void setId_unsafe(Integer cooked) { | |
91 | 0 | id = cooked; |
92 | 0 | } |
93 | ||
94 | /** | |
95 | * Retrieves the Id value, with locking, for this | |
96 | * <code>Download</code> <code>Persistent</code>. | |
97 | * | |
98 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
99 | * @throws AccessPoemException | |
100 | * if the current <code>AccessToken</code> | |
101 | * does not confer write access rights | |
102 | * @return the value of the field <code>Id</code> for this | |
103 | * <code>Download</code> <code>Persistent</code> | |
104 | */ | |
105 | ||
106 | public Integer getId() | |
107 | throws AccessPoemException { | |
108 | 0 | readLock(); |
109 | 0 | return getId_unsafe(); |
110 | } | |
111 | ||
112 | ||
113 | /** | |
114 | * Sets the <code>Id</code> value, with checking, for this | |
115 | * <code>Download</code> <code>Persistent</code>. | |
116 | * | |
117 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
118 | * @param cooked a validated <code>int</code> | |
119 | * @throws AccessPoemException | |
120 | * if the current <code>AccessToken</code> | |
121 | * does not confer write access rights | |
122 | * @throws ValidationPoemException | |
123 | * if the value is not valid | |
124 | */ | |
125 | public void setId(Integer cooked) | |
126 | throws AccessPoemException, ValidationPoemException { | |
127 | 0 | _getDownloadTable().getIdColumn(). |
128 | getType().assertValidCooked(cooked); | |
129 | 0 | writeLock(); |
130 | 0 | setId_unsafe(cooked); |
131 | 0 | } |
132 | ||
133 | /** | |
134 | * Sets the <code>Id</code> value, with checking, for this | |
135 | * <code>Download</code> <code>Persistent</code>. | |
136 | * | |
137 | * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods | |
138 | * @param cooked a validated <code>int</code> | |
139 | * @throws AccessPoemException | |
140 | * if the current <code>AccessToken</code> | |
141 | * does not confer write access rights | |
142 | * @throws ValidationPoemException | |
143 | * if the value is not valid | |
144 | */ | |
145 | ||
146 | public final void setId(int cooked) | |
147 | throws AccessPoemException, ValidationPoemException { | |
148 | 0 | setId(new Integer(cooked)); |
149 | 0 | } |
150 | ||
151 | ||
152 | /** | |
153 | * Retrieves the <code>Id</code> value as a <code>Field</code> | |
154 | * from this <code>Download</code> <code>Persistent</code>. | |
155 | * | |
156 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
157 | * @throws AccessPoemException | |
158 | * if the current <code>AccessToken</code> | |
159 | * does not confer write access rights | |
160 | * @return the Integer id | |
161 | */ | |
162 | public Field<Integer> getIdField() throws AccessPoemException { | |
163 | 0 | Column<Integer> c = _getDownloadTable().getIdColumn(); |
164 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
165 | } | |
166 | ||
167 | ||
168 | /** | |
169 | * Retrieves the <code>Filename</code> value, without locking, | |
170 | * for this <code>Download</code> <code>Persistent</code>. | |
171 | * | |
172 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
173 | * @return the String filename | |
174 | */ | |
175 | public String getFilename_unsafe() { | |
176 | 0 | return filename; |
177 | } | |
178 | ||
179 | ||
180 | /** | |
181 | * Sets the <code>Filename</code> value directly, without checking, | |
182 | * for this Download <code>Persistent</code>. | |
183 | * | |
184 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
185 | * @param cooked the pre-validated value to set | |
186 | */ | |
187 | public void setFilename_unsafe(String cooked) { | |
188 | 0 | filename = cooked; |
189 | 0 | } |
190 | ||
191 | /** | |
192 | * Retrieves the Filename value, with locking, for this | |
193 | * <code>Download</code> <code>Persistent</code>. | |
194 | * Field description: | |
195 | * A file which can be downloaded | |
196 | * | |
197 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
198 | * @throws AccessPoemException | |
199 | * if the current <code>AccessToken</code> | |
200 | * does not confer write access rights | |
201 | * @return the value of the field <code>Filename</code> for this | |
202 | * <code>Download</code> <code>Persistent</code> | |
203 | */ | |
204 | ||
205 | public String getFilename() | |
206 | throws AccessPoemException { | |
207 | 0 | readLock(); |
208 | 0 | return getFilename_unsafe(); |
209 | } | |
210 | ||
211 | ||
212 | /** | |
213 | * Sets the <code>Filename</code> value, with checking, for this | |
214 | * <code>Download</code> <code>Persistent</code>. | |
215 | * Field description: | |
216 | * A file which can be downloaded | |
217 | * | |
218 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
219 | * @param cooked a validated <code>int</code> | |
220 | * @throws AccessPoemException | |
221 | * if the current <code>AccessToken</code> | |
222 | * does not confer write access rights | |
223 | * @throws ValidationPoemException | |
224 | * if the value is not valid | |
225 | */ | |
226 | public void setFilename(String cooked) | |
227 | throws AccessPoemException, ValidationPoemException { | |
228 | 0 | _getDownloadTable().getFilenameColumn(). |
229 | getType().assertValidCooked(cooked); | |
230 | 0 | writeLock(); |
231 | 0 | setFilename_unsafe(cooked); |
232 | 0 | } |
233 | ||
234 | ||
235 | /** | |
236 | * Retrieves the <code>Filename</code> value as a <code>Field</code> | |
237 | * from this <code>Download</code> <code>Persistent</code>. | |
238 | * | |
239 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
240 | * @throws AccessPoemException | |
241 | * if the current <code>AccessToken</code> | |
242 | * does not confer write access rights | |
243 | * @return the String filename | |
244 | */ | |
245 | public Field<String> getFilenameField() throws AccessPoemException { | |
246 | 0 | Column<String> c = _getDownloadTable().getFilenameColumn(); |
247 | 0 | return new Field<String>((String)c.getRaw(this), c); |
248 | } | |
249 | ||
250 | 0 | private CachedSelection<Product> downloadProducts = null; |
251 | /** References to this Download in the Product table via its download field.*/ | |
252 | @SuppressWarnings("unchecked") | |
253 | public Enumeration<Product> getDownloadProducts() { | |
254 | 0 | if (getTroid() == null) |
255 | 0 | return new EmptyEnumeration<Product>(); |
256 | else { | |
257 | 0 | if (downloadProducts == null) |
258 | 0 | downloadProducts = |
259 | getBibliomaniaDatabaseTables().getProductTable().getDownloadColumn().cachedSelectionWhereEq(getTroid()); | |
260 | 0 | return downloadProducts.objects(); |
261 | } | |
262 | } | |
263 | ||
264 | ||
265 | /** References to this Download in the Product table via its download field, as a List.*/ | |
266 | public List<Product> getDownloadProductList() { | |
267 | 0 | return Collections.list(getDownloadProducts()); |
268 | } | |
269 | ||
270 | ||
271 | ||
272 | 0 | private CachedSelection<DownloadEvent> documentDownloadEvents = null; |
273 | /** References to this Download in the DownloadEvent table via its document field.*/ | |
274 | @SuppressWarnings("unchecked") | |
275 | public Enumeration<DownloadEvent> getDocumentDownloadEvents() { | |
276 | 0 | if (getTroid() == null) |
277 | 0 | return new EmptyEnumeration<DownloadEvent>(); |
278 | else { | |
279 | 0 | if (documentDownloadEvents == null) |
280 | 0 | documentDownloadEvents = |
281 | getBibliomaniaDatabaseTables().getDownloadEventTable().getDocumentColumn().cachedSelectionWhereEq(getTroid()); | |
282 | 0 | return documentDownloadEvents.objects(); |
283 | } | |
284 | } | |
285 | ||
286 | ||
287 | /** References to this Download in the DownloadEvent table via its document field, as a List.*/ | |
288 | public List<DownloadEvent> getDocumentDownloadEventList() { | |
289 | 0 | return Collections.list(getDocumentDownloadEvents()); |
290 | } | |
291 | ||
292 | ||
293 | ||
294 | } | |
295 |