001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016// Generated File -- DO NOT EDIT BY HAND 017// -------------------------------------------------------------------------------- 018 019/** 020 * PartyContactMechanismPurposeDetailValue.java 021 */ 022 023package com.echothree.model.data.contact.server.value; 024 025import com.echothree.model.data.contact.common.pk.PartyContactMechanismPurposeDetailPK; 026 027import com.echothree.model.data.contact.server.factory.PartyContactMechanismPurposeDetailFactory; 028 029import com.echothree.model.data.contact.common.pk.PartyContactMechanismPurposePK; 030import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK; 031import com.echothree.model.data.contact.common.pk.ContactMechanismPurposePK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class PartyContactMechanismPurposeDetailValue 044 extends BaseValue<PartyContactMechanismPurposeDetailPK> 045 implements Cloneable, Serializable { 046 047 private PartyContactMechanismPurposePK partyContactMechanismPurposePK; 048 private boolean partyContactMechanismPurposePKHasBeenModified = false; 049 private PartyContactMechanismPK partyContactMechanismPK; 050 private boolean partyContactMechanismPKHasBeenModified = false; 051 private ContactMechanismPurposePK contactMechanismPurposePK; 052 private boolean contactMechanismPurposePKHasBeenModified = false; 053 private Boolean isDefault; 054 private boolean isDefaultHasBeenModified = false; 055 private Integer sortOrder; 056 private boolean sortOrderHasBeenModified = false; 057 private Long fromTime; 058 private boolean fromTimeHasBeenModified = false; 059 private Long thruTime; 060 private boolean thruTimeHasBeenModified = false; 061 062 private transient Integer _hashCode = null; 063 private transient String _stringValue = null; 064 065 private void constructFields(PartyContactMechanismPurposePK partyContactMechanismPurposePK, PartyContactMechanismPK partyContactMechanismPK, ContactMechanismPurposePK contactMechanismPurposePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 066 throws PersistenceNotNullException { 067 checkForNull(partyContactMechanismPurposePK); 068 this.partyContactMechanismPurposePK = partyContactMechanismPurposePK; 069 checkForNull(partyContactMechanismPK); 070 this.partyContactMechanismPK = partyContactMechanismPK; 071 checkForNull(contactMechanismPurposePK); 072 this.contactMechanismPurposePK = contactMechanismPurposePK; 073 checkForNull(isDefault); 074 this.isDefault = isDefault; 075 checkForNull(sortOrder); 076 this.sortOrder = sortOrder; 077 checkForNull(fromTime); 078 this.fromTime = fromTime; 079 checkForNull(thruTime); 080 this.thruTime = thruTime; 081 } 082 083 /** Creates a new instance of PartyContactMechanismPurposeDetailValue */ 084 public PartyContactMechanismPurposeDetailValue(PartyContactMechanismPurposeDetailPK partyContactMechanismPurposeDetailPK, PartyContactMechanismPurposePK partyContactMechanismPurposePK, PartyContactMechanismPK partyContactMechanismPK, ContactMechanismPurposePK contactMechanismPurposePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 085 throws PersistenceNotNullException { 086 super(partyContactMechanismPurposeDetailPK); 087 constructFields(partyContactMechanismPurposePK, partyContactMechanismPK, contactMechanismPurposePK, isDefault, sortOrder, fromTime, thruTime); 088 } 089 090 /** Creates a new instance of PartyContactMechanismPurposeDetailValue */ 091 public PartyContactMechanismPurposeDetailValue(PartyContactMechanismPurposePK partyContactMechanismPurposePK, PartyContactMechanismPK partyContactMechanismPK, ContactMechanismPurposePK contactMechanismPurposePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 092 throws PersistenceNotNullException { 093 super(); 094 constructFields(partyContactMechanismPurposePK, partyContactMechanismPK, contactMechanismPurposePK, isDefault, sortOrder, fromTime, thruTime); 095 } 096 097 @Override 098 @Nonnull 099 public PartyContactMechanismPurposeDetailFactory getBaseFactoryInstance() { 100 return PartyContactMechanismPurposeDetailFactory.getInstance(); 101 } 102 103 @Override 104 @Nonnull 105 public PartyContactMechanismPurposeDetailValue clone() { 106 Object result; 107 108 try { 109 result = super.clone(); 110 } catch (CloneNotSupportedException cnse) { 111 // This shouldn't happen, fail when it does. 112 throw new PersistenceCloneException(cnse); 113 } 114 115 return (PartyContactMechanismPurposeDetailValue)result; 116 } 117 118 @Override 119 @Nonnull 120 public PartyContactMechanismPurposeDetailPK getPrimaryKey() { 121 if(_primaryKey == null) { 122 _primaryKey = new PartyContactMechanismPurposeDetailPK(entityId); 123 } 124 125 return _primaryKey; 126 } 127 128 private void clearHashAndString() { 129 _hashCode = null; 130 _stringValue = null; 131 } 132 133 @Override 134 public int hashCode() { 135 if(_hashCode == null) { 136 int hashCode = 17; 137 138 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 139 140 hashCode = 37 * hashCode + ((partyContactMechanismPurposePK != null) ? partyContactMechanismPurposePK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((partyContactMechanismPK != null) ? partyContactMechanismPK.hashCode() : 0); 142 hashCode = 37 * hashCode + ((contactMechanismPurposePK != null) ? contactMechanismPurposePK.hashCode() : 0); 143 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 144 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 145 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 146 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 147 148 _hashCode = hashCode; 149 } 150 151 return _hashCode; 152 } 153 154 @Override 155 @Nonnull 156 public String toString() { 157 if(_stringValue == null) { 158 _stringValue = "{" + 159 "entityId=" + getEntityId() + 160 ", partyContactMechanismPurposePK=" + getPartyContactMechanismPurposePK() + 161 ", partyContactMechanismPK=" + getPartyContactMechanismPK() + 162 ", contactMechanismPurposePK=" + getContactMechanismPurposePK() + 163 ", isDefault=" + getIsDefault() + 164 ", sortOrder=" + getSortOrder() + 165 ", fromTime=" + getFromTime() + 166 ", thruTime=" + getThruTime() + 167 "}"; 168 } 169 return _stringValue; 170 } 171 172 @Override 173 public boolean equals(Object other) { 174 if(this == other) 175 return true; 176 177 if(!hasIdentity()) 178 return false; 179 180 if(other instanceof PartyContactMechanismPurposeDetailValue that) { 181 if(!that.hasIdentity()) 182 return false; 183 184 Long thisEntityId = getEntityId(); 185 Long thatEntityId = that.getEntityId(); 186 187 boolean objectsEqual = thisEntityId.equals(thatEntityId); 188 if(objectsEqual) 189 objectsEqual = isIdentical(that); 190 191 return objectsEqual; 192 } else { 193 return false; 194 } 195 } 196 197 public boolean isIdentical(Object other) { 198 if(other instanceof PartyContactMechanismPurposeDetailValue that) { 199 boolean objectsEqual = true; 200 201 202 if(objectsEqual) { 203 PartyContactMechanismPurposePK thisPartyContactMechanismPurposePK = getPartyContactMechanismPurposePK(); 204 PartyContactMechanismPurposePK thatPartyContactMechanismPurposePK = that.getPartyContactMechanismPurposePK(); 205 206 if(thisPartyContactMechanismPurposePK == null) { 207 objectsEqual = objectsEqual && (thatPartyContactMechanismPurposePK == null); 208 } else { 209 objectsEqual = objectsEqual && thisPartyContactMechanismPurposePK.equals(thatPartyContactMechanismPurposePK); 210 } 211 } 212 213 if(objectsEqual) { 214 PartyContactMechanismPK thisPartyContactMechanismPK = getPartyContactMechanismPK(); 215 PartyContactMechanismPK thatPartyContactMechanismPK = that.getPartyContactMechanismPK(); 216 217 if(thisPartyContactMechanismPK == null) { 218 objectsEqual = objectsEqual && (thatPartyContactMechanismPK == null); 219 } else { 220 objectsEqual = objectsEqual && thisPartyContactMechanismPK.equals(thatPartyContactMechanismPK); 221 } 222 } 223 224 if(objectsEqual) { 225 ContactMechanismPurposePK thisContactMechanismPurposePK = getContactMechanismPurposePK(); 226 ContactMechanismPurposePK thatContactMechanismPurposePK = that.getContactMechanismPurposePK(); 227 228 if(thisContactMechanismPurposePK == null) { 229 objectsEqual = objectsEqual && (thatContactMechanismPurposePK == null); 230 } else { 231 objectsEqual = objectsEqual && thisContactMechanismPurposePK.equals(thatContactMechanismPurposePK); 232 } 233 } 234 235 if(objectsEqual) { 236 Boolean thisIsDefault = getIsDefault(); 237 Boolean thatIsDefault = that.getIsDefault(); 238 239 if(thisIsDefault == null) { 240 objectsEqual = objectsEqual && (thatIsDefault == null); 241 } else { 242 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 243 } 244 } 245 246 if(objectsEqual) { 247 Integer thisSortOrder = getSortOrder(); 248 Integer thatSortOrder = that.getSortOrder(); 249 250 if(thisSortOrder == null) { 251 objectsEqual = objectsEqual && (thatSortOrder == null); 252 } else { 253 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 254 } 255 } 256 257 if(objectsEqual) { 258 Long thisFromTime = getFromTime(); 259 Long thatFromTime = that.getFromTime(); 260 261 if(thisFromTime == null) { 262 objectsEqual = objectsEqual && (thatFromTime == null); 263 } else { 264 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 265 } 266 } 267 268 if(objectsEqual) { 269 Long thisThruTime = getThruTime(); 270 Long thatThruTime = that.getThruTime(); 271 272 if(thisThruTime == null) { 273 objectsEqual = objectsEqual && (thatThruTime == null); 274 } else { 275 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 276 } 277 } 278 279 return objectsEqual; 280 } else { 281 return false; 282 } 283 } 284 285 @Override 286 public boolean hasBeenModified() { 287 return partyContactMechanismPurposePKHasBeenModified || partyContactMechanismPKHasBeenModified || contactMechanismPurposePKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 288 } 289 290 @Override 291 public void clearHasBeenModified() { 292 partyContactMechanismPurposePKHasBeenModified = false; 293 partyContactMechanismPKHasBeenModified = false; 294 contactMechanismPurposePKHasBeenModified = false; 295 isDefaultHasBeenModified = false; 296 sortOrderHasBeenModified = false; 297 fromTimeHasBeenModified = false; 298 thruTimeHasBeenModified = false; 299 } 300 301 @Nonnull 302 public PartyContactMechanismPurposePK getPartyContactMechanismPurposePK() { 303 return partyContactMechanismPurposePK; 304 } 305 306 public void setPartyContactMechanismPurposePK(@Nonnull PartyContactMechanismPurposePK partyContactMechanismPurposePK) 307 throws PersistenceNotNullException { 308 checkForNull(partyContactMechanismPurposePK); 309 310 boolean update = true; 311 312 if(this.partyContactMechanismPurposePK != null) { 313 if(this.partyContactMechanismPurposePK.equals(partyContactMechanismPurposePK)) { 314 update = false; 315 } 316 } else if(partyContactMechanismPurposePK == null) { 317 update = false; 318 } 319 320 if(update) { 321 this.partyContactMechanismPurposePK = partyContactMechanismPurposePK; 322 partyContactMechanismPurposePKHasBeenModified = true; 323 clearHashAndString(); 324 } 325 } 326 327 public boolean getPartyContactMechanismPurposePKHasBeenModified() { 328 return partyContactMechanismPurposePKHasBeenModified; 329 } 330 331 @Nonnull 332 public PartyContactMechanismPK getPartyContactMechanismPK() { 333 return partyContactMechanismPK; 334 } 335 336 public void setPartyContactMechanismPK(@Nonnull PartyContactMechanismPK partyContactMechanismPK) 337 throws PersistenceNotNullException { 338 checkForNull(partyContactMechanismPK); 339 340 boolean update = true; 341 342 if(this.partyContactMechanismPK != null) { 343 if(this.partyContactMechanismPK.equals(partyContactMechanismPK)) { 344 update = false; 345 } 346 } else if(partyContactMechanismPK == null) { 347 update = false; 348 } 349 350 if(update) { 351 this.partyContactMechanismPK = partyContactMechanismPK; 352 partyContactMechanismPKHasBeenModified = true; 353 clearHashAndString(); 354 } 355 } 356 357 public boolean getPartyContactMechanismPKHasBeenModified() { 358 return partyContactMechanismPKHasBeenModified; 359 } 360 361 @Nonnull 362 public ContactMechanismPurposePK getContactMechanismPurposePK() { 363 return contactMechanismPurposePK; 364 } 365 366 public void setContactMechanismPurposePK(@Nonnull ContactMechanismPurposePK contactMechanismPurposePK) 367 throws PersistenceNotNullException { 368 checkForNull(contactMechanismPurposePK); 369 370 boolean update = true; 371 372 if(this.contactMechanismPurposePK != null) { 373 if(this.contactMechanismPurposePK.equals(contactMechanismPurposePK)) { 374 update = false; 375 } 376 } else if(contactMechanismPurposePK == null) { 377 update = false; 378 } 379 380 if(update) { 381 this.contactMechanismPurposePK = contactMechanismPurposePK; 382 contactMechanismPurposePKHasBeenModified = true; 383 clearHashAndString(); 384 } 385 } 386 387 public boolean getContactMechanismPurposePKHasBeenModified() { 388 return contactMechanismPurposePKHasBeenModified; 389 } 390 391 @Nonnull 392 public Boolean getIsDefault() { 393 return isDefault; 394 } 395 396 public void setIsDefault(@Nonnull Boolean isDefault) 397 throws PersistenceNotNullException { 398 checkForNull(isDefault); 399 400 boolean update = true; 401 402 if(this.isDefault != null) { 403 if(this.isDefault.equals(isDefault)) { 404 update = false; 405 } 406 } else if(isDefault == null) { 407 update = false; 408 } 409 410 if(update) { 411 this.isDefault = isDefault; 412 isDefaultHasBeenModified = true; 413 clearHashAndString(); 414 } 415 } 416 417 public boolean getIsDefaultHasBeenModified() { 418 return isDefaultHasBeenModified; 419 } 420 421 @Nonnull 422 public Integer getSortOrder() { 423 return sortOrder; 424 } 425 426 public void setSortOrder(@Nonnull Integer sortOrder) 427 throws PersistenceNotNullException { 428 checkForNull(sortOrder); 429 430 boolean update = true; 431 432 if(this.sortOrder != null) { 433 if(this.sortOrder.equals(sortOrder)) { 434 update = false; 435 } 436 } else if(sortOrder == null) { 437 update = false; 438 } 439 440 if(update) { 441 this.sortOrder = sortOrder; 442 sortOrderHasBeenModified = true; 443 clearHashAndString(); 444 } 445 } 446 447 public boolean getSortOrderHasBeenModified() { 448 return sortOrderHasBeenModified; 449 } 450 451 @Nonnull 452 public Long getFromTime() { 453 return fromTime; 454 } 455 456 public void setFromTime(@Nonnull Long fromTime) 457 throws PersistenceNotNullException { 458 checkForNull(fromTime); 459 460 boolean update = true; 461 462 if(this.fromTime != null) { 463 if(this.fromTime.equals(fromTime)) { 464 update = false; 465 } 466 } else if(fromTime == null) { 467 update = false; 468 } 469 470 if(update) { 471 this.fromTime = fromTime; 472 fromTimeHasBeenModified = true; 473 clearHashAndString(); 474 } 475 } 476 477 public boolean getFromTimeHasBeenModified() { 478 return fromTimeHasBeenModified; 479 } 480 481 @Nonnull 482 public Long getThruTime() { 483 return thruTime; 484 } 485 486 public void setThruTime(@Nonnull Long thruTime) 487 throws PersistenceNotNullException { 488 checkForNull(thruTime); 489 490 boolean update = true; 491 492 if(this.thruTime != null) { 493 if(this.thruTime.equals(thruTime)) { 494 update = false; 495 } 496 } else if(thruTime == null) { 497 update = false; 498 } 499 500 if(update) { 501 this.thruTime = thruTime; 502 thruTimeHasBeenModified = true; 503 clearHashAndString(); 504 } 505 } 506 507 public boolean getThruTimeHasBeenModified() { 508 return thruTimeHasBeenModified; 509 } 510 511}