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 * PartyContactListDetailValue.java 021 */ 022 023package com.echothree.model.data.contactlist.server.value; 024 025import com.echothree.model.data.contactlist.common.pk.PartyContactListDetailPK; 026 027import com.echothree.model.data.contactlist.server.factory.PartyContactListDetailFactory; 028 029import com.echothree.model.data.contactlist.common.pk.PartyContactListPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.contactlist.common.pk.ContactListPK; 032import com.echothree.model.data.contactlist.common.pk.ContactListContactMechanismPurposePK; 033 034import com.echothree.util.common.exception.PersistenceCloneException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036 037import com.echothree.util.server.persistence.BaseValue; 038 039import java.io.Serializable; 040 041public class PartyContactListDetailValue 042 extends BaseValue<PartyContactListDetailPK> 043 implements Cloneable, Serializable { 044 045 private PartyContactListPK partyContactListPK; 046 private boolean partyContactListPKHasBeenModified = false; 047 private PartyPK partyPK; 048 private boolean partyPKHasBeenModified = false; 049 private ContactListPK contactListPK; 050 private boolean contactListPKHasBeenModified = false; 051 private ContactListContactMechanismPurposePK preferredContactListContactMechanismPurposePK; 052 private boolean preferredContactListContactMechanismPurposePKHasBeenModified = false; 053 private Long fromTime; 054 private boolean fromTimeHasBeenModified = false; 055 private Long thruTime; 056 private boolean thruTimeHasBeenModified = false; 057 058 private transient Integer _hashCode = null; 059 private transient String _stringValue = null; 060 061 private void constructFields(PartyContactListPK partyContactListPK, PartyPK partyPK, ContactListPK contactListPK, ContactListContactMechanismPurposePK preferredContactListContactMechanismPurposePK, Long fromTime, Long thruTime) 062 throws PersistenceNotNullException { 063 checkForNull(partyContactListPK); 064 this.partyContactListPK = partyContactListPK; 065 checkForNull(partyPK); 066 this.partyPK = partyPK; 067 checkForNull(contactListPK); 068 this.contactListPK = contactListPK; 069 this.preferredContactListContactMechanismPurposePK = preferredContactListContactMechanismPurposePK; 070 checkForNull(fromTime); 071 this.fromTime = fromTime; 072 checkForNull(thruTime); 073 this.thruTime = thruTime; 074 } 075 076 /** Creates a new instance of PartyContactListDetailValue */ 077 public PartyContactListDetailValue(PartyContactListDetailPK partyContactListDetailPK, PartyContactListPK partyContactListPK, PartyPK partyPK, ContactListPK contactListPK, ContactListContactMechanismPurposePK preferredContactListContactMechanismPurposePK, Long fromTime, Long thruTime) 078 throws PersistenceNotNullException { 079 super(partyContactListDetailPK); 080 constructFields(partyContactListPK, partyPK, contactListPK, preferredContactListContactMechanismPurposePK, fromTime, thruTime); 081 } 082 083 /** Creates a new instance of PartyContactListDetailValue */ 084 public PartyContactListDetailValue(PartyContactListPK partyContactListPK, PartyPK partyPK, ContactListPK contactListPK, ContactListContactMechanismPurposePK preferredContactListContactMechanismPurposePK, Long fromTime, Long thruTime) 085 throws PersistenceNotNullException { 086 super(); 087 constructFields(partyContactListPK, partyPK, contactListPK, preferredContactListContactMechanismPurposePK, fromTime, thruTime); 088 } 089 090 @Override 091 public PartyContactListDetailFactory getBaseFactoryInstance() { 092 return PartyContactListDetailFactory.getInstance(); 093 } 094 095 @Override 096 public PartyContactListDetailValue 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 (PartyContactListDetailValue)result; 107 } 108 109 @Override 110 public PartyContactListDetailPK getPrimaryKey() { 111 if(_primaryKey == null) { 112 _primaryKey = new PartyContactListDetailPK(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 + ((partyContactListPK != null) ? partyContactListPK.hashCode() : 0); 131 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((contactListPK != null) ? contactListPK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((preferredContactListContactMechanismPurposePK != null) ? preferredContactListContactMechanismPurposePK.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 ", partyContactListPK=" + getPartyContactListPK() + 149 ", partyPK=" + getPartyPK() + 150 ", contactListPK=" + getContactListPK() + 151 ", preferredContactListContactMechanismPurposePK=" + getPreferredContactListContactMechanismPurposePK() + 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 PartyContactListDetailValue 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 PartyContactListDetailValue that) { 186 boolean objectsEqual = true; 187 188 189 if(objectsEqual) { 190 PartyContactListPK thisPartyContactListPK = getPartyContactListPK(); 191 PartyContactListPK thatPartyContactListPK = that.getPartyContactListPK(); 192 193 if(thisPartyContactListPK == null) { 194 objectsEqual = objectsEqual && (thatPartyContactListPK == null); 195 } else { 196 objectsEqual = objectsEqual && thisPartyContactListPK.equals(thatPartyContactListPK); 197 } 198 } 199 200 if(objectsEqual) { 201 PartyPK thisPartyPK = getPartyPK(); 202 PartyPK thatPartyPK = that.getPartyPK(); 203 204 if(thisPartyPK == null) { 205 objectsEqual = objectsEqual && (thatPartyPK == null); 206 } else { 207 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 208 } 209 } 210 211 if(objectsEqual) { 212 ContactListPK thisContactListPK = getContactListPK(); 213 ContactListPK thatContactListPK = that.getContactListPK(); 214 215 if(thisContactListPK == null) { 216 objectsEqual = objectsEqual && (thatContactListPK == null); 217 } else { 218 objectsEqual = objectsEqual && thisContactListPK.equals(thatContactListPK); 219 } 220 } 221 222 if(objectsEqual) { 223 ContactListContactMechanismPurposePK thisPreferredContactListContactMechanismPurposePK = getPreferredContactListContactMechanismPurposePK(); 224 ContactListContactMechanismPurposePK thatPreferredContactListContactMechanismPurposePK = that.getPreferredContactListContactMechanismPurposePK(); 225 226 if(thisPreferredContactListContactMechanismPurposePK == null) { 227 objectsEqual = objectsEqual && (thatPreferredContactListContactMechanismPurposePK == null); 228 } else { 229 objectsEqual = objectsEqual && thisPreferredContactListContactMechanismPurposePK.equals(thatPreferredContactListContactMechanismPurposePK); 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 partyContactListPKHasBeenModified || partyPKHasBeenModified || contactListPKHasBeenModified || preferredContactListContactMechanismPurposePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 264 } 265 266 @Override 267 public void clearHasBeenModified() { 268 partyContactListPKHasBeenModified = false; 269 partyPKHasBeenModified = false; 270 contactListPKHasBeenModified = false; 271 preferredContactListContactMechanismPurposePKHasBeenModified = false; 272 fromTimeHasBeenModified = false; 273 thruTimeHasBeenModified = false; 274 } 275 276 public PartyContactListPK getPartyContactListPK() { 277 return partyContactListPK; 278 } 279 280 public void setPartyContactListPK(PartyContactListPK partyContactListPK) 281 throws PersistenceNotNullException { 282 checkForNull(partyContactListPK); 283 284 boolean update = true; 285 286 if(this.partyContactListPK != null) { 287 if(this.partyContactListPK.equals(partyContactListPK)) { 288 update = false; 289 } 290 } else if(partyContactListPK == null) { 291 update = false; 292 } 293 294 if(update) { 295 this.partyContactListPK = partyContactListPK; 296 partyContactListPKHasBeenModified = true; 297 clearHashAndString(); 298 } 299 } 300 301 public boolean getPartyContactListPKHasBeenModified() { 302 return partyContactListPKHasBeenModified; 303 } 304 305 public PartyPK getPartyPK() { 306 return partyPK; 307 } 308 309 public void setPartyPK(PartyPK partyPK) 310 throws PersistenceNotNullException { 311 checkForNull(partyPK); 312 313 boolean update = true; 314 315 if(this.partyPK != null) { 316 if(this.partyPK.equals(partyPK)) { 317 update = false; 318 } 319 } else if(partyPK == null) { 320 update = false; 321 } 322 323 if(update) { 324 this.partyPK = partyPK; 325 partyPKHasBeenModified = true; 326 clearHashAndString(); 327 } 328 } 329 330 public boolean getPartyPKHasBeenModified() { 331 return partyPKHasBeenModified; 332 } 333 334 public ContactListPK getContactListPK() { 335 return contactListPK; 336 } 337 338 public void setContactListPK(ContactListPK contactListPK) 339 throws PersistenceNotNullException { 340 checkForNull(contactListPK); 341 342 boolean update = true; 343 344 if(this.contactListPK != null) { 345 if(this.contactListPK.equals(contactListPK)) { 346 update = false; 347 } 348 } else if(contactListPK == null) { 349 update = false; 350 } 351 352 if(update) { 353 this.contactListPK = contactListPK; 354 contactListPKHasBeenModified = true; 355 clearHashAndString(); 356 } 357 } 358 359 public boolean getContactListPKHasBeenModified() { 360 return contactListPKHasBeenModified; 361 } 362 363 public ContactListContactMechanismPurposePK getPreferredContactListContactMechanismPurposePK() { 364 return preferredContactListContactMechanismPurposePK; 365 } 366 367 public void setPreferredContactListContactMechanismPurposePK(ContactListContactMechanismPurposePK preferredContactListContactMechanismPurposePK) { 368 boolean update = true; 369 370 if(this.preferredContactListContactMechanismPurposePK != null) { 371 if(this.preferredContactListContactMechanismPurposePK.equals(preferredContactListContactMechanismPurposePK)) { 372 update = false; 373 } 374 } else if(preferredContactListContactMechanismPurposePK == null) { 375 update = false; 376 } 377 378 if(update) { 379 this.preferredContactListContactMechanismPurposePK = preferredContactListContactMechanismPurposePK; 380 preferredContactListContactMechanismPurposePKHasBeenModified = true; 381 clearHashAndString(); 382 } 383 } 384 385 public boolean getPreferredContactListContactMechanismPurposePKHasBeenModified() { 386 return preferredContactListContactMechanismPurposePKHasBeenModified; 387 } 388 389 public Long getFromTime() { 390 return fromTime; 391 } 392 393 public void setFromTime(Long fromTime) 394 throws PersistenceNotNullException { 395 checkForNull(fromTime); 396 397 boolean update = true; 398 399 if(this.fromTime != null) { 400 if(this.fromTime.equals(fromTime)) { 401 update = false; 402 } 403 } else if(fromTime == null) { 404 update = false; 405 } 406 407 if(update) { 408 this.fromTime = fromTime; 409 fromTimeHasBeenModified = true; 410 clearHashAndString(); 411 } 412 } 413 414 public boolean getFromTimeHasBeenModified() { 415 return fromTimeHasBeenModified; 416 } 417 418 public Long getThruTime() { 419 return thruTime; 420 } 421 422 public void setThruTime(Long thruTime) 423 throws PersistenceNotNullException { 424 checkForNull(thruTime); 425 426 boolean update = true; 427 428 if(this.thruTime != null) { 429 if(this.thruTime.equals(thruTime)) { 430 update = false; 431 } 432 } else if(thruTime == null) { 433 update = false; 434 } 435 436 if(update) { 437 this.thruTime = thruTime; 438 thruTimeHasBeenModified = true; 439 clearHashAndString(); 440 } 441 } 442 443 public boolean getThruTimeHasBeenModified() { 444 return thruTimeHasBeenModified; 445 } 446 447}