1 // Do not edit this file! It was generated by Melati POEM's DSD preprocessor. 2 3 package org.paneris.rimauresq.model.generated; 4 5 6 import java.math.BigDecimal; 7 import org.melati.poem.AccessPoemException; 8 import org.melati.poem.Column; 9 import org.melati.poem.Field; 10 import org.melati.poem.JdbcPersistent; 11 import org.melati.poem.ValidationPoemException; 12 import org.paneris.rimauresq.model.ProductTable; 13 import org.paneris.rimauresq.model.RimauresqDatabaseTables; 14 15 16 /** 17 * Melati POEM generated abstract base class for a <code>Persistent</code> 18 * <code>Product</code> Object. 19 * 20 * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava 21 */ 22 public abstract class ProductBase extends JdbcPersistent { 23 24 25 /** 26 * Retrieves the Database object. 27 * 28 * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava 29 * @return the database 30 */ 31 public RimauresqDatabaseTables getRimauresqDatabaseTables() { 32 return (RimauresqDatabaseTables)getDatabase(); 33 } 34 35 36 /** 37 * Retrieves the <code>ProductTable</code> table 38 * which this <code>Persistent</code> is from. 39 * 40 * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava 41 * @return the ProductTable 42 */ 43 public ProductTable getProductTable() { 44 return (ProductTable)getTable(); 45 } 46 47 private ProductTable _getProductTable() { 48 return (ProductTable)getTable(); 49 } 50 51 // Fields in this table 52 /** 53 * id 54 */ 55 protected Integer id; 56 /** 57 * Item - Product name 58 */ 59 protected String name; 60 /** 61 * Description - Tasting note 62 */ 63 protected String description; 64 /** 65 * Retail Price inc VAT 66 */ 67 protected BigDecimal price; 68 69 70 /** 71 * Retrieves the <code>Id</code> value, without locking, 72 * for this <code>Product</code> <code>Persistent</code>. 73 * 74 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 75 * @return the Integer id 76 */ 77 public Integer getId_unsafe() { 78 return id; 79 } 80 81 82 /** 83 * Sets the <code>Id</code> value directly, without checking, 84 * for this Product <code>Persistent</code>. 85 * 86 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 87 * @param cooked the pre-validated value to set 88 */ 89 public void setId_unsafe(Integer cooked) { 90 id = cooked; 91 } 92 93 /** 94 * Retrieves the Id value, with locking, for this 95 * <code>Product</code> <code>Persistent</code>. 96 * 97 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 98 * @throws AccessPoemException 99 * if the current <code>AccessToken</code> 100 * does not confer write access rights 101 * @return the value of the field <code>Id</code> for this 102 * <code>Product</code> <code>Persistent</code> 103 */ 104 105 public Integer getId() 106 throws AccessPoemException { 107 readLock(); 108 return getId_unsafe(); 109 } 110 111 112 /** 113 * Sets the <code>Id</code> value, with checking, for this 114 * <code>Product</code> <code>Persistent</code>. 115 * 116 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 117 * @param cooked a validated <code>int</code> 118 * @throws AccessPoemException 119 * if the current <code>AccessToken</code> 120 * does not confer write access rights 121 * @throws ValidationPoemException 122 * if the value is not valid 123 */ 124 public void setId(Integer cooked) 125 throws AccessPoemException, ValidationPoemException { 126 _getProductTable().getIdColumn(). 127 getType().assertValidCooked(cooked); 128 writeLock(); 129 setId_unsafe(cooked); 130 } 131 132 /** 133 * Sets the <code>Id</code> value, with checking, for this 134 * <code>Product</code> <code>Persistent</code>. 135 * 136 * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 137 * @param cooked a validated <code>int</code> 138 * @throws AccessPoemException 139 * if the current <code>AccessToken</code> 140 * does not confer write access rights 141 * @throws ValidationPoemException 142 * if the value is not valid 143 */ 144 145 public final void setId(int cooked) 146 throws AccessPoemException, ValidationPoemException { 147 setId(new Integer(cooked)); 148 } 149 150 151 /** 152 * Retrieves the <code>Id</code> value as a <code>Field</code> 153 * from this <code>Product</code> <code>Persistent</code>. 154 * 155 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator 156 * @throws AccessPoemException 157 * if the current <code>AccessToken</code> 158 * does not confer write access rights 159 * @return the Integer id 160 */ 161 public Field getIdField() throws AccessPoemException { 162 Column c = _getProductTable().getIdColumn(); 163 return new Field(c.getRaw(this), c); 164 } 165 166 167 /** 168 * Retrieves the <code>Name</code> value, without locking, 169 * for this <code>Product</code> <code>Persistent</code>. 170 * 171 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 172 * @return the String name 173 */ 174 public String getName_unsafe() { 175 return name; 176 } 177 178 179 /** 180 * Sets the <code>Name</code> value directly, without checking, 181 * for this Product <code>Persistent</code>. 182 * 183 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 184 * @param cooked the pre-validated value to set 185 */ 186 public void setName_unsafe(String cooked) { 187 name = cooked; 188 } 189 190 /** 191 * Retrieves the Name value, with locking, for this 192 * <code>Product</code> <code>Persistent</code>. 193 * Field description: 194 * Product name 195 * 196 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 197 * @throws AccessPoemException 198 * if the current <code>AccessToken</code> 199 * does not confer write access rights 200 * @return the value of the field <code>Name</code> for this 201 * <code>Product</code> <code>Persistent</code> 202 */ 203 204 public String getName() 205 throws AccessPoemException { 206 readLock(); 207 return getName_unsafe(); 208 } 209 210 211 /** 212 * Sets the <code>Name</code> value, with checking, for this 213 * <code>Product</code> <code>Persistent</code>. 214 * Field description: 215 * Product name 216 * 217 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 218 * @param cooked a validated <code>int</code> 219 * @throws AccessPoemException 220 * if the current <code>AccessToken</code> 221 * does not confer write access rights 222 * @throws ValidationPoemException 223 * if the value is not valid 224 */ 225 public void setName(String cooked) 226 throws AccessPoemException, ValidationPoemException { 227 _getProductTable().getNameColumn(). 228 getType().assertValidCooked(cooked); 229 writeLock(); 230 setName_unsafe(cooked); 231 } 232 233 234 /** 235 * Retrieves the <code>Name</code> value as a <code>Field</code> 236 * from this <code>Product</code> <code>Persistent</code>. 237 * 238 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator 239 * @throws AccessPoemException 240 * if the current <code>AccessToken</code> 241 * does not confer write access rights 242 * @return the String name 243 */ 244 public Field getNameField() throws AccessPoemException { 245 Column c = _getProductTable().getNameColumn(); 246 return new Field(c.getRaw(this), c); 247 } 248 249 250 /** 251 * Retrieves the <code>Description</code> value, without locking, 252 * for this <code>Product</code> <code>Persistent</code>. 253 * 254 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 255 * @return the String description 256 */ 257 public String getDescription_unsafe() { 258 return description; 259 } 260 261 262 /** 263 * Sets the <code>Description</code> value directly, without checking, 264 * for this Product <code>Persistent</code>. 265 * 266 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 267 * @param cooked the pre-validated value to set 268 */ 269 public void setDescription_unsafe(String cooked) { 270 description = cooked; 271 } 272 273 /** 274 * Retrieves the Description value, with locking, for this 275 * <code>Product</code> <code>Persistent</code>. 276 * Field description: 277 * Tasting note 278 * 279 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 280 * @throws AccessPoemException 281 * if the current <code>AccessToken</code> 282 * does not confer write access rights 283 * @return the value of the field <code>Description</code> for this 284 * <code>Product</code> <code>Persistent</code> 285 */ 286 287 public String getDescription() 288 throws AccessPoemException { 289 readLock(); 290 return getDescription_unsafe(); 291 } 292 293 294 /** 295 * Sets the <code>Description</code> value, with checking, for this 296 * <code>Product</code> <code>Persistent</code>. 297 * Field description: 298 * Tasting note 299 * 300 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 301 * @param cooked a validated <code>int</code> 302 * @throws AccessPoemException 303 * if the current <code>AccessToken</code> 304 * does not confer write access rights 305 * @throws ValidationPoemException 306 * if the value is not valid 307 */ 308 public void setDescription(String cooked) 309 throws AccessPoemException, ValidationPoemException { 310 _getProductTable().getDescriptionColumn(). 311 getType().assertValidCooked(cooked); 312 writeLock(); 313 setDescription_unsafe(cooked); 314 } 315 316 317 /** 318 * Retrieves the <code>Description</code> value as a <code>Field</code> 319 * from this <code>Product</code> <code>Persistent</code>. 320 * 321 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator 322 * @throws AccessPoemException 323 * if the current <code>AccessToken</code> 324 * does not confer write access rights 325 * @return the String description 326 */ 327 public Field getDescriptionField() throws AccessPoemException { 328 Column c = _getProductTable().getDescriptionColumn(); 329 return new Field(c.getRaw(this), c); 330 } 331 332 333 /** 334 * Retrieves the <code>Price</code> value, without locking, 335 * for this <code>Product</code> <code>Persistent</code>. 336 * 337 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 338 * @return the BigDecimal price 339 */ 340 public BigDecimal getPrice_unsafe() { 341 return price; 342 } 343 344 345 /** 346 * Sets the <code>Price</code> value directly, without checking, 347 * for this Product <code>Persistent</code>. 348 * 349 * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 350 * @param cooked the pre-validated value to set 351 */ 352 public void setPrice_unsafe(BigDecimal cooked) { 353 price = cooked; 354 } 355 356 /** 357 * Retrieves the Price value, with locking, for this 358 * <code>Product</code> <code>Persistent</code>. 359 * 360 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 361 * @throws AccessPoemException 362 * if the current <code>AccessToken</code> 363 * does not confer write access rights 364 * @return the value of the field <code>Price</code> for this 365 * <code>Product</code> <code>Persistent</code> 366 */ 367 368 public BigDecimal getPrice() 369 throws AccessPoemException { 370 readLock(); 371 return getPrice_unsafe(); 372 } 373 374 375 /** 376 * Sets the <code>Price</code> value, with checking, for this 377 * <code>Product</code> <code>Persistent</code>. 378 * 379 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 380 * @param cooked a validated <code>int</code> 381 * @throws AccessPoemException 382 * if the current <code>AccessToken</code> 383 * does not confer write access rights 384 * @throws ValidationPoemException 385 * if the value is not valid 386 */ 387 public void setPrice(BigDecimal cooked) 388 throws AccessPoemException, ValidationPoemException { 389 _getProductTable().getPriceColumn(). 390 getType().assertValidCooked(cooked); 391 writeLock(); 392 setPrice_unsafe(cooked); 393 } 394 395 396 /** 397 * Retrieves the <code>Price</code> value as a <code>Field</code> 398 * from this <code>Product</code> <code>Persistent</code>. 399 * 400 * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator 401 * @throws AccessPoemException 402 * if the current <code>AccessToken</code> 403 * does not confer write access rights 404 * @return the BigDecimal price 405 */ 406 public Field getPriceField() throws AccessPoemException { 407 Column c = _getProductTable().getPriceColumn(); 408 return new Field(c.getRaw(this), c); 409 } 410 } 411