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 * TaxClassificationTranslationValue.java 021 */ 022 023package com.echothree.model.data.tax.server.value; 024 025import com.echothree.model.data.tax.common.pk.TaxClassificationTranslationPK; 026 027import com.echothree.model.data.tax.server.factory.TaxClassificationTranslationFactory; 028 029import com.echothree.model.data.tax.common.pk.TaxClassificationPK; 030import com.echothree.model.data.party.common.pk.LanguagePK; 031import com.echothree.model.data.core.common.pk.MimeTypePK; 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 TaxClassificationTranslationValue 041 extends BaseValue<TaxClassificationTranslationPK> 042 implements Cloneable, Serializable { 043 044 private TaxClassificationPK taxClassificationPK; 045 private boolean taxClassificationPKHasBeenModified = false; 046 private LanguagePK languagePK; 047 private boolean languagePKHasBeenModified = false; 048 private String description; 049 private boolean descriptionHasBeenModified = false; 050 private MimeTypePK overviewMimeTypePK; 051 private boolean overviewMimeTypePKHasBeenModified = false; 052 private String overview; 053 private boolean overviewHasBeenModified = 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(TaxClassificationPK taxClassificationPK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, Long fromTime, Long thruTime) 063 throws PersistenceNotNullException { 064 checkForNull(taxClassificationPK); 065 this.taxClassificationPK = taxClassificationPK; 066 checkForNull(languagePK); 067 this.languagePK = languagePK; 068 checkForNull(description); 069 this.description = description; 070 this.overviewMimeTypePK = overviewMimeTypePK; 071 this.overview = overview; 072 checkForNull(fromTime); 073 this.fromTime = fromTime; 074 checkForNull(thruTime); 075 this.thruTime = thruTime; 076 } 077 078 /** Creates a new instance of TaxClassificationTranslationValue */ 079 public TaxClassificationTranslationValue(TaxClassificationTranslationPK taxClassificationTranslationPK, TaxClassificationPK taxClassificationPK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, Long fromTime, Long thruTime) 080 throws PersistenceNotNullException { 081 super(taxClassificationTranslationPK); 082 constructFields(taxClassificationPK, languagePK, description, overviewMimeTypePK, overview, fromTime, thruTime); 083 } 084 085 /** Creates a new instance of TaxClassificationTranslationValue */ 086 public TaxClassificationTranslationValue(TaxClassificationPK taxClassificationPK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, Long fromTime, Long thruTime) 087 throws PersistenceNotNullException { 088 super(); 089 constructFields(taxClassificationPK, languagePK, description, overviewMimeTypePK, overview, fromTime, thruTime); 090 } 091 092 @Override 093 public TaxClassificationTranslationFactory getBaseFactoryInstance() { 094 return TaxClassificationTranslationFactory.getInstance(); 095 } 096 097 @Override 098 public TaxClassificationTranslationValue clone() { 099 Object result; 100 101 try { 102 result = super.clone(); 103 } catch (CloneNotSupportedException cnse) { 104 // This shouldn't happen, fail when it does. 105 throw new PersistenceCloneException(cnse); 106 } 107 108 return (TaxClassificationTranslationValue)result; 109 } 110 111 @Override 112 public TaxClassificationTranslationPK getPrimaryKey() { 113 if(_primaryKey == null) { 114 _primaryKey = new TaxClassificationTranslationPK(entityId); 115 } 116 117 return _primaryKey; 118 } 119 120 private void clearHashAndString() { 121 _hashCode = null; 122 _stringValue = null; 123 } 124 125 @Override 126 public int hashCode() { 127 if(_hashCode == null) { 128 int hashCode = 17; 129 130 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 131 132 hashCode = 37 * hashCode + ((taxClassificationPK != null) ? taxClassificationPK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0); 134 hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0); 135 hashCode = 37 * hashCode + ((overviewMimeTypePK != null) ? overviewMimeTypePK.hashCode() : 0); 136 hashCode = 37 * hashCode + ((overview != null) ? overview.hashCode() : 0); 137 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 138 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 139 140 _hashCode = hashCode; 141 } 142 143 return _hashCode; 144 } 145 146 @Override 147 public String toString() { 148 if(_stringValue == null) { 149 StringBuilder stringValue = new StringBuilder("{"); 150 151 stringValue.append("entityId=").append(getEntityId()); 152 153 stringValue.append(", taxClassificationPK=").append(getTaxClassificationPK()); 154 stringValue.append(", languagePK=").append(getLanguagePK()); 155 stringValue.append(", description=").append(getDescription()); 156 stringValue.append(", overviewMimeTypePK=").append(getOverviewMimeTypePK()); 157 stringValue.append(", overview=").append(getOverview()); 158 stringValue.append(", fromTime=").append(getFromTime()); 159 stringValue.append(", thruTime=").append(getThruTime()); 160 161 stringValue.append('}'); 162 163 _stringValue = stringValue.toString(); 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 TaxClassificationTranslationValue) { 177 TaxClassificationTranslationValue that = (TaxClassificationTranslationValue)other; 178 179 if(!that.hasIdentity()) 180 return false; 181 182 Long thisEntityId = getEntityId(); 183 Long thatEntityId = that.getEntityId(); 184 185 boolean objectsEqual = thisEntityId.equals(thatEntityId); 186 if(objectsEqual) 187 objectsEqual = objectsEqual && isIdentical(that); 188 189 return objectsEqual; 190 } else { 191 return false; 192 } 193 } 194 195 public boolean isIdentical(Object other) { 196 if(other instanceof TaxClassificationTranslationValue) { 197 TaxClassificationTranslationValue that = (TaxClassificationTranslationValue)other; 198 boolean objectsEqual = true; 199 200 201 if(objectsEqual) { 202 TaxClassificationPK thisTaxClassificationPK = getTaxClassificationPK(); 203 TaxClassificationPK thatTaxClassificationPK = that.getTaxClassificationPK(); 204 205 if(thisTaxClassificationPK == null) { 206 objectsEqual = objectsEqual && (thatTaxClassificationPK == null); 207 } else { 208 objectsEqual = objectsEqual && thisTaxClassificationPK.equals(thatTaxClassificationPK); 209 } 210 } 211 212 if(objectsEqual) { 213 LanguagePK thisLanguagePK = getLanguagePK(); 214 LanguagePK thatLanguagePK = that.getLanguagePK(); 215 216 if(thisLanguagePK == null) { 217 objectsEqual = objectsEqual && (thatLanguagePK == null); 218 } else { 219 objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK); 220 } 221 } 222 223 if(objectsEqual) { 224 String thisDescription = getDescription(); 225 String thatDescription = that.getDescription(); 226 227 if(thisDescription == null) { 228 objectsEqual = objectsEqual && (thatDescription == null); 229 } else { 230 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 231 } 232 } 233 234 if(objectsEqual) { 235 MimeTypePK thisOverviewMimeTypePK = getOverviewMimeTypePK(); 236 MimeTypePK thatOverviewMimeTypePK = that.getOverviewMimeTypePK(); 237 238 if(thisOverviewMimeTypePK == null) { 239 objectsEqual = objectsEqual && (thatOverviewMimeTypePK == null); 240 } else { 241 objectsEqual = objectsEqual && thisOverviewMimeTypePK.equals(thatOverviewMimeTypePK); 242 } 243 } 244 245 if(objectsEqual) { 246 String thisOverview = getOverview(); 247 String thatOverview = that.getOverview(); 248 249 if(thisOverview == null) { 250 objectsEqual = objectsEqual && (thatOverview == null); 251 } else { 252 objectsEqual = objectsEqual && thisOverview.equals(thatOverview); 253 } 254 } 255 256 if(objectsEqual) { 257 Long thisFromTime = getFromTime(); 258 Long thatFromTime = that.getFromTime(); 259 260 if(thisFromTime == null) { 261 objectsEqual = objectsEqual && (thatFromTime == null); 262 } else { 263 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 264 } 265 } 266 267 if(objectsEqual) { 268 Long thisThruTime = getThruTime(); 269 Long thatThruTime = that.getThruTime(); 270 271 if(thisThruTime == null) { 272 objectsEqual = objectsEqual && (thatThruTime == null); 273 } else { 274 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 275 } 276 } 277 278 return objectsEqual; 279 } else { 280 return false; 281 } 282 } 283 284 @Override 285 public boolean hasBeenModified() { 286 return taxClassificationPKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified || overviewMimeTypePKHasBeenModified || overviewHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 287 } 288 289 @Override 290 public void clearHasBeenModified() { 291 taxClassificationPKHasBeenModified = false; 292 languagePKHasBeenModified = false; 293 descriptionHasBeenModified = false; 294 overviewMimeTypePKHasBeenModified = false; 295 overviewHasBeenModified = false; 296 fromTimeHasBeenModified = false; 297 thruTimeHasBeenModified = false; 298 } 299 300 public TaxClassificationPK getTaxClassificationPK() { 301 return taxClassificationPK; 302 } 303 304 public void setTaxClassificationPK(TaxClassificationPK taxClassificationPK) 305 throws PersistenceNotNullException { 306 checkForNull(taxClassificationPK); 307 308 boolean update = true; 309 310 if(this.taxClassificationPK != null) { 311 if(this.taxClassificationPK.equals(taxClassificationPK)) { 312 update = false; 313 } 314 } else if(taxClassificationPK == null) { 315 update = false; 316 } 317 318 if(update) { 319 this.taxClassificationPK = taxClassificationPK; 320 taxClassificationPKHasBeenModified = true; 321 clearHashAndString(); 322 } 323 } 324 325 public boolean getTaxClassificationPKHasBeenModified() { 326 return taxClassificationPKHasBeenModified; 327 } 328 329 public LanguagePK getLanguagePK() { 330 return languagePK; 331 } 332 333 public void setLanguagePK(LanguagePK languagePK) 334 throws PersistenceNotNullException { 335 checkForNull(languagePK); 336 337 boolean update = true; 338 339 if(this.languagePK != null) { 340 if(this.languagePK.equals(languagePK)) { 341 update = false; 342 } 343 } else if(languagePK == null) { 344 update = false; 345 } 346 347 if(update) { 348 this.languagePK = languagePK; 349 languagePKHasBeenModified = true; 350 clearHashAndString(); 351 } 352 } 353 354 public boolean getLanguagePKHasBeenModified() { 355 return languagePKHasBeenModified; 356 } 357 358 public String getDescription() { 359 return description; 360 } 361 362 public void setDescription(String description) 363 throws PersistenceNotNullException { 364 checkForNull(description); 365 366 boolean update = true; 367 368 if(this.description != null) { 369 if(this.description.equals(description)) { 370 update = false; 371 } 372 } else if(description == null) { 373 update = false; 374 } 375 376 if(update) { 377 this.description = description; 378 descriptionHasBeenModified = true; 379 clearHashAndString(); 380 } 381 } 382 383 public boolean getDescriptionHasBeenModified() { 384 return descriptionHasBeenModified; 385 } 386 387 public MimeTypePK getOverviewMimeTypePK() { 388 return overviewMimeTypePK; 389 } 390 391 public void setOverviewMimeTypePK(MimeTypePK overviewMimeTypePK) { 392 boolean update = true; 393 394 if(this.overviewMimeTypePK != null) { 395 if(this.overviewMimeTypePK.equals(overviewMimeTypePK)) { 396 update = false; 397 } 398 } else if(overviewMimeTypePK == null) { 399 update = false; 400 } 401 402 if(update) { 403 this.overviewMimeTypePK = overviewMimeTypePK; 404 overviewMimeTypePKHasBeenModified = true; 405 clearHashAndString(); 406 } 407 } 408 409 public boolean getOverviewMimeTypePKHasBeenModified() { 410 return overviewMimeTypePKHasBeenModified; 411 } 412 413 public String getOverview() { 414 return overview; 415 } 416 417 public void setOverview(String overview) { 418 boolean update = true; 419 420 if(this.overview != null) { 421 if(this.overview.equals(overview)) { 422 update = false; 423 } 424 } else if(overview == null) { 425 update = false; 426 } 427 428 if(update) { 429 this.overview = overview; 430 overviewHasBeenModified = true; 431 clearHashAndString(); 432 } 433 } 434 435 public boolean getOverviewHasBeenModified() { 436 return overviewHasBeenModified; 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}