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:22 CET 2021] 023 * 024 * You should not use this class directly. It should not even be 025 * extended; all references should be to TorqueTurbineUser 026 */ 027@SuppressWarnings("unused") 028public abstract class BaseTorqueTurbineUser extends org.apache.fulcrum.security.torque.turbine.FulcrumAbstractTurbineUser 029 implements Persistent, Serializable 030{ 031 /** Serial version */ 032 private static final long serialVersionUID = 1636029262026L; 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 /** Defines the firstName field. */ 046 private String firstName = null; 047 048 /** Defines the lastName field. */ 049 private String lastName = null; 050 051 /** Defines the email field. */ 052 private String email = null; 053 054 /** Defines the objectdata field. */ 055 private byte[] objectdata = null; 056 057 /** Whether this object was modified after loading or after last save. */ 058 private boolean modified = true; 059 060 /** 061 * Whether this object was loaded from the database or already saved 062 * (false) or whether it is not yet in the database(true). 063 */ 064 private boolean isNew = true; 065 066 /** Flag which indicates whether this object is currently saving. */ 067 private boolean saving = false; 068 069 /** 070 * Flag which indicates whether this object is currently loaded 071 * from the database. 072 */ 073 private boolean loading = false; 074 075 /** 076 * Flag which indicates whether this object was deleted from the database. 077 * Note that this flags does not always display the current database state, 078 * there is no magical connection between this flag and the database. 079 */ 080 private boolean deleted = false; 081 082 083 084 /** Defines the collTorqueTurbineUserGroupRoles field. */ 085 protected List<TorqueTurbineUserGroupRole> collTorqueTurbineUserGroupRoles = null; 086 087 088 089 /** 090 * Get the value of entityId. 091 * 092 * @return the value of entityId as Integer 093 */ 094 public Integer getEntityId() 095 { 096 097 return entityId; 098 } 099 100 /** 101 * Set the value of entityId. 102 * 103 * @param v new value of entityId 104 */ 105 public void setEntityId(Integer v) 106 { 107 if (!Objects.equals(this.entityId, v)) 108 { 109 setModified(true); 110 } 111 112 this.entityId = v; 113 114 // update associated objects in collTorqueTurbineUserGroupRoles 115 if (collTorqueTurbineUserGroupRoles != null) 116 { 117 for (TorqueTurbineUserGroupRole element : collTorqueTurbineUserGroupRoles) 118 { 119 element.setUserId(v); 120 } 121 } 122 123 } 124 125 /** 126 * Get the value of entityName. 127 * 128 * @return the value of entityName as String 129 */ 130 public String getEntityName() 131 { 132 133 return entityName; 134 } 135 136 /** 137 * Set the value of entityName. 138 * 139 * @param v new value of entityName 140 */ 141 public void setEntityName(String v) 142 { 143 if (!Objects.equals(this.entityName, v)) 144 { 145 setModified(true); 146 } 147 148 this.entityName = v; 149 150 151 } 152 153 /** 154 * Get the value of password. 155 * 156 * @return the value of password as String 157 */ 158 public String getPassword() 159 { 160 161 return password; 162 } 163 164 /** 165 * Set the value of password. 166 * 167 * @param v new value of password 168 */ 169 public void setPassword(String v) 170 { 171 if (!Objects.equals(this.password, v)) 172 { 173 setModified(true); 174 } 175 176 this.password = v; 177 178 179 } 180 181 /** 182 * Get the value of firstName. 183 * 184 * @return the value of firstName as String 185 */ 186 public String getFirstName() 187 { 188 189 return firstName; 190 } 191 192 /** 193 * Set the value of firstName. 194 * 195 * @param v new value of firstName 196 */ 197 public void setFirstName(String v) 198 { 199 if (!Objects.equals(this.firstName, v)) 200 { 201 setModified(true); 202 } 203 204 this.firstName = v; 205 206 207 } 208 209 /** 210 * Get the value of lastName. 211 * 212 * @return the value of lastName as String 213 */ 214 public String getLastName() 215 { 216 217 return lastName; 218 } 219 220 /** 221 * Set the value of lastName. 222 * 223 * @param v new value of lastName 224 */ 225 public void setLastName(String v) 226 { 227 if (!Objects.equals(this.lastName, v)) 228 { 229 setModified(true); 230 } 231 232 this.lastName = v; 233 234 235 } 236 237 /** 238 * Get the value of email. 239 * 240 * @return the value of email as String 241 */ 242 public String getEmail() 243 { 244 245 return email; 246 } 247 248 /** 249 * Set the value of email. 250 * 251 * @param v new value of email 252 */ 253 public void setEmail(String v) 254 { 255 if (!Objects.equals(this.email, v)) 256 { 257 setModified(true); 258 } 259 260 this.email = v; 261 262 263 } 264 265 /** 266 * Get the value of objectdata. 267 * 268 * @return the value of objectdata as byte[] 269 */ 270 public byte[] getObjectdata() 271 { 272 273 return objectdata; 274 } 275 276 /** 277 * Set the value of objectdata. 278 * 279 * @param v new value of objectdata 280 */ 281 public void setObjectdata(byte[] v) 282 { 283 if (!Objects.equals(this.objectdata, v)) 284 { 285 setModified(true); 286 } 287 288 this.objectdata = v; 289 290 291 } 292 293 294 /** 295 * Returns whether the object has ever been saved. This will 296 * be false, if the object was retrieved from storage or was created 297 * and then saved. 298 * 299 * @return true, if the object has never been persisted. 300 */ 301 public boolean isNew() 302 { 303 return isNew; 304 } 305 306 /** 307 * Sets whether the object has ever been saved. 308 * 309 * @param isNew true if the object has never been saved, false otherwise. 310 */ 311 public void setNew(boolean isNew) 312 { 313 this.isNew = isNew; 314 } 315 316 /** 317 * Returns whether the object has been modified. 318 * 319 * @return True if the object has been modified. 320 */ 321 public boolean isModified() 322 { 323 return modified; 324 } 325 326 /** 327 * Sets whether the object has been modified. 328 * 329 * @param modified true if the object has been modified, false otherwise. 330 */ 331 public void setModified(boolean modified) 332 { 333 this.modified = modified; 334 } 335 336 /** 337 * Sets the modified state for the object to be false. 338 */ 339 public void resetModified() 340 { 341 modified = false; 342 } 343 344 345 /** 346 * Returns whether this object is currently saving. 347 * 348 * @return true if this object is currently saving, false otherwise. 349 */ 350 public boolean isSaving() 351 { 352 return saving; 353 } 354 355 /** 356 * Sets whether this object is currently saving. 357 * 358 * @param saving true if this object is currently saving, false otherwise. 359 */ 360 public void setSaving(boolean saving) 361 { 362 this.saving = saving; 363 } 364 365 366 /** 367 * Returns whether this object is currently being loaded from the database. 368 * 369 * @return true if this object is currently loading, false otherwise. 370 */ 371 public boolean isLoading() 372 { 373 return loading; 374 } 375 376 /** 377 * Sets whether this object is currently being loaded from the database. 378 * 379 * @param loading true if this object is currently loading, false otherwise. 380 */ 381 public void setLoading(boolean loading) 382 { 383 this.loading = loading; 384 } 385 386 387 /** 388 * Returns whether this object was deleted from the database. 389 * Note that this getter does not automatically reflect database state, 390 * it will be set to true by Torque if doDelete() was called with this 391 * object. Bulk deletes and deletes via primary key do not change 392 * this flag. Also, if doDelete() was called on an object which does 393 * not exist in the database, the deleted flag is set to true even if 394 * it was not deleted. 395 * 396 * @return true if this object was deleted, false otherwise. 397 */ 398 public boolean isDeleted() 399 { 400 return deleted; 401 } 402 403 /** 404 * Sets whether this object was deleted from the database. 405 * 406 * @param deleted true if this object was deleted, false otherwise. 407 */ 408 public void setDeleted(boolean deleted) 409 { 410 this.deleted = deleted; 411 } 412 413 414 415 416 /** 417 * Initializes the cache collTorqueTurbineUserGroupRoles for referenced objects. 418 * This, means, if collTorqueTurbineUserGroupRoles is null when this operation is called, it is 419 * initialized with an empty collection, otherwise it remains unchanged. 420 * 421 * @return the (possibly new) content of the field collTorqueTurbineUserGroupRoles, not null. 422 */ 423 public List<TorqueTurbineUserGroupRole> initTorqueTurbineUserGroupRoles() 424 { 425 if (collTorqueTurbineUserGroupRoles == null) 426 { 427 collTorqueTurbineUserGroupRoles = new ArrayList<TorqueTurbineUserGroupRole>(); 428 } 429 return collTorqueTurbineUserGroupRoles; 430 } 431 432 /** 433 * Checks whether the cache collTorqueTurbineUserGroupRoles for referenced objects has either been 434 * loaded from the database or has been manually initialized. 435 * 436 * @return boolean true if initialized 437 */ 438 public boolean isTorqueTurbineUserGroupRolesInitialized() 439 { 440 return (collTorqueTurbineUserGroupRoles != null); 441 } 442 443 444 /** 445 * Method called to associate a TorqueTurbineUserGroupRole object to this object 446 * through the collTorqueTurbineUserGroupRoles foreign key attribute. 447 * If the associated objects were not retrieved before 448 * and this object is not new, the associated objects are retrieved 449 * from the database before adding the <code>toAdd</code> object. 450 * 451 * @param toAdd the object to add to the associated objects, not null. 452 * 453 * @throws TorqueException if retrieval of the associated objects fails. 454 * @throws NullPointerException if toAdd is null. 455 */ 456 public void addTorqueTurbineUserGroupRole(TorqueTurbineUserGroupRole toAdd) 457 throws TorqueException 458 { 459 toAdd.setTorqueTurbineUser((TorqueTurbineUser) this); 460 getTorqueTurbineUserGroupRoles().add(toAdd); 461 } 462 463 /** 464 * Method called to associate a TorqueTurbineUserGroupRole object to this object 465 * through the collTorqueTurbineUserGroupRoles foreign key attribute using connection. 466 * 467 * @param l TorqueTurbineUserGroupRole 468 * @throws TorqueException if retrieval of the associated objects fails. 469 */ 470 public void addTorqueTurbineUserGroupRole(TorqueTurbineUserGroupRole l, Connection con) throws TorqueException 471 { 472 getTorqueTurbineUserGroupRoles(con).add(l); 473 l.setTorqueTurbineUser((TorqueTurbineUser) this); 474 } 475 476 /** 477 * Method called to reset the cache of TorqueTurbineUserGroupRole objects 478 * which are related through the collTorqueTurbineUserGroupRoles foreign key attribute. 479 */ 480 public void resetTorqueTurbineUserGroupRole() 481 { 482 collTorqueTurbineUserGroupRoles = null; 483 } 484 485 486 /** 487 * The criteria used to select the current contents of collTorqueTurbineUserGroupRoles 488 */ 489 private Criteria lastTorqueTurbineUserGroupRoleCriteria = null; 490 491 /** 492 * If this collection has already been initialized, returns 493 * the collection. Otherwise returns the results of 494 * getTorqueTurbineUserGroupRoles(new Criteria()) 495 * 496 * @return the collection of associated objects 497 * @throws TorqueException 498 */ 499 public List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRoles() 500 throws TorqueException 501 { 502 if (collTorqueTurbineUserGroupRoles == null) 503 { 504 collTorqueTurbineUserGroupRoles = getTorqueTurbineUserGroupRoles(new Criteria()); 505 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 506 { 507 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 508 } 509 } 510 return collTorqueTurbineUserGroupRoles; 511 } 512 513 /** 514 * If this collection has already been initialized with 515 * an identical criteria, it returns the collection. 516 * Otherwise if this BaseTorqueTurbineUser has previously 517 * been saved, it will retrieve related collTorqueTurbineUserGroupRoles from storage. 518 * If this BaseTorqueTurbineUser is new, it will return 519 * an empty collection or the current collection, the criteria 520 * is ignored on a new object. 521 * 522 * @throws TorqueException If a problem occurs with the get[criteria] method. 523 */ 524 public List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRoles(Criteria criteria) throws TorqueException 525 { 526 if (collTorqueTurbineUserGroupRoles == null) 527 { 528 if (isNew()) 529 { 530 initTorqueTurbineUserGroupRoles(); 531 } 532 else 533 { 534 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 535 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelect(criteria); 536 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 537 { 538 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 539 } 540 } 541 } 542 else 543 { 544 // criteria has no effect for a new object 545 if (!isNew()) 546 { 547 // the following code is to determine if a new query is 548 // called for. If the criteria is the same as the last 549 // one, just return the collection. 550 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 551 if (lastTorqueTurbineUserGroupRoleCriteria == null 552 || !lastTorqueTurbineUserGroupRoleCriteria.equals(criteria)) 553 { 554 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelect(criteria); 555 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 556 { 557 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 558 } 559 } 560 } 561 } 562 lastTorqueTurbineUserGroupRoleCriteria = criteria; 563 return collTorqueTurbineUserGroupRoles; 564 } 565 566 /** 567 * If this collection has already been initialized, returns 568 * the collection. Otherwise returns the results of 569 * getTorqueTurbineUserGroupRoles(new Criteria(),Connection) 570 * This method takes in the Connection also as input so that 571 * referenced objects can also be obtained using a Connection 572 * that is taken as input 573 * 574 * @param con the Connection 575 * @return List<TorqueTurbineUserGroupRole> results of the collection 576 * @throws TorqueException If a problem occurs with the get[connection] method. 577 */ 578 public List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRoles(Connection con) throws TorqueException 579 { 580 if (collTorqueTurbineUserGroupRoles == null) 581 { 582 collTorqueTurbineUserGroupRoles = getTorqueTurbineUserGroupRoles(new Criteria(), con); 583 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 584 { 585 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 586 } 587 } 588 return collTorqueTurbineUserGroupRoles; 589 } 590 591 /** 592 * If this collection has already been initialized with 593 * an identical criteria, it returns the collection. 594 * Otherwise if this BaseTorqueTurbineUser has previously 595 * been saved, it will retrieve the related TorqueTurbineUserGroupRole Objects 596 * from storage. 597 * If this BaseTorqueTurbineUser is new, it will return 598 * an empty collection or the current collection, the criteria 599 * is ignored on a new object. 600 * This method takes in the Connection also as input so that 601 * referenced objects can also be obtained using a Connection 602 * that is taken as input 603 * 604 * @param con the Connection 605 * @return List<TorqueTurbineUserGroupRole> results of the collection 606 * @throws TorqueException If a problem occurs with the get[connection] method. 607 */ 608 public List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRoles(Criteria criteria, Connection con) 609 throws TorqueException 610 { 611 if (collTorqueTurbineUserGroupRoles == null) 612 { 613 if (isNew()) 614 { 615 initTorqueTurbineUserGroupRoles(); 616 } 617 else 618 { 619 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 620 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelect(criteria, con); 621 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 622 { 623 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 624 } 625 } 626 } 627 else 628 { 629 // criteria has no effect for a new object 630 if (!isNew()) 631 { 632 // the following code is to determine if a new query is 633 // called for. If the criteria is the same as the last 634 // one, just return the collection. 635 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 636 if (lastTorqueTurbineUserGroupRoleCriteria == null 637 || !lastTorqueTurbineUserGroupRoleCriteria.equals(criteria)) 638 { 639 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelect(criteria, con); 640 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 641 { 642 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 643 } 644 } 645 } 646 } 647 lastTorqueTurbineUserGroupRoleCriteria = criteria; 648 649 return collTorqueTurbineUserGroupRoles; 650 } 651 652 /** 653 * If this collection has already been initialized with 654 * an identical criteria, it returns the collection. 655 * Otherwise if this BaseTorqueTurbineUser is new, it will return 656 * an empty collection; or if this thisObjectClassName has previously 657 * been saved, it will retrieve the related objects from storage. 658 * 659 * This method is protected by default in order to keep the public 660 * api reasonable. You can change the access modifier to public 661 * by overriding this method in the child class. 662 * 663 * @return List<TorqueTurbineUserGroupRole> the collection 664 * @param criteria the criteria to use when filling the collection. 665 * @throws TorqueException if associated objects are not found 666 */ 667 protected List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRolesJoinTorqueTurbineGroup(Criteria criteria) throws TorqueException 668 { 669 try (TorqueConnection connection = Transaction.begin(criteria.getDbName())) 670 { 671 List<TorqueTurbineUserGroupRole> result = getTorqueTurbineUserGroupRolesJoinTorqueTurbineGroup(criteria, connection); 672 673 Transaction.commit(connection); 674 return result; 675 } 676 } 677 678 /** 679 * If this collection has already been initialized with 680 * an identical criteria, it returns the collection. 681 * Otherwise if this BaseTorqueTurbineUser is new, it will return 682 * an empty collection; or if this BaseTorqueTurbineUser has previously 683 * been saved, it will retrieve the related objects from storage. 684 * 685 * This method is protected by default in order to keep the public 686 * api reasonable. You can change the access modifier to public 687 * by overriding this method in the child class. 688 */ 689 protected List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRolesJoinTorqueTurbineGroup(Criteria criteria, Connection connection) 690 throws TorqueException 691 { 692 if (collTorqueTurbineUserGroupRoles == null) 693 { 694 if (isNew()) 695 { 696 initTorqueTurbineUserGroupRoles(); 697 } 698 else 699 { 700 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 701 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineGroup(criteria, connection); 702 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 703 { 704 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 705 } 706 } 707 } 708 else 709 { 710 // the following code is to determine if a new query is 711 // called for. If the criteria is the same as the last 712 // one, just return the collection. 713 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 714 if (lastTorqueTurbineUserGroupRoleCriteria == null 715 || !lastTorqueTurbineUserGroupRoleCriteria.equals(criteria)) 716 { 717 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineGroup(criteria, connection); 718 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 719 { 720 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 721 } 722 } 723 } 724 lastTorqueTurbineUserGroupRoleCriteria = criteria; 725 726 return collTorqueTurbineUserGroupRoles; 727 } 728 729 /** 730 * If this collection has already been initialized with 731 * an identical criteria, it returns the collection. 732 * Otherwise if this BaseTorqueTurbineUser is new, it will return 733 * an empty collection; or if this thisObjectClassName has previously 734 * been saved, it will retrieve the related objects from storage. 735 * 736 * This method is protected by default in order to keep the public 737 * api reasonable. You can change the access modifier to public 738 * by overriding this method in the child class. 739 * 740 * @return List<TorqueTurbineUserGroupRole> the collection 741 * @param criteria the criteria to use when filling the collection. 742 * @throws TorqueException if associated objects are not found 743 */ 744 protected List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRolesJoinTorqueTurbineRole(Criteria criteria) throws TorqueException 745 { 746 try (TorqueConnection connection = Transaction.begin(criteria.getDbName())) 747 { 748 List<TorqueTurbineUserGroupRole> result = getTorqueTurbineUserGroupRolesJoinTorqueTurbineRole(criteria, connection); 749 750 Transaction.commit(connection); 751 return result; 752 } 753 } 754 755 /** 756 * If this collection has already been initialized with 757 * an identical criteria, it returns the collection. 758 * Otherwise if this BaseTorqueTurbineUser is new, it will return 759 * an empty collection; or if this BaseTorqueTurbineUser has previously 760 * been saved, it will retrieve the related objects from storage. 761 * 762 * This method is protected by default in order to keep the public 763 * api reasonable. You can change the access modifier to public 764 * by overriding this method in the child class. 765 */ 766 protected List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRolesJoinTorqueTurbineRole(Criteria criteria, Connection connection) 767 throws TorqueException 768 { 769 if (collTorqueTurbineUserGroupRoles == null) 770 { 771 if (isNew()) 772 { 773 initTorqueTurbineUserGroupRoles(); 774 } 775 else 776 { 777 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 778 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineRole(criteria, connection); 779 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 780 { 781 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 782 } 783 } 784 } 785 else 786 { 787 // the following code is to determine if a new query is 788 // called for. If the criteria is the same as the last 789 // one, just return the collection. 790 criteria.and(org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId()); 791 if (lastTorqueTurbineUserGroupRoleCriteria == null 792 || !lastTorqueTurbineUserGroupRoleCriteria.equals(criteria)) 793 { 794 collTorqueTurbineUserGroupRoles = org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineRole(criteria, connection); 795 for (TorqueTurbineUserGroupRole torqueTurbineUserGroupRole : collTorqueTurbineUserGroupRoles) 796 { 797 torqueTurbineUserGroupRole.setTorqueTurbineUser((TorqueTurbineUser) this); 798 } 799 } 800 } 801 lastTorqueTurbineUserGroupRoleCriteria = criteria; 802 803 return collTorqueTurbineUserGroupRoles; 804 } 805 806 807 808 809 810 /** 811 * Stores an object in the database. If the object is new, 812 * it is inserted; otherwise an update is performed. 813 * 814 * @throws TorqueException if an error occurs during saving. 815 */ 816 public void save() throws TorqueException 817 { 818 save(TorqueTurbineUserPeer.DATABASE_NAME); 819 } 820 821 /** 822 * Stores an object in the database. If the object is new, 823 * it is inserted; otherwise an update is performed. 824 * 825 * @param dbName the name of the database to which the object 826 * should be saved. 827 * 828 * @throws TorqueException if an error occurs during saving. 829 */ 830 public void save(String dbName) 831 throws TorqueException 832 { 833 try (TorqueConnection con = Transaction.begin(dbName)) 834 { 835 save(con); 836 Transaction.commit(con); 837 } 838 } 839 840 /** 841 * Stores an object in the database. If the object is new, 842 * it is inserted; otherwise an update is performed. This method 843 * is meant to be used as part of a transaction, otherwise use 844 * the save() method and the connection details will be handled 845 * internally. 846 * 847 * @param con the connection to use for saving the object, not null. 848 * 849 * @throws TorqueException if an error occurs during saving. 850 */ 851 public void save(Connection con) 852 throws TorqueException 853 { 854 if (isSaving()) 855 { 856 return; 857 } 858 try 859 { 860 setSaving(true); 861 // If this object has been modified, then save it to the database. 862 if (isModified()) 863 { 864 if (isNew()) 865 { 866 TorqueTurbineUserPeer.doInsert((TorqueTurbineUser) this, con); 867 setNew(false); 868 } 869 else 870 { 871 TorqueTurbineUserPeer.doUpdate((TorqueTurbineUser) this, con); 872 } 873 } 874 875 if (isTorqueTurbineUserGroupRolesInitialized()) 876 { 877 for (TorqueTurbineUserGroupRole collTorqueTurbineUserGroupRoles : getTorqueTurbineUserGroupRoles()) 878 { 879 collTorqueTurbineUserGroupRoles.save(con); 880 } 881 } 882 } 883 finally 884 { 885 setSaving(false); 886 } 887 } 888 889 890 891 892 /** 893 * Set the PrimaryKey using ObjectKey. 894 * 895 * @param key entityId ObjectKey 896 */ 897 public void setPrimaryKey(ObjectKey<?> key) 898 899 { 900 setEntityId(Integer.valueOf(((NumberKey) key).intValue())); 901 } 902 903 /** 904 * Set the PrimaryKey using a String. 905 * 906 * @param key the primary key to set. 907 */ 908 public void setPrimaryKey(String key) 909 { 910 setEntityId(new Integer(key)); 911 } 912 913 914 /** 915 * returns an id that differentiates this object from others 916 * of its class. 917 */ 918 public ObjectKey<?> getPrimaryKey() 919 { 920 return SimpleKey.keyFor(getEntityId()); 921 } 922 923 924 925 /** 926 * Makes a copy of this object. 927 * It creates a new object filling in the simple attributes. 928 * It then fills all the association collections and sets the 929 * related objects to isNew=true. 930 * @throws TorqueException if retrieval of the associated objects fails 931 */ 932 public TorqueTurbineUser copy() throws TorqueException 933 { 934 return copy(true); 935 } 936 937 /** 938 * Makes a copy of this object using a connection. 939 * It creates a new object filling in the simple attributes. 940 * It then fills all the association collections and sets the 941 * related objects to isNew=true. 942 * 943 * @param con the database connection to read associated objects. 944 * @throws TorqueException if retrieval of the associated objects fails 945 */ 946 public TorqueTurbineUser copy(Connection con) throws TorqueException 947 { 948 return copy(true, con); 949 } 950 951 /** 952 * Makes a copy of this object. 953 * It creates a new object filling in the simple attributes. 954 * If the parameter deepcopy is true, it then fills all the 955 * association collections and sets the related objects to 956 * isNew=true. 957 * 958 * @param deepcopy whether to copy the associated objects. 959 * @throws TorqueException if retrieval of the associated objects fails 960 */ 961 public TorqueTurbineUser copy(boolean deepcopy) throws TorqueException 962 { 963 TorqueTurbineUser torqueTurbineUser = new TorqueTurbineUser(); 964 965 return copyInto(torqueTurbineUser, deepcopy); 966 } 967 968 /** 969 * Makes a copy of this object using connection. 970 * It creates a new object filling in the simple attributes. 971 * If the parameter deepcopy is true, it then fills all the 972 * association collections and sets the related objects to 973 * isNew=true. 974 * 975 * @param deepcopy whether to copy the associated objects. 976 * @param con the database connection to read associated objects. 977 * @throws TorqueException if retrieval of the associated objects fails 978 */ 979 public TorqueTurbineUser copy(boolean deepcopy, Connection con) throws TorqueException 980 { 981 TorqueTurbineUser torqueTurbineUser = new TorqueTurbineUser(); 982 983 return copyInto(torqueTurbineUser, deepcopy, con); 984 } 985 986 /** 987 * Fills the copyObj with the contents of this object. 988 * The associated objects are also copied and treated as new objects. 989 * 990 * @param copyObj the object to fill. 991 * @throws TorqueException if retrieval of the associated objects fails 992 */ 993 public TorqueTurbineUser copyInto(TorqueTurbineUser copyObj) throws TorqueException 994 { 995 return copyInto(copyObj, true); 996 } 997 998 /** 999 * Fills the copyObj with the contents of this object using connection. 1000 * The associated objects are also copied and treated as new objects. 1001 * 1002 * @param copyObj the object to fill. 1003 * @param con the database connection to read associated objects. 1004 * @throws TorqueException if retrieval of the associated objects fails 1005 */ 1006 public TorqueTurbineUser copyInto(TorqueTurbineUser copyObj, Connection con) throws TorqueException 1007 { 1008 return copyInto(copyObj, true, con); 1009 } 1010 1011 /** 1012 * Fills the copyObj with the contents of this object. 1013 * If deepcopy is true, The associated objects are also copied 1014 * and treated as new objects. 1015 * 1016 * @param copyObj the object to fill. 1017 * @param deepcopy whether the associated objects should be copied. 1018 * @throws TorqueException if retrieval of the associated objects fails 1019 */ 1020 protected TorqueTurbineUser copyInto(TorqueTurbineUser copyObj, boolean deepcopy) throws TorqueException 1021 { 1022 copyObj.setEntityId((Integer) null); 1023 copyObj.setEntityName(entityName); 1024 copyObj.setPassword(password); 1025 copyObj.setFirstName(firstName); 1026 copyObj.setLastName(lastName); 1027 copyObj.setEmail(email); 1028 copyObj.setObjectdata(objectdata); 1029 1030 if (deepcopy) 1031 { 1032 if (collTorqueTurbineUserGroupRoles != null) 1033 { 1034 for (TorqueTurbineUserGroupRole obj : collTorqueTurbineUserGroupRoles) 1035 { 1036 copyObj.addTorqueTurbineUserGroupRole(obj.copy()); 1037 } 1038 } 1039 else 1040 { 1041 copyObj.collTorqueTurbineUserGroupRoles = null; 1042 } 1043 } 1044 return copyObj; 1045 } 1046 1047 1048 /** 1049 * Fills the copyObj with the contents of this object using connection. 1050 * If deepcopy is true, The associated objects are also copied 1051 * and treated as new objects. 1052 * 1053 * @param copyObj the object to fill. 1054 * @param deepcopy whether the associated objects should be copied. 1055 * @param con the database connection to read associated objects. 1056 * @throws TorqueException if retrieval of the associated objects fails 1057 */ 1058 public TorqueTurbineUser copyInto(TorqueTurbineUser copyObj, boolean deepcopy, Connection con) throws TorqueException 1059 { 1060 copyObj.setEntityId((Integer) null); 1061 copyObj.setEntityName(entityName); 1062 copyObj.setPassword(password); 1063 copyObj.setFirstName(firstName); 1064 copyObj.setLastName(lastName); 1065 copyObj.setEmail(email); 1066 copyObj.setObjectdata(objectdata); 1067 1068 if (deepcopy) 1069 { 1070 for (TorqueTurbineUserGroupRole obj : getTorqueTurbineUserGroupRoles(con)) 1071 { 1072 copyObj.addTorqueTurbineUserGroupRole(obj.copy()); 1073 } 1074 } 1075 return copyObj; 1076 } 1077 1078 /** The Peer class */ 1079 private static final org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer peer 1080 = new org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer(); 1081 1082 /** 1083 * returns a peer instance associated with this om. Since Peer classes 1084 * are not to have any instance attributes, this method returns the 1085 * same instance for all member of this class. The method could therefore 1086 * be static, but this would prevent one from overriding the behavior. 1087 */ 1088 public org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer getPeer() 1089 { 1090 return peer; 1091 } 1092 1093 /** 1094 * Retrieves the TableMap object related to this Table data without 1095 * compiler warnings of using getPeer().getTableMap(). 1096 * 1097 * @return The associated TableMap object. 1098 * @throws TorqueException if associated objects are not found 1099 */ 1100 public TableMap getTableMap() throws TorqueException 1101 { 1102 return org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.getTableMap(); 1103 } 1104 1105 1106 1107 public String toString() 1108 { 1109 StringBuffer str = new StringBuffer(); 1110 str.append("TorqueTurbineUser:\n"); 1111 str.append("entityId = ") 1112 .append(getEntityId()) 1113 .append("\n"); 1114 str.append("entityName = ") 1115 .append(getEntityName()) 1116 .append("\n"); 1117 str.append("password = ") 1118 .append(getPassword()) 1119 .append("\n"); 1120 str.append("firstName = ") 1121 .append(getFirstName()) 1122 .append("\n"); 1123 str.append("lastName = ") 1124 .append(getLastName()) 1125 .append("\n"); 1126 str.append("email = ") 1127 .append(getEmail()) 1128 .append("\n"); 1129 str.append("objectdata = ") 1130 .append("<binary>") 1131 .append("\n"); 1132 return(str.toString()); 1133 } 1134 1135 /** 1136 * Compares the primary key of this instance with the key of another. 1137 * 1138 * @param toCompare The object to compare to. 1139 * @return Whether the primary keys are equal and the object have the 1140 * same class. 1141 */ 1142 public boolean equals(Object toCompare) 1143 { 1144 if (toCompare == null) 1145 { 1146 return false; 1147 } 1148 if (this == toCompare) 1149 { 1150 return true; 1151 } 1152 if (!getClass().equals(toCompare.getClass())) 1153 { 1154 return false; 1155 } 1156 TorqueTurbineUser other = (TorqueTurbineUser) toCompare; 1157 if (getPrimaryKey() == null || other.getPrimaryKey() == null) 1158 { 1159 return false; 1160 } 1161 return getPrimaryKey().equals(other.getPrimaryKey()); 1162 } 1163 1164 /** 1165 * If the primary key is not <code>null</code>, return the hashcode of the 1166 * primary key. Otherwise calls <code>Object.hashCode()</code>. 1167 * 1168 * @return an <code>int</code> value 1169 */ 1170 public int hashCode() 1171 { 1172 ObjectKey<?> ok = getPrimaryKey(); 1173 if (ok == null) 1174 { 1175 return super.hashCode(); 1176 } 1177 1178 return ok.hashCode(); 1179 } 1180 1181 1182 1183 /** 1184 * Compares the content of this object to another object 1185 * 1186 * @param toCompare The object to compare to. 1187 * @return true if all of the columns in the other object have 1188 * the same value as the objects in this class. 1189 */ 1190 public boolean valueEquals(TorqueTurbineUser toCompare) 1191 { 1192 if (toCompare == null) 1193 { 1194 return false; 1195 } 1196 if (this == toCompare) 1197 { 1198 return true; 1199 } 1200 if (!Objects.equals(this.entityId, toCompare.getEntityId())) 1201 { 1202 return false; 1203 } 1204 if (!Objects.equals(this.entityName, toCompare.getEntityName())) 1205 { 1206 return false; 1207 } 1208 if (!Objects.equals(this.password, toCompare.getPassword())) 1209 { 1210 return false; 1211 } 1212 if (!Objects.equals(this.firstName, toCompare.getFirstName())) 1213 { 1214 return false; 1215 } 1216 if (!Objects.equals(this.lastName, toCompare.getLastName())) 1217 { 1218 return false; 1219 } 1220 if (!Objects.equals(this.email, toCompare.getEmail())) 1221 { 1222 return false; 1223 } 1224 if (!Objects.equals(this.objectdata, toCompare.getObjectdata())) 1225 { 1226 return false; 1227 } 1228 return true; 1229 } 1230 1231 1232 1233}