| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| GroupMembershipBase |
|
| 1.2608695652173914;1.261 |
| 1 | // Do not edit this file! It was generated by Melati POEM's DSD preprocessor. | |
| 2 | ||
| 3 | package org.melati.poem.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.Group; | |
| 10 | import org.melati.poem.GroupMembership; | |
| 11 | import org.melati.poem.GroupMembershipTable; | |
| 12 | import org.melati.poem.JdbcPersistent; | |
| 13 | import org.melati.poem.NoSuchRowPoemException; | |
| 14 | import org.melati.poem.PoemDatabaseTables; | |
| 15 | import org.melati.poem.User; | |
| 16 | import org.melati.poem.ValidationPoemException; | |
| 17 | ||
| 18 | ||
| 19 | /** | |
| 20 | * Melati POEM generated abstract base class for a <code>Persistent</code> | |
| 21 | * <code>groupMembership</code> Object. | |
| 22 | * | |
| 23 | * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 24 | */ | |
| 25 | 46 | public abstract class GroupMembershipBase 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 PoemDatabaseTables getPoemDatabaseTables() { | |
| 35 | 2 | return (PoemDatabaseTables)getDatabase(); |
| 36 | } | |
| 37 | ||
| 38 | ||
| 39 | /** | |
| 40 | * Retrieves the <code>GroupMembershipTable</code> table | |
| 41 | * which this <code>Persistent</code> is from. | |
| 42 | * | |
| 43 | * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 44 | * @return the GroupMembershipTable | |
| 45 | */ | |
| 46 | @SuppressWarnings("unchecked") | |
| 47 | public GroupMembershipTable<GroupMembership> getGroupMembershipTable() { | |
| 48 | 0 | return (GroupMembershipTable<GroupMembership>)getTable(); |
| 49 | } | |
| 50 | ||
| 51 | @SuppressWarnings("unchecked") | |
| 52 | private GroupMembershipTable<GroupMembership> _getGroupMembershipTable() { | |
| 53 | 123 | return (GroupMembershipTable<GroupMembership>)getTable(); |
| 54 | } | |
| 55 | ||
| 56 | // Fields in this table | |
| 57 | /** | |
| 58 | * id - The Table Row Object ID | |
| 59 | */ | |
| 60 | protected Integer id; | |
| 61 | /** | |
| 62 | * User - The user who belongs to the group | |
| 63 | */ | |
| 64 | protected Integer user; | |
| 65 | /** | |
| 66 | * Group - The group to which the user belongs | |
| 67 | */ | |
| 68 | protected Integer group; | |
| 69 | ||
| 70 | ||
| 71 | /** | |
| 72 | * Retrieves the <code>Id</code> value, without locking, | |
| 73 | * for this <code>groupMembership</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 | 100 | return id; |
| 80 | } | |
| 81 | ||
| 82 | ||
| 83 | /** | |
| 84 | * Sets the <code>Id</code> value directly, without checking, | |
| 85 | * for this groupMembership <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 | 54 | id = cooked; |
| 92 | 54 | } |
| 93 | ||
| 94 | /** | |
| 95 | * Retrieves the Id value, with locking, for this | |
| 96 | * <code>groupMembership</code> <code>Persistent</code>. | |
| 97 | * Field description: | |
| 98 | * The Table Row Object ID | |
| 99 | * | |
| 100 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 101 | * @throws AccessPoemException | |
| 102 | * if the current <code>AccessToken</code> | |
| 103 | * does not confer write access rights | |
| 104 | * @return the value of the field <code>Id</code> for this | |
| 105 | * <code>groupMembership</code> <code>Persistent</code> | |
| 106 | */ | |
| 107 | ||
| 108 | public Integer getId() | |
| 109 | throws AccessPoemException { | |
| 110 | 9 | readLock(); |
| 111 | 9 | return getId_unsafe(); |
| 112 | } | |
| 113 | ||
| 114 | ||
| 115 | /** | |
| 116 | * Sets the <code>Id</code> value, with checking, for this | |
| 117 | * <code>groupMembership</code> <code>Persistent</code>. | |
| 118 | * Field description: | |
| 119 | * The Table Row Object ID | |
| 120 | * | |
| 121 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 122 | * @param cooked a validated <code>int</code> | |
| 123 | * @throws AccessPoemException | |
| 124 | * if the current <code>AccessToken</code> | |
| 125 | * does not confer write access rights | |
| 126 | * @throws ValidationPoemException | |
| 127 | * if the value is not valid | |
| 128 | */ | |
| 129 | public void setId(Integer cooked) | |
| 130 | throws AccessPoemException, ValidationPoemException { | |
| 131 | 0 | _getGroupMembershipTable().getIdColumn(). |
| 132 | 0 | getType().assertValidCooked(cooked); |
| 133 | 0 | writeLock(); |
| 134 | 0 | setId_unsafe(cooked); |
| 135 | 0 | } |
| 136 | ||
| 137 | /** | |
| 138 | * Sets the <code>Id</code> value, with checking, for this | |
| 139 | * <code>groupMembership</code> <code>Persistent</code>. | |
| 140 | * Field description: | |
| 141 | * The Table Row Object ID | |
| 142 | * | |
| 143 | * | |
| 144 | * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods | |
| 145 | * @param cooked a validated <code>int</code> | |
| 146 | * @throws AccessPoemException | |
| 147 | * if the current <code>AccessToken</code> | |
| 148 | * does not confer write access rights | |
| 149 | * @throws ValidationPoemException | |
| 150 | * if the value is not valid | |
| 151 | */ | |
| 152 | ||
| 153 | public final void setId(int cooked) | |
| 154 | throws AccessPoemException, ValidationPoemException { | |
| 155 | 0 | setId(new Integer(cooked)); |
| 156 | 0 | } |
| 157 | ||
| 158 | ||
| 159 | /** | |
| 160 | * Retrieves the <code>Id</code> value as a <code>Field</code> | |
| 161 | * from this <code>groupMembership</code> <code>Persistent</code>. | |
| 162 | * | |
| 163 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 164 | * @throws AccessPoemException | |
| 165 | * if the current <code>AccessToken</code> | |
| 166 | * does not confer write access rights | |
| 167 | * @return the Integer id | |
| 168 | */ | |
| 169 | public Field<Integer> getIdField() throws AccessPoemException { | |
| 170 | 9 | Column<Integer> c = _getGroupMembershipTable().getIdColumn(); |
| 171 | 9 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 172 | } | |
| 173 | ||
| 174 | ||
| 175 | /** | |
| 176 | * Retrieves the <code>User</code> value, without locking, | |
| 177 | * for this <code>groupMembership</code> <code>Persistent</code>. | |
| 178 | * | |
| 179 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 180 | * @return the Integer user | |
| 181 | */ | |
| 182 | public Integer getUser_unsafe() { | |
| 183 | 105 | return user; |
| 184 | } | |
| 185 | ||
| 186 | ||
| 187 | /** | |
| 188 | * Sets the <code>User</code> value directly, without checking, | |
| 189 | * for this groupMembership <code>Persistent</code>. | |
| 190 | * | |
| 191 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 192 | * @param cooked the pre-validated value to set | |
| 193 | */ | |
| 194 | public void setUser_unsafe(Integer cooked) { | |
| 195 | 48 | user = cooked; |
| 196 | 48 | } |
| 197 | ||
| 198 | /** | |
| 199 | * Retrieves the Table Row Object ID. | |
| 200 | * | |
| 201 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 202 | * @throws AccessPoemException | |
| 203 | * if the current <code>AccessToken</code> | |
| 204 | * does not confer read access rights | |
| 205 | * @return the TROID as an <code>Integer</code> | |
| 206 | */ | |
| 207 | ||
| 208 | public Integer getUserTroid() | |
| 209 | throws AccessPoemException { | |
| 210 | 14 | readLock(); |
| 211 | 14 | return getUser_unsafe(); |
| 212 | } | |
| 213 | ||
| 214 | ||
| 215 | /** | |
| 216 | * Sets the Table Row Object ID. | |
| 217 | * | |
| 218 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 219 | * @param raw a Table Row Object Id | |
| 220 | * @throws AccessPoemException | |
| 221 | * if the current <code>AccessToken</code> | |
| 222 | * does not confer write access rights | |
| 223 | */ | |
| 224 | public void setUserTroid(Integer raw) | |
| 225 | throws AccessPoemException { | |
| 226 | 0 | setUser(raw == null ? null : |
| 227 | 0 | getPoemDatabaseTables().getUserTable().getUserObject(raw)); |
| 228 | 0 | } |
| 229 | ||
| 230 | ||
| 231 | /** | |
| 232 | * Retrieves the <code>User</code> object referred to. | |
| 233 | * | |
| 234 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 235 | * @throws AccessPoemException | |
| 236 | * if the current <code>AccessToken</code> | |
| 237 | * does not confer read access rights | |
| 238 | * @throws NoSuchRowPoemException | |
| 239 | * if the <code>Persistent</code> has yet to be allocated a TROID | |
| 240 | * @return the <code>User</code> as a <code>User</code> | |
| 241 | */ | |
| 242 | public User getUser() | |
| 243 | throws AccessPoemException, NoSuchRowPoemException { | |
| 244 | 0 | Integer troid = getUserTroid(); |
| 245 | 0 | return troid == null ? null : |
| 246 | 0 | getPoemDatabaseTables().getUserTable().getUserObject(troid); |
| 247 | } | |
| 248 | ||
| 249 | ||
| 250 | /** | |
| 251 | * Set the User. | |
| 252 | * | |
| 253 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 254 | * @param cooked a validated <code>User</code> | |
| 255 | * @throws AccessPoemException | |
| 256 | * if the current <code>AccessToken</code> | |
| 257 | * does not confer write access rights | |
| 258 | */ | |
| 259 | public void setUser(User cooked) | |
| 260 | throws AccessPoemException { | |
| 261 | 44 | _getGroupMembershipTable(). |
| 262 | 44 | getUserColumn(). |
| 263 | 44 | getType().assertValidCooked(cooked); |
| 264 | 44 | writeLock(); |
| 265 | 44 | if (cooked == null) |
| 266 | 0 | setUser_unsafe(null); |
| 267 | else { | |
| 268 | 44 | cooked.existenceLock(); |
| 269 | 44 | setUser_unsafe(cooked.troid()); |
| 270 | } | |
| 271 | 44 | } |
| 272 | ||
| 273 | ||
| 274 | /** | |
| 275 | * Retrieves the <code>User</code> value as a <code>Field</code> | |
| 276 | * from this <code>groupMembership</code> <code>Persistent</code>. | |
| 277 | * | |
| 278 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 279 | * @throws AccessPoemException | |
| 280 | * if the current <code>AccessToken</code> | |
| 281 | * does not confer write access rights | |
| 282 | * @return the Integer user | |
| 283 | */ | |
| 284 | public Field<Integer> getUserField() throws AccessPoemException { | |
| 285 | 14 | Column<Integer> c = _getGroupMembershipTable().getUserColumn(); |
| 286 | 14 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 287 | } | |
| 288 | ||
| 289 | ||
| 290 | /** | |
| 291 | * Retrieves the <code>Group</code> value, without locking, | |
| 292 | * for this <code>groupMembership</code> <code>Persistent</code>. | |
| 293 | * | |
| 294 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 295 | * @return the Integer group | |
| 296 | */ | |
| 297 | public Integer getGroup_unsafe() { | |
| 298 | 105 | return group; |
| 299 | } | |
| 300 | ||
| 301 | ||
| 302 | /** | |
| 303 | * Sets the <code>Group</code> value directly, without checking, | |
| 304 | * for this groupMembership <code>Persistent</code>. | |
| 305 | * | |
| 306 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 307 | * @param cooked the pre-validated value to set | |
| 308 | */ | |
| 309 | public void setGroup_unsafe(Integer cooked) { | |
| 310 | 48 | group = cooked; |
| 311 | 48 | } |
| 312 | ||
| 313 | /** | |
| 314 | * Retrieves the Table Row Object ID. | |
| 315 | * | |
| 316 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 317 | * @throws AccessPoemException | |
| 318 | * if the current <code>AccessToken</code> | |
| 319 | * does not confer read access rights | |
| 320 | * @return the TROID as an <code>Integer</code> | |
| 321 | */ | |
| 322 | ||
| 323 | public Integer getGroupTroid() | |
| 324 | throws AccessPoemException { | |
| 325 | 14 | readLock(); |
| 326 | 14 | return getGroup_unsafe(); |
| 327 | } | |
| 328 | ||
| 329 | ||
| 330 | /** | |
| 331 | * Sets the Table Row Object ID. | |
| 332 | * | |
| 333 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 334 | * @param raw a Table Row Object Id | |
| 335 | * @throws AccessPoemException | |
| 336 | * if the current <code>AccessToken</code> | |
| 337 | * does not confer write access rights | |
| 338 | */ | |
| 339 | public void setGroupTroid(Integer raw) | |
| 340 | throws AccessPoemException { | |
| 341 | 0 | setGroup(raw == null ? null : |
| 342 | 0 | getPoemDatabaseTables().getGroupTable().getGroupObject(raw)); |
| 343 | 0 | } |
| 344 | ||
| 345 | ||
| 346 | /** | |
| 347 | * Retrieves the <code>Group</code> object referred to. | |
| 348 | * | |
| 349 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 350 | * @throws AccessPoemException | |
| 351 | * if the current <code>AccessToken</code> | |
| 352 | * does not confer read access rights | |
| 353 | * @throws NoSuchRowPoemException | |
| 354 | * if the <code>Persistent</code> has yet to be allocated a TROID | |
| 355 | * @return the <code>Group</code> as a <code>Group</code> | |
| 356 | */ | |
| 357 | public Group getGroup() | |
| 358 | throws AccessPoemException, NoSuchRowPoemException { | |
| 359 | 2 | Integer troid = getGroupTroid(); |
| 360 | 2 | return troid == null ? null : |
| 361 | 2 | getPoemDatabaseTables().getGroupTable().getGroupObject(troid); |
| 362 | } | |
| 363 | ||
| 364 | ||
| 365 | /** | |
| 366 | * Set the Group. | |
| 367 | * | |
| 368 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 369 | * @param cooked a validated <code>Group</code> | |
| 370 | * @throws AccessPoemException | |
| 371 | * if the current <code>AccessToken</code> | |
| 372 | * does not confer write access rights | |
| 373 | */ | |
| 374 | public void setGroup(Group cooked) | |
| 375 | throws AccessPoemException { | |
| 376 | 44 | _getGroupMembershipTable(). |
| 377 | 44 | getGroupColumn(). |
| 378 | 44 | getType().assertValidCooked(cooked); |
| 379 | 44 | writeLock(); |
| 380 | 44 | if (cooked == null) |
| 381 | 0 | setGroup_unsafe(null); |
| 382 | else { | |
| 383 | 44 | cooked.existenceLock(); |
| 384 | 44 | setGroup_unsafe(cooked.troid()); |
| 385 | } | |
| 386 | 44 | } |
| 387 | ||
| 388 | ||
| 389 | /** | |
| 390 | * Retrieves the <code>Group</code> value as a <code>Field</code> | |
| 391 | * from this <code>groupMembership</code> <code>Persistent</code>. | |
| 392 | * | |
| 393 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 394 | * @throws AccessPoemException | |
| 395 | * if the current <code>AccessToken</code> | |
| 396 | * does not confer write access rights | |
| 397 | * @return the Integer group | |
| 398 | */ | |
| 399 | public Field<Integer> getGroupField() throws AccessPoemException { | |
| 400 | 12 | Column<Integer> c = _getGroupMembershipTable().getGroupColumn(); |
| 401 | 12 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 402 | } | |
| 403 | ||
| 404 | } | |
| 405 |