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