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 * CommunicationEmailSourceValue.java 021 */ 022 023package com.echothree.model.data.communication.server.value; 024 025import com.echothree.model.data.communication.common.pk.CommunicationEmailSourcePK; 026 027import com.echothree.model.data.communication.server.factory.CommunicationEmailSourceFactory; 028 029import com.echothree.model.data.communication.common.pk.CommunicationSourcePK; 030import com.echothree.model.data.core.common.pk.ServerPK; 031import com.echothree.model.data.workeffort.common.pk.WorkEffortScopePK; 032import com.echothree.model.data.selector.common.pk.SelectorPK; 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 CommunicationEmailSourceValue 042 extends BaseValue<CommunicationEmailSourcePK> 043 implements Cloneable, Serializable { 044 045 private CommunicationSourcePK communicationSourcePK; 046 private boolean communicationSourcePKHasBeenModified = false; 047 private ServerPK serverPK; 048 private boolean serverPKHasBeenModified = false; 049 private String username; 050 private boolean usernameHasBeenModified = false; 051 private String password; 052 private boolean passwordHasBeenModified = false; 053 private WorkEffortScopePK receiveWorkEffortScopePK; 054 private boolean receiveWorkEffortScopePKHasBeenModified = false; 055 private WorkEffortScopePK sendWorkEffortScopePK; 056 private boolean sendWorkEffortScopePKHasBeenModified = false; 057 private SelectorPK reviewEmployeeSelectorPK; 058 private boolean reviewEmployeeSelectorPKHasBeenModified = false; 059 private Long fromTime; 060 private boolean fromTimeHasBeenModified = false; 061 private Long thruTime; 062 private boolean thruTimeHasBeenModified = false; 063 064 private transient Integer _hashCode = null; 065 private transient String _stringValue = null; 066 067 private void constructFields(CommunicationSourcePK communicationSourcePK, ServerPK serverPK, String username, String password, WorkEffortScopePK receiveWorkEffortScopePK, WorkEffortScopePK sendWorkEffortScopePK, SelectorPK reviewEmployeeSelectorPK, Long fromTime, Long thruTime) 068 throws PersistenceNotNullException { 069 checkForNull(communicationSourcePK); 070 this.communicationSourcePK = communicationSourcePK; 071 checkForNull(serverPK); 072 this.serverPK = serverPK; 073 checkForNull(username); 074 this.username = username; 075 checkForNull(password); 076 this.password = password; 077 checkForNull(receiveWorkEffortScopePK); 078 this.receiveWorkEffortScopePK = receiveWorkEffortScopePK; 079 checkForNull(sendWorkEffortScopePK); 080 this.sendWorkEffortScopePK = sendWorkEffortScopePK; 081 this.reviewEmployeeSelectorPK = reviewEmployeeSelectorPK; 082 checkForNull(fromTime); 083 this.fromTime = fromTime; 084 checkForNull(thruTime); 085 this.thruTime = thruTime; 086 } 087 088 /** Creates a new instance of CommunicationEmailSourceValue */ 089 public CommunicationEmailSourceValue(CommunicationEmailSourcePK communicationEmailSourcePK, CommunicationSourcePK communicationSourcePK, ServerPK serverPK, String username, String password, WorkEffortScopePK receiveWorkEffortScopePK, WorkEffortScopePK sendWorkEffortScopePK, SelectorPK reviewEmployeeSelectorPK, Long fromTime, Long thruTime) 090 throws PersistenceNotNullException { 091 super(communicationEmailSourcePK); 092 constructFields(communicationSourcePK, serverPK, username, password, receiveWorkEffortScopePK, sendWorkEffortScopePK, reviewEmployeeSelectorPK, fromTime, thruTime); 093 } 094 095 /** Creates a new instance of CommunicationEmailSourceValue */ 096 public CommunicationEmailSourceValue(CommunicationSourcePK communicationSourcePK, ServerPK serverPK, String username, String password, WorkEffortScopePK receiveWorkEffortScopePK, WorkEffortScopePK sendWorkEffortScopePK, SelectorPK reviewEmployeeSelectorPK, Long fromTime, Long thruTime) 097 throws PersistenceNotNullException { 098 super(); 099 constructFields(communicationSourcePK, serverPK, username, password, receiveWorkEffortScopePK, sendWorkEffortScopePK, reviewEmployeeSelectorPK, fromTime, thruTime); 100 } 101 102 @Override 103 public CommunicationEmailSourceFactory getBaseFactoryInstance() { 104 return CommunicationEmailSourceFactory.getInstance(); 105 } 106 107 @Override 108 public CommunicationEmailSourceValue clone() { 109 Object result; 110 111 try { 112 result = super.clone(); 113 } catch (CloneNotSupportedException cnse) { 114 // This shouldn't happen, fail when it does. 115 throw new PersistenceCloneException(cnse); 116 } 117 118 return (CommunicationEmailSourceValue)result; 119 } 120 121 @Override 122 public CommunicationEmailSourcePK getPrimaryKey() { 123 if(_primaryKey == null) { 124 _primaryKey = new CommunicationEmailSourcePK(entityId); 125 } 126 127 return _primaryKey; 128 } 129 130 private void clearHashAndString() { 131 _hashCode = null; 132 _stringValue = null; 133 } 134 135 @Override 136 public int hashCode() { 137 if(_hashCode == null) { 138 int hashCode = 17; 139 140 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 141 142 hashCode = 37 * hashCode + ((communicationSourcePK != null) ? communicationSourcePK.hashCode() : 0); 143 hashCode = 37 * hashCode + ((serverPK != null) ? serverPK.hashCode() : 0); 144 hashCode = 37 * hashCode + ((username != null) ? username.hashCode() : 0); 145 hashCode = 37 * hashCode + ((password != null) ? password.hashCode() : 0); 146 hashCode = 37 * hashCode + ((receiveWorkEffortScopePK != null) ? receiveWorkEffortScopePK.hashCode() : 0); 147 hashCode = 37 * hashCode + ((sendWorkEffortScopePK != null) ? sendWorkEffortScopePK.hashCode() : 0); 148 hashCode = 37 * hashCode + ((reviewEmployeeSelectorPK != null) ? reviewEmployeeSelectorPK.hashCode() : 0); 149 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 150 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 151 152 _hashCode = hashCode; 153 } 154 155 return _hashCode; 156 } 157 158 @Override 159 public String toString() { 160 if(_stringValue == null) { 161 _stringValue = "{" + 162 "entityId=" + getEntityId() + 163 ", communicationSourcePK=" + getCommunicationSourcePK() + 164 ", serverPK=" + getServerPK() + 165 ", username=" + getUsername() + 166 ", password=" + getPassword() + 167 ", receiveWorkEffortScopePK=" + getReceiveWorkEffortScopePK() + 168 ", sendWorkEffortScopePK=" + getSendWorkEffortScopePK() + 169 ", reviewEmployeeSelectorPK=" + getReviewEmployeeSelectorPK() + 170 ", fromTime=" + getFromTime() + 171 ", thruTime=" + getThruTime() + 172 "}"; 173 } 174 return _stringValue; 175 } 176 177 @Override 178 public boolean equals(Object other) { 179 if(this == other) 180 return true; 181 182 if(!hasIdentity()) 183 return false; 184 185 if(other instanceof CommunicationEmailSourceValue that) { 186 if(!that.hasIdentity()) 187 return false; 188 189 Long thisEntityId = getEntityId(); 190 Long thatEntityId = that.getEntityId(); 191 192 boolean objectsEqual = thisEntityId.equals(thatEntityId); 193 if(objectsEqual) 194 objectsEqual = isIdentical(that); 195 196 return objectsEqual; 197 } else { 198 return false; 199 } 200 } 201 202 public boolean isIdentical(Object other) { 203 if(other instanceof CommunicationEmailSourceValue that) { 204 boolean objectsEqual = true; 205 206 207 if(objectsEqual) { 208 CommunicationSourcePK thisCommunicationSourcePK = getCommunicationSourcePK(); 209 CommunicationSourcePK thatCommunicationSourcePK = that.getCommunicationSourcePK(); 210 211 if(thisCommunicationSourcePK == null) { 212 objectsEqual = objectsEqual && (thatCommunicationSourcePK == null); 213 } else { 214 objectsEqual = objectsEqual && thisCommunicationSourcePK.equals(thatCommunicationSourcePK); 215 } 216 } 217 218 if(objectsEqual) { 219 ServerPK thisServerPK = getServerPK(); 220 ServerPK thatServerPK = that.getServerPK(); 221 222 if(thisServerPK == null) { 223 objectsEqual = objectsEqual && (thatServerPK == null); 224 } else { 225 objectsEqual = objectsEqual && thisServerPK.equals(thatServerPK); 226 } 227 } 228 229 if(objectsEqual) { 230 String thisUsername = getUsername(); 231 String thatUsername = that.getUsername(); 232 233 if(thisUsername == null) { 234 objectsEqual = objectsEqual && (thatUsername == null); 235 } else { 236 objectsEqual = objectsEqual && thisUsername.equals(thatUsername); 237 } 238 } 239 240 if(objectsEqual) { 241 String thisPassword = getPassword(); 242 String thatPassword = that.getPassword(); 243 244 if(thisPassword == null) { 245 objectsEqual = objectsEqual && (thatPassword == null); 246 } else { 247 objectsEqual = objectsEqual && thisPassword.equals(thatPassword); 248 } 249 } 250 251 if(objectsEqual) { 252 WorkEffortScopePK thisReceiveWorkEffortScopePK = getReceiveWorkEffortScopePK(); 253 WorkEffortScopePK thatReceiveWorkEffortScopePK = that.getReceiveWorkEffortScopePK(); 254 255 if(thisReceiveWorkEffortScopePK == null) { 256 objectsEqual = objectsEqual && (thatReceiveWorkEffortScopePK == null); 257 } else { 258 objectsEqual = objectsEqual && thisReceiveWorkEffortScopePK.equals(thatReceiveWorkEffortScopePK); 259 } 260 } 261 262 if(objectsEqual) { 263 WorkEffortScopePK thisSendWorkEffortScopePK = getSendWorkEffortScopePK(); 264 WorkEffortScopePK thatSendWorkEffortScopePK = that.getSendWorkEffortScopePK(); 265 266 if(thisSendWorkEffortScopePK == null) { 267 objectsEqual = objectsEqual && (thatSendWorkEffortScopePK == null); 268 } else { 269 objectsEqual = objectsEqual && thisSendWorkEffortScopePK.equals(thatSendWorkEffortScopePK); 270 } 271 } 272 273 if(objectsEqual) { 274 SelectorPK thisReviewEmployeeSelectorPK = getReviewEmployeeSelectorPK(); 275 SelectorPK thatReviewEmployeeSelectorPK = that.getReviewEmployeeSelectorPK(); 276 277 if(thisReviewEmployeeSelectorPK == null) { 278 objectsEqual = objectsEqual && (thatReviewEmployeeSelectorPK == null); 279 } else { 280 objectsEqual = objectsEqual && thisReviewEmployeeSelectorPK.equals(thatReviewEmployeeSelectorPK); 281 } 282 } 283 284 if(objectsEqual) { 285 Long thisFromTime = getFromTime(); 286 Long thatFromTime = that.getFromTime(); 287 288 if(thisFromTime == null) { 289 objectsEqual = objectsEqual && (thatFromTime == null); 290 } else { 291 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 292 } 293 } 294 295 if(objectsEqual) { 296 Long thisThruTime = getThruTime(); 297 Long thatThruTime = that.getThruTime(); 298 299 if(thisThruTime == null) { 300 objectsEqual = objectsEqual && (thatThruTime == null); 301 } else { 302 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 303 } 304 } 305 306 return objectsEqual; 307 } else { 308 return false; 309 } 310 } 311 312 @Override 313 public boolean hasBeenModified() { 314 return communicationSourcePKHasBeenModified || serverPKHasBeenModified || usernameHasBeenModified || passwordHasBeenModified || receiveWorkEffortScopePKHasBeenModified || sendWorkEffortScopePKHasBeenModified || reviewEmployeeSelectorPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 315 } 316 317 @Override 318 public void clearHasBeenModified() { 319 communicationSourcePKHasBeenModified = false; 320 serverPKHasBeenModified = false; 321 usernameHasBeenModified = false; 322 passwordHasBeenModified = false; 323 receiveWorkEffortScopePKHasBeenModified = false; 324 sendWorkEffortScopePKHasBeenModified = false; 325 reviewEmployeeSelectorPKHasBeenModified = false; 326 fromTimeHasBeenModified = false; 327 thruTimeHasBeenModified = false; 328 } 329 330 public CommunicationSourcePK getCommunicationSourcePK() { 331 return communicationSourcePK; 332 } 333 334 public void setCommunicationSourcePK(CommunicationSourcePK communicationSourcePK) 335 throws PersistenceNotNullException { 336 checkForNull(communicationSourcePK); 337 338 boolean update = true; 339 340 if(this.communicationSourcePK != null) { 341 if(this.communicationSourcePK.equals(communicationSourcePK)) { 342 update = false; 343 } 344 } else if(communicationSourcePK == null) { 345 update = false; 346 } 347 348 if(update) { 349 this.communicationSourcePK = communicationSourcePK; 350 communicationSourcePKHasBeenModified = true; 351 clearHashAndString(); 352 } 353 } 354 355 public boolean getCommunicationSourcePKHasBeenModified() { 356 return communicationSourcePKHasBeenModified; 357 } 358 359 public ServerPK getServerPK() { 360 return serverPK; 361 } 362 363 public void setServerPK(ServerPK serverPK) 364 throws PersistenceNotNullException { 365 checkForNull(serverPK); 366 367 boolean update = true; 368 369 if(this.serverPK != null) { 370 if(this.serverPK.equals(serverPK)) { 371 update = false; 372 } 373 } else if(serverPK == null) { 374 update = false; 375 } 376 377 if(update) { 378 this.serverPK = serverPK; 379 serverPKHasBeenModified = true; 380 clearHashAndString(); 381 } 382 } 383 384 public boolean getServerPKHasBeenModified() { 385 return serverPKHasBeenModified; 386 } 387 388 public String getUsername() { 389 return username; 390 } 391 392 public void setUsername(String username) 393 throws PersistenceNotNullException { 394 checkForNull(username); 395 396 boolean update = true; 397 398 if(this.username != null) { 399 if(this.username.equals(username)) { 400 update = false; 401 } 402 } else if(username == null) { 403 update = false; 404 } 405 406 if(update) { 407 this.username = username; 408 usernameHasBeenModified = true; 409 clearHashAndString(); 410 } 411 } 412 413 public boolean getUsernameHasBeenModified() { 414 return usernameHasBeenModified; 415 } 416 417 public String getPassword() { 418 return password; 419 } 420 421 public void setPassword(String password) 422 throws PersistenceNotNullException { 423 checkForNull(password); 424 425 boolean update = true; 426 427 if(this.password != null) { 428 if(this.password.equals(password)) { 429 update = false; 430 } 431 } else if(password == null) { 432 update = false; 433 } 434 435 if(update) { 436 this.password = password; 437 passwordHasBeenModified = true; 438 clearHashAndString(); 439 } 440 } 441 442 public boolean getPasswordHasBeenModified() { 443 return passwordHasBeenModified; 444 } 445 446 public WorkEffortScopePK getReceiveWorkEffortScopePK() { 447 return receiveWorkEffortScopePK; 448 } 449 450 public void setReceiveWorkEffortScopePK(WorkEffortScopePK receiveWorkEffortScopePK) 451 throws PersistenceNotNullException { 452 checkForNull(receiveWorkEffortScopePK); 453 454 boolean update = true; 455 456 if(this.receiveWorkEffortScopePK != null) { 457 if(this.receiveWorkEffortScopePK.equals(receiveWorkEffortScopePK)) { 458 update = false; 459 } 460 } else if(receiveWorkEffortScopePK == null) { 461 update = false; 462 } 463 464 if(update) { 465 this.receiveWorkEffortScopePK = receiveWorkEffortScopePK; 466 receiveWorkEffortScopePKHasBeenModified = true; 467 clearHashAndString(); 468 } 469 } 470 471 public boolean getReceiveWorkEffortScopePKHasBeenModified() { 472 return receiveWorkEffortScopePKHasBeenModified; 473 } 474 475 public WorkEffortScopePK getSendWorkEffortScopePK() { 476 return sendWorkEffortScopePK; 477 } 478 479 public void setSendWorkEffortScopePK(WorkEffortScopePK sendWorkEffortScopePK) 480 throws PersistenceNotNullException { 481 checkForNull(sendWorkEffortScopePK); 482 483 boolean update = true; 484 485 if(this.sendWorkEffortScopePK != null) { 486 if(this.sendWorkEffortScopePK.equals(sendWorkEffortScopePK)) { 487 update = false; 488 } 489 } else if(sendWorkEffortScopePK == null) { 490 update = false; 491 } 492 493 if(update) { 494 this.sendWorkEffortScopePK = sendWorkEffortScopePK; 495 sendWorkEffortScopePKHasBeenModified = true; 496 clearHashAndString(); 497 } 498 } 499 500 public boolean getSendWorkEffortScopePKHasBeenModified() { 501 return sendWorkEffortScopePKHasBeenModified; 502 } 503 504 public SelectorPK getReviewEmployeeSelectorPK() { 505 return reviewEmployeeSelectorPK; 506 } 507 508 public void setReviewEmployeeSelectorPK(SelectorPK reviewEmployeeSelectorPK) { 509 boolean update = true; 510 511 if(this.reviewEmployeeSelectorPK != null) { 512 if(this.reviewEmployeeSelectorPK.equals(reviewEmployeeSelectorPK)) { 513 update = false; 514 } 515 } else if(reviewEmployeeSelectorPK == null) { 516 update = false; 517 } 518 519 if(update) { 520 this.reviewEmployeeSelectorPK = reviewEmployeeSelectorPK; 521 reviewEmployeeSelectorPKHasBeenModified = true; 522 clearHashAndString(); 523 } 524 } 525 526 public boolean getReviewEmployeeSelectorPKHasBeenModified() { 527 return reviewEmployeeSelectorPKHasBeenModified; 528 } 529 530 public Long getFromTime() { 531 return fromTime; 532 } 533 534 public void setFromTime(Long fromTime) 535 throws PersistenceNotNullException { 536 checkForNull(fromTime); 537 538 boolean update = true; 539 540 if(this.fromTime != null) { 541 if(this.fromTime.equals(fromTime)) { 542 update = false; 543 } 544 } else if(fromTime == null) { 545 update = false; 546 } 547 548 if(update) { 549 this.fromTime = fromTime; 550 fromTimeHasBeenModified = true; 551 clearHashAndString(); 552 } 553 } 554 555 public boolean getFromTimeHasBeenModified() { 556 return fromTimeHasBeenModified; 557 } 558 559 public Long getThruTime() { 560 return thruTime; 561 } 562 563 public void setThruTime(Long thruTime) 564 throws PersistenceNotNullException { 565 checkForNull(thruTime); 566 567 boolean update = true; 568 569 if(this.thruTime != null) { 570 if(this.thruTime.equals(thruTime)) { 571 update = false; 572 } 573 } else if(thruTime == null) { 574 update = false; 575 } 576 577 if(update) { 578 this.thruTime = thruTime; 579 thruTimeHasBeenModified = true; 580 clearHashAndString(); 581 } 582 } 583 584 public boolean getThruTimeHasBeenModified() { 585 return thruTimeHasBeenModified; 586 } 587 588}