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 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.GroupMembership; 14 import org.melati.poem.JdbcPersistent; 15 import org.melati.poem.PoemDatabaseTables; 16 import org.melati.poem.User; 17 import org.melati.poem.UserTable; 18 import org.melati.poem.ValidationPoemException; 19 import org.melati.poem.util.EmptyEnumeration; 20 21 22 /** 23 * Melati POEM generated abstract base class for a <code>Persistent</code> 24 * <code>user</code> Object. 25 * 26 * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava 27 */ 28 public abstract class UserBase 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 PoemDatabaseTables getPoemDatabaseTables() { 38 return (PoemDatabaseTables)getDatabase(); 39 } 40 41 42 /** 43 * Retrieves the <code>UserTable</code> table 44 * which this <code>Persistent</code> is from. 45 * 46 * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava 47 * @return the UserTable 48 */ 49 @SuppressWarnings("unchecked") 50 public UserTable<User> getUserTable() { 51 return (UserTable<User>)getTable(); 52 } 53 54 @SuppressWarnings("unchecked") 55 private UserTable<User> _getUserTable() { 56 return (UserTable<User>)getTable(); 57 } 58 59 // Fields in this table 60 /** 61 * id - The Table Row Object ID 62 */ 63 protected Integer id; 64 /** 65 * Full name - The user's real name 66 */ 67 protected String name; 68 /** 69 * login - The user's login name 70 */ 71 protected String login; 72 /** 73 * password - The user's password 74 */ 75 protected String password; 76 77 78 /** 79 * Retrieves the <code>Id</code> value, without locking, 80 * for this <code>user</code> <code>Persistent</code>. 81 * 82 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 83 * @return the Integer id 84 */ 85 public Integer getId_unsafe() { 86 return id; 87 } 88 89 90 /** 91 * Sets the <code>Id</code> value directly, without checking, 92 * for this user <code>Persistent</code>. 93 * 94 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 95 * @param cooked the pre-validated value to set 96 */ 97 public void setId_unsafe(Integer cooked) { 98 id = cooked; 99 } 100 101 /** 102 * Retrieves the Id value, with locking, for this 103 * <code>user</code> <code>Persistent</code>. 104 * Field description: 105 * The Table Row Object ID 106 * 107 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 108 * @throws AccessPoemException 109 * if the current <code>AccessToken</code> 110 * does not confer write access rights 111 * @return the value of the field <code>Id</code> for this 112 * <code>user</code> <code>Persistent</code> 113 */ 114 115 public Integer getId() 116 throws AccessPoemException { 117 readLock(); 118 return getId_unsafe(); 119 } 120 121 122 /** 123 * Sets the <code>Id</code> value, with checking, for this 124 * <code>user</code> <code>Persistent</code>. 125 * Field description: 126 * The Table Row Object ID 127 * 128 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 129 * @param cooked a validated <code>int</code> 130 * @throws AccessPoemException 131 * if the current <code>AccessToken</code> 132 * does not confer write access rights 133 * @throws ValidationPoemException 134 * if the value is not valid 135 */ 136 public void setId(Integer cooked) 137 throws AccessPoemException, ValidationPoemException { 138 _getUserTable().getIdColumn(). 139 getType().assertValidCooked(cooked); 140 writeLock(); 141 setId_unsafe(cooked); 142 } 143 144 /** 145 * Sets the <code>Id</code> value, with checking, for this 146 * <code>user</code> <code>Persistent</code>. 147 * Field description: 148 * The Table Row Object ID 149 * 150 * 151 * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 152 * @param cooked a validated <code>int</code> 153 * @throws AccessPoemException 154 * if the current <code>AccessToken</code> 155 * does not confer write access rights 156 * @throws ValidationPoemException 157 * if the value is not valid 158 */ 159 160 public final void setId(int cooked) 161 throws AccessPoemException, ValidationPoemException { 162 setId(new Integer(cooked)); 163 } 164 165 166 /** 167 * Retrieves the <code>Id</code> value as a <code>Field</code> 168 * from this <code>user</code> <code>Persistent</code>. 169 * 170 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 171 * @throws AccessPoemException 172 * if the current <code>AccessToken</code> 173 * does not confer write access rights 174 * @return the Integer id 175 */ 176 public Field<Integer> getIdField() throws AccessPoemException { 177 Column<Integer> c = _getUserTable().getIdColumn(); 178 return new Field<Integer>((Integer)c.getRaw(this), c); 179 } 180 181 182 /** 183 * Retrieves the <code>Name</code> value, without locking, 184 * for this <code>user</code> <code>Persistent</code>. 185 * 186 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 187 * @return the String name 188 */ 189 public String getName_unsafe() { 190 return name; 191 } 192 193 194 /** 195 * Sets the <code>Name</code> value directly, without checking, 196 * for this user <code>Persistent</code>. 197 * 198 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 199 * @param cooked the pre-validated value to set 200 */ 201 public void setName_unsafe(String cooked) { 202 name = cooked; 203 } 204 205 /** 206 * Retrieves the Name value, with locking, for this 207 * <code>user</code> <code>Persistent</code>. 208 * Field description: 209 * The user's real name 210 * 211 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 212 * @throws AccessPoemException 213 * if the current <code>AccessToken</code> 214 * does not confer write access rights 215 * @return the value of the field <code>Name</code> for this 216 * <code>user</code> <code>Persistent</code> 217 */ 218 219 public String getName() 220 throws AccessPoemException { 221 readLock(); 222 return getName_unsafe(); 223 } 224 225 226 /** 227 * Sets the <code>Name</code> value, with checking, for this 228 * <code>user</code> <code>Persistent</code>. 229 * Field description: 230 * The user's real name 231 * 232 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 233 * @param cooked a validated <code>int</code> 234 * @throws AccessPoemException 235 * if the current <code>AccessToken</code> 236 * does not confer write access rights 237 * @throws ValidationPoemException 238 * if the value is not valid 239 */ 240 public void setName(String cooked) 241 throws AccessPoemException, ValidationPoemException { 242 _getUserTable().getNameColumn(). 243 getType().assertValidCooked(cooked); 244 writeLock(); 245 setName_unsafe(cooked); 246 } 247 248 249 /** 250 * Retrieves the <code>Name</code> value as a <code>Field</code> 251 * from this <code>user</code> <code>Persistent</code>. 252 * 253 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 254 * @throws AccessPoemException 255 * if the current <code>AccessToken</code> 256 * does not confer write access rights 257 * @return the String name 258 */ 259 public Field<String> getNameField() throws AccessPoemException { 260 Column<String> c = _getUserTable().getNameColumn(); 261 return new Field<String>((String)c.getRaw(this), c); 262 } 263 264 265 /** 266 * Retrieves the <code>Login</code> value, without locking, 267 * for this <code>user</code> <code>Persistent</code>. 268 * 269 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 270 * @return the String login 271 */ 272 public String getLogin_unsafe() { 273 return login; 274 } 275 276 277 /** 278 * Sets the <code>Login</code> value directly, without checking, 279 * for this user <code>Persistent</code>. 280 * 281 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 282 * @param cooked the pre-validated value to set 283 */ 284 public void setLogin_unsafe(String cooked) { 285 login = cooked; 286 } 287 288 /** 289 * Retrieves the Login value, with locking, for this 290 * <code>user</code> <code>Persistent</code>. 291 * Field description: 292 * The user's login name 293 * 294 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 295 * @throws AccessPoemException 296 * if the current <code>AccessToken</code> 297 * does not confer write access rights 298 * @return the value of the field <code>Login</code> for this 299 * <code>user</code> <code>Persistent</code> 300 */ 301 302 public String getLogin() 303 throws AccessPoemException { 304 readLock(); 305 return getLogin_unsafe(); 306 } 307 308 309 /** 310 * Sets the <code>Login</code> value, with checking, for this 311 * <code>user</code> <code>Persistent</code>. 312 * Field description: 313 * The user's login name 314 * 315 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 316 * @param cooked a validated <code>int</code> 317 * @throws AccessPoemException 318 * if the current <code>AccessToken</code> 319 * does not confer write access rights 320 * @throws ValidationPoemException 321 * if the value is not valid 322 */ 323 public void setLogin(String cooked) 324 throws AccessPoemException, ValidationPoemException { 325 _getUserTable().getLoginColumn(). 326 getType().assertValidCooked(cooked); 327 writeLock(); 328 setLogin_unsafe(cooked); 329 } 330 331 332 /** 333 * Retrieves the <code>Login</code> value as a <code>Field</code> 334 * from this <code>user</code> <code>Persistent</code>. 335 * 336 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 337 * @throws AccessPoemException 338 * if the current <code>AccessToken</code> 339 * does not confer write access rights 340 * @return the String login 341 */ 342 public Field<String> getLoginField() throws AccessPoemException { 343 Column<String> c = _getUserTable().getLoginColumn(); 344 return new Field<String>((String)c.getRaw(this), c); 345 } 346 347 348 /** 349 * Retrieves the <code>Password</code> value, without locking, 350 * for this <code>user</code> <code>Persistent</code>. 351 * 352 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 353 * @return the String password 354 */ 355 public String getPassword_unsafe() { 356 return password; 357 } 358 359 360 /** 361 * Sets the <code>Password</code> value directly, without checking, 362 * for this user <code>Persistent</code>. 363 * 364 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 365 * @param cooked the pre-validated value to set 366 */ 367 public void setPassword_unsafe(String cooked) { 368 password = cooked; 369 } 370 371 /** 372 * Retrieves the Password value, with locking, for this 373 * <code>user</code> <code>Persistent</code>. 374 * Field description: 375 * The user's password 376 * 377 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 378 * @throws AccessPoemException 379 * if the current <code>AccessToken</code> 380 * does not confer write access rights 381 * @return the value of the field <code>Password</code> for this 382 * <code>user</code> <code>Persistent</code> 383 */ 384 385 public String getPassword() 386 throws AccessPoemException { 387 readLock(); 388 return getPassword_unsafe(); 389 } 390 391 392 /** 393 * Sets the <code>Password</code> value, with checking, for this 394 * <code>user</code> <code>Persistent</code>. 395 * Field description: 396 * The user's password 397 * 398 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 399 * @param cooked a validated <code>int</code> 400 * @throws AccessPoemException 401 * if the current <code>AccessToken</code> 402 * does not confer write access rights 403 * @throws ValidationPoemException 404 * if the value is not valid 405 */ 406 public void setPassword(String cooked) 407 throws AccessPoemException, ValidationPoemException { 408 _getUserTable().getPasswordColumn(). 409 getType().assertValidCooked(cooked); 410 writeLock(); 411 setPassword_unsafe(cooked); 412 } 413 414 415 /** 416 * Retrieves the <code>Password</code> value as a <code>Field</code> 417 * from this <code>user</code> <code>Persistent</code>. 418 * 419 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 420 * @throws AccessPoemException 421 * if the current <code>AccessToken</code> 422 * does not confer write access rights 423 * @return the String password 424 */ 425 public Field<String> getPasswordField() throws AccessPoemException { 426 Column<String> c = _getUserTable().getPasswordColumn(); 427 return new Field<String>((String)c.getRaw(this), c); 428 } 429 430 private CachedSelection<GroupMembership> userGroupMemberships = null; 431 /** References to this User in the GroupMembership table via its user field.*/ 432 @SuppressWarnings("unchecked") 433 public Enumeration<GroupMembership> getUserGroupMemberships() { 434 if (getTroid() == null) 435 return new EmptyEnumeration<GroupMembership>(); 436 else { 437 if (userGroupMemberships == null) 438 userGroupMemberships = 439 getPoemDatabaseTables().getGroupMembershipTable().getUserColumn().cachedSelectionWhereEq(getTroid()); 440 return userGroupMemberships.objects(); 441 } 442 } 443 444 445 /** References to this User in the GroupMembership table via its user field, as a List.*/ 446 public List<GroupMembership> getUserGroupMembershipList() { 447 return Collections.list(getUserGroupMemberships()); 448 } 449 450 451 452 } 453