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