001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 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 * ContactListContactMechanismPurposeDetailValue.java 021 */ 022 023package com.echothree.model.data.contactlist.server.value; 024 025import com.echothree.model.data.contactlist.common.pk.ContactListContactMechanismPurposeDetailPK; 026 027import com.echothree.model.data.contactlist.server.factory.ContactListContactMechanismPurposeDetailFactory; 028 029import com.echothree.model.data.contactlist.common.pk.ContactListContactMechanismPurposePK; 030import com.echothree.model.data.contactlist.common.pk.ContactListPK; 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 ContactListContactMechanismPurposeDetailValue 041 extends BaseValue<ContactListContactMechanismPurposeDetailPK> 042 implements Cloneable, Serializable { 043 044 private ContactListContactMechanismPurposePK contactListContactMechanismPurposePK; 045 private boolean contactListContactMechanismPurposePKHasBeenModified = false; 046 private ContactListPK contactListPK; 047 private boolean contactListPKHasBeenModified = false; 048 private ContactMechanismPurposePK contactMechanismPurposePK; 049 private boolean contactMechanismPurposePKHasBeenModified = false; 050 private Boolean isDefault; 051 private boolean isDefaultHasBeenModified = false; 052 private Integer sortOrder; 053 private boolean sortOrderHasBeenModified = false; 054 private Long fromTime; 055 private boolean fromTimeHasBeenModified = false; 056 private Long thruTime; 057 private boolean thruTimeHasBeenModified = false; 058 059 private transient Integer _hashCode = null; 060 private transient String _stringValue = null; 061 062 private void constructFields(ContactListContactMechanismPurposePK contactListContactMechanismPurposePK, ContactListPK contactListPK, ContactMechanismPurposePK contactMechanismPurposePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 063 throws PersistenceNotNullException { 064 checkForNull(contactListContactMechanismPurposePK); 065 this.contactListContactMechanismPurposePK = contactListContactMechanismPurposePK; 066 checkForNull(contactListPK); 067 this.contactListPK = contactListPK; 068 checkForNull(contactMechanismPurposePK); 069 this.contactMechanismPurposePK = contactMechanismPurposePK; 070 checkForNull(isDefault); 071 this.isDefault = isDefault; 072 checkForNull(sortOrder); 073 this.sortOrder = sortOrder; 074 checkForNull(fromTime); 075 this.fromTime = fromTime; 076 checkForNull(thruTime); 077 this.thruTime = thruTime; 078 } 079 080 /** Creates a new instance of ContactListContactMechanismPurposeDetailValue */ 081 public ContactListContactMechanismPurposeDetailValue(ContactListContactMechanismPurposeDetailPK contactListContactMechanismPurposeDetailPK, ContactListContactMechanismPurposePK contactListContactMechanismPurposePK, ContactListPK contactListPK, ContactMechanismPurposePK contactMechanismPurposePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 082 throws PersistenceNotNullException { 083 super(contactListContactMechanismPurposeDetailPK); 084 constructFields(contactListContactMechanismPurposePK, contactListPK, contactMechanismPurposePK, isDefault, sortOrder, fromTime, thruTime); 085 } 086 087 /** Creates a new instance of ContactListContactMechanismPurposeDetailValue */ 088 public ContactListContactMechanismPurposeDetailValue(ContactListContactMechanismPurposePK contactListContactMechanismPurposePK, ContactListPK contactListPK, ContactMechanismPurposePK contactMechanismPurposePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 089 throws PersistenceNotNullException { 090 super(); 091 constructFields(contactListContactMechanismPurposePK, contactListPK, contactMechanismPurposePK, isDefault, sortOrder, fromTime, thruTime); 092 } 093 094 @Override 095 public ContactListContactMechanismPurposeDetailFactory getBaseFactoryInstance() { 096 return ContactListContactMechanismPurposeDetailFactory.getInstance(); 097 } 098 099 @Override 100 public ContactListContactMechanismPurposeDetailValue clone() { 101 Object result; 102 103 try { 104 result = super.clone(); 105 } catch (CloneNotSupportedException cnse) { 106 // This shouldn't happen, fail when it does. 107 throw new PersistenceCloneException(cnse); 108 } 109 110 return (ContactListContactMechanismPurposeDetailValue)result; 111 } 112 113 @Override 114 public ContactListContactMechanismPurposeDetailPK getPrimaryKey() { 115 if(_primaryKey == null) { 116 _primaryKey = new ContactListContactMechanismPurposeDetailPK(entityId); 117 } 118 119 return _primaryKey; 120 } 121 122 private void clearHashAndString() { 123 _hashCode = null; 124 _stringValue = null; 125 } 126 127 @Override 128 public int hashCode() { 129 if(_hashCode == null) { 130 int hashCode = 17; 131 132 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 133 134 hashCode = 37 * hashCode + ((contactListContactMechanismPurposePK != null) ? contactListContactMechanismPurposePK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((contactListPK != null) ? contactListPK.hashCode() : 0); 136 hashCode = 37 * hashCode + ((contactMechanismPurposePK != null) ? contactMechanismPurposePK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 138 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 139 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 140 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 141 142 _hashCode = hashCode; 143 } 144 145 return _hashCode; 146 } 147 148 @Override 149 public String toString() { 150 if(_stringValue == null) { 151 StringBuilder stringValue = new StringBuilder("{"); 152 153 stringValue.append("entityId=").append(getEntityId()); 154 155 stringValue.append(", contactListContactMechanismPurposePK=").append(getContactListContactMechanismPurposePK()); 156 stringValue.append(", contactListPK=").append(getContactListPK()); 157 stringValue.append(", contactMechanismPurposePK=").append(getContactMechanismPurposePK()); 158 stringValue.append(", isDefault=").append(getIsDefault()); 159 stringValue.append(", sortOrder=").append(getSortOrder()); 160 stringValue.append(", fromTime=").append(getFromTime()); 161 stringValue.append(", thruTime=").append(getThruTime()); 162 163 stringValue.append('}'); 164 165 _stringValue = stringValue.toString(); 166 } 167 return _stringValue; 168 } 169 170 @Override 171 public boolean equals(Object other) { 172 if(this == other) 173 return true; 174 175 if(!hasIdentity()) 176 return false; 177 178 if(other instanceof ContactListContactMechanismPurposeDetailValue) { 179 ContactListContactMechanismPurposeDetailValue that = (ContactListContactMechanismPurposeDetailValue)other; 180 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 = 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 ContactListContactMechanismPurposeDetailValue) { 199 ContactListContactMechanismPurposeDetailValue that = (ContactListContactMechanismPurposeDetailValue)other; 200 boolean objectsEqual = true; 201 202 203 if(objectsEqual) { 204 ContactListContactMechanismPurposePK thisContactListContactMechanismPurposePK = getContactListContactMechanismPurposePK(); 205 ContactListContactMechanismPurposePK thatContactListContactMechanismPurposePK = that.getContactListContactMechanismPurposePK(); 206 207 if(thisContactListContactMechanismPurposePK == null) { 208 objectsEqual = objectsEqual && (thatContactListContactMechanismPurposePK == null); 209 } else { 210 objectsEqual = objectsEqual && thisContactListContactMechanismPurposePK.equals(thatContactListContactMechanismPurposePK); 211 } 212 } 213 214 if(objectsEqual) { 215 ContactListPK thisContactListPK = getContactListPK(); 216 ContactListPK thatContactListPK = that.getContactListPK(); 217 218 if(thisContactListPK == null) { 219 objectsEqual = objectsEqual && (thatContactListPK == null); 220 } else { 221 objectsEqual = objectsEqual && thisContactListPK.equals(thatContactListPK); 222 } 223 } 224 225 if(objectsEqual) { 226 ContactMechanismPurposePK thisContactMechanismPurposePK = getContactMechanismPurposePK(); 227 ContactMechanismPurposePK thatContactMechanismPurposePK = that.getContactMechanismPurposePK(); 228 229 if(thisContactMechanismPurposePK == null) { 230 objectsEqual = objectsEqual && (thatContactMechanismPurposePK == null); 231 } else { 232 objectsEqual = objectsEqual && thisContactMechanismPurposePK.equals(thatContactMechanismPurposePK); 233 } 234 } 235 236 if(objectsEqual) { 237 Boolean thisIsDefault = getIsDefault(); 238 Boolean thatIsDefault = that.getIsDefault(); 239 240 if(thisIsDefault == null) { 241 objectsEqual = objectsEqual && (thatIsDefault == null); 242 } else { 243 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 244 } 245 } 246 247 if(objectsEqual) { 248 Integer thisSortOrder = getSortOrder(); 249 Integer thatSortOrder = that.getSortOrder(); 250 251 if(thisSortOrder == null) { 252 objectsEqual = objectsEqual && (thatSortOrder == null); 253 } else { 254 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 255 } 256 } 257 258 if(objectsEqual) { 259 Long thisFromTime = getFromTime(); 260 Long thatFromTime = that.getFromTime(); 261 262 if(thisFromTime == null) { 263 objectsEqual = objectsEqual && (thatFromTime == null); 264 } else { 265 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 266 } 267 } 268 269 if(objectsEqual) { 270 Long thisThruTime = getThruTime(); 271 Long thatThruTime = that.getThruTime(); 272 273 if(thisThruTime == null) { 274 objectsEqual = objectsEqual && (thatThruTime == null); 275 } else { 276 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 277 } 278 } 279 280 return objectsEqual; 281 } else { 282 return false; 283 } 284 } 285 286 @Override 287 public boolean hasBeenModified() { 288 return contactListContactMechanismPurposePKHasBeenModified || contactListPKHasBeenModified || contactMechanismPurposePKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 289 } 290 291 @Override 292 public void clearHasBeenModified() { 293 contactListContactMechanismPurposePKHasBeenModified = false; 294 contactListPKHasBeenModified = false; 295 contactMechanismPurposePKHasBeenModified = false; 296 isDefaultHasBeenModified = false; 297 sortOrderHasBeenModified = false; 298 fromTimeHasBeenModified = false; 299 thruTimeHasBeenModified = false; 300 } 301 302 public ContactListContactMechanismPurposePK getContactListContactMechanismPurposePK() { 303 return contactListContactMechanismPurposePK; 304 } 305 306 public void setContactListContactMechanismPurposePK(ContactListContactMechanismPurposePK contactListContactMechanismPurposePK) 307 throws PersistenceNotNullException { 308 checkForNull(contactListContactMechanismPurposePK); 309 310 boolean update = true; 311 312 if(this.contactListContactMechanismPurposePK != null) { 313 if(this.contactListContactMechanismPurposePK.equals(contactListContactMechanismPurposePK)) { 314 update = false; 315 } 316 } else if(contactListContactMechanismPurposePK == null) { 317 update = false; 318 } 319 320 if(update) { 321 this.contactListContactMechanismPurposePK = contactListContactMechanismPurposePK; 322 contactListContactMechanismPurposePKHasBeenModified = true; 323 clearHashAndString(); 324 } 325 } 326 327 public boolean getContactListContactMechanismPurposePKHasBeenModified() { 328 return contactListContactMechanismPurposePKHasBeenModified; 329 } 330 331 public ContactListPK getContactListPK() { 332 return contactListPK; 333 } 334 335 public void setContactListPK(ContactListPK contactListPK) 336 throws PersistenceNotNullException { 337 checkForNull(contactListPK); 338 339 boolean update = true; 340 341 if(this.contactListPK != null) { 342 if(this.contactListPK.equals(contactListPK)) { 343 update = false; 344 } 345 } else if(contactListPK == null) { 346 update = false; 347 } 348 349 if(update) { 350 this.contactListPK = contactListPK; 351 contactListPKHasBeenModified = true; 352 clearHashAndString(); 353 } 354 } 355 356 public boolean getContactListPKHasBeenModified() { 357 return contactListPKHasBeenModified; 358 } 359 360 public ContactMechanismPurposePK getContactMechanismPurposePK() { 361 return contactMechanismPurposePK; 362 } 363 364 public void setContactMechanismPurposePK(ContactMechanismPurposePK contactMechanismPurposePK) 365 throws PersistenceNotNullException { 366 checkForNull(contactMechanismPurposePK); 367 368 boolean update = true; 369 370 if(this.contactMechanismPurposePK != null) { 371 if(this.contactMechanismPurposePK.equals(contactMechanismPurposePK)) { 372 update = false; 373 } 374 } else if(contactMechanismPurposePK == null) { 375 update = false; 376 } 377 378 if(update) { 379 this.contactMechanismPurposePK = contactMechanismPurposePK; 380 contactMechanismPurposePKHasBeenModified = true; 381 clearHashAndString(); 382 } 383 } 384 385 public boolean getContactMechanismPurposePKHasBeenModified() { 386 return contactMechanismPurposePKHasBeenModified; 387 } 388 389 public Boolean getIsDefault() { 390 return isDefault; 391 } 392 393 public void setIsDefault(Boolean isDefault) 394 throws PersistenceNotNullException { 395 checkForNull(isDefault); 396 397 boolean update = true; 398 399 if(this.isDefault != null) { 400 if(this.isDefault.equals(isDefault)) { 401 update = false; 402 } 403 } else if(isDefault == null) { 404 update = false; 405 } 406 407 if(update) { 408 this.isDefault = isDefault; 409 isDefaultHasBeenModified = true; 410 clearHashAndString(); 411 } 412 } 413 414 public boolean getIsDefaultHasBeenModified() { 415 return isDefaultHasBeenModified; 416 } 417 418 public Integer getSortOrder() { 419 return sortOrder; 420 } 421 422 public void setSortOrder(Integer sortOrder) 423 throws PersistenceNotNullException { 424 checkForNull(sortOrder); 425 426 boolean update = true; 427 428 if(this.sortOrder != null) { 429 if(this.sortOrder.equals(sortOrder)) { 430 update = false; 431 } 432 } else if(sortOrder == null) { 433 update = false; 434 } 435 436 if(update) { 437 this.sortOrder = sortOrder; 438 sortOrderHasBeenModified = true; 439 clearHashAndString(); 440 } 441 } 442 443 public boolean getSortOrderHasBeenModified() { 444 return sortOrderHasBeenModified; 445 } 446 447 public Long getFromTime() { 448 return fromTime; 449 } 450 451 public void setFromTime(Long fromTime) 452 throws PersistenceNotNullException { 453 checkForNull(fromTime); 454 455 boolean update = true; 456 457 if(this.fromTime != null) { 458 if(this.fromTime.equals(fromTime)) { 459 update = false; 460 } 461 } else if(fromTime == null) { 462 update = false; 463 } 464 465 if(update) { 466 this.fromTime = fromTime; 467 fromTimeHasBeenModified = true; 468 clearHashAndString(); 469 } 470 } 471 472 public boolean getFromTimeHasBeenModified() { 473 return fromTimeHasBeenModified; 474 } 475 476 public Long getThruTime() { 477 return thruTime; 478 } 479 480 public void setThruTime(Long thruTime) 481 throws PersistenceNotNullException { 482 checkForNull(thruTime); 483 484 boolean update = true; 485 486 if(this.thruTime != null) { 487 if(this.thruTime.equals(thruTime)) { 488 update = false; 489 } 490 } else if(thruTime == null) { 491 update = false; 492 } 493 494 if(update) { 495 this.thruTime = thruTime; 496 thruTimeHasBeenModified = true; 497 clearHashAndString(); 498 } 499 } 500 501 public boolean getThruTimeHasBeenModified() { 502 return thruTimeHasBeenModified; 503 } 504 505}