| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| OrderStatusBase |
|
| 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.OrderStatus; | |
| 18 | import org.paneris.bibliomania.OrderStatusTable; | |
| 19 | import org.paneris.bibliomania.ShopOrder; | |
| 20 | import org.paneris.bibliomania.ShopOrderItem; | |
| 21 | ||
| 22 | ||
| 23 | /** | |
| 24 | * Melati POEM generated abstract base class for a <code>Persistent</code> | |
| 25 | * <code>OrderStatus</code> Object. | |
| 26 | * | |
| 27 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 28 | */ | |
| 29 | 0 | public abstract class OrderStatusBase 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>OrderStatusTable</code> table | |
| 45 | * which this <code>Persistent</code> is from. | |
| 46 | * | |
| 47 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 48 | * @return the OrderStatusTable | |
| 49 | */ | |
| 50 | @SuppressWarnings("unchecked") | |
| 51 | public OrderStatusTable<OrderStatus> getOrderStatusTable() { | |
| 52 | 0 | return (OrderStatusTable<OrderStatus>)getTable(); |
| 53 | } | |
| 54 | ||
| 55 | @SuppressWarnings("unchecked") | |
| 56 | private OrderStatusTable<OrderStatus> _getOrderStatusTable() { | |
| 57 | 0 | return (OrderStatusTable<OrderStatus>)getTable(); |
| 58 | } | |
| 59 | ||
| 60 | // Fields in this table | |
| 61 | /** | |
| 62 | * id | |
| 63 | */ | |
| 64 | protected Integer id; | |
| 65 | /** | |
| 66 | * Status - The status of an order or order item | |
| 67 | */ | |
| 68 | protected String status; | |
| 69 | ||
| 70 | ||
| 71 | /** | |
| 72 | * Retrieves the <code>Id</code> value, without locking, | |
| 73 | * for this <code>OrderStatus</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 OrderStatus <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>OrderStatus</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>OrderStatus</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>OrderStatus</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 | _getOrderStatusTable().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>OrderStatus</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>OrderStatus</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 = _getOrderStatusTable().getIdColumn(); |
| 164 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 165 | } | |
| 166 | ||
| 167 | ||
| 168 | /** | |
| 169 | * Retrieves the <code>Status</code> value, without locking, | |
| 170 | * for this <code>OrderStatus</code> <code>Persistent</code>. | |
| 171 | * | |
| 172 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 173 | * @return the String status | |
| 174 | */ | |
| 175 | public String getStatus_unsafe() { | |
| 176 | 0 | return status; |
| 177 | } | |
| 178 | ||
| 179 | ||
| 180 | /** | |
| 181 | * Sets the <code>Status</code> value directly, without checking, | |
| 182 | * for this OrderStatus <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 setStatus_unsafe(String cooked) { | |
| 188 | 0 | status = cooked; |
| 189 | 0 | } |
| 190 | ||
| 191 | /** | |
| 192 | * Retrieves the Status value, with locking, for this | |
| 193 | * <code>OrderStatus</code> <code>Persistent</code>. | |
| 194 | * Field description: | |
| 195 | * The status of an order or order item | |
| 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>Status</code> for this | |
| 202 | * <code>OrderStatus</code> <code>Persistent</code> | |
| 203 | */ | |
| 204 | ||
| 205 | public String getStatus() | |
| 206 | throws AccessPoemException { | |
| 207 | 0 | readLock(); |
| 208 | 0 | return getStatus_unsafe(); |
| 209 | } | |
| 210 | ||
| 211 | ||
| 212 | /** | |
| 213 | * Sets the <code>Status</code> value, with checking, for this | |
| 214 | * <code>OrderStatus</code> <code>Persistent</code>. | |
| 215 | * Field description: | |
| 216 | * The status of an order or order item | |
| 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 setStatus(String cooked) | |
| 227 | throws AccessPoemException, ValidationPoemException { | |
| 228 | 0 | _getOrderStatusTable().getStatusColumn(). |
| 229 | getType().assertValidCooked(cooked); | |
| 230 | 0 | writeLock(); |
| 231 | 0 | setStatus_unsafe(cooked); |
| 232 | 0 | } |
| 233 | ||
| 234 | ||
| 235 | /** | |
| 236 | * Retrieves the <code>Status</code> value as a <code>Field</code> | |
| 237 | * from this <code>OrderStatus</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 status | |
| 244 | */ | |
| 245 | public Field<String> getStatusField() throws AccessPoemException { | |
| 246 | 0 | Column<String> c = _getOrderStatusTable().getStatusColumn(); |
| 247 | 0 | return new Field<String>((String)c.getRaw(this), c); |
| 248 | } | |
| 249 | ||
| 250 | 0 | private CachedSelection<ShopOrder> statusShopOrders = null; |
| 251 | /** References to this OrderStatus in the ShopOrder table via its status field.*/ | |
| 252 | @SuppressWarnings("unchecked") | |
| 253 | public Enumeration<ShopOrder> getStatusShopOrders() { | |
| 254 | 0 | if (getTroid() == null) |
| 255 | 0 | return new EmptyEnumeration<ShopOrder>(); |
| 256 | else { | |
| 257 | 0 | if (statusShopOrders == null) |
| 258 | 0 | statusShopOrders = |
| 259 | getBibliomaniaDatabaseTables().getShopOrderTable().getStatusColumn().cachedSelectionWhereEq(getTroid()); | |
| 260 | 0 | return statusShopOrders.objects(); |
| 261 | } | |
| 262 | } | |
| 263 | ||
| 264 | ||
| 265 | /** References to this OrderStatus in the ShopOrder table via its status field, as a List.*/ | |
| 266 | public List<ShopOrder> getStatusShopOrderList() { | |
| 267 | 0 | return Collections.list(getStatusShopOrders()); |
| 268 | } | |
| 269 | ||
| 270 | ||
| 271 | ||
| 272 | 0 | private CachedSelection<ShopOrderItem> statusShopOrderItems = null; |
| 273 | /** References to this OrderStatus in the ShopOrderItem table via its status field.*/ | |
| 274 | @SuppressWarnings("unchecked") | |
| 275 | public Enumeration<ShopOrderItem> getStatusShopOrderItems() { | |
| 276 | 0 | if (getTroid() == null) |
| 277 | 0 | return new EmptyEnumeration<ShopOrderItem>(); |
| 278 | else { | |
| 279 | 0 | if (statusShopOrderItems == null) |
| 280 | 0 | statusShopOrderItems = |
| 281 | getBibliomaniaDatabaseTables().getShopOrderItemTable().getStatusColumn().cachedSelectionWhereEq(getTroid()); | |
| 282 | 0 | return statusShopOrderItems.objects(); |
| 283 | } | |
| 284 | } | |
| 285 | ||
| 286 | ||
| 287 | /** References to this OrderStatus in the ShopOrderItem table via its status field, as a List.*/ | |
| 288 | public List<ShopOrderItem> getStatusShopOrderItemList() { | |
| 289 | 0 | return Collections.list(getStatusShopOrderItems()); |
| 290 | } | |
| 291 | ||
| 292 | ||
| 293 | ||
| 294 | } | |
| 295 |