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 * 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 StringBuilder stringValue = new StringBuilder("{"); 154 155 stringValue.append("entityId=").append(getEntityId()); 156 157 stringValue.append(", itemCategoryPK=").append(getItemCategoryPK()); 158 stringValue.append(", itemCategoryName=").append(getItemCategoryName()); 159 stringValue.append(", parentItemCategoryPK=").append(getParentItemCategoryPK()); 160 stringValue.append(", itemSequencePK=").append(getItemSequencePK()); 161 stringValue.append(", isDefault=").append(getIsDefault()); 162 stringValue.append(", sortOrder=").append(getSortOrder()); 163 stringValue.append(", fromTime=").append(getFromTime()); 164 stringValue.append(", thruTime=").append(getThruTime()); 165 166 stringValue.append('}'); 167 168 _stringValue = stringValue.toString(); 169 } 170 return _stringValue; 171 } 172 173 @Override 174 public boolean equals(Object other) { 175 if(this == other) 176 return true; 177 178 if(!hasIdentity()) 179 return false; 180 181 if(other instanceof ItemCategoryDetailValue) { 182 ItemCategoryDetailValue that = (ItemCategoryDetailValue)other; 183 184 if(!that.hasIdentity()) 185 return false; 186 187 Long thisEntityId = getEntityId(); 188 Long thatEntityId = that.getEntityId(); 189 190 boolean objectsEqual = thisEntityId.equals(thatEntityId); 191 if(objectsEqual) 192 objectsEqual = objectsEqual && isIdentical(that); 193 194 return objectsEqual; 195 } else { 196 return false; 197 } 198 } 199 200 public boolean isIdentical(Object other) { 201 if(other instanceof ItemCategoryDetailValue) { 202 ItemCategoryDetailValue that = (ItemCategoryDetailValue)other; 203 boolean objectsEqual = true; 204 205 206 if(objectsEqual) { 207 ItemCategoryPK thisItemCategoryPK = getItemCategoryPK(); 208 ItemCategoryPK thatItemCategoryPK = that.getItemCategoryPK(); 209 210 if(thisItemCategoryPK == null) { 211 objectsEqual = objectsEqual && (thatItemCategoryPK == null); 212 } else { 213 objectsEqual = objectsEqual && thisItemCategoryPK.equals(thatItemCategoryPK); 214 } 215 } 216 217 if(objectsEqual) { 218 String thisItemCategoryName = getItemCategoryName(); 219 String thatItemCategoryName = that.getItemCategoryName(); 220 221 if(thisItemCategoryName == null) { 222 objectsEqual = objectsEqual && (thatItemCategoryName == null); 223 } else { 224 objectsEqual = objectsEqual && thisItemCategoryName.equals(thatItemCategoryName); 225 } 226 } 227 228 if(objectsEqual) { 229 ItemCategoryPK thisParentItemCategoryPK = getParentItemCategoryPK(); 230 ItemCategoryPK thatParentItemCategoryPK = that.getParentItemCategoryPK(); 231 232 if(thisParentItemCategoryPK == null) { 233 objectsEqual = objectsEqual && (thatParentItemCategoryPK == null); 234 } else { 235 objectsEqual = objectsEqual && thisParentItemCategoryPK.equals(thatParentItemCategoryPK); 236 } 237 } 238 239 if(objectsEqual) { 240 SequencePK thisItemSequencePK = getItemSequencePK(); 241 SequencePK thatItemSequencePK = that.getItemSequencePK(); 242 243 if(thisItemSequencePK == null) { 244 objectsEqual = objectsEqual && (thatItemSequencePK == null); 245 } else { 246 objectsEqual = objectsEqual && thisItemSequencePK.equals(thatItemSequencePK); 247 } 248 } 249 250 if(objectsEqual) { 251 Boolean thisIsDefault = getIsDefault(); 252 Boolean thatIsDefault = that.getIsDefault(); 253 254 if(thisIsDefault == null) { 255 objectsEqual = objectsEqual && (thatIsDefault == null); 256 } else { 257 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 258 } 259 } 260 261 if(objectsEqual) { 262 Integer thisSortOrder = getSortOrder(); 263 Integer thatSortOrder = that.getSortOrder(); 264 265 if(thisSortOrder == null) { 266 objectsEqual = objectsEqual && (thatSortOrder == null); 267 } else { 268 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 269 } 270 } 271 272 if(objectsEqual) { 273 Long thisFromTime = getFromTime(); 274 Long thatFromTime = that.getFromTime(); 275 276 if(thisFromTime == null) { 277 objectsEqual = objectsEqual && (thatFromTime == null); 278 } else { 279 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 280 } 281 } 282 283 if(objectsEqual) { 284 Long thisThruTime = getThruTime(); 285 Long thatThruTime = that.getThruTime(); 286 287 if(thisThruTime == null) { 288 objectsEqual = objectsEqual && (thatThruTime == null); 289 } else { 290 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 291 } 292 } 293 294 return objectsEqual; 295 } else { 296 return false; 297 } 298 } 299 300 @Override 301 public boolean hasBeenModified() { 302 return itemCategoryPKHasBeenModified || itemCategoryNameHasBeenModified || parentItemCategoryPKHasBeenModified || itemSequencePKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 303 } 304 305 @Override 306 public void clearHasBeenModified() { 307 itemCategoryPKHasBeenModified = false; 308 itemCategoryNameHasBeenModified = false; 309 parentItemCategoryPKHasBeenModified = false; 310 itemSequencePKHasBeenModified = false; 311 isDefaultHasBeenModified = false; 312 sortOrderHasBeenModified = false; 313 fromTimeHasBeenModified = false; 314 thruTimeHasBeenModified = false; 315 } 316 317 public ItemCategoryPK getItemCategoryPK() { 318 return itemCategoryPK; 319 } 320 321 public void setItemCategoryPK(ItemCategoryPK itemCategoryPK) 322 throws PersistenceNotNullException { 323 checkForNull(itemCategoryPK); 324 325 boolean update = true; 326 327 if(this.itemCategoryPK != null) { 328 if(this.itemCategoryPK.equals(itemCategoryPK)) { 329 update = false; 330 } 331 } else if(itemCategoryPK == null) { 332 update = false; 333 } 334 335 if(update) { 336 this.itemCategoryPK = itemCategoryPK; 337 itemCategoryPKHasBeenModified = true; 338 clearHashAndString(); 339 } 340 } 341 342 public boolean getItemCategoryPKHasBeenModified() { 343 return itemCategoryPKHasBeenModified; 344 } 345 346 public String getItemCategoryName() { 347 return itemCategoryName; 348 } 349 350 public void setItemCategoryName(String itemCategoryName) 351 throws PersistenceNotNullException { 352 checkForNull(itemCategoryName); 353 354 boolean update = true; 355 356 if(this.itemCategoryName != null) { 357 if(this.itemCategoryName.equals(itemCategoryName)) { 358 update = false; 359 } 360 } else if(itemCategoryName == null) { 361 update = false; 362 } 363 364 if(update) { 365 this.itemCategoryName = itemCategoryName; 366 itemCategoryNameHasBeenModified = true; 367 clearHashAndString(); 368 } 369 } 370 371 public boolean getItemCategoryNameHasBeenModified() { 372 return itemCategoryNameHasBeenModified; 373 } 374 375 public ItemCategoryPK getParentItemCategoryPK() { 376 return parentItemCategoryPK; 377 } 378 379 public void setParentItemCategoryPK(ItemCategoryPK parentItemCategoryPK) { 380 boolean update = true; 381 382 if(this.parentItemCategoryPK != null) { 383 if(this.parentItemCategoryPK.equals(parentItemCategoryPK)) { 384 update = false; 385 } 386 } else if(parentItemCategoryPK == null) { 387 update = false; 388 } 389 390 if(update) { 391 this.parentItemCategoryPK = parentItemCategoryPK; 392 parentItemCategoryPKHasBeenModified = true; 393 clearHashAndString(); 394 } 395 } 396 397 public boolean getParentItemCategoryPKHasBeenModified() { 398 return parentItemCategoryPKHasBeenModified; 399 } 400 401 public SequencePK getItemSequencePK() { 402 return itemSequencePK; 403 } 404 405 public void setItemSequencePK(SequencePK itemSequencePK) { 406 boolean update = true; 407 408 if(this.itemSequencePK != null) { 409 if(this.itemSequencePK.equals(itemSequencePK)) { 410 update = false; 411 } 412 } else if(itemSequencePK == null) { 413 update = false; 414 } 415 416 if(update) { 417 this.itemSequencePK = itemSequencePK; 418 itemSequencePKHasBeenModified = true; 419 clearHashAndString(); 420 } 421 } 422 423 public boolean getItemSequencePKHasBeenModified() { 424 return itemSequencePKHasBeenModified; 425 } 426 427 public Boolean getIsDefault() { 428 return isDefault; 429 } 430 431 public void setIsDefault(Boolean isDefault) 432 throws PersistenceNotNullException { 433 checkForNull(isDefault); 434 435 boolean update = true; 436 437 if(this.isDefault != null) { 438 if(this.isDefault.equals(isDefault)) { 439 update = false; 440 } 441 } else if(isDefault == null) { 442 update = false; 443 } 444 445 if(update) { 446 this.isDefault = isDefault; 447 isDefaultHasBeenModified = true; 448 clearHashAndString(); 449 } 450 } 451 452 public boolean getIsDefaultHasBeenModified() { 453 return isDefaultHasBeenModified; 454 } 455 456 public Integer getSortOrder() { 457 return sortOrder; 458 } 459 460 public void setSortOrder(Integer sortOrder) 461 throws PersistenceNotNullException { 462 checkForNull(sortOrder); 463 464 boolean update = true; 465 466 if(this.sortOrder != null) { 467 if(this.sortOrder.equals(sortOrder)) { 468 update = false; 469 } 470 } else if(sortOrder == null) { 471 update = false; 472 } 473 474 if(update) { 475 this.sortOrder = sortOrder; 476 sortOrderHasBeenModified = true; 477 clearHashAndString(); 478 } 479 } 480 481 public boolean getSortOrderHasBeenModified() { 482 return sortOrderHasBeenModified; 483 } 484 485 public Long getFromTime() { 486 return fromTime; 487 } 488 489 public void setFromTime(Long fromTime) 490 throws PersistenceNotNullException { 491 checkForNull(fromTime); 492 493 boolean update = true; 494 495 if(this.fromTime != null) { 496 if(this.fromTime.equals(fromTime)) { 497 update = false; 498 } 499 } else if(fromTime == null) { 500 update = false; 501 } 502 503 if(update) { 504 this.fromTime = fromTime; 505 fromTimeHasBeenModified = true; 506 clearHashAndString(); 507 } 508 } 509 510 public boolean getFromTimeHasBeenModified() { 511 return fromTimeHasBeenModified; 512 } 513 514 public Long getThruTime() { 515 return thruTime; 516 } 517 518 public void setThruTime(Long thruTime) 519 throws PersistenceNotNullException { 520 checkForNull(thruTime); 521 522 boolean update = true; 523 524 if(this.thruTime != null) { 525 if(this.thruTime.equals(thruTime)) { 526 update = false; 527 } 528 } else if(thruTime == null) { 529 update = false; 530 } 531 532 if(update) { 533 this.thruTime = thruTime; 534 thruTimeHasBeenModified = true; 535 clearHashAndString(); 536 } 537 } 538 539 public boolean getThruTimeHasBeenModified() { 540 return thruTimeHasBeenModified; 541 } 542 543}