001package org.apache.fulcrum.security.torque.om; 002 003import java.io.Serializable; 004import java.sql.Connection; 005import java.util.ArrayList; 006import java.util.List; 007import java.util.Objects; 008 009import org.apache.torque.TorqueException; 010import org.apache.torque.map.TableMap; 011import org.apache.torque.om.NumberKey; 012import org.apache.torque.om.ObjectKey; 013import org.apache.torque.om.SimpleKey; 014import org.apache.torque.om.Persistent; 015import org.apache.torque.criteria.Criteria; 016import org.apache.torque.util.TorqueConnection; 017import org.apache.torque.util.Transaction; 018 019/** 020 * This class was autogenerated by Torque on: 021 * 022 * [Thu Nov 04 13:34:21 CET 2021] 023 * 024 * You should not use this class directly. It should not even be 025 * extended; all references should be to TorqueDynamicUser 026 */ 027@SuppressWarnings("unused") 028public abstract class BaseTorqueDynamicUser extends org.apache.fulcrum.security.torque.dynamic.TorqueAbstractDynamicUser 029 implements Persistent, Serializable 030{ 031 /** Serial version */ 032 private static final long serialVersionUID = 1636029261490L; 033 034 035 036 /** Defines the entityId field. */ 037 private Integer entityId = null; 038 039 /** Defines the entityName field. */ 040 private String entityName = null; 041 042 /** Defines the password field. */ 043 private String password = null; 044 045 /** Whether this object was modified after loading or after last save. */ 046 private boolean modified = true; 047 048 /** 049 * Whether this object was loaded from the database or already saved 050 * (false) or whether it is not yet in the database(true). 051 */ 052 private boolean isNew = true; 053 054 /** Flag which indicates whether this object is currently saving. */ 055 private boolean saving = false; 056 057 /** 058 * Flag which indicates whether this object is currently loaded 059 * from the database. 060 */ 061 private boolean loading = false; 062 063 /** 064 * Flag which indicates whether this object was deleted from the database. 065 * Note that this flags does not always display the current database state, 066 * there is no magical connection between this flag and the database. 067 */ 068 private boolean deleted = false; 069 070 071 072 /** Defines the collTorqueDynamicUserGroups field. */ 073 protected List<TorqueDynamicUserGroup> collTorqueDynamicUserGroups = null; 074 075 /** Defines the collTorqueDynamicUserDelegatessRelatedByDelegatorUserId field. */ 076 protected List<TorqueDynamicUserDelegates> collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = null; 077 078 /** Defines the collTorqueDynamicUserDelegatessRelatedByDelegateeUserId field. */ 079 protected List<TorqueDynamicUserDelegates> collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = null; 080 081 082 083 /** 084 * Get the value of entityId. 085 * 086 * @return the value of entityId as Integer 087 */ 088 public Integer getEntityId() 089 { 090 091 return entityId; 092 } 093 094 /** 095 * Set the value of entityId. 096 * 097 * @param v new value of entityId 098 */ 099 public void setEntityId(Integer v) 100 { 101 if (!Objects.equals(this.entityId, v)) 102 { 103 setModified(true); 104 } 105 106 this.entityId = v; 107 108 // update associated objects in collTorqueDynamicUserGroups 109 if (collTorqueDynamicUserGroups != null) 110 { 111 for (TorqueDynamicUserGroup element : collTorqueDynamicUserGroups) 112 { 113 element.setUserId(v); 114 } 115 } 116 // update associated objects in collTorqueDynamicUserDelegatessRelatedByDelegatorUserId 117 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId != null) 118 { 119 for (TorqueDynamicUserDelegates element : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 120 { 121 element.setDelegatorUserId(v); 122 } 123 } 124 // update associated objects in collTorqueDynamicUserDelegatessRelatedByDelegateeUserId 125 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId != null) 126 { 127 for (TorqueDynamicUserDelegates element : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 128 { 129 element.setDelegateeUserId(v); 130 } 131 } 132 133 } 134 135 /** 136 * Get the value of entityName. 137 * 138 * @return the value of entityName as String 139 */ 140 public String getEntityName() 141 { 142 143 return entityName; 144 } 145 146 /** 147 * Set the value of entityName. 148 * 149 * @param v new value of entityName 150 */ 151 public void setEntityName(String v) 152 { 153 if (!Objects.equals(this.entityName, v)) 154 { 155 setModified(true); 156 } 157 158 this.entityName = v; 159 160 161 } 162 163 /** 164 * Get the value of password. 165 * 166 * @return the value of password as String 167 */ 168 public String getPassword() 169 { 170 171 return password; 172 } 173 174 /** 175 * Set the value of password. 176 * 177 * @param v new value of password 178 */ 179 public void setPassword(String v) 180 { 181 if (!Objects.equals(this.password, v)) 182 { 183 setModified(true); 184 } 185 186 this.password = v; 187 188 189 } 190 191 192 /** 193 * Returns whether the object has ever been saved. This will 194 * be false, if the object was retrieved from storage or was created 195 * and then saved. 196 * 197 * @return true, if the object has never been persisted. 198 */ 199 public boolean isNew() 200 { 201 return isNew; 202 } 203 204 /** 205 * Sets whether the object has ever been saved. 206 * 207 * @param isNew true if the object has never been saved, false otherwise. 208 */ 209 public void setNew(boolean isNew) 210 { 211 this.isNew = isNew; 212 } 213 214 /** 215 * Returns whether the object has been modified. 216 * 217 * @return True if the object has been modified. 218 */ 219 public boolean isModified() 220 { 221 return modified; 222 } 223 224 /** 225 * Sets whether the object has been modified. 226 * 227 * @param modified true if the object has been modified, false otherwise. 228 */ 229 public void setModified(boolean modified) 230 { 231 this.modified = modified; 232 } 233 234 /** 235 * Sets the modified state for the object to be false. 236 */ 237 public void resetModified() 238 { 239 modified = false; 240 } 241 242 243 /** 244 * Returns whether this object is currently saving. 245 * 246 * @return true if this object is currently saving, false otherwise. 247 */ 248 public boolean isSaving() 249 { 250 return saving; 251 } 252 253 /** 254 * Sets whether this object is currently saving. 255 * 256 * @param saving true if this object is currently saving, false otherwise. 257 */ 258 public void setSaving(boolean saving) 259 { 260 this.saving = saving; 261 } 262 263 264 /** 265 * Returns whether this object is currently being loaded from the database. 266 * 267 * @return true if this object is currently loading, false otherwise. 268 */ 269 public boolean isLoading() 270 { 271 return loading; 272 } 273 274 /** 275 * Sets whether this object is currently being loaded from the database. 276 * 277 * @param loading true if this object is currently loading, false otherwise. 278 */ 279 public void setLoading(boolean loading) 280 { 281 this.loading = loading; 282 } 283 284 285 /** 286 * Returns whether this object was deleted from the database. 287 * Note that this getter does not automatically reflect database state, 288 * it will be set to true by Torque if doDelete() was called with this 289 * object. Bulk deletes and deletes via primary key do not change 290 * this flag. Also, if doDelete() was called on an object which does 291 * not exist in the database, the deleted flag is set to true even if 292 * it was not deleted. 293 * 294 * @return true if this object was deleted, false otherwise. 295 */ 296 public boolean isDeleted() 297 { 298 return deleted; 299 } 300 301 /** 302 * Sets whether this object was deleted from the database. 303 * 304 * @param deleted true if this object was deleted, false otherwise. 305 */ 306 public void setDeleted(boolean deleted) 307 { 308 this.deleted = deleted; 309 } 310 311 312 313 314 /** 315 * Initializes the cache collTorqueDynamicUserGroups for referenced objects. 316 * This, means, if collTorqueDynamicUserGroups is null when this operation is called, it is 317 * initialized with an empty collection, otherwise it remains unchanged. 318 * 319 * @return the (possibly new) content of the field collTorqueDynamicUserGroups, not null. 320 */ 321 public List<TorqueDynamicUserGroup> initTorqueDynamicUserGroups() 322 { 323 if (collTorqueDynamicUserGroups == null) 324 { 325 collTorqueDynamicUserGroups = new ArrayList<TorqueDynamicUserGroup>(); 326 } 327 return collTorqueDynamicUserGroups; 328 } 329 330 /** 331 * Checks whether the cache collTorqueDynamicUserGroups for referenced objects has either been 332 * loaded from the database or has been manually initialized. 333 * 334 * @return boolean true if initialized 335 */ 336 public boolean isTorqueDynamicUserGroupsInitialized() 337 { 338 return (collTorqueDynamicUserGroups != null); 339 } 340 341 342 /** 343 * Method called to associate a TorqueDynamicUserGroup object to this object 344 * through the collTorqueDynamicUserGroups foreign key attribute. 345 * If the associated objects were not retrieved before 346 * and this object is not new, the associated objects are retrieved 347 * from the database before adding the <code>toAdd</code> object. 348 * 349 * @param toAdd the object to add to the associated objects, not null. 350 * 351 * @throws TorqueException if retrieval of the associated objects fails. 352 * @throws NullPointerException if toAdd is null. 353 */ 354 public void addTorqueDynamicUserGroup(TorqueDynamicUserGroup toAdd) 355 throws TorqueException 356 { 357 toAdd.setTorqueDynamicUser((TorqueDynamicUser) this); 358 getTorqueDynamicUserGroups().add(toAdd); 359 } 360 361 /** 362 * Method called to associate a TorqueDynamicUserGroup object to this object 363 * through the collTorqueDynamicUserGroups foreign key attribute using connection. 364 * 365 * @param l TorqueDynamicUserGroup 366 * @throws TorqueException if retrieval of the associated objects fails. 367 */ 368 public void addTorqueDynamicUserGroup(TorqueDynamicUserGroup l, Connection con) throws TorqueException 369 { 370 getTorqueDynamicUserGroups(con).add(l); 371 l.setTorqueDynamicUser((TorqueDynamicUser) this); 372 } 373 374 /** 375 * Method called to reset the cache of TorqueDynamicUserGroup objects 376 * which are related through the collTorqueDynamicUserGroups foreign key attribute. 377 */ 378 public void resetTorqueDynamicUserGroup() 379 { 380 collTorqueDynamicUserGroups = null; 381 } 382 383 384 /** 385 * The criteria used to select the current contents of collTorqueDynamicUserGroups 386 */ 387 private Criteria lastTorqueDynamicUserGroupCriteria = null; 388 389 /** 390 * If this collection has already been initialized, returns 391 * the collection. Otherwise returns the results of 392 * getTorqueDynamicUserGroups(new Criteria()) 393 * 394 * @return the collection of associated objects 395 * @throws TorqueException 396 */ 397 public List<TorqueDynamicUserGroup> getTorqueDynamicUserGroups() 398 throws TorqueException 399 { 400 if (collTorqueDynamicUserGroups == null) 401 { 402 collTorqueDynamicUserGroups = getTorqueDynamicUserGroups(new Criteria()); 403 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 404 { 405 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 406 } 407 } 408 return collTorqueDynamicUserGroups; 409 } 410 411 /** 412 * If this collection has already been initialized with 413 * an identical criteria, it returns the collection. 414 * Otherwise if this BaseTorqueDynamicUser has previously 415 * been saved, it will retrieve related collTorqueDynamicUserGroups from storage. 416 * If this BaseTorqueDynamicUser is new, it will return 417 * an empty collection or the current collection, the criteria 418 * is ignored on a new object. 419 * 420 * @throws TorqueException If a problem occurs with the get[criteria] method. 421 */ 422 public List<TorqueDynamicUserGroup> getTorqueDynamicUserGroups(Criteria criteria) throws TorqueException 423 { 424 if (collTorqueDynamicUserGroups == null) 425 { 426 if (isNew()) 427 { 428 initTorqueDynamicUserGroups(); 429 } 430 else 431 { 432 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.USER_ID, getEntityId()); 433 collTorqueDynamicUserGroups = org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.doSelect(criteria); 434 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 435 { 436 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 437 } 438 } 439 } 440 else 441 { 442 // criteria has no effect for a new object 443 if (!isNew()) 444 { 445 // the following code is to determine if a new query is 446 // called for. If the criteria is the same as the last 447 // one, just return the collection. 448 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.USER_ID, getEntityId()); 449 if (lastTorqueDynamicUserGroupCriteria == null 450 || !lastTorqueDynamicUserGroupCriteria.equals(criteria)) 451 { 452 collTorqueDynamicUserGroups = org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.doSelect(criteria); 453 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 454 { 455 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 456 } 457 } 458 } 459 } 460 lastTorqueDynamicUserGroupCriteria = criteria; 461 return collTorqueDynamicUserGroups; 462 } 463 464 /** 465 * If this collection has already been initialized, returns 466 * the collection. Otherwise returns the results of 467 * getTorqueDynamicUserGroups(new Criteria(),Connection) 468 * This method takes in the Connection also as input so that 469 * referenced objects can also be obtained using a Connection 470 * that is taken as input 471 * 472 * @param con the Connection 473 * @return List<TorqueDynamicUserGroup> results of the collection 474 * @throws TorqueException If a problem occurs with the get[connection] method. 475 */ 476 public List<TorqueDynamicUserGroup> getTorqueDynamicUserGroups(Connection con) throws TorqueException 477 { 478 if (collTorqueDynamicUserGroups == null) 479 { 480 collTorqueDynamicUserGroups = getTorqueDynamicUserGroups(new Criteria(), con); 481 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 482 { 483 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 484 } 485 } 486 return collTorqueDynamicUserGroups; 487 } 488 489 /** 490 * If this collection has already been initialized with 491 * an identical criteria, it returns the collection. 492 * Otherwise if this BaseTorqueDynamicUser has previously 493 * been saved, it will retrieve the related TorqueDynamicUserGroup Objects 494 * from storage. 495 * If this BaseTorqueDynamicUser is new, it will return 496 * an empty collection or the current collection, the criteria 497 * is ignored on a new object. 498 * This method takes in the Connection also as input so that 499 * referenced objects can also be obtained using a Connection 500 * that is taken as input 501 * 502 * @param con the Connection 503 * @return List<TorqueDynamicUserGroup> results of the collection 504 * @throws TorqueException If a problem occurs with the get[connection] method. 505 */ 506 public List<TorqueDynamicUserGroup> getTorqueDynamicUserGroups(Criteria criteria, Connection con) 507 throws TorqueException 508 { 509 if (collTorqueDynamicUserGroups == null) 510 { 511 if (isNew()) 512 { 513 initTorqueDynamicUserGroups(); 514 } 515 else 516 { 517 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.USER_ID, getEntityId()); 518 collTorqueDynamicUserGroups = org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.doSelect(criteria, con); 519 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 520 { 521 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 522 } 523 } 524 } 525 else 526 { 527 // criteria has no effect for a new object 528 if (!isNew()) 529 { 530 // the following code is to determine if a new query is 531 // called for. If the criteria is the same as the last 532 // one, just return the collection. 533 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.USER_ID, getEntityId()); 534 if (lastTorqueDynamicUserGroupCriteria == null 535 || !lastTorqueDynamicUserGroupCriteria.equals(criteria)) 536 { 537 collTorqueDynamicUserGroups = org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.doSelect(criteria, con); 538 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 539 { 540 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 541 } 542 } 543 } 544 } 545 lastTorqueDynamicUserGroupCriteria = criteria; 546 547 return collTorqueDynamicUserGroups; 548 } 549 550 /** 551 * Initializes the cache collTorqueDynamicUserDelegatessRelatedByDelegatorUserId for referenced objects. 552 * This, means, if collTorqueDynamicUserDelegatessRelatedByDelegatorUserId is null when this operation is called, it is 553 * initialized with an empty collection, otherwise it remains unchanged. 554 * 555 * @return the (possibly new) content of the field collTorqueDynamicUserDelegatessRelatedByDelegatorUserId, not null. 556 */ 557 public List<TorqueDynamicUserDelegates> initTorqueDynamicUserDelegatesRelatedByDelegatorUserIds() 558 { 559 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId == null) 560 { 561 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = new ArrayList<TorqueDynamicUserDelegates>(); 562 } 563 return collTorqueDynamicUserDelegatessRelatedByDelegatorUserId; 564 } 565 566 /** 567 * Checks whether the cache collTorqueDynamicUserDelegatessRelatedByDelegatorUserId for referenced objects has either been 568 * loaded from the database or has been manually initialized. 569 * 570 * @return boolean true if initialized 571 */ 572 public boolean isTorqueDynamicUserDelegatesRelatedByDelegatorUserIdsInitialized() 573 { 574 return (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId != null); 575 } 576 577 578 /** 579 * Method called to associate a TorqueDynamicUserDelegates object to this object 580 * through the collTorqueDynamicUserDelegatessRelatedByDelegatorUserId foreign key attribute. 581 * If the associated objects were not retrieved before 582 * and this object is not new, the associated objects are retrieved 583 * from the database before adding the <code>toAdd</code> object. 584 * 585 * @param toAdd the object to add to the associated objects, not null. 586 * 587 * @throws TorqueException if retrieval of the associated objects fails. 588 * @throws NullPointerException if toAdd is null. 589 */ 590 public void addTorqueDynamicUserDelegatesRelatedByDelegatorUserId(TorqueDynamicUserDelegates toAdd) 591 throws TorqueException 592 { 593 toAdd.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 594 getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds().add(toAdd); 595 } 596 597 /** 598 * Method called to associate a TorqueDynamicUserDelegates object to this object 599 * through the collTorqueDynamicUserDelegatessRelatedByDelegatorUserId foreign key attribute using connection. 600 * 601 * @param l TorqueDynamicUserDelegates 602 * @throws TorqueException if retrieval of the associated objects fails. 603 */ 604 public void addTorqueDynamicUserDelegatesRelatedByDelegatorUserId(TorqueDynamicUserDelegates l, Connection con) throws TorqueException 605 { 606 getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(con).add(l); 607 l.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 608 } 609 610 /** 611 * Method called to reset the cache of TorqueDynamicUserDelegates objects 612 * which are related through the collTorqueDynamicUserDelegatessRelatedByDelegatorUserId foreign key attribute. 613 */ 614 public void resetTorqueDynamicUserDelegatesRelatedByDelegatorUserId() 615 { 616 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = null; 617 } 618 619 620 /** 621 * The criteria used to select the current contents of collTorqueDynamicUserDelegatessRelatedByDelegatorUserId 622 */ 623 private Criteria lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria = null; 624 625 /** 626 * If this collection has already been initialized, returns 627 * the collection. Otherwise returns the results of 628 * getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(new Criteria()) 629 * 630 * @return the collection of associated objects 631 * @throws TorqueException 632 */ 633 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds() 634 throws TorqueException 635 { 636 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId == null) 637 { 638 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(new Criteria()); 639 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 640 { 641 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 642 } 643 } 644 return collTorqueDynamicUserDelegatessRelatedByDelegatorUserId; 645 } 646 647 /** 648 * If this collection has already been initialized with 649 * an identical criteria, it returns the collection. 650 * Otherwise if this BaseTorqueDynamicUser has previously 651 * been saved, it will retrieve related collTorqueDynamicUserDelegatessRelatedByDelegatorUserId from storage. 652 * If this BaseTorqueDynamicUser is new, it will return 653 * an empty collection or the current collection, the criteria 654 * is ignored on a new object. 655 * 656 * @throws TorqueException If a problem occurs with the get[criteria] method. 657 */ 658 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(Criteria criteria) throws TorqueException 659 { 660 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId == null) 661 { 662 if (isNew()) 663 { 664 initTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(); 665 } 666 else 667 { 668 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, getEntityId()); 669 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria); 670 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 671 { 672 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 673 } 674 } 675 } 676 else 677 { 678 // criteria has no effect for a new object 679 if (!isNew()) 680 { 681 // the following code is to determine if a new query is 682 // called for. If the criteria is the same as the last 683 // one, just return the collection. 684 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, getEntityId()); 685 if (lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria == null 686 || !lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria.equals(criteria)) 687 { 688 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria); 689 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 690 { 691 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 692 } 693 } 694 } 695 } 696 lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria = criteria; 697 return collTorqueDynamicUserDelegatessRelatedByDelegatorUserId; 698 } 699 700 /** 701 * If this collection has already been initialized, returns 702 * the collection. Otherwise returns the results of 703 * getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(new Criteria(),Connection) 704 * This method takes in the Connection also as input so that 705 * referenced objects can also be obtained using a Connection 706 * that is taken as input 707 * 708 * @param con the Connection 709 * @return List<TorqueDynamicUserDelegates> results of the collection 710 * @throws TorqueException If a problem occurs with the get[connection] method. 711 */ 712 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(Connection con) throws TorqueException 713 { 714 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId == null) 715 { 716 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(new Criteria(), con); 717 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 718 { 719 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 720 } 721 } 722 return collTorqueDynamicUserDelegatessRelatedByDelegatorUserId; 723 } 724 725 /** 726 * If this collection has already been initialized with 727 * an identical criteria, it returns the collection. 728 * Otherwise if this BaseTorqueDynamicUser has previously 729 * been saved, it will retrieve the related TorqueDynamicUserDelegates Objects 730 * from storage. 731 * If this BaseTorqueDynamicUser is new, it will return 732 * an empty collection or the current collection, the criteria 733 * is ignored on a new object. 734 * This method takes in the Connection also as input so that 735 * referenced objects can also be obtained using a Connection 736 * that is taken as input 737 * 738 * @param con the Connection 739 * @return List<TorqueDynamicUserDelegates> results of the collection 740 * @throws TorqueException If a problem occurs with the get[connection] method. 741 */ 742 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(Criteria criteria, Connection con) 743 throws TorqueException 744 { 745 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId == null) 746 { 747 if (isNew()) 748 { 749 initTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(); 750 } 751 else 752 { 753 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, getEntityId()); 754 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria, con); 755 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 756 { 757 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 758 } 759 } 760 } 761 else 762 { 763 // criteria has no effect for a new object 764 if (!isNew()) 765 { 766 // the following code is to determine if a new query is 767 // called for. If the criteria is the same as the last 768 // one, just return the collection. 769 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, getEntityId()); 770 if (lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria == null 771 || !lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria.equals(criteria)) 772 { 773 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria, con); 774 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 775 { 776 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 777 } 778 } 779 } 780 } 781 lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria = criteria; 782 783 return collTorqueDynamicUserDelegatessRelatedByDelegatorUserId; 784 } 785 786 /** 787 * Initializes the cache collTorqueDynamicUserDelegatessRelatedByDelegateeUserId for referenced objects. 788 * This, means, if collTorqueDynamicUserDelegatessRelatedByDelegateeUserId is null when this operation is called, it is 789 * initialized with an empty collection, otherwise it remains unchanged. 790 * 791 * @return the (possibly new) content of the field collTorqueDynamicUserDelegatessRelatedByDelegateeUserId, not null. 792 */ 793 public List<TorqueDynamicUserDelegates> initTorqueDynamicUserDelegatesRelatedByDelegateeUserIds() 794 { 795 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId == null) 796 { 797 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = new ArrayList<TorqueDynamicUserDelegates>(); 798 } 799 return collTorqueDynamicUserDelegatessRelatedByDelegateeUserId; 800 } 801 802 /** 803 * Checks whether the cache collTorqueDynamicUserDelegatessRelatedByDelegateeUserId for referenced objects has either been 804 * loaded from the database or has been manually initialized. 805 * 806 * @return boolean true if initialized 807 */ 808 public boolean isTorqueDynamicUserDelegatesRelatedByDelegateeUserIdsInitialized() 809 { 810 return (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId != null); 811 } 812 813 814 /** 815 * Method called to associate a TorqueDynamicUserDelegates object to this object 816 * through the collTorqueDynamicUserDelegatessRelatedByDelegateeUserId foreign key attribute. 817 * If the associated objects were not retrieved before 818 * and this object is not new, the associated objects are retrieved 819 * from the database before adding the <code>toAdd</code> object. 820 * 821 * @param toAdd the object to add to the associated objects, not null. 822 * 823 * @throws TorqueException if retrieval of the associated objects fails. 824 * @throws NullPointerException if toAdd is null. 825 */ 826 public void addTorqueDynamicUserDelegatesRelatedByDelegateeUserId(TorqueDynamicUserDelegates toAdd) 827 throws TorqueException 828 { 829 toAdd.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 830 getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds().add(toAdd); 831 } 832 833 /** 834 * Method called to associate a TorqueDynamicUserDelegates object to this object 835 * through the collTorqueDynamicUserDelegatessRelatedByDelegateeUserId foreign key attribute using connection. 836 * 837 * @param l TorqueDynamicUserDelegates 838 * @throws TorqueException if retrieval of the associated objects fails. 839 */ 840 public void addTorqueDynamicUserDelegatesRelatedByDelegateeUserId(TorqueDynamicUserDelegates l, Connection con) throws TorqueException 841 { 842 getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(con).add(l); 843 l.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 844 } 845 846 /** 847 * Method called to reset the cache of TorqueDynamicUserDelegates objects 848 * which are related through the collTorqueDynamicUserDelegatessRelatedByDelegateeUserId foreign key attribute. 849 */ 850 public void resetTorqueDynamicUserDelegatesRelatedByDelegateeUserId() 851 { 852 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = null; 853 } 854 855 856 /** 857 * The criteria used to select the current contents of collTorqueDynamicUserDelegatessRelatedByDelegateeUserId 858 */ 859 private Criteria lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria = null; 860 861 /** 862 * If this collection has already been initialized, returns 863 * the collection. Otherwise returns the results of 864 * getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(new Criteria()) 865 * 866 * @return the collection of associated objects 867 * @throws TorqueException 868 */ 869 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds() 870 throws TorqueException 871 { 872 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId == null) 873 { 874 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(new Criteria()); 875 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 876 { 877 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 878 } 879 } 880 return collTorqueDynamicUserDelegatessRelatedByDelegateeUserId; 881 } 882 883 /** 884 * If this collection has already been initialized with 885 * an identical criteria, it returns the collection. 886 * Otherwise if this BaseTorqueDynamicUser has previously 887 * been saved, it will retrieve related collTorqueDynamicUserDelegatessRelatedByDelegateeUserId from storage. 888 * If this BaseTorqueDynamicUser is new, it will return 889 * an empty collection or the current collection, the criteria 890 * is ignored on a new object. 891 * 892 * @throws TorqueException If a problem occurs with the get[criteria] method. 893 */ 894 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(Criteria criteria) throws TorqueException 895 { 896 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId == null) 897 { 898 if (isNew()) 899 { 900 initTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(); 901 } 902 else 903 { 904 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, getEntityId()); 905 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria); 906 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 907 { 908 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 909 } 910 } 911 } 912 else 913 { 914 // criteria has no effect for a new object 915 if (!isNew()) 916 { 917 // the following code is to determine if a new query is 918 // called for. If the criteria is the same as the last 919 // one, just return the collection. 920 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, getEntityId()); 921 if (lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria == null 922 || !lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria.equals(criteria)) 923 { 924 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria); 925 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 926 { 927 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 928 } 929 } 930 } 931 } 932 lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria = criteria; 933 return collTorqueDynamicUserDelegatessRelatedByDelegateeUserId; 934 } 935 936 /** 937 * If this collection has already been initialized, returns 938 * the collection. Otherwise returns the results of 939 * getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(new Criteria(),Connection) 940 * This method takes in the Connection also as input so that 941 * referenced objects can also be obtained using a Connection 942 * that is taken as input 943 * 944 * @param con the Connection 945 * @return List<TorqueDynamicUserDelegates> results of the collection 946 * @throws TorqueException If a problem occurs with the get[connection] method. 947 */ 948 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(Connection con) throws TorqueException 949 { 950 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId == null) 951 { 952 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(new Criteria(), con); 953 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 954 { 955 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 956 } 957 } 958 return collTorqueDynamicUserDelegatessRelatedByDelegateeUserId; 959 } 960 961 /** 962 * If this collection has already been initialized with 963 * an identical criteria, it returns the collection. 964 * Otherwise if this BaseTorqueDynamicUser has previously 965 * been saved, it will retrieve the related TorqueDynamicUserDelegates Objects 966 * from storage. 967 * If this BaseTorqueDynamicUser is new, it will return 968 * an empty collection or the current collection, the criteria 969 * is ignored on a new object. 970 * This method takes in the Connection also as input so that 971 * referenced objects can also be obtained using a Connection 972 * that is taken as input 973 * 974 * @param con the Connection 975 * @return List<TorqueDynamicUserDelegates> results of the collection 976 * @throws TorqueException If a problem occurs with the get[connection] method. 977 */ 978 public List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(Criteria criteria, Connection con) 979 throws TorqueException 980 { 981 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId == null) 982 { 983 if (isNew()) 984 { 985 initTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(); 986 } 987 else 988 { 989 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, getEntityId()); 990 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria, con); 991 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 992 { 993 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 994 } 995 } 996 } 997 else 998 { 999 // criteria has no effect for a new object 1000 if (!isNew()) 1001 { 1002 // the following code is to determine if a new query is 1003 // called for. If the criteria is the same as the last 1004 // one, just return the collection. 1005 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, getEntityId()); 1006 if (lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria == null 1007 || !lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria.equals(criteria)) 1008 { 1009 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelect(criteria, con); 1010 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 1011 { 1012 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 1013 } 1014 } 1015 } 1016 } 1017 lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria = criteria; 1018 1019 return collTorqueDynamicUserDelegatessRelatedByDelegateeUserId; 1020 } 1021 1022 /** 1023 * If this collection has already been initialized with 1024 * an identical criteria, it returns the collection. 1025 * Otherwise if this BaseTorqueDynamicUser is new, it will return 1026 * an empty collection; or if this thisObjectClassName has previously 1027 * been saved, it will retrieve the related objects from storage. 1028 * 1029 * This method is protected by default in order to keep the public 1030 * api reasonable. You can change the access modifier to public 1031 * by overriding this method in the child class. 1032 * 1033 * @return List<TorqueDynamicUserGroup> the collection 1034 * @param criteria the criteria to use when filling the collection. 1035 * @throws TorqueException if associated objects are not found 1036 */ 1037 protected List<TorqueDynamicUserGroup> getTorqueDynamicUserGroupsJoinTorqueDynamicGroup(Criteria criteria) throws TorqueException 1038 { 1039 try (TorqueConnection connection = Transaction.begin(criteria.getDbName())) 1040 { 1041 List<TorqueDynamicUserGroup> result = getTorqueDynamicUserGroupsJoinTorqueDynamicGroup(criteria, connection); 1042 1043 Transaction.commit(connection); 1044 return result; 1045 } 1046 } 1047 1048 /** 1049 * If this collection has already been initialized with 1050 * an identical criteria, it returns the collection. 1051 * Otherwise if this BaseTorqueDynamicUser is new, it will return 1052 * an empty collection; or if this BaseTorqueDynamicUser has previously 1053 * been saved, it will retrieve the related objects from storage. 1054 * 1055 * This method is protected by default in order to keep the public 1056 * api reasonable. You can change the access modifier to public 1057 * by overriding this method in the child class. 1058 */ 1059 protected List<TorqueDynamicUserGroup> getTorqueDynamicUserGroupsJoinTorqueDynamicGroup(Criteria criteria, Connection connection) 1060 throws TorqueException 1061 { 1062 if (collTorqueDynamicUserGroups == null) 1063 { 1064 if (isNew()) 1065 { 1066 initTorqueDynamicUserGroups(); 1067 } 1068 else 1069 { 1070 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.USER_ID, getEntityId()); 1071 collTorqueDynamicUserGroups = org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.doSelectJoinTorqueDynamicGroup(criteria, connection); 1072 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 1073 { 1074 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 1075 } 1076 } 1077 } 1078 else 1079 { 1080 // the following code is to determine if a new query is 1081 // called for. If the criteria is the same as the last 1082 // one, just return the collection. 1083 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.USER_ID, getEntityId()); 1084 if (lastTorqueDynamicUserGroupCriteria == null 1085 || !lastTorqueDynamicUserGroupCriteria.equals(criteria)) 1086 { 1087 collTorqueDynamicUserGroups = org.apache.fulcrum.security.torque.om.TorqueDynamicUserGroupPeer.doSelectJoinTorqueDynamicGroup(criteria, connection); 1088 for (TorqueDynamicUserGroup torqueDynamicUserGroup : collTorqueDynamicUserGroups) 1089 { 1090 torqueDynamicUserGroup.setTorqueDynamicUser((TorqueDynamicUser) this); 1091 } 1092 } 1093 } 1094 lastTorqueDynamicUserGroupCriteria = criteria; 1095 1096 return collTorqueDynamicUserGroups; 1097 } 1098 1099 /** 1100 * If this collection has already been initialized with 1101 * an identical criteria, it returns the collection. 1102 * Otherwise if this BaseTorqueDynamicUser is new, it will return 1103 * an empty collection; or if this thisObjectClassName has previously 1104 * been saved, it will retrieve the related objects from storage. 1105 * 1106 * This method is protected by default in order to keep the public 1107 * api reasonable. You can change the access modifier to public 1108 * by overriding this method in the child class. 1109 * 1110 * @return List<TorqueDynamicUserDelegates> the collection 1111 * @param criteria the criteria to use when filling the collection. 1112 * @throws TorqueException if associated objects are not found 1113 */ 1114 protected List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegatorUserIdsJoinTorqueDynamicUserRelatedByDelegateeUserId(Criteria criteria) throws TorqueException 1115 { 1116 try (TorqueConnection connection = Transaction.begin(criteria.getDbName())) 1117 { 1118 List<TorqueDynamicUserDelegates> result = getTorqueDynamicUserDelegatesRelatedByDelegatorUserIdsJoinTorqueDynamicUserRelatedByDelegateeUserId(criteria, connection); 1119 1120 Transaction.commit(connection); 1121 return result; 1122 } 1123 } 1124 1125 /** 1126 * If this collection has already been initialized with 1127 * an identical criteria, it returns the collection. 1128 * Otherwise if this BaseTorqueDynamicUser is new, it will return 1129 * an empty collection; or if this BaseTorqueDynamicUser has previously 1130 * been saved, it will retrieve the related objects from storage. 1131 * 1132 * This method is protected by default in order to keep the public 1133 * api reasonable. You can change the access modifier to public 1134 * by overriding this method in the child class. 1135 */ 1136 protected List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegatorUserIdsJoinTorqueDynamicUserRelatedByDelegateeUserId(Criteria criteria, Connection connection) 1137 throws TorqueException 1138 { 1139 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId == null) 1140 { 1141 if (isNew()) 1142 { 1143 initTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(); 1144 } 1145 else 1146 { 1147 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, getEntityId()); 1148 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegateeUserId(criteria, connection); 1149 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 1150 { 1151 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 1152 } 1153 } 1154 } 1155 else 1156 { 1157 // the following code is to determine if a new query is 1158 // called for. If the criteria is the same as the last 1159 // one, just return the collection. 1160 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, getEntityId()); 1161 if (lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria == null 1162 || !lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria.equals(criteria)) 1163 { 1164 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegateeUserId(criteria, connection); 1165 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 1166 { 1167 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegatorUserId((TorqueDynamicUser) this); 1168 } 1169 } 1170 } 1171 lastTorqueDynamicUserDelegatesRelatedByDelegatorUserIdCriteria = criteria; 1172 1173 return collTorqueDynamicUserDelegatessRelatedByDelegatorUserId; 1174 } 1175 1176 /** 1177 * If this collection has already been initialized with 1178 * an identical criteria, it returns the collection. 1179 * Otherwise if this BaseTorqueDynamicUser is new, it will return 1180 * an empty collection; or if this thisObjectClassName has previously 1181 * been saved, it will retrieve the related objects from storage. 1182 * 1183 * This method is protected by default in order to keep the public 1184 * api reasonable. You can change the access modifier to public 1185 * by overriding this method in the child class. 1186 * 1187 * @return List<TorqueDynamicUserDelegates> the collection 1188 * @param criteria the criteria to use when filling the collection. 1189 * @throws TorqueException if associated objects are not found 1190 */ 1191 protected List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegateeUserIdsJoinTorqueDynamicUserRelatedByDelegatorUserId(Criteria criteria) throws TorqueException 1192 { 1193 try (TorqueConnection connection = Transaction.begin(criteria.getDbName())) 1194 { 1195 List<TorqueDynamicUserDelegates> result = getTorqueDynamicUserDelegatesRelatedByDelegateeUserIdsJoinTorqueDynamicUserRelatedByDelegatorUserId(criteria, connection); 1196 1197 Transaction.commit(connection); 1198 return result; 1199 } 1200 } 1201 1202 /** 1203 * If this collection has already been initialized with 1204 * an identical criteria, it returns the collection. 1205 * Otherwise if this BaseTorqueDynamicUser is new, it will return 1206 * an empty collection; or if this BaseTorqueDynamicUser has previously 1207 * been saved, it will retrieve the related objects from storage. 1208 * 1209 * This method is protected by default in order to keep the public 1210 * api reasonable. You can change the access modifier to public 1211 * by overriding this method in the child class. 1212 */ 1213 protected List<TorqueDynamicUserDelegates> getTorqueDynamicUserDelegatesRelatedByDelegateeUserIdsJoinTorqueDynamicUserRelatedByDelegatorUserId(Criteria criteria, Connection connection) 1214 throws TorqueException 1215 { 1216 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId == null) 1217 { 1218 if (isNew()) 1219 { 1220 initTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(); 1221 } 1222 else 1223 { 1224 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, getEntityId()); 1225 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegatorUserId(criteria, connection); 1226 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 1227 { 1228 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 1229 } 1230 } 1231 } 1232 else 1233 { 1234 // the following code is to determine if a new query is 1235 // called for. If the criteria is the same as the last 1236 // one, just return the collection. 1237 criteria.and(org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, getEntityId()); 1238 if (lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria == null 1239 || !lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria.equals(criteria)) 1240 { 1241 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = org.apache.fulcrum.security.torque.om.TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegatorUserId(criteria, connection); 1242 for (TorqueDynamicUserDelegates torqueDynamicUserDelegates : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 1243 { 1244 torqueDynamicUserDelegates.setTorqueDynamicUserRelatedByDelegateeUserId((TorqueDynamicUser) this); 1245 } 1246 } 1247 } 1248 lastTorqueDynamicUserDelegatesRelatedByDelegateeUserIdCriteria = criteria; 1249 1250 return collTorqueDynamicUserDelegatessRelatedByDelegateeUserId; 1251 } 1252 1253 1254 1255 1256 1257 /** 1258 * Stores an object in the database. If the object is new, 1259 * it is inserted; otherwise an update is performed. 1260 * 1261 * @throws TorqueException if an error occurs during saving. 1262 */ 1263 public void save() throws TorqueException 1264 { 1265 save(TorqueDynamicUserPeer.DATABASE_NAME); 1266 } 1267 1268 /** 1269 * Stores an object in the database. If the object is new, 1270 * it is inserted; otherwise an update is performed. 1271 * 1272 * @param dbName the name of the database to which the object 1273 * should be saved. 1274 * 1275 * @throws TorqueException if an error occurs during saving. 1276 */ 1277 public void save(String dbName) 1278 throws TorqueException 1279 { 1280 try (TorqueConnection con = Transaction.begin(dbName)) 1281 { 1282 save(con); 1283 Transaction.commit(con); 1284 } 1285 } 1286 1287 /** 1288 * Stores an object in the database. If the object is new, 1289 * it is inserted; otherwise an update is performed. This method 1290 * is meant to be used as part of a transaction, otherwise use 1291 * the save() method and the connection details will be handled 1292 * internally. 1293 * 1294 * @param con the connection to use for saving the object, not null. 1295 * 1296 * @throws TorqueException if an error occurs during saving. 1297 */ 1298 public void save(Connection con) 1299 throws TorqueException 1300 { 1301 if (isSaving()) 1302 { 1303 return; 1304 } 1305 try 1306 { 1307 setSaving(true); 1308 // If this object has been modified, then save it to the database. 1309 if (isModified()) 1310 { 1311 if (isNew()) 1312 { 1313 TorqueDynamicUserPeer.doInsert((TorqueDynamicUser) this, con); 1314 setNew(false); 1315 } 1316 else 1317 { 1318 TorqueDynamicUserPeer.doUpdate((TorqueDynamicUser) this, con); 1319 } 1320 } 1321 1322 if (isTorqueDynamicUserGroupsInitialized()) 1323 { 1324 for (TorqueDynamicUserGroup collTorqueDynamicUserGroups : getTorqueDynamicUserGroups()) 1325 { 1326 collTorqueDynamicUserGroups.save(con); 1327 } 1328 } 1329 if (isTorqueDynamicUserDelegatesRelatedByDelegatorUserIdsInitialized()) 1330 { 1331 for (TorqueDynamicUserDelegates collTorqueDynamicUserDelegatessRelatedByDelegatorUserId : getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds()) 1332 { 1333 collTorqueDynamicUserDelegatessRelatedByDelegatorUserId.save(con); 1334 } 1335 } 1336 if (isTorqueDynamicUserDelegatesRelatedByDelegateeUserIdsInitialized()) 1337 { 1338 for (TorqueDynamicUserDelegates collTorqueDynamicUserDelegatessRelatedByDelegateeUserId : getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds()) 1339 { 1340 collTorqueDynamicUserDelegatessRelatedByDelegateeUserId.save(con); 1341 } 1342 } 1343 } 1344 finally 1345 { 1346 setSaving(false); 1347 } 1348 } 1349 1350 1351 1352 1353 /** 1354 * Set the PrimaryKey using ObjectKey. 1355 * 1356 * @param key entityId ObjectKey 1357 */ 1358 public void setPrimaryKey(ObjectKey<?> key) 1359 1360 { 1361 setEntityId(Integer.valueOf(((NumberKey) key).intValue())); 1362 } 1363 1364 /** 1365 * Set the PrimaryKey using a String. 1366 * 1367 * @param key the primary key to set. 1368 */ 1369 public void setPrimaryKey(String key) 1370 { 1371 setEntityId(new Integer(key)); 1372 } 1373 1374 1375 /** 1376 * returns an id that differentiates this object from others 1377 * of its class. 1378 */ 1379 public ObjectKey<?> getPrimaryKey() 1380 { 1381 return SimpleKey.keyFor(getEntityId()); 1382 } 1383 1384 1385 1386 /** 1387 * Makes a copy of this object. 1388 * It creates a new object filling in the simple attributes. 1389 * It then fills all the association collections and sets the 1390 * related objects to isNew=true. 1391 * @throws TorqueException if retrieval of the associated objects fails 1392 */ 1393 public TorqueDynamicUser copy() throws TorqueException 1394 { 1395 return copy(true); 1396 } 1397 1398 /** 1399 * Makes a copy of this object using a connection. 1400 * It creates a new object filling in the simple attributes. 1401 * It then fills all the association collections and sets the 1402 * related objects to isNew=true. 1403 * 1404 * @param con the database connection to read associated objects. 1405 * @throws TorqueException if retrieval of the associated objects fails 1406 */ 1407 public TorqueDynamicUser copy(Connection con) throws TorqueException 1408 { 1409 return copy(true, con); 1410 } 1411 1412 /** 1413 * Makes a copy of this object. 1414 * It creates a new object filling in the simple attributes. 1415 * If the parameter deepcopy is true, it then fills all the 1416 * association collections and sets the related objects to 1417 * isNew=true. 1418 * 1419 * @param deepcopy whether to copy the associated objects. 1420 * @throws TorqueException if retrieval of the associated objects fails 1421 */ 1422 public TorqueDynamicUser copy(boolean deepcopy) throws TorqueException 1423 { 1424 TorqueDynamicUser torqueDynamicUser = new TorqueDynamicUser(); 1425 1426 return copyInto(torqueDynamicUser, deepcopy); 1427 } 1428 1429 /** 1430 * Makes a copy of this object using connection. 1431 * It creates a new object filling in the simple attributes. 1432 * If the parameter deepcopy is true, it then fills all the 1433 * association collections and sets the related objects to 1434 * isNew=true. 1435 * 1436 * @param deepcopy whether to copy the associated objects. 1437 * @param con the database connection to read associated objects. 1438 * @throws TorqueException if retrieval of the associated objects fails 1439 */ 1440 public TorqueDynamicUser copy(boolean deepcopy, Connection con) throws TorqueException 1441 { 1442 TorqueDynamicUser torqueDynamicUser = new TorqueDynamicUser(); 1443 1444 return copyInto(torqueDynamicUser, deepcopy, con); 1445 } 1446 1447 /** 1448 * Fills the copyObj with the contents of this object. 1449 * The associated objects are also copied and treated as new objects. 1450 * 1451 * @param copyObj the object to fill. 1452 * @throws TorqueException if retrieval of the associated objects fails 1453 */ 1454 public TorqueDynamicUser copyInto(TorqueDynamicUser copyObj) throws TorqueException 1455 { 1456 return copyInto(copyObj, true); 1457 } 1458 1459 /** 1460 * Fills the copyObj with the contents of this object using connection. 1461 * The associated objects are also copied and treated as new objects. 1462 * 1463 * @param copyObj the object to fill. 1464 * @param con the database connection to read associated objects. 1465 * @throws TorqueException if retrieval of the associated objects fails 1466 */ 1467 public TorqueDynamicUser copyInto(TorqueDynamicUser copyObj, Connection con) throws TorqueException 1468 { 1469 return copyInto(copyObj, true, con); 1470 } 1471 1472 /** 1473 * Fills the copyObj with the contents of this object. 1474 * If deepcopy is true, The associated objects are also copied 1475 * and treated as new objects. 1476 * 1477 * @param copyObj the object to fill. 1478 * @param deepcopy whether the associated objects should be copied. 1479 * @throws TorqueException if retrieval of the associated objects fails 1480 */ 1481 protected TorqueDynamicUser copyInto(TorqueDynamicUser copyObj, boolean deepcopy) throws TorqueException 1482 { 1483 copyObj.setEntityId((Integer) null); 1484 copyObj.setEntityName(entityName); 1485 copyObj.setPassword(password); 1486 1487 if (deepcopy) 1488 { 1489 if (collTorqueDynamicUserGroups != null) 1490 { 1491 for (TorqueDynamicUserGroup obj : collTorqueDynamicUserGroups) 1492 { 1493 copyObj.addTorqueDynamicUserGroup(obj.copy()); 1494 } 1495 } 1496 else 1497 { 1498 copyObj.collTorqueDynamicUserGroups = null; 1499 } 1500 if (collTorqueDynamicUserDelegatessRelatedByDelegatorUserId != null) 1501 { 1502 for (TorqueDynamicUserDelegates obj : collTorqueDynamicUserDelegatessRelatedByDelegatorUserId) 1503 { 1504 copyObj.addTorqueDynamicUserDelegatesRelatedByDelegatorUserId(obj.copy()); 1505 } 1506 } 1507 else 1508 { 1509 copyObj.collTorqueDynamicUserDelegatessRelatedByDelegatorUserId = null; 1510 } 1511 if (collTorqueDynamicUserDelegatessRelatedByDelegateeUserId != null) 1512 { 1513 for (TorqueDynamicUserDelegates obj : collTorqueDynamicUserDelegatessRelatedByDelegateeUserId) 1514 { 1515 copyObj.addTorqueDynamicUserDelegatesRelatedByDelegateeUserId(obj.copy()); 1516 } 1517 } 1518 else 1519 { 1520 copyObj.collTorqueDynamicUserDelegatessRelatedByDelegateeUserId = null; 1521 } 1522 } 1523 return copyObj; 1524 } 1525 1526 1527 /** 1528 * Fills the copyObj with the contents of this object using connection. 1529 * If deepcopy is true, The associated objects are also copied 1530 * and treated as new objects. 1531 * 1532 * @param copyObj the object to fill. 1533 * @param deepcopy whether the associated objects should be copied. 1534 * @param con the database connection to read associated objects. 1535 * @throws TorqueException if retrieval of the associated objects fails 1536 */ 1537 public TorqueDynamicUser copyInto(TorqueDynamicUser copyObj, boolean deepcopy, Connection con) throws TorqueException 1538 { 1539 copyObj.setEntityId((Integer) null); 1540 copyObj.setEntityName(entityName); 1541 copyObj.setPassword(password); 1542 1543 if (deepcopy) 1544 { 1545 for (TorqueDynamicUserGroup obj : getTorqueDynamicUserGroups(con)) 1546 { 1547 copyObj.addTorqueDynamicUserGroup(obj.copy()); 1548 } 1549 for (TorqueDynamicUserDelegates obj : getTorqueDynamicUserDelegatesRelatedByDelegatorUserIds(con)) 1550 { 1551 copyObj.addTorqueDynamicUserDelegatesRelatedByDelegatorUserId(obj.copy()); 1552 } 1553 for (TorqueDynamicUserDelegates obj : getTorqueDynamicUserDelegatesRelatedByDelegateeUserIds(con)) 1554 { 1555 copyObj.addTorqueDynamicUserDelegatesRelatedByDelegateeUserId(obj.copy()); 1556 } 1557 } 1558 return copyObj; 1559 } 1560 1561 /** The Peer class */ 1562 private static final org.apache.fulcrum.security.torque.om.TorqueDynamicUserPeer peer 1563 = new org.apache.fulcrum.security.torque.om.TorqueDynamicUserPeer(); 1564 1565 /** 1566 * returns a peer instance associated with this om. Since Peer classes 1567 * are not to have any instance attributes, this method returns the 1568 * same instance for all member of this class. The method could therefore 1569 * be static, but this would prevent one from overriding the behavior. 1570 */ 1571 public org.apache.fulcrum.security.torque.om.TorqueDynamicUserPeer getPeer() 1572 { 1573 return peer; 1574 } 1575 1576 /** 1577 * Retrieves the TableMap object related to this Table data without 1578 * compiler warnings of using getPeer().getTableMap(). 1579 * 1580 * @return The associated TableMap object. 1581 * @throws TorqueException if associated objects are not found 1582 */ 1583 public TableMap getTableMap() throws TorqueException 1584 { 1585 return org.apache.fulcrum.security.torque.om.TorqueDynamicUserPeer.getTableMap(); 1586 } 1587 1588 1589 1590 public String toString() 1591 { 1592 StringBuffer str = new StringBuffer(); 1593 str.append("TorqueDynamicUser:\n"); 1594 str.append("entityId = ") 1595 .append(getEntityId()) 1596 .append("\n"); 1597 str.append("entityName = ") 1598 .append(getEntityName()) 1599 .append("\n"); 1600 str.append("password = ") 1601 .append(getPassword()) 1602 .append("\n"); 1603 return(str.toString()); 1604 } 1605 1606 /** 1607 * Compares the primary key of this instance with the key of another. 1608 * 1609 * @param toCompare The object to compare to. 1610 * @return Whether the primary keys are equal and the object have the 1611 * same class. 1612 */ 1613 public boolean equals(Object toCompare) 1614 { 1615 if (toCompare == null) 1616 { 1617 return false; 1618 } 1619 if (this == toCompare) 1620 { 1621 return true; 1622 } 1623 if (!getClass().equals(toCompare.getClass())) 1624 { 1625 return false; 1626 } 1627 TorqueDynamicUser other = (TorqueDynamicUser) toCompare; 1628 if (getPrimaryKey() == null || other.getPrimaryKey() == null) 1629 { 1630 return false; 1631 } 1632 return getPrimaryKey().equals(other.getPrimaryKey()); 1633 } 1634 1635 /** 1636 * If the primary key is not <code>null</code>, return the hashcode of the 1637 * primary key. Otherwise calls <code>Object.hashCode()</code>. 1638 * 1639 * @return an <code>int</code> value 1640 */ 1641 public int hashCode() 1642 { 1643 ObjectKey<?> ok = getPrimaryKey(); 1644 if (ok == null) 1645 { 1646 return super.hashCode(); 1647 } 1648 1649 return ok.hashCode(); 1650 } 1651 1652 1653 1654 /** 1655 * Compares the content of this object to another object 1656 * 1657 * @param toCompare The object to compare to. 1658 * @return true if all of the columns in the other object have 1659 * the same value as the objects in this class. 1660 */ 1661 public boolean valueEquals(TorqueDynamicUser toCompare) 1662 { 1663 if (toCompare == null) 1664 { 1665 return false; 1666 } 1667 if (this == toCompare) 1668 { 1669 return true; 1670 } 1671 if (!Objects.equals(this.entityId, toCompare.getEntityId())) 1672 { 1673 return false; 1674 } 1675 if (!Objects.equals(this.entityName, toCompare.getEntityName())) 1676 { 1677 return false; 1678 } 1679 if (!Objects.equals(this.password, toCompare.getPassword())) 1680 { 1681 return false; 1682 } 1683 return true; 1684 } 1685 1686 1687 1688}