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