001package org.apache.fulcrum.security.torque.om; 002 003import java.io.Serializable; 004import java.sql.Connection; 005import java.util.Objects; 006 007import org.apache.torque.TorqueException; 008import org.apache.torque.map.TableMap; 009import org.apache.torque.om.ComboKey; 010import org.apache.torque.om.NumberKey; 011import org.apache.torque.om.ObjectKey; 012import org.apache.torque.om.SimpleKey; 013import org.apache.torque.om.Persistent; 014import org.apache.torque.util.TorqueConnection; 015import org.apache.torque.util.Transaction; 016 017/** 018 * This class was autogenerated by Torque on: 019 * 020 * [Thu Nov 04 13:34:22 CET 2021] 021 * 022 * You should not use this class directly. It should not even be 023 * extended; all references should be to TorqueTurbineUserGroupRole 024 */ 025@SuppressWarnings("unused") 026public abstract class BaseTorqueTurbineUserGroupRole 027 implements Persistent, Serializable 028{ 029 /** Serial version */ 030 private static final long serialVersionUID = 1636029262106L; 031 032 033 034 /** Defines the userId field. */ 035 private Integer userId = null; 036 037 /** Defines the groupId field. */ 038 private Integer groupId = null; 039 040 /** Defines the roleId field. */ 041 private Integer roleId = null; 042 043 /** Whether this object was modified after loading or after last save. */ 044 private boolean modified = true; 045 046 /** 047 * Whether this object was loaded from the database or already saved 048 * (false) or whether it is not yet in the database(true). 049 */ 050 private boolean isNew = true; 051 052 /** Flag which indicates whether this object is currently saving. */ 053 private boolean saving = false; 054 055 /** 056 * Flag which indicates whether this object is currently loaded 057 * from the database. 058 */ 059 private boolean loading = false; 060 061 /** 062 * Flag which indicates whether this object was deleted from the database. 063 * Note that this flags does not always display the current database state, 064 * there is no magical connection between this flag and the database. 065 */ 066 private boolean deleted = false; 067 068 /** Defines the aTorqueTurbineUser field. */ 069 private TorqueTurbineUser aTorqueTurbineUser = null; 070 071 /** Defines the aTorqueTurbineGroup field. */ 072 private TorqueTurbineGroup aTorqueTurbineGroup = null; 073 074 /** Defines the aTorqueTurbineRole field. */ 075 private TorqueTurbineRole aTorqueTurbineRole = null; 076 077 078 079 080 081 /** 082 * Get the value of userId. 083 * 084 * @return the value of userId as Integer 085 */ 086 public Integer getUserId() 087 { 088 089 return userId; 090 } 091 092 /** 093 * Set the value of userId. 094 * 095 * @param v new value of userId 096 */ 097 public void setUserId(Integer v) 098 { 099 if (!Objects.equals(this.userId, v)) 100 { 101 setModified(true); 102 } 103 104 this.userId = v; 105 if (aTorqueTurbineUser != null && !Objects.equals(aTorqueTurbineUser.getEntityId(), v)) 106 { 107 aTorqueTurbineUser = null; 108 } 109 110 111 } 112 113 /** 114 * Get the value of groupId. 115 * 116 * @return the value of groupId as Integer 117 */ 118 public Integer getGroupId() 119 { 120 121 return groupId; 122 } 123 124 /** 125 * Set the value of groupId. 126 * 127 * @param v new value of groupId 128 */ 129 public void setGroupId(Integer v) 130 { 131 if (!Objects.equals(this.groupId, v)) 132 { 133 setModified(true); 134 } 135 136 this.groupId = v; 137 if (aTorqueTurbineGroup != null && !Objects.equals(aTorqueTurbineGroup.getEntityId(), v)) 138 { 139 aTorqueTurbineGroup = null; 140 } 141 142 143 } 144 145 /** 146 * Get the value of roleId. 147 * 148 * @return the value of roleId as Integer 149 */ 150 public Integer getRoleId() 151 { 152 153 return roleId; 154 } 155 156 /** 157 * Set the value of roleId. 158 * 159 * @param v new value of roleId 160 */ 161 public void setRoleId(Integer v) 162 { 163 if (!Objects.equals(this.roleId, v)) 164 { 165 setModified(true); 166 } 167 168 this.roleId = v; 169 if (aTorqueTurbineRole != null && !Objects.equals(aTorqueTurbineRole.getEntityId(), v)) 170 { 171 aTorqueTurbineRole = null; 172 } 173 174 175 } 176 177 178 /** 179 * Returns whether the object has ever been saved. This will 180 * be false, if the object was retrieved from storage or was created 181 * and then saved. 182 * 183 * @return true, if the object has never been persisted. 184 */ 185 public boolean isNew() 186 { 187 return isNew; 188 } 189 190 /** 191 * Sets whether the object has ever been saved. 192 * 193 * @param isNew true if the object has never been saved, false otherwise. 194 */ 195 public void setNew(boolean isNew) 196 { 197 this.isNew = isNew; 198 } 199 200 /** 201 * Returns whether the object has been modified. 202 * 203 * @return True if the object has been modified. 204 */ 205 public boolean isModified() 206 { 207 return modified; 208 } 209 210 /** 211 * Sets whether the object has been modified. 212 * 213 * @param modified true if the object has been modified, false otherwise. 214 */ 215 public void setModified(boolean modified) 216 { 217 this.modified = modified; 218 } 219 220 /** 221 * Sets the modified state for the object to be false. 222 */ 223 public void resetModified() 224 { 225 modified = false; 226 } 227 228 229 /** 230 * Returns whether this object is currently saving. 231 * 232 * @return true if this object is currently saving, false otherwise. 233 */ 234 public boolean isSaving() 235 { 236 return saving; 237 } 238 239 /** 240 * Sets whether this object is currently saving. 241 * 242 * @param saving true if this object is currently saving, false otherwise. 243 */ 244 public void setSaving(boolean saving) 245 { 246 this.saving = saving; 247 } 248 249 250 /** 251 * Returns whether this object is currently being loaded from the database. 252 * 253 * @return true if this object is currently loading, false otherwise. 254 */ 255 public boolean isLoading() 256 { 257 return loading; 258 } 259 260 /** 261 * Sets whether this object is currently being loaded from the database. 262 * 263 * @param loading true if this object is currently loading, false otherwise. 264 */ 265 public void setLoading(boolean loading) 266 { 267 this.loading = loading; 268 } 269 270 271 /** 272 * Returns whether this object was deleted from the database. 273 * Note that this getter does not automatically reflect database state, 274 * it will be set to true by Torque if doDelete() was called with this 275 * object. Bulk deletes and deletes via primary key do not change 276 * this flag. Also, if doDelete() was called on an object which does 277 * not exist in the database, the deleted flag is set to true even if 278 * it was not deleted. 279 * 280 * @return true if this object was deleted, false otherwise. 281 */ 282 public boolean isDeleted() 283 { 284 return deleted; 285 } 286 287 /** 288 * Sets whether this object was deleted from the database. 289 * 290 * @param deleted true if this object was deleted, false otherwise. 291 */ 292 public void setDeleted(boolean deleted) 293 { 294 this.deleted = deleted; 295 } 296 297 298 /** 299 * Returns the associated TorqueTurbineUser object. 300 * If it was not retrieved before, the object is retrieved from 301 * the database 302 * 303 * @return the associated TorqueTurbineUser object 304 * @throws TorqueException when reading from the database fails. 305 */ 306 public TorqueTurbineUser getTorqueTurbineUser() 307 throws TorqueException 308 { 309 if (aTorqueTurbineUser == null && !Objects.equals(this.userId, null)) 310 { 311 aTorqueTurbineUser = org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.retrieveByPK(SimpleKey.keyFor(this.userId)); 312 } 313 return aTorqueTurbineUser; 314 } 315 316 /** 317 * Return the associated TorqueTurbineUser object 318 * If it was not retrieved before, the object is retrieved from 319 * the database using the passed connection 320 * 321 * @param connection the connection used to retrieve the associated object 322 * from the database, if it was not retrieved before 323 * @return the associated TorqueTurbineUser object 324 * @throws TorqueException If a problem occurs with the get[TorqueTurbineUser] method. 325 */ 326 public TorqueTurbineUser getTorqueTurbineUser(Connection connection) 327 throws TorqueException 328 { 329 if (aTorqueTurbineUser == null && !Objects.equals(this.userId, null)) 330 { 331 aTorqueTurbineUser = org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.retrieveByPK(SimpleKey.keyFor(this.userId), connection); 332 } 333 return aTorqueTurbineUser; 334 } 335 336 337 /** 338 * Declares an association between this object and a TorqueTurbineUser object 339 * 340 * @param v TorqueTurbineUser 341 */ 342 public void setTorqueTurbineUser(TorqueTurbineUser v) 343 { 344 if (v == null) 345 { 346 setUserId(null); 347 } 348 else 349 { 350 setUserId(v.getEntityId()); 351 } 352 aTorqueTurbineUser = v; 353 } 354 /** 355 * Provides convenient way to set a relationship based on a 356 * ObjectKey, for example 357 * <code>bar.setFooKey(foo.getPrimaryKey())</code> 358 * 359 * @param key the key to set 360 * @throws TorqueException if associated objects are not found 361 */ 362 public void setTorqueTurbineUserKey(ObjectKey<?> key) throws TorqueException 363 { 364 365 setUserId(Integer.valueOf(((NumberKey) key).intValue())); 366 } 367 368 /** 369 * Returns the associated TorqueTurbineGroup object. 370 * If it was not retrieved before, the object is retrieved from 371 * the database 372 * 373 * @return the associated TorqueTurbineGroup object 374 * @throws TorqueException when reading from the database fails. 375 */ 376 public TorqueTurbineGroup getTorqueTurbineGroup() 377 throws TorqueException 378 { 379 if (aTorqueTurbineGroup == null && !Objects.equals(this.groupId, null)) 380 { 381 aTorqueTurbineGroup = org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.retrieveByPK(SimpleKey.keyFor(this.groupId)); 382 } 383 return aTorqueTurbineGroup; 384 } 385 386 /** 387 * Return the associated TorqueTurbineGroup object 388 * If it was not retrieved before, the object is retrieved from 389 * the database using the passed connection 390 * 391 * @param connection the connection used to retrieve the associated object 392 * from the database, if it was not retrieved before 393 * @return the associated TorqueTurbineGroup object 394 * @throws TorqueException If a problem occurs with the get[TorqueTurbineGroup] method. 395 */ 396 public TorqueTurbineGroup getTorqueTurbineGroup(Connection connection) 397 throws TorqueException 398 { 399 if (aTorqueTurbineGroup == null && !Objects.equals(this.groupId, null)) 400 { 401 aTorqueTurbineGroup = org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.retrieveByPK(SimpleKey.keyFor(this.groupId), connection); 402 } 403 return aTorqueTurbineGroup; 404 } 405 406 407 /** 408 * Declares an association between this object and a TorqueTurbineGroup object 409 * 410 * @param v TorqueTurbineGroup 411 */ 412 public void setTorqueTurbineGroup(TorqueTurbineGroup v) 413 { 414 if (v == null) 415 { 416 setGroupId(null); 417 } 418 else 419 { 420 setGroupId(v.getEntityId()); 421 } 422 aTorqueTurbineGroup = v; 423 } 424 /** 425 * Provides convenient way to set a relationship based on a 426 * ObjectKey, for example 427 * <code>bar.setFooKey(foo.getPrimaryKey())</code> 428 * 429 * @param key the key to set 430 * @throws TorqueException if associated objects are not found 431 */ 432 public void setTorqueTurbineGroupKey(ObjectKey<?> key) throws TorqueException 433 { 434 435 setGroupId(Integer.valueOf(((NumberKey) key).intValue())); 436 } 437 438 /** 439 * Returns the associated TorqueTurbineRole object. 440 * If it was not retrieved before, the object is retrieved from 441 * the database 442 * 443 * @return the associated TorqueTurbineRole object 444 * @throws TorqueException when reading from the database fails. 445 */ 446 public TorqueTurbineRole getTorqueTurbineRole() 447 throws TorqueException 448 { 449 if (aTorqueTurbineRole == null && !Objects.equals(this.roleId, null)) 450 { 451 aTorqueTurbineRole = org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.retrieveByPK(SimpleKey.keyFor(this.roleId)); 452 } 453 return aTorqueTurbineRole; 454 } 455 456 /** 457 * Return the associated TorqueTurbineRole object 458 * If it was not retrieved before, the object is retrieved from 459 * the database using the passed connection 460 * 461 * @param connection the connection used to retrieve the associated object 462 * from the database, if it was not retrieved before 463 * @return the associated TorqueTurbineRole object 464 * @throws TorqueException If a problem occurs with the get[TorqueTurbineRole] method. 465 */ 466 public TorqueTurbineRole getTorqueTurbineRole(Connection connection) 467 throws TorqueException 468 { 469 if (aTorqueTurbineRole == null && !Objects.equals(this.roleId, null)) 470 { 471 aTorqueTurbineRole = org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.retrieveByPK(SimpleKey.keyFor(this.roleId), connection); 472 } 473 return aTorqueTurbineRole; 474 } 475 476 477 /** 478 * Declares an association between this object and a TorqueTurbineRole object 479 * 480 * @param v TorqueTurbineRole 481 */ 482 public void setTorqueTurbineRole(TorqueTurbineRole v) 483 { 484 if (v == null) 485 { 486 setRoleId(null); 487 } 488 else 489 { 490 setRoleId(v.getEntityId()); 491 } 492 aTorqueTurbineRole = v; 493 } 494 /** 495 * Provides convenient way to set a relationship based on a 496 * ObjectKey, for example 497 * <code>bar.setFooKey(foo.getPrimaryKey())</code> 498 * 499 * @param key the key to set 500 * @throws TorqueException if associated objects are not found 501 */ 502 public void setTorqueTurbineRoleKey(ObjectKey<?> key) throws TorqueException 503 { 504 505 setRoleId(Integer.valueOf(((NumberKey) key).intValue())); 506 } 507 508 509 510 511 512 513 514 /** 515 * Stores an object in the database. If the object is new, 516 * it is inserted; otherwise an update is performed. 517 * 518 * @throws TorqueException if an error occurs during saving. 519 */ 520 public void save() throws TorqueException 521 { 522 save(TorqueTurbineUserGroupRolePeer.DATABASE_NAME); 523 } 524 525 /** 526 * Stores an object in the database. If the object is new, 527 * it is inserted; otherwise an update is performed. 528 * 529 * @param dbName the name of the database to which the object 530 * should be saved. 531 * 532 * @throws TorqueException if an error occurs during saving. 533 */ 534 public void save(String dbName) 535 throws TorqueException 536 { 537 try (TorqueConnection con = Transaction.begin(dbName)) 538 { 539 save(con); 540 Transaction.commit(con); 541 } 542 } 543 544 /** 545 * Stores an object in the database. If the object is new, 546 * it is inserted; otherwise an update is performed. This method 547 * is meant to be used as part of a transaction, otherwise use 548 * the save() method and the connection details will be handled 549 * internally. 550 * 551 * @param con the connection to use for saving the object, not null. 552 * 553 * @throws TorqueException if an error occurs during saving. 554 */ 555 public void save(Connection con) 556 throws TorqueException 557 { 558 if (isSaving()) 559 { 560 return; 561 } 562 try 563 { 564 setSaving(true); 565 // If this object has been modified, then save it to the database. 566 if (isModified()) 567 { 568 if (isNew()) 569 { 570 TorqueTurbineUserGroupRolePeer.doInsert((TorqueTurbineUserGroupRole) this, con); 571 setNew(false); 572 } 573 else 574 { 575 TorqueTurbineUserGroupRolePeer.doUpdate((TorqueTurbineUserGroupRole) this, con); 576 } 577 } 578 579 } 580 finally 581 { 582 setSaving(false); 583 } 584 } 585 586 587 588 589 590 private final SimpleKey<?>[] pks = new SimpleKey[3]; 591 private final ComboKey comboPK = new ComboKey(pks); 592 593 /** 594 * Set the PrimaryKey with an ObjectKey 595 * 596 * @param key the primary key to set, not null. 597 */ 598 public void setPrimaryKey(ObjectKey<?> key) throws TorqueException 599 { 600 SimpleKey<?>[] keys = (SimpleKey[]) key.getValue(); 601 setUserId(((NumberKey) keys[0]).intValue()); 602 setGroupId(((NumberKey) keys[1]).intValue()); 603 setRoleId(((NumberKey) keys[2]).intValue()); 604 } 605 606 /** 607 * Set the PrimaryKey using SimpleKeys. 608 * 609 * @param userId a part of the primary key. 610 * @param groupId a part of the primary key. 611 * @param roleId a part of the primary key. 612 */ 613 public void setPrimaryKey(Integer userId, Integer groupId, Integer roleId) 614 615 { 616 setUserId(userId); 617 setGroupId(groupId); 618 setRoleId(roleId); 619 } 620 621 /** 622 * Set the PrimaryKey using a String. 623 * @param key the primary key to set. 624 */ 625 public void setPrimaryKey(String key) throws TorqueException 626 { 627 setPrimaryKey(new ComboKey(key)); 628 } 629 630 /** 631 * returns an id that differentiates this object from others 632 * of its class. 633 */ 634 public ObjectKey<?> getPrimaryKey() 635 { 636 SimpleKey<?>[] pks = new SimpleKey[3]; 637 pks[0] = SimpleKey.keyFor(getUserId()); 638 pks[1] = SimpleKey.keyFor(getGroupId()); 639 pks[2] = SimpleKey.keyFor(getRoleId()); 640 return new ComboKey(pks); 641 } 642 643 644 /** 645 * Returns an id that differentiates the referenced TorqueTurbineUser object 646 * from all other TorqueTurbineUser objects. 647 * 648 * @return an ObjectKey. 649 */ 650 public ObjectKey<?> getForeignKeyForTorqueTurbineUser() 651 { 652 return SimpleKey.keyFor(getUserId()); 653 } 654 /** 655 * Returns an id that differentiates the referenced TorqueTurbineGroup object 656 * from all other TorqueTurbineGroup objects. 657 * 658 * @return an ObjectKey. 659 */ 660 public ObjectKey<?> getForeignKeyForTorqueTurbineGroup() 661 { 662 return SimpleKey.keyFor(getGroupId()); 663 } 664 /** 665 * Returns an id that differentiates the referenced TorqueTurbineRole object 666 * from all other TorqueTurbineRole objects. 667 * 668 * @return an ObjectKey. 669 */ 670 public ObjectKey<?> getForeignKeyForTorqueTurbineRole() 671 { 672 return SimpleKey.keyFor(getRoleId()); 673 } 674 675 /** 676 * Makes a copy of this object. 677 * It creates a new object filling in the simple attributes. 678 * It then fills all the association collections and sets the 679 * related objects to isNew=true. 680 * @throws TorqueException if retrieval of the associated objects fails 681 */ 682 public TorqueTurbineUserGroupRole copy() throws TorqueException 683 { 684 return copy(true); 685 } 686 687 /** 688 * Makes a copy of this object using a connection. 689 * It creates a new object filling in the simple attributes. 690 * It then fills all the association collections and sets the 691 * related objects to isNew=true. 692 * 693 * @param con the database connection to read associated objects. 694 * @throws TorqueException if retrieval of the associated objects fails 695 */ 696 public TorqueTurbineUserGroupRole copy(Connection con) throws TorqueException 697 { 698 return copy(true, con); 699 } 700 701 /** 702 * Makes a copy of this object. 703 * It creates a new object filling in the simple attributes. 704 * If the parameter deepcopy is true, it then fills all the 705 * association collections and sets the related objects to 706 * isNew=true. 707 * 708 * @param deepcopy whether to copy the associated objects. 709 * @throws TorqueException if retrieval of the associated objects fails 710 */ 711 public TorqueTurbineUserGroupRole copy(boolean deepcopy) throws TorqueException 712 { 713 TorqueTurbineUserGroupRole torqueTurbineUserGroupRole = new TorqueTurbineUserGroupRole(); 714 715 return copyInto(torqueTurbineUserGroupRole, deepcopy); 716 } 717 718 /** 719 * Makes a copy of this object using connection. 720 * It creates a new object filling in the simple attributes. 721 * If the parameter deepcopy is true, it then fills all the 722 * association collections and sets the related objects to 723 * isNew=true. 724 * 725 * @param deepcopy whether to copy the associated objects. 726 * @param con the database connection to read associated objects. 727 * @throws TorqueException if retrieval of the associated objects fails 728 */ 729 public TorqueTurbineUserGroupRole copy(boolean deepcopy, Connection con) throws TorqueException 730 { 731 TorqueTurbineUserGroupRole torqueTurbineUserGroupRole = new TorqueTurbineUserGroupRole(); 732 733 return copyInto(torqueTurbineUserGroupRole, deepcopy, con); 734 } 735 736 /** 737 * Fills the copyObj with the contents of this object. 738 * The associated objects are also copied and treated as new objects. 739 * 740 * @param copyObj the object to fill. 741 * @throws TorqueException if retrieval of the associated objects fails 742 */ 743 public TorqueTurbineUserGroupRole copyInto(TorqueTurbineUserGroupRole copyObj) throws TorqueException 744 { 745 return copyInto(copyObj, true); 746 } 747 748 /** 749 * Fills the copyObj with the contents of this object using connection. 750 * The associated objects are also copied and treated as new objects. 751 * 752 * @param copyObj the object to fill. 753 * @param con the database connection to read associated objects. 754 * @throws TorqueException if retrieval of the associated objects fails 755 */ 756 public TorqueTurbineUserGroupRole copyInto(TorqueTurbineUserGroupRole copyObj, Connection con) throws TorqueException 757 { 758 return copyInto(copyObj, true, con); 759 } 760 761 /** 762 * Fills the copyObj with the contents of this object. 763 * If deepcopy is true, The associated objects are also copied 764 * and treated as new objects. 765 * 766 * @param copyObj the object to fill. 767 * @param deepcopy whether the associated objects should be copied. 768 * @throws TorqueException if retrieval of the associated objects fails 769 */ 770 protected TorqueTurbineUserGroupRole copyInto(TorqueTurbineUserGroupRole copyObj, boolean deepcopy) throws TorqueException 771 { 772 copyObj.setUserId((Integer) null); 773 copyObj.setGroupId((Integer) null); 774 copyObj.setRoleId((Integer) null); 775 776 if (deepcopy) 777 { 778 } 779 return copyObj; 780 } 781 782 783 /** 784 * Fills the copyObj with the contents of this object using connection. 785 * If deepcopy is true, The associated objects are also copied 786 * and treated as new objects. 787 * 788 * @param copyObj the object to fill. 789 * @param deepcopy whether the associated objects should be copied. 790 * @param con the database connection to read associated objects. 791 * @throws TorqueException if retrieval of the associated objects fails 792 */ 793 public TorqueTurbineUserGroupRole copyInto(TorqueTurbineUserGroupRole copyObj, boolean deepcopy, Connection con) throws TorqueException 794 { 795 copyObj.setUserId((Integer) null); 796 copyObj.setGroupId((Integer) null); 797 copyObj.setRoleId((Integer) null); 798 799 if (deepcopy) 800 { 801 } 802 return copyObj; 803 } 804 805 /** The Peer class */ 806 private static final org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer peer 807 = new org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer(); 808 809 /** 810 * returns a peer instance associated with this om. Since Peer classes 811 * are not to have any instance attributes, this method returns the 812 * same instance for all member of this class. The method could therefore 813 * be static, but this would prevent one from overriding the behavior. 814 */ 815 public org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer getPeer() 816 { 817 return peer; 818 } 819 820 /** 821 * Retrieves the TableMap object related to this Table data without 822 * compiler warnings of using getPeer().getTableMap(). 823 * 824 * @return The associated TableMap object. 825 * @throws TorqueException if associated objects are not found 826 */ 827 public TableMap getTableMap() throws TorqueException 828 { 829 return org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer.getTableMap(); 830 } 831 832 833 834 public String toString() 835 { 836 StringBuffer str = new StringBuffer(); 837 str.append("TorqueTurbineUserGroupRole:\n"); 838 str.append("userId = ") 839 .append(getUserId()) 840 .append("\n"); 841 str.append("groupId = ") 842 .append(getGroupId()) 843 .append("\n"); 844 str.append("roleId = ") 845 .append(getRoleId()) 846 .append("\n"); 847 return(str.toString()); 848 } 849 850 /** 851 * Compares the primary key of this instance with the key of another. 852 * 853 * @param toCompare The object to compare to. 854 * @return Whether the primary keys are equal and the object have the 855 * same class. 856 */ 857 public boolean equals(Object toCompare) 858 { 859 if (toCompare == null) 860 { 861 return false; 862 } 863 if (this == toCompare) 864 { 865 return true; 866 } 867 if (!getClass().equals(toCompare.getClass())) 868 { 869 return false; 870 } 871 TorqueTurbineUserGroupRole other = (TorqueTurbineUserGroupRole) toCompare; 872 if (getPrimaryKey() == null || other.getPrimaryKey() == null) 873 { 874 return false; 875 } 876 return getPrimaryKey().equals(other.getPrimaryKey()); 877 } 878 879 /** 880 * If the primary key is not <code>null</code>, return the hashcode of the 881 * primary key. Otherwise calls <code>Object.hashCode()</code>. 882 * 883 * @return an <code>int</code> value 884 */ 885 public int hashCode() 886 { 887 ObjectKey<?> ok = getPrimaryKey(); 888 if (ok == null) 889 { 890 return super.hashCode(); 891 } 892 893 return ok.hashCode(); 894 } 895 896 897 898 /** 899 * Compares the content of this object to another object 900 * 901 * @param toCompare The object to compare to. 902 * @return true if all of the columns in the other object have 903 * the same value as the objects in this class. 904 */ 905 public boolean valueEquals(TorqueTurbineUserGroupRole toCompare) 906 { 907 if (toCompare == null) 908 { 909 return false; 910 } 911 if (this == toCompare) 912 { 913 return true; 914 } 915 if (!Objects.equals(this.userId, toCompare.getUserId())) 916 { 917 return false; 918 } 919 if (!Objects.equals(this.groupId, toCompare.getGroupId())) 920 { 921 return false; 922 } 923 if (!Objects.equals(this.roleId, toCompare.getRoleId())) 924 { 925 return false; 926 } 927 return true; 928 } 929 930 931 932}