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