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 * 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 StringBuilder stringValue = new StringBuilder("{"); 162 163 stringValue.append("entityId=").append(getEntityId()); 164 165 stringValue.append(", communicationSourcePK=").append(getCommunicationSourcePK()); 166 stringValue.append(", serverPK=").append(getServerPK()); 167 stringValue.append(", username=").append(getUsername()); 168 stringValue.append(", password=").append(getPassword()); 169 stringValue.append(", receiveWorkEffortScopePK=").append(getReceiveWorkEffortScopePK()); 170 stringValue.append(", sendWorkEffortScopePK=").append(getSendWorkEffortScopePK()); 171 stringValue.append(", reviewEmployeeSelectorPK=").append(getReviewEmployeeSelectorPK()); 172 stringValue.append(", fromTime=").append(getFromTime()); 173 stringValue.append(", thruTime=").append(getThruTime()); 174 175 stringValue.append('}'); 176 177 _stringValue = stringValue.toString(); 178 } 179 return _stringValue; 180 } 181 182 @Override 183 public boolean equals(Object other) { 184 if(this == other) 185 return true; 186 187 if(!hasIdentity()) 188 return false; 189 190 if(other instanceof CommunicationEmailSourceValue) { 191 CommunicationEmailSourceValue that = (CommunicationEmailSourceValue)other; 192 193 if(!that.hasIdentity()) 194 return false; 195 196 Long thisEntityId = getEntityId(); 197 Long thatEntityId = that.getEntityId(); 198 199 boolean objectsEqual = thisEntityId.equals(thatEntityId); 200 if(objectsEqual) 201 objectsEqual = objectsEqual && isIdentical(that); 202 203 return objectsEqual; 204 } else { 205 return false; 206 } 207 } 208 209 public boolean isIdentical(Object other) { 210 if(other instanceof CommunicationEmailSourceValue) { 211 CommunicationEmailSourceValue that = (CommunicationEmailSourceValue)other; 212 boolean objectsEqual = true; 213 214 215 if(objectsEqual) { 216 CommunicationSourcePK thisCommunicationSourcePK = getCommunicationSourcePK(); 217 CommunicationSourcePK thatCommunicationSourcePK = that.getCommunicationSourcePK(); 218 219 if(thisCommunicationSourcePK == null) { 220 objectsEqual = objectsEqual && (thatCommunicationSourcePK == null); 221 } else { 222 objectsEqual = objectsEqual && thisCommunicationSourcePK.equals(thatCommunicationSourcePK); 223 } 224 } 225 226 if(objectsEqual) { 227 ServerPK thisServerPK = getServerPK(); 228 ServerPK thatServerPK = that.getServerPK(); 229 230 if(thisServerPK == null) { 231 objectsEqual = objectsEqual && (thatServerPK == null); 232 } else { 233 objectsEqual = objectsEqual && thisServerPK.equals(thatServerPK); 234 } 235 } 236 237 if(objectsEqual) { 238 String thisUsername = getUsername(); 239 String thatUsername = that.getUsername(); 240 241 if(thisUsername == null) { 242 objectsEqual = objectsEqual && (thatUsername == null); 243 } else { 244 objectsEqual = objectsEqual && thisUsername.equals(thatUsername); 245 } 246 } 247 248 if(objectsEqual) { 249 String thisPassword = getPassword(); 250 String thatPassword = that.getPassword(); 251 252 if(thisPassword == null) { 253 objectsEqual = objectsEqual && (thatPassword == null); 254 } else { 255 objectsEqual = objectsEqual && thisPassword.equals(thatPassword); 256 } 257 } 258 259 if(objectsEqual) { 260 WorkEffortScopePK thisReceiveWorkEffortScopePK = getReceiveWorkEffortScopePK(); 261 WorkEffortScopePK thatReceiveWorkEffortScopePK = that.getReceiveWorkEffortScopePK(); 262 263 if(thisReceiveWorkEffortScopePK == null) { 264 objectsEqual = objectsEqual && (thatReceiveWorkEffortScopePK == null); 265 } else { 266 objectsEqual = objectsEqual && thisReceiveWorkEffortScopePK.equals(thatReceiveWorkEffortScopePK); 267 } 268 } 269 270 if(objectsEqual) { 271 WorkEffortScopePK thisSendWorkEffortScopePK = getSendWorkEffortScopePK(); 272 WorkEffortScopePK thatSendWorkEffortScopePK = that.getSendWorkEffortScopePK(); 273 274 if(thisSendWorkEffortScopePK == null) { 275 objectsEqual = objectsEqual && (thatSendWorkEffortScopePK == null); 276 } else { 277 objectsEqual = objectsEqual && thisSendWorkEffortScopePK.equals(thatSendWorkEffortScopePK); 278 } 279 } 280 281 if(objectsEqual) { 282 SelectorPK thisReviewEmployeeSelectorPK = getReviewEmployeeSelectorPK(); 283 SelectorPK thatReviewEmployeeSelectorPK = that.getReviewEmployeeSelectorPK(); 284 285 if(thisReviewEmployeeSelectorPK == null) { 286 objectsEqual = objectsEqual && (thatReviewEmployeeSelectorPK == null); 287 } else { 288 objectsEqual = objectsEqual && thisReviewEmployeeSelectorPK.equals(thatReviewEmployeeSelectorPK); 289 } 290 } 291 292 if(objectsEqual) { 293 Long thisFromTime = getFromTime(); 294 Long thatFromTime = that.getFromTime(); 295 296 if(thisFromTime == null) { 297 objectsEqual = objectsEqual && (thatFromTime == null); 298 } else { 299 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 300 } 301 } 302 303 if(objectsEqual) { 304 Long thisThruTime = getThruTime(); 305 Long thatThruTime = that.getThruTime(); 306 307 if(thisThruTime == null) { 308 objectsEqual = objectsEqual && (thatThruTime == null); 309 } else { 310 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 311 } 312 } 313 314 return objectsEqual; 315 } else { 316 return false; 317 } 318 } 319 320 @Override 321 public boolean hasBeenModified() { 322 return communicationSourcePKHasBeenModified || serverPKHasBeenModified || usernameHasBeenModified || passwordHasBeenModified || receiveWorkEffortScopePKHasBeenModified || sendWorkEffortScopePKHasBeenModified || reviewEmployeeSelectorPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 323 } 324 325 @Override 326 public void clearHasBeenModified() { 327 communicationSourcePKHasBeenModified = false; 328 serverPKHasBeenModified = false; 329 usernameHasBeenModified = false; 330 passwordHasBeenModified = false; 331 receiveWorkEffortScopePKHasBeenModified = false; 332 sendWorkEffortScopePKHasBeenModified = false; 333 reviewEmployeeSelectorPKHasBeenModified = false; 334 fromTimeHasBeenModified = false; 335 thruTimeHasBeenModified = false; 336 } 337 338 public CommunicationSourcePK getCommunicationSourcePK() { 339 return communicationSourcePK; 340 } 341 342 public void setCommunicationSourcePK(CommunicationSourcePK communicationSourcePK) 343 throws PersistenceNotNullException { 344 checkForNull(communicationSourcePK); 345 346 boolean update = true; 347 348 if(this.communicationSourcePK != null) { 349 if(this.communicationSourcePK.equals(communicationSourcePK)) { 350 update = false; 351 } 352 } else if(communicationSourcePK == null) { 353 update = false; 354 } 355 356 if(update) { 357 this.communicationSourcePK = communicationSourcePK; 358 communicationSourcePKHasBeenModified = true; 359 clearHashAndString(); 360 } 361 } 362 363 public boolean getCommunicationSourcePKHasBeenModified() { 364 return communicationSourcePKHasBeenModified; 365 } 366 367 public ServerPK getServerPK() { 368 return serverPK; 369 } 370 371 public void setServerPK(ServerPK serverPK) 372 throws PersistenceNotNullException { 373 checkForNull(serverPK); 374 375 boolean update = true; 376 377 if(this.serverPK != null) { 378 if(this.serverPK.equals(serverPK)) { 379 update = false; 380 } 381 } else if(serverPK == null) { 382 update = false; 383 } 384 385 if(update) { 386 this.serverPK = serverPK; 387 serverPKHasBeenModified = true; 388 clearHashAndString(); 389 } 390 } 391 392 public boolean getServerPKHasBeenModified() { 393 return serverPKHasBeenModified; 394 } 395 396 public String getUsername() { 397 return username; 398 } 399 400 public void setUsername(String username) 401 throws PersistenceNotNullException { 402 checkForNull(username); 403 404 boolean update = true; 405 406 if(this.username != null) { 407 if(this.username.equals(username)) { 408 update = false; 409 } 410 } else if(username == null) { 411 update = false; 412 } 413 414 if(update) { 415 this.username = username; 416 usernameHasBeenModified = true; 417 clearHashAndString(); 418 } 419 } 420 421 public boolean getUsernameHasBeenModified() { 422 return usernameHasBeenModified; 423 } 424 425 public String getPassword() { 426 return password; 427 } 428 429 public void setPassword(String password) 430 throws PersistenceNotNullException { 431 checkForNull(password); 432 433 boolean update = true; 434 435 if(this.password != null) { 436 if(this.password.equals(password)) { 437 update = false; 438 } 439 } else if(password == null) { 440 update = false; 441 } 442 443 if(update) { 444 this.password = password; 445 passwordHasBeenModified = true; 446 clearHashAndString(); 447 } 448 } 449 450 public boolean getPasswordHasBeenModified() { 451 return passwordHasBeenModified; 452 } 453 454 public WorkEffortScopePK getReceiveWorkEffortScopePK() { 455 return receiveWorkEffortScopePK; 456 } 457 458 public void setReceiveWorkEffortScopePK(WorkEffortScopePK receiveWorkEffortScopePK) 459 throws PersistenceNotNullException { 460 checkForNull(receiveWorkEffortScopePK); 461 462 boolean update = true; 463 464 if(this.receiveWorkEffortScopePK != null) { 465 if(this.receiveWorkEffortScopePK.equals(receiveWorkEffortScopePK)) { 466 update = false; 467 } 468 } else if(receiveWorkEffortScopePK == null) { 469 update = false; 470 } 471 472 if(update) { 473 this.receiveWorkEffortScopePK = receiveWorkEffortScopePK; 474 receiveWorkEffortScopePKHasBeenModified = true; 475 clearHashAndString(); 476 } 477 } 478 479 public boolean getReceiveWorkEffortScopePKHasBeenModified() { 480 return receiveWorkEffortScopePKHasBeenModified; 481 } 482 483 public WorkEffortScopePK getSendWorkEffortScopePK() { 484 return sendWorkEffortScopePK; 485 } 486 487 public void setSendWorkEffortScopePK(WorkEffortScopePK sendWorkEffortScopePK) 488 throws PersistenceNotNullException { 489 checkForNull(sendWorkEffortScopePK); 490 491 boolean update = true; 492 493 if(this.sendWorkEffortScopePK != null) { 494 if(this.sendWorkEffortScopePK.equals(sendWorkEffortScopePK)) { 495 update = false; 496 } 497 } else if(sendWorkEffortScopePK == null) { 498 update = false; 499 } 500 501 if(update) { 502 this.sendWorkEffortScopePK = sendWorkEffortScopePK; 503 sendWorkEffortScopePKHasBeenModified = true; 504 clearHashAndString(); 505 } 506 } 507 508 public boolean getSendWorkEffortScopePKHasBeenModified() { 509 return sendWorkEffortScopePKHasBeenModified; 510 } 511 512 public SelectorPK getReviewEmployeeSelectorPK() { 513 return reviewEmployeeSelectorPK; 514 } 515 516 public void setReviewEmployeeSelectorPK(SelectorPK reviewEmployeeSelectorPK) { 517 boolean update = true; 518 519 if(this.reviewEmployeeSelectorPK != null) { 520 if(this.reviewEmployeeSelectorPK.equals(reviewEmployeeSelectorPK)) { 521 update = false; 522 } 523 } else if(reviewEmployeeSelectorPK == null) { 524 update = false; 525 } 526 527 if(update) { 528 this.reviewEmployeeSelectorPK = reviewEmployeeSelectorPK; 529 reviewEmployeeSelectorPKHasBeenModified = true; 530 clearHashAndString(); 531 } 532 } 533 534 public boolean getReviewEmployeeSelectorPKHasBeenModified() { 535 return reviewEmployeeSelectorPKHasBeenModified; 536 } 537 538 public Long getFromTime() { 539 return fromTime; 540 } 541 542 public void setFromTime(Long fromTime) 543 throws PersistenceNotNullException { 544 checkForNull(fromTime); 545 546 boolean update = true; 547 548 if(this.fromTime != null) { 549 if(this.fromTime.equals(fromTime)) { 550 update = false; 551 } 552 } else if(fromTime == null) { 553 update = false; 554 } 555 556 if(update) { 557 this.fromTime = fromTime; 558 fromTimeHasBeenModified = true; 559 clearHashAndString(); 560 } 561 } 562 563 public boolean getFromTimeHasBeenModified() { 564 return fromTimeHasBeenModified; 565 } 566 567 public Long getThruTime() { 568 return thruTime; 569 } 570 571 public void setThruTime(Long thruTime) 572 throws PersistenceNotNullException { 573 checkForNull(thruTime); 574 575 boolean update = true; 576 577 if(this.thruTime != null) { 578 if(this.thruTime.equals(thruTime)) { 579 update = false; 580 } 581 } else if(thruTime == null) { 582 update = false; 583 } 584 585 if(update) { 586 this.thruTime = thruTime; 587 thruTimeHasBeenModified = true; 588 clearHashAndString(); 589 } 590 } 591 592 public boolean getThruTimeHasBeenModified() { 593 return thruTimeHasBeenModified; 594 } 595 596}