001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 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 * PeriodKindDetailValue.java 021 */ 022 023package com.echothree.model.data.period.server.value; 024 025import com.echothree.model.data.period.common.pk.PeriodKindDetailPK; 026 027import com.echothree.model.data.period.server.factory.PeriodKindDetailFactory; 028 029import com.echothree.model.data.period.common.pk.PeriodKindPK; 030import com.echothree.model.data.workflow.common.pk.WorkflowEntrancePK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039import javax.annotation.Nonnull; 040import javax.annotation.Nullable; 041 042public class PeriodKindDetailValue 043 extends BaseValue<PeriodKindDetailPK> 044 implements Cloneable, Serializable { 045 046 private PeriodKindPK periodKindPK; 047 private boolean periodKindPKHasBeenModified = false; 048 private String periodKindName; 049 private boolean periodKindNameHasBeenModified = false; 050 private WorkflowEntrancePK workflowEntrancePK; 051 private boolean workflowEntrancePKHasBeenModified = false; 052 private Boolean isDefault; 053 private boolean isDefaultHasBeenModified = false; 054 private Integer sortOrder; 055 private boolean sortOrderHasBeenModified = false; 056 private Long fromTime; 057 private boolean fromTimeHasBeenModified = false; 058 private Long thruTime; 059 private boolean thruTimeHasBeenModified = false; 060 061 private transient Integer _hashCode = null; 062 private transient String _stringValue = null; 063 064 private void constructFields(PeriodKindPK periodKindPK, String periodKindName, WorkflowEntrancePK workflowEntrancePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 065 throws PersistenceNotNullException { 066 checkForNull(periodKindPK); 067 this.periodKindPK = periodKindPK; 068 checkForNull(periodKindName); 069 this.periodKindName = periodKindName; 070 this.workflowEntrancePK = workflowEntrancePK; 071 checkForNull(isDefault); 072 this.isDefault = isDefault; 073 checkForNull(sortOrder); 074 this.sortOrder = sortOrder; 075 checkForNull(fromTime); 076 this.fromTime = fromTime; 077 checkForNull(thruTime); 078 this.thruTime = thruTime; 079 } 080 081 /** Creates a new instance of PeriodKindDetailValue */ 082 public PeriodKindDetailValue(PeriodKindDetailPK periodKindDetailPK, PeriodKindPK periodKindPK, String periodKindName, WorkflowEntrancePK workflowEntrancePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(periodKindDetailPK); 085 constructFields(periodKindPK, periodKindName, workflowEntrancePK, isDefault, sortOrder, fromTime, thruTime); 086 } 087 088 /** Creates a new instance of PeriodKindDetailValue */ 089 public PeriodKindDetailValue(PeriodKindPK periodKindPK, String periodKindName, WorkflowEntrancePK workflowEntrancePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 090 throws PersistenceNotNullException { 091 super(); 092 constructFields(periodKindPK, periodKindName, workflowEntrancePK, isDefault, sortOrder, fromTime, thruTime); 093 } 094 095 @Override 096 @Nonnull 097 public PeriodKindDetailFactory getBaseFactoryInstance() { 098 return PeriodKindDetailFactory.getInstance(); 099 } 100 101 @Override 102 @Nonnull 103 public PeriodKindDetailValue clone() { 104 Object result; 105 106 try { 107 result = super.clone(); 108 } catch (CloneNotSupportedException cnse) { 109 // This shouldn't happen, fail when it does. 110 throw new PersistenceCloneException(cnse); 111 } 112 113 return (PeriodKindDetailValue)result; 114 } 115 116 @Override 117 @Nonnull 118 public PeriodKindDetailPK getPrimaryKey() { 119 if(_primaryKey == null) { 120 _primaryKey = new PeriodKindDetailPK(entityId); 121 } 122 123 return _primaryKey; 124 } 125 126 private void clearHashAndString() { 127 _hashCode = null; 128 _stringValue = null; 129 } 130 131 @Override 132 public int hashCode() { 133 if(_hashCode == null) { 134 int hashCode = 17; 135 136 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 137 138 hashCode = 37 * hashCode + ((periodKindPK != null) ? periodKindPK.hashCode() : 0); 139 hashCode = 37 * hashCode + ((periodKindName != null) ? periodKindName.hashCode() : 0); 140 hashCode = 37 * hashCode + ((workflowEntrancePK != null) ? workflowEntrancePK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 142 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 143 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 144 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 145 146 _hashCode = hashCode; 147 } 148 149 return _hashCode; 150 } 151 152 @Override 153 @Nonnull 154 public String toString() { 155 if(_stringValue == null) { 156 _stringValue = "{" + 157 "entityId=" + getEntityId() + 158 ", periodKindPK=" + getPeriodKindPK() + 159 ", periodKindName=" + getPeriodKindName() + 160 ", workflowEntrancePK=" + getWorkflowEntrancePK() + 161 ", isDefault=" + getIsDefault() + 162 ", sortOrder=" + getSortOrder() + 163 ", fromTime=" + getFromTime() + 164 ", thruTime=" + getThruTime() + 165 "}"; 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 PeriodKindDetailValue that) { 179 if(!that.hasIdentity()) 180 return false; 181 182 Long thisEntityId = getEntityId(); 183 Long thatEntityId = that.getEntityId(); 184 185 boolean objectsEqual = thisEntityId.equals(thatEntityId); 186 if(objectsEqual) 187 objectsEqual = isIdentical(that); 188 189 return objectsEqual; 190 } else { 191 return false; 192 } 193 } 194 195 public boolean isIdentical(Object other) { 196 if(other instanceof PeriodKindDetailValue that) { 197 boolean objectsEqual = true; 198 199 200 if(objectsEqual) { 201 PeriodKindPK thisPeriodKindPK = getPeriodKindPK(); 202 PeriodKindPK thatPeriodKindPK = that.getPeriodKindPK(); 203 204 if(thisPeriodKindPK == null) { 205 objectsEqual = objectsEqual && (thatPeriodKindPK == null); 206 } else { 207 objectsEqual = objectsEqual && thisPeriodKindPK.equals(thatPeriodKindPK); 208 } 209 } 210 211 if(objectsEqual) { 212 String thisPeriodKindName = getPeriodKindName(); 213 String thatPeriodKindName = that.getPeriodKindName(); 214 215 if(thisPeriodKindName == null) { 216 objectsEqual = objectsEqual && (thatPeriodKindName == null); 217 } else { 218 objectsEqual = objectsEqual && thisPeriodKindName.equals(thatPeriodKindName); 219 } 220 } 221 222 if(objectsEqual) { 223 WorkflowEntrancePK thisWorkflowEntrancePK = getWorkflowEntrancePK(); 224 WorkflowEntrancePK thatWorkflowEntrancePK = that.getWorkflowEntrancePK(); 225 226 if(thisWorkflowEntrancePK == null) { 227 objectsEqual = objectsEqual && (thatWorkflowEntrancePK == null); 228 } else { 229 objectsEqual = objectsEqual && thisWorkflowEntrancePK.equals(thatWorkflowEntrancePK); 230 } 231 } 232 233 if(objectsEqual) { 234 Boolean thisIsDefault = getIsDefault(); 235 Boolean thatIsDefault = that.getIsDefault(); 236 237 if(thisIsDefault == null) { 238 objectsEqual = objectsEqual && (thatIsDefault == null); 239 } else { 240 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 241 } 242 } 243 244 if(objectsEqual) { 245 Integer thisSortOrder = getSortOrder(); 246 Integer thatSortOrder = that.getSortOrder(); 247 248 if(thisSortOrder == null) { 249 objectsEqual = objectsEqual && (thatSortOrder == null); 250 } else { 251 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 252 } 253 } 254 255 if(objectsEqual) { 256 Long thisFromTime = getFromTime(); 257 Long thatFromTime = that.getFromTime(); 258 259 if(thisFromTime == null) { 260 objectsEqual = objectsEqual && (thatFromTime == null); 261 } else { 262 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 263 } 264 } 265 266 if(objectsEqual) { 267 Long thisThruTime = getThruTime(); 268 Long thatThruTime = that.getThruTime(); 269 270 if(thisThruTime == null) { 271 objectsEqual = objectsEqual && (thatThruTime == null); 272 } else { 273 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 274 } 275 } 276 277 return objectsEqual; 278 } else { 279 return false; 280 } 281 } 282 283 @Override 284 public boolean hasBeenModified() { 285 return periodKindPKHasBeenModified || periodKindNameHasBeenModified || workflowEntrancePKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 286 } 287 288 @Override 289 public void clearHasBeenModified() { 290 periodKindPKHasBeenModified = false; 291 periodKindNameHasBeenModified = false; 292 workflowEntrancePKHasBeenModified = false; 293 isDefaultHasBeenModified = false; 294 sortOrderHasBeenModified = false; 295 fromTimeHasBeenModified = false; 296 thruTimeHasBeenModified = false; 297 } 298 299 @Nonnull 300 public PeriodKindPK getPeriodKindPK() { 301 return periodKindPK; 302 } 303 304 public void setPeriodKindPK(@Nonnull PeriodKindPK periodKindPK) 305 throws PersistenceNotNullException { 306 checkForNull(periodKindPK); 307 308 boolean update = true; 309 310 if(this.periodKindPK != null) { 311 if(this.periodKindPK.equals(periodKindPK)) { 312 update = false; 313 } 314 } else if(periodKindPK == null) { 315 update = false; 316 } 317 318 if(update) { 319 this.periodKindPK = periodKindPK; 320 periodKindPKHasBeenModified = true; 321 clearHashAndString(); 322 } 323 } 324 325 public boolean getPeriodKindPKHasBeenModified() { 326 return periodKindPKHasBeenModified; 327 } 328 329 @Nonnull 330 public String getPeriodKindName() { 331 return periodKindName; 332 } 333 334 public void setPeriodKindName(@Nonnull String periodKindName) 335 throws PersistenceNotNullException { 336 checkForNull(periodKindName); 337 338 boolean update = true; 339 340 if(this.periodKindName != null) { 341 if(this.periodKindName.equals(periodKindName)) { 342 update = false; 343 } 344 } else if(periodKindName == null) { 345 update = false; 346 } 347 348 if(update) { 349 this.periodKindName = periodKindName; 350 periodKindNameHasBeenModified = true; 351 clearHashAndString(); 352 } 353 } 354 355 public boolean getPeriodKindNameHasBeenModified() { 356 return periodKindNameHasBeenModified; 357 } 358 359 @Nullable 360 public WorkflowEntrancePK getWorkflowEntrancePK() { 361 return workflowEntrancePK; 362 } 363 364 public void setWorkflowEntrancePK(@Nullable WorkflowEntrancePK workflowEntrancePK) { 365 boolean update = true; 366 367 if(this.workflowEntrancePK != null) { 368 if(this.workflowEntrancePK.equals(workflowEntrancePK)) { 369 update = false; 370 } 371 } else if(workflowEntrancePK == null) { 372 update = false; 373 } 374 375 if(update) { 376 this.workflowEntrancePK = workflowEntrancePK; 377 workflowEntrancePKHasBeenModified = true; 378 clearHashAndString(); 379 } 380 } 381 382 public boolean getWorkflowEntrancePKHasBeenModified() { 383 return workflowEntrancePKHasBeenModified; 384 } 385 386 @Nonnull 387 public Boolean getIsDefault() { 388 return isDefault; 389 } 390 391 public void setIsDefault(@Nonnull Boolean isDefault) 392 throws PersistenceNotNullException { 393 checkForNull(isDefault); 394 395 boolean update = true; 396 397 if(this.isDefault != null) { 398 if(this.isDefault.equals(isDefault)) { 399 update = false; 400 } 401 } else if(isDefault == null) { 402 update = false; 403 } 404 405 if(update) { 406 this.isDefault = isDefault; 407 isDefaultHasBeenModified = true; 408 clearHashAndString(); 409 } 410 } 411 412 public boolean getIsDefaultHasBeenModified() { 413 return isDefaultHasBeenModified; 414 } 415 416 @Nonnull 417 public Integer getSortOrder() { 418 return sortOrder; 419 } 420 421 public void setSortOrder(@Nonnull Integer sortOrder) 422 throws PersistenceNotNullException { 423 checkForNull(sortOrder); 424 425 boolean update = true; 426 427 if(this.sortOrder != null) { 428 if(this.sortOrder.equals(sortOrder)) { 429 update = false; 430 } 431 } else if(sortOrder == null) { 432 update = false; 433 } 434 435 if(update) { 436 this.sortOrder = sortOrder; 437 sortOrderHasBeenModified = true; 438 clearHashAndString(); 439 } 440 } 441 442 public boolean getSortOrderHasBeenModified() { 443 return sortOrderHasBeenModified; 444 } 445 446 @Nonnull 447 public Long getFromTime() { 448 return fromTime; 449 } 450 451 public void setFromTime(@Nonnull 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 @Nonnull 477 public Long getThruTime() { 478 return thruTime; 479 } 480 481 public void setThruTime(@Nonnull Long thruTime) 482 throws PersistenceNotNullException { 483 checkForNull(thruTime); 484 485 boolean update = true; 486 487 if(this.thruTime != null) { 488 if(this.thruTime.equals(thruTime)) { 489 update = false; 490 } 491 } else if(thruTime == null) { 492 update = false; 493 } 494 495 if(update) { 496 this.thruTime = thruTime; 497 thruTimeHasBeenModified = true; 498 clearHashAndString(); 499 } 500 } 501 502 public boolean getThruTimeHasBeenModified() { 503 return thruTimeHasBeenModified; 504 } 505 506}