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.BookStocking; 18 import org.paneris.bibliomania.Bookshop; 19 import org.paneris.bibliomania.BookshopTable; 20 21 22 /** 23 * Melati POEM generated abstract base class for a <code>Persistent</code> 24 * <code>Bookshop</code> Object. 25 * 26 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 27 */ 28 public abstract class BookshopBase extends JdbcPersistent { 29 30 31 /** 32 * Retrieves the Database object. 33 * 34 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 35 * @return the database 36 */ 37 public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { 38 return (BibliomaniaDatabaseTables)getDatabase(); 39 } 40 41 42 /** 43 * Retrieves the <code>BookshopTable</code> table 44 * which this <code>Persistent</code> is from. 45 * 46 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 47 * @return the BookshopTable 48 */ 49 @SuppressWarnings("unchecked") 50 public BookshopTable<Bookshop> getBookshopTable() { 51 return (BookshopTable<Bookshop>)getTable(); 52 } 53 54 @SuppressWarnings("unchecked") 55 private BookshopTable<Bookshop> _getBookshopTable() { 56 return (BookshopTable<Bookshop>)getTable(); 57 } 58 59 // Fields in this table 60 /** 61 * id 62 */ 63 protected Integer id; 64 /** 65 * code - The system codename for the shop: must be BOB for blackwell.co.uk, 66 * BOLUK for uk.bol.com 67 */ 68 protected String code; 69 /** 70 * Display name - A display name for the bookshop 71 */ 72 protected String displayname; 73 /** 74 * Flag image name - The name of a flag image file in 75 * bibliomania/html/graphics to be displayed next to the bookshop's 76 * stockings 77 */ 78 protected String flagfilename; 79 /** 80 * disabled - Whether the shop should currently be excluded from searches 81 * (takes effect next time server restarted) 82 */ 83 protected Boolean disabled; 84 85 86 /** 87 * Retrieves the <code>Id</code> value, without locking, 88 * for this <code>Bookshop</code> <code>Persistent</code>. 89 * 90 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 91 * @return the Integer id 92 */ 93 public Integer getId_unsafe() { 94 return id; 95 } 96 97 98 /** 99 * Sets the <code>Id</code> value directly, without checking, 100 * for this Bookshop <code>Persistent</code>. 101 * 102 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 103 * @param cooked the pre-validated value to set 104 */ 105 public void setId_unsafe(Integer cooked) { 106 id = cooked; 107 } 108 109 /** 110 * Retrieves the Id value, with locking, for this 111 * <code>Bookshop</code> <code>Persistent</code>. 112 * 113 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 114 * @throws AccessPoemException 115 * if the current <code>AccessToken</code> 116 * does not confer write access rights 117 * @return the value of the field <code>Id</code> for this 118 * <code>Bookshop</code> <code>Persistent</code> 119 */ 120 121 public Integer getId() 122 throws AccessPoemException { 123 readLock(); 124 return getId_unsafe(); 125 } 126 127 128 /** 129 * Sets the <code>Id</code> value, with checking, for this 130 * <code>Bookshop</code> <code>Persistent</code>. 131 * 132 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 133 * @param cooked a validated <code>int</code> 134 * @throws AccessPoemException 135 * if the current <code>AccessToken</code> 136 * does not confer write access rights 137 * @throws ValidationPoemException 138 * if the value is not valid 139 */ 140 public void setId(Integer cooked) 141 throws AccessPoemException, ValidationPoemException { 142 _getBookshopTable().getIdColumn(). 143 getType().assertValidCooked(cooked); 144 writeLock(); 145 setId_unsafe(cooked); 146 } 147 148 /** 149 * Sets the <code>Id</code> value, with checking, for this 150 * <code>Bookshop</code> <code>Persistent</code>. 151 * 152 * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 153 * @param cooked a validated <code>int</code> 154 * @throws AccessPoemException 155 * if the current <code>AccessToken</code> 156 * does not confer write access rights 157 * @throws ValidationPoemException 158 * if the value is not valid 159 */ 160 161 public final void setId(int cooked) 162 throws AccessPoemException, ValidationPoemException { 163 setId(new Integer(cooked)); 164 } 165 166 167 /** 168 * Retrieves the <code>Id</code> value as a <code>Field</code> 169 * from this <code>Bookshop</code> <code>Persistent</code>. 170 * 171 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 172 * @throws AccessPoemException 173 * if the current <code>AccessToken</code> 174 * does not confer write access rights 175 * @return the Integer id 176 */ 177 public Field<Integer> getIdField() throws AccessPoemException { 178 Column<Integer> c = _getBookshopTable().getIdColumn(); 179 return new Field<Integer>((Integer)c.getRaw(this), c); 180 } 181 182 183 /** 184 * Retrieves the <code>Code</code> value, without locking, 185 * for this <code>Bookshop</code> <code>Persistent</code>. 186 * 187 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 188 * @return the String code 189 */ 190 public String getCode_unsafe() { 191 return code; 192 } 193 194 195 /** 196 * Sets the <code>Code</code> value directly, without checking, 197 * for this Bookshop <code>Persistent</code>. 198 * 199 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 200 * @param cooked the pre-validated value to set 201 */ 202 public void setCode_unsafe(String cooked) { 203 code = cooked; 204 } 205 206 /** 207 * Retrieves the Code value, with locking, for this 208 * <code>Bookshop</code> <code>Persistent</code>. 209 * Field description: 210 * The system codename for the shop: must be BOB for blackwell.co.uk, 211 * BOLUK for uk.bol.com 212 * 213 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 214 * @throws AccessPoemException 215 * if the current <code>AccessToken</code> 216 * does not confer write access rights 217 * @return the value of the field <code>Code</code> for this 218 * <code>Bookshop</code> <code>Persistent</code> 219 */ 220 221 public String getCode() 222 throws AccessPoemException { 223 readLock(); 224 return getCode_unsafe(); 225 } 226 227 228 /** 229 * Sets the <code>Code</code> value, with checking, for this 230 * <code>Bookshop</code> <code>Persistent</code>. 231 * Field description: 232 * The system codename for the shop: must be BOB for blackwell.co.uk, 233 * BOLUK for uk.bol.com 234 * 235 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 236 * @param cooked a validated <code>int</code> 237 * @throws AccessPoemException 238 * if the current <code>AccessToken</code> 239 * does not confer write access rights 240 * @throws ValidationPoemException 241 * if the value is not valid 242 */ 243 public void setCode(String cooked) 244 throws AccessPoemException, ValidationPoemException { 245 _getBookshopTable().getCodeColumn(). 246 getType().assertValidCooked(cooked); 247 writeLock(); 248 setCode_unsafe(cooked); 249 } 250 251 252 /** 253 * Retrieves the <code>Code</code> value as a <code>Field</code> 254 * from this <code>Bookshop</code> <code>Persistent</code>. 255 * 256 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 257 * @throws AccessPoemException 258 * if the current <code>AccessToken</code> 259 * does not confer write access rights 260 * @return the String code 261 */ 262 public Field<String> getCodeField() throws AccessPoemException { 263 Column<String> c = _getBookshopTable().getCodeColumn(); 264 return new Field<String>((String)c.getRaw(this), c); 265 } 266 267 268 /** 269 * Retrieves the <code>Displayname</code> value, without locking, 270 * for this <code>Bookshop</code> <code>Persistent</code>. 271 * 272 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 273 * @return the String displayname 274 */ 275 public String getDisplayname_unsafe() { 276 return displayname; 277 } 278 279 280 /** 281 * Sets the <code>Displayname</code> value directly, without checking, 282 * for this Bookshop <code>Persistent</code>. 283 * 284 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 285 * @param cooked the pre-validated value to set 286 */ 287 public void setDisplayname_unsafe(String cooked) { 288 displayname = cooked; 289 } 290 291 /** 292 * Retrieves the Displayname value, with locking, for this 293 * <code>Bookshop</code> <code>Persistent</code>. 294 * Field description: 295 * A display name for the bookshop 296 * 297 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 298 * @throws AccessPoemException 299 * if the current <code>AccessToken</code> 300 * does not confer write access rights 301 * @return the value of the field <code>Displayname</code> for this 302 * <code>Bookshop</code> <code>Persistent</code> 303 */ 304 305 public String getDisplayname() 306 throws AccessPoemException { 307 readLock(); 308 return getDisplayname_unsafe(); 309 } 310 311 312 /** 313 * Sets the <code>Displayname</code> value, with checking, for this 314 * <code>Bookshop</code> <code>Persistent</code>. 315 * Field description: 316 * A display name for the bookshop 317 * 318 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 319 * @param cooked a validated <code>int</code> 320 * @throws AccessPoemException 321 * if the current <code>AccessToken</code> 322 * does not confer write access rights 323 * @throws ValidationPoemException 324 * if the value is not valid 325 */ 326 public void setDisplayname(String cooked) 327 throws AccessPoemException, ValidationPoemException { 328 _getBookshopTable().getDisplaynameColumn(). 329 getType().assertValidCooked(cooked); 330 writeLock(); 331 setDisplayname_unsafe(cooked); 332 } 333 334 335 /** 336 * Retrieves the <code>Displayname</code> value as a <code>Field</code> 337 * from this <code>Bookshop</code> <code>Persistent</code>. 338 * 339 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 340 * @throws AccessPoemException 341 * if the current <code>AccessToken</code> 342 * does not confer write access rights 343 * @return the String displayname 344 */ 345 public Field<String> getDisplaynameField() throws AccessPoemException { 346 Column<String> c = _getBookshopTable().getDisplaynameColumn(); 347 return new Field<String>((String)c.getRaw(this), c); 348 } 349 350 351 /** 352 * Retrieves the <code>Flagfilename</code> value, without locking, 353 * for this <code>Bookshop</code> <code>Persistent</code>. 354 * 355 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 356 * @return the String flagfilename 357 */ 358 public String getFlagfilename_unsafe() { 359 return flagfilename; 360 } 361 362 363 /** 364 * Sets the <code>Flagfilename</code> value directly, without checking, 365 * for this Bookshop <code>Persistent</code>. 366 * 367 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 368 * @param cooked the pre-validated value to set 369 */ 370 public void setFlagfilename_unsafe(String cooked) { 371 flagfilename = cooked; 372 } 373 374 /** 375 * Retrieves the Flagfilename value, with locking, for this 376 * <code>Bookshop</code> <code>Persistent</code>. 377 * Field description: 378 * The name of a flag image file in bibliomania/html/graphics to be 379 * displayed next to the bookshop's stockings 380 * 381 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 382 * @throws AccessPoemException 383 * if the current <code>AccessToken</code> 384 * does not confer write access rights 385 * @return the value of the field <code>Flagfilename</code> for this 386 * <code>Bookshop</code> <code>Persistent</code> 387 */ 388 389 public String getFlagfilename() 390 throws AccessPoemException { 391 readLock(); 392 return getFlagfilename_unsafe(); 393 } 394 395 396 /** 397 * Sets the <code>Flagfilename</code> value, with checking, for this 398 * <code>Bookshop</code> <code>Persistent</code>. 399 * Field description: 400 * The name of a flag image file in bibliomania/html/graphics to be 401 * displayed next to the bookshop's stockings 402 * 403 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 404 * @param cooked a validated <code>int</code> 405 * @throws AccessPoemException 406 * if the current <code>AccessToken</code> 407 * does not confer write access rights 408 * @throws ValidationPoemException 409 * if the value is not valid 410 */ 411 public void setFlagfilename(String cooked) 412 throws AccessPoemException, ValidationPoemException { 413 _getBookshopTable().getFlagfilenameColumn(). 414 getType().assertValidCooked(cooked); 415 writeLock(); 416 setFlagfilename_unsafe(cooked); 417 } 418 419 420 /** 421 * Retrieves the <code>Flagfilename</code> value as a <code>Field</code> 422 * from this <code>Bookshop</code> <code>Persistent</code>. 423 * 424 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 425 * @throws AccessPoemException 426 * if the current <code>AccessToken</code> 427 * does not confer write access rights 428 * @return the String flagfilename 429 */ 430 public Field<String> getFlagfilenameField() throws AccessPoemException { 431 Column<String> c = _getBookshopTable().getFlagfilenameColumn(); 432 return new Field<String>((String)c.getRaw(this), c); 433 } 434 435 436 /** 437 * Retrieves the <code>Disabled</code> value, without locking, 438 * for this <code>Bookshop</code> <code>Persistent</code>. 439 * 440 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 441 * @return the Boolean disabled 442 */ 443 public Boolean getDisabled_unsafe() { 444 return disabled; 445 } 446 447 448 /** 449 * Sets the <code>Disabled</code> value directly, without checking, 450 * for this Bookshop <code>Persistent</code>. 451 * 452 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 453 * @param cooked the pre-validated value to set 454 */ 455 public void setDisabled_unsafe(Boolean cooked) { 456 disabled = cooked; 457 } 458 459 /** 460 * Retrieves the Disabled value, with locking, for this 461 * <code>Bookshop</code> <code>Persistent</code>. 462 * Field description: 463 * Whether the shop should currently be excluded from searches (takes 464 * effect next time server restarted) 465 * 466 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 467 * @throws AccessPoemException 468 * if the current <code>AccessToken</code> 469 * does not confer write access rights 470 * @return the value of the field <code>Disabled</code> for this 471 * <code>Bookshop</code> <code>Persistent</code> 472 */ 473 474 public Boolean getDisabled() 475 throws AccessPoemException { 476 readLock(); 477 return getDisabled_unsafe(); 478 } 479 480 481 /** 482 * Sets the <code>Disabled</code> value, with checking, for this 483 * <code>Bookshop</code> <code>Persistent</code>. 484 * Field description: 485 * Whether the shop should currently be excluded from searches (takes 486 * effect next time server restarted) 487 * 488 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 489 * @param cooked a validated <code>int</code> 490 * @throws AccessPoemException 491 * if the current <code>AccessToken</code> 492 * does not confer write access rights 493 * @throws ValidationPoemException 494 * if the value is not valid 495 */ 496 public void setDisabled(Boolean cooked) 497 throws AccessPoemException, ValidationPoemException { 498 _getBookshopTable().getDisabledColumn(). 499 getType().assertValidCooked(cooked); 500 writeLock(); 501 setDisabled_unsafe(cooked); 502 } 503 504 /** 505 * Sets the <code>Disabled</code> value, with checking, 506 * from a <code>boolean</code>, for this 507 * <code>Bookshop</code> <code>Persistent</code>. 508 * Field description: 509 * Whether the shop should currently be excluded from searches (takes 510 * effect next time server restarted) 511 * 512 * 513 * Generated by org.melati.poem.prepro.BooleanFieldDef#generateBaseMethods 514 * @param cooked a <code>boolean</code> 515 * @throws AccessPoemException 516 * if the current <code>AccessToken</code> 517 * does not confer write access rights 518 * @throws ValidationPoemException 519 * if the value is not valid 520 */ 521 522 public final void setDisabled(boolean cooked) 523 throws AccessPoemException, ValidationPoemException { 524 setDisabled(cooked ? Boolean.TRUE : Boolean.FALSE); 525 } 526 527 528 /** 529 * Retrieves the <code>Disabled</code> value as a <code>Field</code> 530 * from this <code>Bookshop</code> <code>Persistent</code>. 531 * 532 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 533 * @throws AccessPoemException 534 * if the current <code>AccessToken</code> 535 * does not confer write access rights 536 * @return the Boolean disabled 537 */ 538 public Field<Boolean> getDisabledField() throws AccessPoemException { 539 Column<Boolean> c = _getBookshopTable().getDisabledColumn(); 540 return new Field<Boolean>((Boolean)c.getRaw(this), c); 541 } 542 543 private CachedSelection<BookStocking> shopBookStockings = null; 544 /** References to this Bookshop in the BookStocking table via its shop field.*/ 545 @SuppressWarnings("unchecked") 546 public Enumeration<BookStocking> getShopBookStockings() { 547 if (getTroid() == null) 548 return new EmptyEnumeration<BookStocking>(); 549 else { 550 if (shopBookStockings == null) 551 shopBookStockings = 552 getBibliomaniaDatabaseTables().getBookStockingTable().getShopColumn().cachedSelectionWhereEq(getTroid()); 553 return shopBookStockings.objects(); 554 } 555 } 556 557 558 /** References to this Bookshop in the BookStocking table via its shop field, as a List.*/ 559 public List<BookStocking> getShopBookStockingList() { 560 return Collections.list(getShopBookStockings()); 561 } 562 563 564 565 } 566