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