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