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