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 * BillingAccountRoleValue.java 021 */ 022 023package com.echothree.model.data.payment.server.value; 024 025import com.echothree.model.data.payment.common.pk.BillingAccountRolePK; 026 027import com.echothree.model.data.payment.server.factory.BillingAccountRoleFactory; 028 029import com.echothree.model.data.payment.common.pk.BillingAccountPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK; 032import com.echothree.model.data.payment.common.pk.BillingAccountRoleTypePK; 033 034import com.echothree.util.common.exception.PersistenceCloneException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036 037import com.echothree.util.server.persistence.BaseValue; 038 039import java.io.Serializable; 040 041import javax.annotation.Nonnull; 042import javax.annotation.Nullable; 043 044public class BillingAccountRoleValue 045 extends BaseValue<BillingAccountRolePK> 046 implements Cloneable, Serializable { 047 048 private BillingAccountPK billingAccountPK; 049 private boolean billingAccountPKHasBeenModified = false; 050 private PartyPK partyPK; 051 private boolean partyPKHasBeenModified = false; 052 private PartyContactMechanismPK partyContactMechanismPK; 053 private boolean partyContactMechanismPKHasBeenModified = false; 054 private BillingAccountRoleTypePK billingAccountRoleTypePK; 055 private boolean billingAccountRoleTypePKHasBeenModified = false; 056 private Long fromTime; 057 private boolean fromTimeHasBeenModified = false; 058 private Long thruTime; 059 private boolean thruTimeHasBeenModified = false; 060 061 private transient Integer _hashCode = null; 062 private transient String _stringValue = null; 063 064 private void constructFields(BillingAccountPK billingAccountPK, PartyPK partyPK, PartyContactMechanismPK partyContactMechanismPK, BillingAccountRoleTypePK billingAccountRoleTypePK, Long fromTime, Long thruTime) 065 throws PersistenceNotNullException { 066 checkForNull(billingAccountPK); 067 this.billingAccountPK = billingAccountPK; 068 checkForNull(partyPK); 069 this.partyPK = partyPK; 070 checkForNull(partyContactMechanismPK); 071 this.partyContactMechanismPK = partyContactMechanismPK; 072 checkForNull(billingAccountRoleTypePK); 073 this.billingAccountRoleTypePK = billingAccountRoleTypePK; 074 checkForNull(fromTime); 075 this.fromTime = fromTime; 076 checkForNull(thruTime); 077 this.thruTime = thruTime; 078 } 079 080 /** Creates a new instance of BillingAccountRoleValue */ 081 public BillingAccountRoleValue(BillingAccountRolePK billingAccountRolePK, BillingAccountPK billingAccountPK, PartyPK partyPK, PartyContactMechanismPK partyContactMechanismPK, BillingAccountRoleTypePK billingAccountRoleTypePK, Long fromTime, Long thruTime) 082 throws PersistenceNotNullException { 083 super(billingAccountRolePK); 084 constructFields(billingAccountPK, partyPK, partyContactMechanismPK, billingAccountRoleTypePK, fromTime, thruTime); 085 } 086 087 /** Creates a new instance of BillingAccountRoleValue */ 088 public BillingAccountRoleValue(BillingAccountPK billingAccountPK, PartyPK partyPK, PartyContactMechanismPK partyContactMechanismPK, BillingAccountRoleTypePK billingAccountRoleTypePK, Long fromTime, Long thruTime) 089 throws PersistenceNotNullException { 090 super(); 091 constructFields(billingAccountPK, partyPK, partyContactMechanismPK, billingAccountRoleTypePK, fromTime, thruTime); 092 } 093 094 @Override 095 @Nonnull 096 public BillingAccountRoleFactory getBaseFactoryInstance() { 097 return BillingAccountRoleFactory.getInstance(); 098 } 099 100 @Override 101 @Nonnull 102 public BillingAccountRoleValue clone() { 103 Object result; 104 105 try { 106 result = super.clone(); 107 } catch (CloneNotSupportedException cnse) { 108 // This shouldn't happen, fail when it does. 109 throw new PersistenceCloneException(cnse); 110 } 111 112 return (BillingAccountRoleValue)result; 113 } 114 115 @Override 116 @Nonnull 117 public BillingAccountRolePK getPrimaryKey() { 118 if(_primaryKey == null) { 119 _primaryKey = new BillingAccountRolePK(entityId); 120 } 121 122 return _primaryKey; 123 } 124 125 private void clearHashAndString() { 126 _hashCode = null; 127 _stringValue = null; 128 } 129 130 @Override 131 public int hashCode() { 132 if(_hashCode == null) { 133 int hashCode = 17; 134 135 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 136 137 hashCode = 37 * hashCode + ((billingAccountPK != null) ? billingAccountPK.hashCode() : 0); 138 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 139 hashCode = 37 * hashCode + ((partyContactMechanismPK != null) ? partyContactMechanismPK.hashCode() : 0); 140 hashCode = 37 * hashCode + ((billingAccountRoleTypePK != null) ? billingAccountRoleTypePK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 142 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 143 144 _hashCode = hashCode; 145 } 146 147 return _hashCode; 148 } 149 150 @Override 151 @Nonnull 152 public String toString() { 153 if(_stringValue == null) { 154 _stringValue = "{" + 155 "entityId=" + getEntityId() + 156 ", billingAccountPK=" + getBillingAccountPK() + 157 ", partyPK=" + getPartyPK() + 158 ", partyContactMechanismPK=" + getPartyContactMechanismPK() + 159 ", billingAccountRoleTypePK=" + getBillingAccountRoleTypePK() + 160 ", fromTime=" + getFromTime() + 161 ", thruTime=" + getThruTime() + 162 "}"; 163 } 164 return _stringValue; 165 } 166 167 @Override 168 public boolean equals(Object other) { 169 if(this == other) 170 return true; 171 172 if(!hasIdentity()) 173 return false; 174 175 if(other instanceof BillingAccountRoleValue that) { 176 if(!that.hasIdentity()) 177 return false; 178 179 Long thisEntityId = getEntityId(); 180 Long thatEntityId = that.getEntityId(); 181 182 boolean objectsEqual = thisEntityId.equals(thatEntityId); 183 if(objectsEqual) 184 objectsEqual = isIdentical(that); 185 186 return objectsEqual; 187 } else { 188 return false; 189 } 190 } 191 192 public boolean isIdentical(Object other) { 193 if(other instanceof BillingAccountRoleValue that) { 194 boolean objectsEqual = true; 195 196 197 if(objectsEqual) { 198 BillingAccountPK thisBillingAccountPK = getBillingAccountPK(); 199 BillingAccountPK thatBillingAccountPK = that.getBillingAccountPK(); 200 201 if(thisBillingAccountPK == null) { 202 objectsEqual = objectsEqual && (thatBillingAccountPK == null); 203 } else { 204 objectsEqual = objectsEqual && thisBillingAccountPK.equals(thatBillingAccountPK); 205 } 206 } 207 208 if(objectsEqual) { 209 PartyPK thisPartyPK = getPartyPK(); 210 PartyPK thatPartyPK = that.getPartyPK(); 211 212 if(thisPartyPK == null) { 213 objectsEqual = objectsEqual && (thatPartyPK == null); 214 } else { 215 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 216 } 217 } 218 219 if(objectsEqual) { 220 PartyContactMechanismPK thisPartyContactMechanismPK = getPartyContactMechanismPK(); 221 PartyContactMechanismPK thatPartyContactMechanismPK = that.getPartyContactMechanismPK(); 222 223 if(thisPartyContactMechanismPK == null) { 224 objectsEqual = objectsEqual && (thatPartyContactMechanismPK == null); 225 } else { 226 objectsEqual = objectsEqual && thisPartyContactMechanismPK.equals(thatPartyContactMechanismPK); 227 } 228 } 229 230 if(objectsEqual) { 231 BillingAccountRoleTypePK thisBillingAccountRoleTypePK = getBillingAccountRoleTypePK(); 232 BillingAccountRoleTypePK thatBillingAccountRoleTypePK = that.getBillingAccountRoleTypePK(); 233 234 if(thisBillingAccountRoleTypePK == null) { 235 objectsEqual = objectsEqual && (thatBillingAccountRoleTypePK == null); 236 } else { 237 objectsEqual = objectsEqual && thisBillingAccountRoleTypePK.equals(thatBillingAccountRoleTypePK); 238 } 239 } 240 241 if(objectsEqual) { 242 Long thisFromTime = getFromTime(); 243 Long thatFromTime = that.getFromTime(); 244 245 if(thisFromTime == null) { 246 objectsEqual = objectsEqual && (thatFromTime == null); 247 } else { 248 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 249 } 250 } 251 252 if(objectsEqual) { 253 Long thisThruTime = getThruTime(); 254 Long thatThruTime = that.getThruTime(); 255 256 if(thisThruTime == null) { 257 objectsEqual = objectsEqual && (thatThruTime == null); 258 } else { 259 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 260 } 261 } 262 263 return objectsEqual; 264 } else { 265 return false; 266 } 267 } 268 269 @Override 270 public boolean hasBeenModified() { 271 return billingAccountPKHasBeenModified || partyPKHasBeenModified || partyContactMechanismPKHasBeenModified || billingAccountRoleTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 272 } 273 274 @Override 275 public void clearHasBeenModified() { 276 billingAccountPKHasBeenModified = false; 277 partyPKHasBeenModified = false; 278 partyContactMechanismPKHasBeenModified = false; 279 billingAccountRoleTypePKHasBeenModified = false; 280 fromTimeHasBeenModified = false; 281 thruTimeHasBeenModified = false; 282 } 283 284 @Nonnull 285 public BillingAccountPK getBillingAccountPK() { 286 return billingAccountPK; 287 } 288 289 public void setBillingAccountPK(@Nonnull BillingAccountPK billingAccountPK) 290 throws PersistenceNotNullException { 291 checkForNull(billingAccountPK); 292 293 boolean update = true; 294 295 if(this.billingAccountPK != null) { 296 if(this.billingAccountPK.equals(billingAccountPK)) { 297 update = false; 298 } 299 } else if(billingAccountPK == null) { 300 update = false; 301 } 302 303 if(update) { 304 this.billingAccountPK = billingAccountPK; 305 billingAccountPKHasBeenModified = true; 306 clearHashAndString(); 307 } 308 } 309 310 public boolean getBillingAccountPKHasBeenModified() { 311 return billingAccountPKHasBeenModified; 312 } 313 314 @Nonnull 315 public PartyPK getPartyPK() { 316 return partyPK; 317 } 318 319 public void setPartyPK(@Nonnull PartyPK partyPK) 320 throws PersistenceNotNullException { 321 checkForNull(partyPK); 322 323 boolean update = true; 324 325 if(this.partyPK != null) { 326 if(this.partyPK.equals(partyPK)) { 327 update = false; 328 } 329 } else if(partyPK == null) { 330 update = false; 331 } 332 333 if(update) { 334 this.partyPK = partyPK; 335 partyPKHasBeenModified = true; 336 clearHashAndString(); 337 } 338 } 339 340 public boolean getPartyPKHasBeenModified() { 341 return partyPKHasBeenModified; 342 } 343 344 @Nonnull 345 public PartyContactMechanismPK getPartyContactMechanismPK() { 346 return partyContactMechanismPK; 347 } 348 349 public void setPartyContactMechanismPK(@Nonnull PartyContactMechanismPK partyContactMechanismPK) 350 throws PersistenceNotNullException { 351 checkForNull(partyContactMechanismPK); 352 353 boolean update = true; 354 355 if(this.partyContactMechanismPK != null) { 356 if(this.partyContactMechanismPK.equals(partyContactMechanismPK)) { 357 update = false; 358 } 359 } else if(partyContactMechanismPK == null) { 360 update = false; 361 } 362 363 if(update) { 364 this.partyContactMechanismPK = partyContactMechanismPK; 365 partyContactMechanismPKHasBeenModified = true; 366 clearHashAndString(); 367 } 368 } 369 370 public boolean getPartyContactMechanismPKHasBeenModified() { 371 return partyContactMechanismPKHasBeenModified; 372 } 373 374 @Nonnull 375 public BillingAccountRoleTypePK getBillingAccountRoleTypePK() { 376 return billingAccountRoleTypePK; 377 } 378 379 public void setBillingAccountRoleTypePK(@Nonnull BillingAccountRoleTypePK billingAccountRoleTypePK) 380 throws PersistenceNotNullException { 381 checkForNull(billingAccountRoleTypePK); 382 383 boolean update = true; 384 385 if(this.billingAccountRoleTypePK != null) { 386 if(this.billingAccountRoleTypePK.equals(billingAccountRoleTypePK)) { 387 update = false; 388 } 389 } else if(billingAccountRoleTypePK == null) { 390 update = false; 391 } 392 393 if(update) { 394 this.billingAccountRoleTypePK = billingAccountRoleTypePK; 395 billingAccountRoleTypePKHasBeenModified = true; 396 clearHashAndString(); 397 } 398 } 399 400 public boolean getBillingAccountRoleTypePKHasBeenModified() { 401 return billingAccountRoleTypePKHasBeenModified; 402 } 403 404 @Nonnull 405 public Long getFromTime() { 406 return fromTime; 407 } 408 409 public void setFromTime(@Nonnull Long fromTime) 410 throws PersistenceNotNullException { 411 checkForNull(fromTime); 412 413 boolean update = true; 414 415 if(this.fromTime != null) { 416 if(this.fromTime.equals(fromTime)) { 417 update = false; 418 } 419 } else if(fromTime == null) { 420 update = false; 421 } 422 423 if(update) { 424 this.fromTime = fromTime; 425 fromTimeHasBeenModified = true; 426 clearHashAndString(); 427 } 428 } 429 430 public boolean getFromTimeHasBeenModified() { 431 return fromTimeHasBeenModified; 432 } 433 434 @Nonnull 435 public Long getThruTime() { 436 return thruTime; 437 } 438 439 public void setThruTime(@Nonnull Long thruTime) 440 throws PersistenceNotNullException { 441 checkForNull(thruTime); 442 443 boolean update = true; 444 445 if(this.thruTime != null) { 446 if(this.thruTime.equals(thruTime)) { 447 update = false; 448 } 449 } else if(thruTime == null) { 450 update = false; 451 } 452 453 if(update) { 454 this.thruTime = thruTime; 455 thruTimeHasBeenModified = true; 456 clearHashAndString(); 457 } 458 } 459 460 public boolean getThruTimeHasBeenModified() { 461 return thruTimeHasBeenModified; 462 } 463 464}