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 * GlAccountDescriptionValue.java 021 */ 022 023package com.echothree.model.data.accounting.server.value; 024 025import com.echothree.model.data.accounting.common.pk.GlAccountDescriptionPK; 026 027import com.echothree.model.data.accounting.server.factory.GlAccountDescriptionFactory; 028 029import com.echothree.model.data.accounting.common.pk.GlAccountPK; 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 GlAccountDescriptionValue 043 extends BaseValue<GlAccountDescriptionPK> 044 implements Cloneable, Serializable { 045 046 private GlAccountPK glAccountPK; 047 private boolean glAccountPKHasBeenModified = 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(GlAccountPK glAccountPK, LanguagePK languagePK, String description, Long fromTime, Long thruTime) 061 throws PersistenceNotNullException { 062 checkForNull(glAccountPK); 063 this.glAccountPK = glAccountPK; 064 checkForNull(languagePK); 065 this.languagePK = languagePK; 066 checkForNull(description); 067 this.description = description; 068 checkForNull(fromTime); 069 this.fromTime = fromTime; 070 checkForNull(thruTime); 071 this.thruTime = thruTime; 072 } 073 074 /** Creates a new instance of GlAccountDescriptionValue */ 075 public GlAccountDescriptionValue(GlAccountDescriptionPK glAccountDescriptionPK, GlAccountPK glAccountPK, LanguagePK languagePK, String description, Long fromTime, Long thruTime) 076 throws PersistenceNotNullException { 077 super(glAccountDescriptionPK); 078 constructFields(glAccountPK, languagePK, description, fromTime, thruTime); 079 } 080 081 /** Creates a new instance of GlAccountDescriptionValue */ 082 public GlAccountDescriptionValue(GlAccountPK glAccountPK, LanguagePK languagePK, String description, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(); 085 constructFields(glAccountPK, languagePK, description, fromTime, thruTime); 086 } 087 088 @Override 089 @Nonnull 090 public GlAccountDescriptionFactory getBaseFactoryInstance() { 091 return GlAccountDescriptionFactory.getInstance(); 092 } 093 094 @Override 095 @Nonnull 096 public GlAccountDescriptionValue clone() { 097 Object result; 098 099 try { 100 result = super.clone(); 101 } catch (CloneNotSupportedException cnse) { 102 // This shouldn't happen, fail when it does. 103 throw new PersistenceCloneException(cnse); 104 } 105 106 return (GlAccountDescriptionValue)result; 107 } 108 109 @Override 110 @Nonnull 111 public GlAccountDescriptionPK getPrimaryKey() { 112 if(_primaryKey == null) { 113 _primaryKey = new GlAccountDescriptionPK(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 + ((glAccountPK != null) ? glAccountPK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0); 134 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 135 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 136 137 _hashCode = hashCode; 138 } 139 140 return _hashCode; 141 } 142 143 @Override 144 @Nonnull 145 public String toString() { 146 if(_stringValue == null) { 147 _stringValue = "{" + 148 "entityId=" + getEntityId() + 149 ", glAccountPK=" + getGlAccountPK() + 150 ", languagePK=" + getLanguagePK() + 151 ", description=" + getDescription() + 152 ", fromTime=" + getFromTime() + 153 ", thruTime=" + getThruTime() + 154 "}"; 155 } 156 return _stringValue; 157 } 158 159 @Override 160 public boolean equals(Object other) { 161 if(this == other) 162 return true; 163 164 if(!hasIdentity()) 165 return false; 166 167 if(other instanceof GlAccountDescriptionValue that) { 168 if(!that.hasIdentity()) 169 return false; 170 171 Long thisEntityId = getEntityId(); 172 Long thatEntityId = that.getEntityId(); 173 174 boolean objectsEqual = thisEntityId.equals(thatEntityId); 175 if(objectsEqual) 176 objectsEqual = isIdentical(that); 177 178 return objectsEqual; 179 } else { 180 return false; 181 } 182 } 183 184 public boolean isIdentical(Object other) { 185 if(other instanceof GlAccountDescriptionValue that) { 186 boolean objectsEqual = true; 187 188 189 if(objectsEqual) { 190 GlAccountPK thisGlAccountPK = getGlAccountPK(); 191 GlAccountPK thatGlAccountPK = that.getGlAccountPK(); 192 193 if(thisGlAccountPK == null) { 194 objectsEqual = objectsEqual && (thatGlAccountPK == null); 195 } else { 196 objectsEqual = objectsEqual && thisGlAccountPK.equals(thatGlAccountPK); 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 glAccountPKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 253 } 254 255 @Override 256 public void clearHasBeenModified() { 257 glAccountPKHasBeenModified = false; 258 languagePKHasBeenModified = false; 259 descriptionHasBeenModified = false; 260 fromTimeHasBeenModified = false; 261 thruTimeHasBeenModified = false; 262 } 263 264 @Nonnull 265 public GlAccountPK getGlAccountPK() { 266 return glAccountPK; 267 } 268 269 public void setGlAccountPK(@Nonnull GlAccountPK glAccountPK) 270 throws PersistenceNotNullException { 271 checkForNull(glAccountPK); 272 273 boolean update = true; 274 275 if(this.glAccountPK != null) { 276 if(this.glAccountPK.equals(glAccountPK)) { 277 update = false; 278 } 279 } else if(glAccountPK == null) { 280 update = false; 281 } 282 283 if(update) { 284 this.glAccountPK = glAccountPK; 285 glAccountPKHasBeenModified = true; 286 clearHashAndString(); 287 } 288 } 289 290 public boolean getGlAccountPKHasBeenModified() { 291 return glAccountPKHasBeenModified; 292 } 293 294 @Nonnull 295 public LanguagePK getLanguagePK() { 296 return languagePK; 297 } 298 299 public void setLanguagePK(@Nonnull LanguagePK languagePK) 300 throws PersistenceNotNullException { 301 checkForNull(languagePK); 302 303 boolean update = true; 304 305 if(this.languagePK != null) { 306 if(this.languagePK.equals(languagePK)) { 307 update = false; 308 } 309 } else if(languagePK == null) { 310 update = false; 311 } 312 313 if(update) { 314 this.languagePK = languagePK; 315 languagePKHasBeenModified = true; 316 clearHashAndString(); 317 } 318 } 319 320 public boolean getLanguagePKHasBeenModified() { 321 return languagePKHasBeenModified; 322 } 323 324 @Nonnull 325 public String getDescription() { 326 return description; 327 } 328 329 public void setDescription(@Nonnull String description) 330 throws PersistenceNotNullException { 331 checkForNull(description); 332 333 boolean update = true; 334 335 if(this.description != null) { 336 if(this.description.equals(description)) { 337 update = false; 338 } 339 } else if(description == null) { 340 update = false; 341 } 342 343 if(update) { 344 this.description = description; 345 descriptionHasBeenModified = true; 346 clearHashAndString(); 347 } 348 } 349 350 public boolean getDescriptionHasBeenModified() { 351 return descriptionHasBeenModified; 352 } 353 354 @Nonnull 355 public Long getFromTime() { 356 return fromTime; 357 } 358 359 public void setFromTime(@Nonnull Long fromTime) 360 throws PersistenceNotNullException { 361 checkForNull(fromTime); 362 363 boolean update = true; 364 365 if(this.fromTime != null) { 366 if(this.fromTime.equals(fromTime)) { 367 update = false; 368 } 369 } else if(fromTime == null) { 370 update = false; 371 } 372 373 if(update) { 374 this.fromTime = fromTime; 375 fromTimeHasBeenModified = true; 376 clearHashAndString(); 377 } 378 } 379 380 public boolean getFromTimeHasBeenModified() { 381 return fromTimeHasBeenModified; 382 } 383 384 @Nonnull 385 public Long getThruTime() { 386 return thruTime; 387 } 388 389 public void setThruTime(@Nonnull Long thruTime) 390 throws PersistenceNotNullException { 391 checkForNull(thruTime); 392 393 boolean update = true; 394 395 if(this.thruTime != null) { 396 if(this.thruTime.equals(thruTime)) { 397 update = false; 398 } 399 } else if(thruTime == null) { 400 update = false; 401 } 402 403 if(update) { 404 this.thruTime = thruTime; 405 thruTimeHasBeenModified = true; 406 clearHashAndString(); 407 } 408 } 409 410 public boolean getThruTimeHasBeenModified() { 411 return thruTimeHasBeenModified; 412 } 413 414}