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 * 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 041public class ItemTaxClassificationDetailValue 042 extends BaseValue<ItemTaxClassificationDetailPK> 043 implements Cloneable, Serializable { 044 045 private ItemTaxClassificationPK itemTaxClassificationPK; 046 private boolean itemTaxClassificationPKHasBeenModified = false; 047 private ItemPK itemPK; 048 private boolean itemPKHasBeenModified = false; 049 private GeoCodePK countryGeoCodePK; 050 private boolean countryGeoCodePKHasBeenModified = false; 051 private TaxClassificationPK taxClassificationPK; 052 private boolean taxClassificationPKHasBeenModified = false; 053 private Long fromTime; 054 private boolean fromTimeHasBeenModified = false; 055 private Long thruTime; 056 private boolean thruTimeHasBeenModified = false; 057 058 private transient Integer _hashCode = null; 059 private transient String _stringValue = null; 060 061 private void constructFields(ItemTaxClassificationPK itemTaxClassificationPK, ItemPK itemPK, GeoCodePK countryGeoCodePK, TaxClassificationPK taxClassificationPK, Long fromTime, Long thruTime) 062 throws PersistenceNotNullException { 063 checkForNull(itemTaxClassificationPK); 064 this.itemTaxClassificationPK = itemTaxClassificationPK; 065 checkForNull(itemPK); 066 this.itemPK = itemPK; 067 checkForNull(countryGeoCodePK); 068 this.countryGeoCodePK = countryGeoCodePK; 069 checkForNull(taxClassificationPK); 070 this.taxClassificationPK = taxClassificationPK; 071 checkForNull(fromTime); 072 this.fromTime = fromTime; 073 checkForNull(thruTime); 074 this.thruTime = thruTime; 075 } 076 077 /** Creates a new instance of ItemTaxClassificationDetailValue */ 078 public ItemTaxClassificationDetailValue(ItemTaxClassificationDetailPK itemTaxClassificationDetailPK, ItemTaxClassificationPK itemTaxClassificationPK, ItemPK itemPK, GeoCodePK countryGeoCodePK, TaxClassificationPK taxClassificationPK, Long fromTime, Long thruTime) 079 throws PersistenceNotNullException { 080 super(itemTaxClassificationDetailPK); 081 constructFields(itemTaxClassificationPK, itemPK, countryGeoCodePK, taxClassificationPK, fromTime, thruTime); 082 } 083 084 /** Creates a new instance of ItemTaxClassificationDetailValue */ 085 public ItemTaxClassificationDetailValue(ItemTaxClassificationPK itemTaxClassificationPK, ItemPK itemPK, GeoCodePK countryGeoCodePK, TaxClassificationPK taxClassificationPK, Long fromTime, Long thruTime) 086 throws PersistenceNotNullException { 087 super(); 088 constructFields(itemTaxClassificationPK, itemPK, countryGeoCodePK, taxClassificationPK, fromTime, thruTime); 089 } 090 091 @Override 092 public ItemTaxClassificationDetailFactory getBaseFactoryInstance() { 093 return ItemTaxClassificationDetailFactory.getInstance(); 094 } 095 096 @Override 097 public ItemTaxClassificationDetailValue clone() { 098 Object result; 099 100 try { 101 result = super.clone(); 102 } catch (CloneNotSupportedException cnse) { 103 // This shouldn't happen, fail when it does. 104 throw new PersistenceCloneException(cnse); 105 } 106 107 return (ItemTaxClassificationDetailValue)result; 108 } 109 110 @Override 111 public ItemTaxClassificationDetailPK getPrimaryKey() { 112 if(_primaryKey == null) { 113 _primaryKey = new ItemTaxClassificationDetailPK(entityId); 114 } 115 116 return _primaryKey; 117 } 118 119 private void clearHashAndString() { 120 _hashCode = null; 121 _stringValue = null; 122 } 123 124 @Override 125 public int hashCode() { 126 if(_hashCode == null) { 127 int hashCode = 17; 128 129 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 130 131 hashCode = 37 * hashCode + ((itemTaxClassificationPK != null) ? itemTaxClassificationPK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((itemPK != null) ? itemPK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((countryGeoCodePK != null) ? countryGeoCodePK.hashCode() : 0); 134 hashCode = 37 * hashCode + ((taxClassificationPK != null) ? taxClassificationPK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 136 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 137 138 _hashCode = hashCode; 139 } 140 141 return _hashCode; 142 } 143 144 @Override 145 public String toString() { 146 if(_stringValue == null) { 147 StringBuilder stringValue = new StringBuilder("{"); 148 149 stringValue.append("entityId=").append(getEntityId()); 150 151 stringValue.append(", itemTaxClassificationPK=").append(getItemTaxClassificationPK()); 152 stringValue.append(", itemPK=").append(getItemPK()); 153 stringValue.append(", countryGeoCodePK=").append(getCountryGeoCodePK()); 154 stringValue.append(", taxClassificationPK=").append(getTaxClassificationPK()); 155 stringValue.append(", fromTime=").append(getFromTime()); 156 stringValue.append(", thruTime=").append(getThruTime()); 157 158 stringValue.append('}'); 159 160 _stringValue = stringValue.toString(); 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 ItemTaxClassificationDetailValue) { 174 ItemTaxClassificationDetailValue that = (ItemTaxClassificationDetailValue)other; 175 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 = 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) { 194 ItemTaxClassificationDetailValue that = (ItemTaxClassificationDetailValue)other; 195 boolean objectsEqual = true; 196 197 198 if(objectsEqual) { 199 ItemTaxClassificationPK thisItemTaxClassificationPK = getItemTaxClassificationPK(); 200 ItemTaxClassificationPK thatItemTaxClassificationPK = that.getItemTaxClassificationPK(); 201 202 if(thisItemTaxClassificationPK == null) { 203 objectsEqual = objectsEqual && (thatItemTaxClassificationPK == null); 204 } else { 205 objectsEqual = objectsEqual && thisItemTaxClassificationPK.equals(thatItemTaxClassificationPK); 206 } 207 } 208 209 if(objectsEqual) { 210 ItemPK thisItemPK = getItemPK(); 211 ItemPK thatItemPK = that.getItemPK(); 212 213 if(thisItemPK == null) { 214 objectsEqual = objectsEqual && (thatItemPK == null); 215 } else { 216 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 217 } 218 } 219 220 if(objectsEqual) { 221 GeoCodePK thisCountryGeoCodePK = getCountryGeoCodePK(); 222 GeoCodePK thatCountryGeoCodePK = that.getCountryGeoCodePK(); 223 224 if(thisCountryGeoCodePK == null) { 225 objectsEqual = objectsEqual && (thatCountryGeoCodePK == null); 226 } else { 227 objectsEqual = objectsEqual && thisCountryGeoCodePK.equals(thatCountryGeoCodePK); 228 } 229 } 230 231 if(objectsEqual) { 232 TaxClassificationPK thisTaxClassificationPK = getTaxClassificationPK(); 233 TaxClassificationPK thatTaxClassificationPK = that.getTaxClassificationPK(); 234 235 if(thisTaxClassificationPK == null) { 236 objectsEqual = objectsEqual && (thatTaxClassificationPK == null); 237 } else { 238 objectsEqual = objectsEqual && thisTaxClassificationPK.equals(thatTaxClassificationPK); 239 } 240 } 241 242 if(objectsEqual) { 243 Long thisFromTime = getFromTime(); 244 Long thatFromTime = that.getFromTime(); 245 246 if(thisFromTime == null) { 247 objectsEqual = objectsEqual && (thatFromTime == null); 248 } else { 249 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 250 } 251 } 252 253 if(objectsEqual) { 254 Long thisThruTime = getThruTime(); 255 Long thatThruTime = that.getThruTime(); 256 257 if(thisThruTime == null) { 258 objectsEqual = objectsEqual && (thatThruTime == null); 259 } else { 260 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 261 } 262 } 263 264 return objectsEqual; 265 } else { 266 return false; 267 } 268 } 269 270 @Override 271 public boolean hasBeenModified() { 272 return itemTaxClassificationPKHasBeenModified || itemPKHasBeenModified || countryGeoCodePKHasBeenModified || taxClassificationPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 273 } 274 275 @Override 276 public void clearHasBeenModified() { 277 itemTaxClassificationPKHasBeenModified = false; 278 itemPKHasBeenModified = false; 279 countryGeoCodePKHasBeenModified = false; 280 taxClassificationPKHasBeenModified = false; 281 fromTimeHasBeenModified = false; 282 thruTimeHasBeenModified = false; 283 } 284 285 public ItemTaxClassificationPK getItemTaxClassificationPK() { 286 return itemTaxClassificationPK; 287 } 288 289 public void setItemTaxClassificationPK(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 public ItemPK getItemPK() { 315 return itemPK; 316 } 317 318 public void setItemPK(ItemPK itemPK) 319 throws PersistenceNotNullException { 320 checkForNull(itemPK); 321 322 boolean update = true; 323 324 if(this.itemPK != null) { 325 if(this.itemPK.equals(itemPK)) { 326 update = false; 327 } 328 } else if(itemPK == null) { 329 update = false; 330 } 331 332 if(update) { 333 this.itemPK = itemPK; 334 itemPKHasBeenModified = true; 335 clearHashAndString(); 336 } 337 } 338 339 public boolean getItemPKHasBeenModified() { 340 return itemPKHasBeenModified; 341 } 342 343 public GeoCodePK getCountryGeoCodePK() { 344 return countryGeoCodePK; 345 } 346 347 public void setCountryGeoCodePK(GeoCodePK countryGeoCodePK) 348 throws PersistenceNotNullException { 349 checkForNull(countryGeoCodePK); 350 351 boolean update = true; 352 353 if(this.countryGeoCodePK != null) { 354 if(this.countryGeoCodePK.equals(countryGeoCodePK)) { 355 update = false; 356 } 357 } else if(countryGeoCodePK == null) { 358 update = false; 359 } 360 361 if(update) { 362 this.countryGeoCodePK = countryGeoCodePK; 363 countryGeoCodePKHasBeenModified = true; 364 clearHashAndString(); 365 } 366 } 367 368 public boolean getCountryGeoCodePKHasBeenModified() { 369 return countryGeoCodePKHasBeenModified; 370 } 371 372 public TaxClassificationPK getTaxClassificationPK() { 373 return taxClassificationPK; 374 } 375 376 public void setTaxClassificationPK(TaxClassificationPK taxClassificationPK) 377 throws PersistenceNotNullException { 378 checkForNull(taxClassificationPK); 379 380 boolean update = true; 381 382 if(this.taxClassificationPK != null) { 383 if(this.taxClassificationPK.equals(taxClassificationPK)) { 384 update = false; 385 } 386 } else if(taxClassificationPK == null) { 387 update = false; 388 } 389 390 if(update) { 391 this.taxClassificationPK = taxClassificationPK; 392 taxClassificationPKHasBeenModified = true; 393 clearHashAndString(); 394 } 395 } 396 397 public boolean getTaxClassificationPKHasBeenModified() { 398 return taxClassificationPKHasBeenModified; 399 } 400 401 public Long getFromTime() { 402 return fromTime; 403 } 404 405 public void setFromTime(Long fromTime) 406 throws PersistenceNotNullException { 407 checkForNull(fromTime); 408 409 boolean update = true; 410 411 if(this.fromTime != null) { 412 if(this.fromTime.equals(fromTime)) { 413 update = false; 414 } 415 } else if(fromTime == null) { 416 update = false; 417 } 418 419 if(update) { 420 this.fromTime = fromTime; 421 fromTimeHasBeenModified = true; 422 clearHashAndString(); 423 } 424 } 425 426 public boolean getFromTimeHasBeenModified() { 427 return fromTimeHasBeenModified; 428 } 429 430 public Long getThruTime() { 431 return thruTime; 432 } 433 434 public void setThruTime(Long thruTime) 435 throws PersistenceNotNullException { 436 checkForNull(thruTime); 437 438 boolean update = true; 439 440 if(this.thruTime != null) { 441 if(this.thruTime.equals(thruTime)) { 442 update = false; 443 } 444 } else if(thruTime == null) { 445 update = false; 446 } 447 448 if(update) { 449 this.thruTime = thruTime; 450 thruTimeHasBeenModified = true; 451 clearHashAndString(); 452 } 453 } 454 455 public boolean getThruTimeHasBeenModified() { 456 return thruTimeHasBeenModified; 457 } 458 459}