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 * PaymentDeductionDetailValue.java 021 */ 022 023package com.echothree.model.data.payment.server.value; 024 025import com.echothree.model.data.payment.common.pk.PaymentDeductionDetailPK; 026 027import com.echothree.model.data.payment.server.factory.PaymentDeductionDetailFactory; 028 029import com.echothree.model.data.payment.common.pk.PaymentDeductionPK; 030import com.echothree.model.data.payment.common.pk.PaymentDeductionTypePK; 031import com.echothree.model.data.payment.common.pk.PaymentPK; 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 PaymentDeductionDetailValue 041 extends BaseValue<PaymentDeductionDetailPK> 042 implements Cloneable, Serializable { 043 044 private PaymentDeductionPK paymentDeductionPK; 045 private boolean paymentDeductionPKHasBeenModified = false; 046 private String paymentDeductionName; 047 private boolean paymentDeductionNameHasBeenModified = false; 048 private PaymentDeductionTypePK paymentDeductionTypePK; 049 private boolean paymentDeductionTypePKHasBeenModified = false; 050 private PaymentPK paymentPK; 051 private boolean paymentPKHasBeenModified = false; 052 private Long amount; 053 private boolean amountHasBeenModified = 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(PaymentDeductionPK paymentDeductionPK, String paymentDeductionName, PaymentDeductionTypePK paymentDeductionTypePK, PaymentPK paymentPK, Long amount, Long fromTime, Long thruTime) 063 throws PersistenceNotNullException { 064 checkForNull(paymentDeductionPK); 065 this.paymentDeductionPK = paymentDeductionPK; 066 checkForNull(paymentDeductionName); 067 this.paymentDeductionName = paymentDeductionName; 068 this.paymentDeductionTypePK = paymentDeductionTypePK; 069 this.paymentPK = paymentPK; 070 checkForNull(amount); 071 this.amount = amount; 072 checkForNull(fromTime); 073 this.fromTime = fromTime; 074 checkForNull(thruTime); 075 this.thruTime = thruTime; 076 } 077 078 /** Creates a new instance of PaymentDeductionDetailValue */ 079 public PaymentDeductionDetailValue(PaymentDeductionDetailPK paymentDeductionDetailPK, PaymentDeductionPK paymentDeductionPK, String paymentDeductionName, PaymentDeductionTypePK paymentDeductionTypePK, PaymentPK paymentPK, Long amount, Long fromTime, Long thruTime) 080 throws PersistenceNotNullException { 081 super(paymentDeductionDetailPK); 082 constructFields(paymentDeductionPK, paymentDeductionName, paymentDeductionTypePK, paymentPK, amount, fromTime, thruTime); 083 } 084 085 /** Creates a new instance of PaymentDeductionDetailValue */ 086 public PaymentDeductionDetailValue(PaymentDeductionPK paymentDeductionPK, String paymentDeductionName, PaymentDeductionTypePK paymentDeductionTypePK, PaymentPK paymentPK, Long amount, Long fromTime, Long thruTime) 087 throws PersistenceNotNullException { 088 super(); 089 constructFields(paymentDeductionPK, paymentDeductionName, paymentDeductionTypePK, paymentPK, amount, fromTime, thruTime); 090 } 091 092 @Override 093 public PaymentDeductionDetailFactory getBaseFactoryInstance() { 094 return PaymentDeductionDetailFactory.getInstance(); 095 } 096 097 @Override 098 public PaymentDeductionDetailValue 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 (PaymentDeductionDetailValue)result; 109 } 110 111 @Override 112 public PaymentDeductionDetailPK getPrimaryKey() { 113 if(_primaryKey == null) { 114 _primaryKey = new PaymentDeductionDetailPK(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 + ((paymentDeductionPK != null) ? paymentDeductionPK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((paymentDeductionName != null) ? paymentDeductionName.hashCode() : 0); 134 hashCode = 37 * hashCode + ((paymentDeductionTypePK != null) ? paymentDeductionTypePK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((paymentPK != null) ? paymentPK.hashCode() : 0); 136 hashCode = 37 * hashCode + ((amount != null) ? amount.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(", paymentDeductionPK=").append(getPaymentDeductionPK()); 154 stringValue.append(", paymentDeductionName=").append(getPaymentDeductionName()); 155 stringValue.append(", paymentDeductionTypePK=").append(getPaymentDeductionTypePK()); 156 stringValue.append(", paymentPK=").append(getPaymentPK()); 157 stringValue.append(", amount=").append(getAmount()); 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 PaymentDeductionDetailValue) { 177 PaymentDeductionDetailValue that = (PaymentDeductionDetailValue)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 PaymentDeductionDetailValue) { 197 PaymentDeductionDetailValue that = (PaymentDeductionDetailValue)other; 198 boolean objectsEqual = true; 199 200 201 if(objectsEqual) { 202 PaymentDeductionPK thisPaymentDeductionPK = getPaymentDeductionPK(); 203 PaymentDeductionPK thatPaymentDeductionPK = that.getPaymentDeductionPK(); 204 205 if(thisPaymentDeductionPK == null) { 206 objectsEqual = objectsEqual && (thatPaymentDeductionPK == null); 207 } else { 208 objectsEqual = objectsEqual && thisPaymentDeductionPK.equals(thatPaymentDeductionPK); 209 } 210 } 211 212 if(objectsEqual) { 213 String thisPaymentDeductionName = getPaymentDeductionName(); 214 String thatPaymentDeductionName = that.getPaymentDeductionName(); 215 216 if(thisPaymentDeductionName == null) { 217 objectsEqual = objectsEqual && (thatPaymentDeductionName == null); 218 } else { 219 objectsEqual = objectsEqual && thisPaymentDeductionName.equals(thatPaymentDeductionName); 220 } 221 } 222 223 if(objectsEqual) { 224 PaymentDeductionTypePK thisPaymentDeductionTypePK = getPaymentDeductionTypePK(); 225 PaymentDeductionTypePK thatPaymentDeductionTypePK = that.getPaymentDeductionTypePK(); 226 227 if(thisPaymentDeductionTypePK == null) { 228 objectsEqual = objectsEqual && (thatPaymentDeductionTypePK == null); 229 } else { 230 objectsEqual = objectsEqual && thisPaymentDeductionTypePK.equals(thatPaymentDeductionTypePK); 231 } 232 } 233 234 if(objectsEqual) { 235 PaymentPK thisPaymentPK = getPaymentPK(); 236 PaymentPK thatPaymentPK = that.getPaymentPK(); 237 238 if(thisPaymentPK == null) { 239 objectsEqual = objectsEqual && (thatPaymentPK == null); 240 } else { 241 objectsEqual = objectsEqual && thisPaymentPK.equals(thatPaymentPK); 242 } 243 } 244 245 if(objectsEqual) { 246 Long thisAmount = getAmount(); 247 Long thatAmount = that.getAmount(); 248 249 if(thisAmount == null) { 250 objectsEqual = objectsEqual && (thatAmount == null); 251 } else { 252 objectsEqual = objectsEqual && thisAmount.equals(thatAmount); 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 paymentDeductionPKHasBeenModified || paymentDeductionNameHasBeenModified || paymentDeductionTypePKHasBeenModified || paymentPKHasBeenModified || amountHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 287 } 288 289 @Override 290 public void clearHasBeenModified() { 291 paymentDeductionPKHasBeenModified = false; 292 paymentDeductionNameHasBeenModified = false; 293 paymentDeductionTypePKHasBeenModified = false; 294 paymentPKHasBeenModified = false; 295 amountHasBeenModified = false; 296 fromTimeHasBeenModified = false; 297 thruTimeHasBeenModified = false; 298 } 299 300 public PaymentDeductionPK getPaymentDeductionPK() { 301 return paymentDeductionPK; 302 } 303 304 public void setPaymentDeductionPK(PaymentDeductionPK paymentDeductionPK) 305 throws PersistenceNotNullException { 306 checkForNull(paymentDeductionPK); 307 308 boolean update = true; 309 310 if(this.paymentDeductionPK != null) { 311 if(this.paymentDeductionPK.equals(paymentDeductionPK)) { 312 update = false; 313 } 314 } else if(paymentDeductionPK == null) { 315 update = false; 316 } 317 318 if(update) { 319 this.paymentDeductionPK = paymentDeductionPK; 320 paymentDeductionPKHasBeenModified = true; 321 clearHashAndString(); 322 } 323 } 324 325 public boolean getPaymentDeductionPKHasBeenModified() { 326 return paymentDeductionPKHasBeenModified; 327 } 328 329 public String getPaymentDeductionName() { 330 return paymentDeductionName; 331 } 332 333 public void setPaymentDeductionName(String paymentDeductionName) 334 throws PersistenceNotNullException { 335 checkForNull(paymentDeductionName); 336 337 boolean update = true; 338 339 if(this.paymentDeductionName != null) { 340 if(this.paymentDeductionName.equals(paymentDeductionName)) { 341 update = false; 342 } 343 } else if(paymentDeductionName == null) { 344 update = false; 345 } 346 347 if(update) { 348 this.paymentDeductionName = paymentDeductionName; 349 paymentDeductionNameHasBeenModified = true; 350 clearHashAndString(); 351 } 352 } 353 354 public boolean getPaymentDeductionNameHasBeenModified() { 355 return paymentDeductionNameHasBeenModified; 356 } 357 358 public PaymentDeductionTypePK getPaymentDeductionTypePK() { 359 return paymentDeductionTypePK; 360 } 361 362 public void setPaymentDeductionTypePK(PaymentDeductionTypePK paymentDeductionTypePK) { 363 boolean update = true; 364 365 if(this.paymentDeductionTypePK != null) { 366 if(this.paymentDeductionTypePK.equals(paymentDeductionTypePK)) { 367 update = false; 368 } 369 } else if(paymentDeductionTypePK == null) { 370 update = false; 371 } 372 373 if(update) { 374 this.paymentDeductionTypePK = paymentDeductionTypePK; 375 paymentDeductionTypePKHasBeenModified = true; 376 clearHashAndString(); 377 } 378 } 379 380 public boolean getPaymentDeductionTypePKHasBeenModified() { 381 return paymentDeductionTypePKHasBeenModified; 382 } 383 384 public PaymentPK getPaymentPK() { 385 return paymentPK; 386 } 387 388 public void setPaymentPK(PaymentPK paymentPK) { 389 boolean update = true; 390 391 if(this.paymentPK != null) { 392 if(this.paymentPK.equals(paymentPK)) { 393 update = false; 394 } 395 } else if(paymentPK == null) { 396 update = false; 397 } 398 399 if(update) { 400 this.paymentPK = paymentPK; 401 paymentPKHasBeenModified = true; 402 clearHashAndString(); 403 } 404 } 405 406 public boolean getPaymentPKHasBeenModified() { 407 return paymentPKHasBeenModified; 408 } 409 410 public Long getAmount() { 411 return amount; 412 } 413 414 public void setAmount(Long amount) 415 throws PersistenceNotNullException { 416 checkForNull(amount); 417 418 boolean update = true; 419 420 if(this.amount != null) { 421 if(this.amount.equals(amount)) { 422 update = false; 423 } 424 } else if(amount == null) { 425 update = false; 426 } 427 428 if(update) { 429 this.amount = amount; 430 amountHasBeenModified = true; 431 clearHashAndString(); 432 } 433 } 434 435 public boolean getAmountHasBeenModified() { 436 return amountHasBeenModified; 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}