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