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 org.melati.poem.AccessPoemException; 7 import org.melati.poem.Column; 8 import org.melati.poem.Field; 9 import org.melati.poem.JdbcPersistent; 10 import org.melati.poem.NoSuchRowPoemException; 11 import org.melati.poem.ValidationPoemException; 12 import org.paneris.bibliomania.BibliomaniaDatabaseTables; 13 import org.paneris.bibliomania.Campaign; 14 import org.paneris.bibliomania.CampaignUser; 15 import org.paneris.bibliomania.CampaignUserTable; 16 import org.paneris.bibliomania.User; 17 18 19 /** 20 * Melati POEM generated abstract base class for a <code>Persistent</code> 21 * <code>CampaignUser</code> Object. 22 * 23 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 24 */ 25 public abstract class CampaignUserBase extends JdbcPersistent { 26 27 28 /** 29 * Retrieves the Database object. 30 * 31 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 32 * @return the database 33 */ 34 public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { 35 return (BibliomaniaDatabaseTables)getDatabase(); 36 } 37 38 39 /** 40 * Retrieves the <code>CampaignUserTable</code> table 41 * which this <code>Persistent</code> is from. 42 * 43 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 44 * @return the CampaignUserTable 45 */ 46 @SuppressWarnings("unchecked") 47 public CampaignUserTable<CampaignUser> getCampaignUserTable() { 48 return (CampaignUserTable<CampaignUser>)getTable(); 49 } 50 51 @SuppressWarnings("unchecked") 52 private CampaignUserTable<CampaignUser> _getCampaignUserTable() { 53 return (CampaignUserTable<CampaignUser>)getTable(); 54 } 55 56 // Fields in this table 57 /** 58 * id 59 */ 60 protected Integer id; 61 /** 62 * Campaign 63 */ 64 protected Integer campaign; 65 /** 66 * User 67 */ 68 protected Integer user; 69 70 71 /** 72 * Retrieves the <code>Id</code> value, without locking, 73 * for this <code>CampaignUser</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 return id; 80 } 81 82 83 /** 84 * Sets the <code>Id</code> value directly, without checking, 85 * for this CampaignUser <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 id = cooked; 92 } 93 94 /** 95 * Retrieves the Id value, with locking, for this 96 * <code>CampaignUser</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>CampaignUser</code> <code>Persistent</code> 104 */ 105 106 public Integer getId() 107 throws AccessPoemException { 108 readLock(); 109 return getId_unsafe(); 110 } 111 112 113 /** 114 * Sets the <code>Id</code> value, with checking, for this 115 * <code>CampaignUser</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 _getCampaignUserTable().getIdColumn(). 128 getType().assertValidCooked(cooked); 129 writeLock(); 130 setId_unsafe(cooked); 131 } 132 133 /** 134 * Sets the <code>Id</code> value, with checking, for this 135 * <code>CampaignUser</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 setId(new Integer(cooked)); 149 } 150 151 152 /** 153 * Retrieves the <code>Id</code> value as a <code>Field</code> 154 * from this <code>CampaignUser</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 Column<Integer> c = _getCampaignUserTable().getIdColumn(); 164 return new Field<Integer>((Integer)c.getRaw(this), c); 165 } 166 167 168 /** 169 * Retrieves the <code>Campaign</code> value, without locking, 170 * for this <code>CampaignUser</code> <code>Persistent</code>. 171 * 172 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 173 * @return the Integer campaign 174 */ 175 public Integer getCampaign_unsafe() { 176 return campaign; 177 } 178 179 180 /** 181 * Sets the <code>Campaign</code> value directly, without checking, 182 * for this CampaignUser <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 setCampaign_unsafe(Integer cooked) { 188 campaign = cooked; 189 } 190 191 /** 192 * Retrieves the Table Row Object ID. 193 * 194 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 195 * @throws AccessPoemException 196 * if the current <code>AccessToken</code> 197 * does not confer read access rights 198 * @return the TROID as an <code>Integer</code> 199 */ 200 201 public Integer getCampaignTroid() 202 throws AccessPoemException { 203 readLock(); 204 return getCampaign_unsafe(); 205 } 206 207 208 /** 209 * Sets the Table Row Object ID. 210 * 211 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 212 * @param raw a Table Row Object Id 213 * @throws AccessPoemException 214 * if the current <code>AccessToken</code> 215 * does not confer write access rights 216 */ 217 public void setCampaignTroid(Integer raw) 218 throws AccessPoemException { 219 setCampaign(raw == null ? null : 220 getBibliomaniaDatabaseTables().getCampaignTable().getCampaignObject(raw)); 221 } 222 223 224 /** 225 * Retrieves the <code>Campaign</code> object referred to. 226 * 227 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 228 * @throws AccessPoemException 229 * if the current <code>AccessToken</code> 230 * does not confer read access rights 231 * @throws NoSuchRowPoemException 232 * if the <code>Persistent</code> has yet to be allocated a TROID 233 * @return the <code>Campaign</code> as a <code>Campaign</code> 234 */ 235 public Campaign getCampaign() 236 throws AccessPoemException, NoSuchRowPoemException { 237 Integer troid = getCampaignTroid(); 238 return troid == null ? null : 239 getBibliomaniaDatabaseTables().getCampaignTable().getCampaignObject(troid); 240 } 241 242 243 /** 244 * Set the Campaign. 245 * 246 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 247 * @param cooked a validated <code>Campaign</code> 248 * @throws AccessPoemException 249 * if the current <code>AccessToken</code> 250 * does not confer write access rights 251 */ 252 public void setCampaign(Campaign cooked) 253 throws AccessPoemException { 254 _getCampaignUserTable(). 255 getCampaignColumn(). 256 getType().assertValidCooked(cooked); 257 writeLock(); 258 if (cooked == null) 259 setCampaign_unsafe(null); 260 else { 261 cooked.existenceLock(); 262 setCampaign_unsafe(cooked.troid()); 263 } 264 } 265 266 267 /** 268 * Retrieves the <code>Campaign</code> value as a <code>Field</code> 269 * from this <code>CampaignUser</code> <code>Persistent</code>. 270 * 271 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 272 * @throws AccessPoemException 273 * if the current <code>AccessToken</code> 274 * does not confer write access rights 275 * @return the Integer campaign 276 */ 277 public Field<Integer> getCampaignField() throws AccessPoemException { 278 Column<Integer> c = _getCampaignUserTable().getCampaignColumn(); 279 return new Field<Integer>((Integer)c.getRaw(this), c); 280 } 281 282 283 /** 284 * Retrieves the <code>User</code> value, without locking, 285 * for this <code>CampaignUser</code> <code>Persistent</code>. 286 * 287 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 288 * @return the Integer user 289 */ 290 public Integer getUser_unsafe() { 291 return user; 292 } 293 294 295 /** 296 * Sets the <code>User</code> value directly, without checking, 297 * for this CampaignUser <code>Persistent</code>. 298 * 299 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 300 * @param cooked the pre-validated value to set 301 */ 302 public void setUser_unsafe(Integer cooked) { 303 user = cooked; 304 } 305 306 /** 307 * Retrieves the Table Row Object ID. 308 * 309 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 310 * @throws AccessPoemException 311 * if the current <code>AccessToken</code> 312 * does not confer read access rights 313 * @return the TROID as an <code>Integer</code> 314 */ 315 316 public Integer getUserTroid() 317 throws AccessPoemException { 318 readLock(); 319 return getUser_unsafe(); 320 } 321 322 323 /** 324 * Sets the Table Row Object ID. 325 * 326 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 327 * @param raw a Table Row Object Id 328 * @throws AccessPoemException 329 * if the current <code>AccessToken</code> 330 * does not confer write access rights 331 */ 332 public void setUserTroid(Integer raw) 333 throws AccessPoemException { 334 setUser(raw == null ? null : 335 (User)getBibliomaniaDatabaseTables().getUserTable().getUserObject(raw)); 336 } 337 338 339 /** 340 * Retrieves the <code>User</code> object referred to. 341 * 342 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 343 * @throws AccessPoemException 344 * if the current <code>AccessToken</code> 345 * does not confer read access rights 346 * @throws NoSuchRowPoemException 347 * if the <code>Persistent</code> has yet to be allocated a TROID 348 * @return the <code>User</code> as a <code>User</code> 349 */ 350 public User getUser() 351 throws AccessPoemException, NoSuchRowPoemException { 352 Integer troid = getUserTroid(); 353 return troid == null ? null : 354 (User)getBibliomaniaDatabaseTables().getUserTable().getUserObject(troid); 355 } 356 357 358 /** 359 * Set the User. 360 * 361 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 362 * @param cooked a validated <code>User</code> 363 * @throws AccessPoemException 364 * if the current <code>AccessToken</code> 365 * does not confer write access rights 366 */ 367 public void setUser(User cooked) 368 throws AccessPoemException { 369 _getCampaignUserTable(). 370 getUserColumn(). 371 getType().assertValidCooked(cooked); 372 writeLock(); 373 if (cooked == null) 374 setUser_unsafe(null); 375 else { 376 cooked.existenceLock(); 377 setUser_unsafe(cooked.troid()); 378 } 379 } 380 381 382 /** 383 * Retrieves the <code>User</code> value as a <code>Field</code> 384 * from this <code>CampaignUser</code> <code>Persistent</code>. 385 * 386 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 387 * @throws AccessPoemException 388 * if the current <code>AccessToken</code> 389 * does not confer write access rights 390 * @return the Integer user 391 */ 392 public Field<Integer> getUserField() throws AccessPoemException { 393 Column<Integer> c = _getCampaignUserTable().getUserColumn(); 394 return new Field<Integer>((Integer)c.getRaw(this), c); 395 } 396 397 } 398