001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 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 * LetterContactMechanismPurposeDetailValue.java 021 */ 022 023package com.echothree.model.data.letter.server.value; 024 025import com.echothree.model.data.letter.common.pk.LetterContactMechanismPurposeDetailPK; 026 027import com.echothree.model.data.letter.server.factory.LetterContactMechanismPurposeDetailFactory; 028 029import com.echothree.model.data.letter.common.pk.LetterContactMechanismPurposePK; 030import com.echothree.model.data.letter.common.pk.LetterPK; 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 040public class LetterContactMechanismPurposeDetailValue 041 extends BaseValue<LetterContactMechanismPurposeDetailPK> 042 implements Cloneable, Serializable { 043 044 private LetterContactMechanismPurposePK letterContactMechanismPurposePK; 045 private boolean letterContactMechanismPurposePKHasBeenModified = false; 046 private LetterPK letterPK; 047 private boolean letterPKHasBeenModified = false; 048 private Integer priority; 049 private boolean priorityHasBeenModified = false; 050 private ContactMechanismPurposePK contactMechanismPurposePK; 051 private boolean contactMechanismPurposePKHasBeenModified = false; 052 private Long fromTime; 053 private boolean fromTimeHasBeenModified = false; 054 private Long thruTime; 055 private boolean thruTimeHasBeenModified = false; 056 057 private transient Integer _hashCode = null; 058 private transient String _stringValue = null; 059 060 private void constructFields(LetterContactMechanismPurposePK letterContactMechanismPurposePK, LetterPK letterPK, Integer priority, ContactMechanismPurposePK contactMechanismPurposePK, Long fromTime, Long thruTime) 061 throws PersistenceNotNullException { 062 checkForNull(letterContactMechanismPurposePK); 063 this.letterContactMechanismPurposePK = letterContactMechanismPurposePK; 064 checkForNull(letterPK); 065 this.letterPK = letterPK; 066 checkForNull(priority); 067 this.priority = priority; 068 checkForNull(contactMechanismPurposePK); 069 this.contactMechanismPurposePK = contactMechanismPurposePK; 070 checkForNull(fromTime); 071 this.fromTime = fromTime; 072 checkForNull(thruTime); 073 this.thruTime = thruTime; 074 } 075 076 /** Creates a new instance of LetterContactMechanismPurposeDetailValue */ 077 public LetterContactMechanismPurposeDetailValue(LetterContactMechanismPurposeDetailPK letterContactMechanismPurposeDetailPK, LetterContactMechanismPurposePK letterContactMechanismPurposePK, LetterPK letterPK, Integer priority, ContactMechanismPurposePK contactMechanismPurposePK, Long fromTime, Long thruTime) 078 throws PersistenceNotNullException { 079 super(letterContactMechanismPurposeDetailPK); 080 constructFields(letterContactMechanismPurposePK, letterPK, priority, contactMechanismPurposePK, fromTime, thruTime); 081 } 082 083 /** Creates a new instance of LetterContactMechanismPurposeDetailValue */ 084 public LetterContactMechanismPurposeDetailValue(LetterContactMechanismPurposePK letterContactMechanismPurposePK, LetterPK letterPK, Integer priority, ContactMechanismPurposePK contactMechanismPurposePK, Long fromTime, Long thruTime) 085 throws PersistenceNotNullException { 086 super(); 087 constructFields(letterContactMechanismPurposePK, letterPK, priority, contactMechanismPurposePK, fromTime, thruTime); 088 } 089 090 @Override 091 public LetterContactMechanismPurposeDetailFactory getBaseFactoryInstance() { 092 return LetterContactMechanismPurposeDetailFactory.getInstance(); 093 } 094 095 @Override 096 public LetterContactMechanismPurposeDetailValue clone() { 097 Object result; 098 099 try { 100 result = super.clone(); 101 } catch (CloneNotSupportedException cnse) { 102 // This shouldn't happen, fail when it does. 103 throw new PersistenceCloneException(cnse); 104 } 105 106 return (LetterContactMechanismPurposeDetailValue)result; 107 } 108 109 @Override 110 public LetterContactMechanismPurposeDetailPK getPrimaryKey() { 111 if(_primaryKey == null) { 112 _primaryKey = new LetterContactMechanismPurposeDetailPK(entityId); 113 } 114 115 return _primaryKey; 116 } 117 118 private void clearHashAndString() { 119 _hashCode = null; 120 _stringValue = null; 121 } 122 123 @Override 124 public int hashCode() { 125 if(_hashCode == null) { 126 int hashCode = 17; 127 128 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 129 130 hashCode = 37 * hashCode + ((letterContactMechanismPurposePK != null) ? letterContactMechanismPurposePK.hashCode() : 0); 131 hashCode = 37 * hashCode + ((letterPK != null) ? letterPK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((priority != null) ? priority.hashCode() : 0); 133 hashCode = 37 * hashCode + ((contactMechanismPurposePK != null) ? contactMechanismPurposePK.hashCode() : 0); 134 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 135 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 136 137 _hashCode = hashCode; 138 } 139 140 return _hashCode; 141 } 142 143 @Override 144 public String toString() { 145 if(_stringValue == null) { 146 _stringValue = "{" + 147 "entityId=" + getEntityId() + 148 ", letterContactMechanismPurposePK=" + getLetterContactMechanismPurposePK() + 149 ", letterPK=" + getLetterPK() + 150 ", priority=" + getPriority() + 151 ", contactMechanismPurposePK=" + getContactMechanismPurposePK() + 152 ", fromTime=" + getFromTime() + 153 ", thruTime=" + getThruTime() + 154 "}"; 155 } 156 return _stringValue; 157 } 158 159 @Override 160 public boolean equals(Object other) { 161 if(this == other) 162 return true; 163 164 if(!hasIdentity()) 165 return false; 166 167 if(other instanceof LetterContactMechanismPurposeDetailValue that) { 168 if(!that.hasIdentity()) 169 return false; 170 171 Long thisEntityId = getEntityId(); 172 Long thatEntityId = that.getEntityId(); 173 174 boolean objectsEqual = thisEntityId.equals(thatEntityId); 175 if(objectsEqual) 176 objectsEqual = isIdentical(that); 177 178 return objectsEqual; 179 } else { 180 return false; 181 } 182 } 183 184 public boolean isIdentical(Object other) { 185 if(other instanceof LetterContactMechanismPurposeDetailValue that) { 186 boolean objectsEqual = true; 187 188 189 if(objectsEqual) { 190 LetterContactMechanismPurposePK thisLetterContactMechanismPurposePK = getLetterContactMechanismPurposePK(); 191 LetterContactMechanismPurposePK thatLetterContactMechanismPurposePK = that.getLetterContactMechanismPurposePK(); 192 193 if(thisLetterContactMechanismPurposePK == null) { 194 objectsEqual = objectsEqual && (thatLetterContactMechanismPurposePK == null); 195 } else { 196 objectsEqual = objectsEqual && thisLetterContactMechanismPurposePK.equals(thatLetterContactMechanismPurposePK); 197 } 198 } 199 200 if(objectsEqual) { 201 LetterPK thisLetterPK = getLetterPK(); 202 LetterPK thatLetterPK = that.getLetterPK(); 203 204 if(thisLetterPK == null) { 205 objectsEqual = objectsEqual && (thatLetterPK == null); 206 } else { 207 objectsEqual = objectsEqual && thisLetterPK.equals(thatLetterPK); 208 } 209 } 210 211 if(objectsEqual) { 212 Integer thisPriority = getPriority(); 213 Integer thatPriority = that.getPriority(); 214 215 if(thisPriority == null) { 216 objectsEqual = objectsEqual && (thatPriority == null); 217 } else { 218 objectsEqual = objectsEqual && thisPriority.equals(thatPriority); 219 } 220 } 221 222 if(objectsEqual) { 223 ContactMechanismPurposePK thisContactMechanismPurposePK = getContactMechanismPurposePK(); 224 ContactMechanismPurposePK thatContactMechanismPurposePK = that.getContactMechanismPurposePK(); 225 226 if(thisContactMechanismPurposePK == null) { 227 objectsEqual = objectsEqual && (thatContactMechanismPurposePK == null); 228 } else { 229 objectsEqual = objectsEqual && thisContactMechanismPurposePK.equals(thatContactMechanismPurposePK); 230 } 231 } 232 233 if(objectsEqual) { 234 Long thisFromTime = getFromTime(); 235 Long thatFromTime = that.getFromTime(); 236 237 if(thisFromTime == null) { 238 objectsEqual = objectsEqual && (thatFromTime == null); 239 } else { 240 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 241 } 242 } 243 244 if(objectsEqual) { 245 Long thisThruTime = getThruTime(); 246 Long thatThruTime = that.getThruTime(); 247 248 if(thisThruTime == null) { 249 objectsEqual = objectsEqual && (thatThruTime == null); 250 } else { 251 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 252 } 253 } 254 255 return objectsEqual; 256 } else { 257 return false; 258 } 259 } 260 261 @Override 262 public boolean hasBeenModified() { 263 return letterContactMechanismPurposePKHasBeenModified || letterPKHasBeenModified || priorityHasBeenModified || contactMechanismPurposePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 264 } 265 266 @Override 267 public void clearHasBeenModified() { 268 letterContactMechanismPurposePKHasBeenModified = false; 269 letterPKHasBeenModified = false; 270 priorityHasBeenModified = false; 271 contactMechanismPurposePKHasBeenModified = false; 272 fromTimeHasBeenModified = false; 273 thruTimeHasBeenModified = false; 274 } 275 276 public LetterContactMechanismPurposePK getLetterContactMechanismPurposePK() { 277 return letterContactMechanismPurposePK; 278 } 279 280 public void setLetterContactMechanismPurposePK(LetterContactMechanismPurposePK letterContactMechanismPurposePK) 281 throws PersistenceNotNullException { 282 checkForNull(letterContactMechanismPurposePK); 283 284 boolean update = true; 285 286 if(this.letterContactMechanismPurposePK != null) { 287 if(this.letterContactMechanismPurposePK.equals(letterContactMechanismPurposePK)) { 288 update = false; 289 } 290 } else if(letterContactMechanismPurposePK == null) { 291 update = false; 292 } 293 294 if(update) { 295 this.letterContactMechanismPurposePK = letterContactMechanismPurposePK; 296 letterContactMechanismPurposePKHasBeenModified = true; 297 clearHashAndString(); 298 } 299 } 300 301 public boolean getLetterContactMechanismPurposePKHasBeenModified() { 302 return letterContactMechanismPurposePKHasBeenModified; 303 } 304 305 public LetterPK getLetterPK() { 306 return letterPK; 307 } 308 309 public void setLetterPK(LetterPK letterPK) 310 throws PersistenceNotNullException { 311 checkForNull(letterPK); 312 313 boolean update = true; 314 315 if(this.letterPK != null) { 316 if(this.letterPK.equals(letterPK)) { 317 update = false; 318 } 319 } else if(letterPK == null) { 320 update = false; 321 } 322 323 if(update) { 324 this.letterPK = letterPK; 325 letterPKHasBeenModified = true; 326 clearHashAndString(); 327 } 328 } 329 330 public boolean getLetterPKHasBeenModified() { 331 return letterPKHasBeenModified; 332 } 333 334 public Integer getPriority() { 335 return priority; 336 } 337 338 public void setPriority(Integer priority) 339 throws PersistenceNotNullException { 340 checkForNull(priority); 341 342 boolean update = true; 343 344 if(this.priority != null) { 345 if(this.priority.equals(priority)) { 346 update = false; 347 } 348 } else if(priority == null) { 349 update = false; 350 } 351 352 if(update) { 353 this.priority = priority; 354 priorityHasBeenModified = true; 355 clearHashAndString(); 356 } 357 } 358 359 public boolean getPriorityHasBeenModified() { 360 return priorityHasBeenModified; 361 } 362 363 public ContactMechanismPurposePK getContactMechanismPurposePK() { 364 return contactMechanismPurposePK; 365 } 366 367 public void setContactMechanismPurposePK(ContactMechanismPurposePK contactMechanismPurposePK) 368 throws PersistenceNotNullException { 369 checkForNull(contactMechanismPurposePK); 370 371 boolean update = true; 372 373 if(this.contactMechanismPurposePK != null) { 374 if(this.contactMechanismPurposePK.equals(contactMechanismPurposePK)) { 375 update = false; 376 } 377 } else if(contactMechanismPurposePK == null) { 378 update = false; 379 } 380 381 if(update) { 382 this.contactMechanismPurposePK = contactMechanismPurposePK; 383 contactMechanismPurposePKHasBeenModified = true; 384 clearHashAndString(); 385 } 386 } 387 388 public boolean getContactMechanismPurposePKHasBeenModified() { 389 return contactMechanismPurposePKHasBeenModified; 390 } 391 392 public Long getFromTime() { 393 return fromTime; 394 } 395 396 public void setFromTime(Long fromTime) 397 throws PersistenceNotNullException { 398 checkForNull(fromTime); 399 400 boolean update = true; 401 402 if(this.fromTime != null) { 403 if(this.fromTime.equals(fromTime)) { 404 update = false; 405 } 406 } else if(fromTime == null) { 407 update = false; 408 } 409 410 if(update) { 411 this.fromTime = fromTime; 412 fromTimeHasBeenModified = true; 413 clearHashAndString(); 414 } 415 } 416 417 public boolean getFromTimeHasBeenModified() { 418 return fromTimeHasBeenModified; 419 } 420 421 public Long getThruTime() { 422 return thruTime; 423 } 424 425 public void setThruTime(Long thruTime) 426 throws PersistenceNotNullException { 427 checkForNull(thruTime); 428 429 boolean update = true; 430 431 if(this.thruTime != null) { 432 if(this.thruTime.equals(thruTime)) { 433 update = false; 434 } 435 } else if(thruTime == null) { 436 update = false; 437 } 438 439 if(update) { 440 this.thruTime = thruTime; 441 thruTimeHasBeenModified = true; 442 clearHashAndString(); 443 } 444 } 445 446 public boolean getThruTimeHasBeenModified() { 447 return thruTimeHasBeenModified; 448 } 449 450}