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