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 * Customer.java 021 */ 022 023package com.echothree.model.data.customer.server.entity; 024 025import com.echothree.model.data.customer.common.pk.CustomerPK; 026 027import com.echothree.model.data.party.common.pk.PartyPK; 028import com.echothree.model.data.customer.common.pk.CustomerTypePK; 029import com.echothree.model.data.offer.common.pk.OfferUsePK; 030import com.echothree.model.data.cancellationpolicy.common.pk.CancellationPolicyPK; 031import com.echothree.model.data.returnpolicy.common.pk.ReturnPolicyPK; 032import com.echothree.model.data.accounting.common.pk.GlAccountPK; 033 034import com.echothree.model.data.party.server.entity.Party; 035import com.echothree.model.data.customer.server.entity.CustomerType; 036import com.echothree.model.data.offer.server.entity.OfferUse; 037import com.echothree.model.data.cancellationpolicy.server.entity.CancellationPolicy; 038import com.echothree.model.data.returnpolicy.server.entity.ReturnPolicy; 039import com.echothree.model.data.accounting.server.entity.GlAccount; 040 041import com.echothree.model.data.party.server.factory.PartyFactory; 042import com.echothree.model.data.customer.server.factory.CustomerTypeFactory; 043import com.echothree.model.data.offer.server.factory.OfferUseFactory; 044import com.echothree.model.data.cancellationpolicy.server.factory.CancellationPolicyFactory; 045import com.echothree.model.data.returnpolicy.server.factory.ReturnPolicyFactory; 046import com.echothree.model.data.accounting.server.factory.GlAccountFactory; 047 048import com.echothree.model.data.customer.common.pk.CustomerPK; 049 050import com.echothree.model.data.customer.server.value.CustomerValue; 051 052import com.echothree.model.data.customer.server.factory.CustomerFactory; 053 054import com.echothree.util.common.exception.PersistenceException; 055import com.echothree.util.common.exception.PersistenceDatabaseException; 056import com.echothree.util.common.exception.PersistenceNotNullException; 057import com.echothree.util.common.exception.PersistenceReadOnlyException; 058 059import com.echothree.util.common.persistence.BasePK; 060 061import com.echothree.util.common.persistence.type.ByteArray; 062 063import com.echothree.util.server.persistence.BaseEntity; 064import com.echothree.util.server.persistence.EntityPermission; 065import com.echothree.util.server.persistence.Session; 066import com.echothree.util.server.persistence.ThreadSession; 067 068import java.io.Serializable; 069 070public class Customer 071 extends BaseEntity 072 implements Serializable { 073 074 private CustomerPK _pk; 075 private CustomerValue _value; 076 077 /** Creates a new instance of Customer */ 078 public Customer() 079 throws PersistenceException { 080 super(); 081 } 082 083 /** Creates a new instance of Customer */ 084 public Customer(CustomerValue value, EntityPermission entityPermission) { 085 super(entityPermission); 086 087 _value = value; 088 _pk = value.getPrimaryKey(); 089 } 090 091 @Override 092 public CustomerFactory getBaseFactoryInstance() { 093 return CustomerFactory.getInstance(); 094 } 095 096 @Override 097 public boolean hasBeenModified() { 098 return _value.hasBeenModified(); 099 } 100 101 @Override 102 public int hashCode() { 103 return _pk.hashCode(); 104 } 105 106 @Override 107 public String toString() { 108 return _pk.toString(); 109 } 110 111 @Override 112 public boolean equals(Object other) { 113 if(this == other) 114 return true; 115 116 if(other instanceof Customer that) { 117 CustomerValue thatValue = that.getCustomerValue(); 118 return _value.equals(thatValue); 119 } else { 120 return false; 121 } 122 } 123 124 @Override 125 public void store() 126 throws PersistenceDatabaseException { 127 getBaseFactoryInstance().store(this); 128 } 129 130 @Override 131 public void remove() 132 throws PersistenceDatabaseException { 133 getBaseFactoryInstance().remove(this); 134 } 135 136 public CustomerValue getCustomerValue() { 137 return _value; 138 } 139 140 public void setCustomerValue(CustomerValue value) 141 throws PersistenceReadOnlyException { 142 checkReadWrite(); 143 _value = value; 144 } 145 146 @Override 147 public CustomerPK getPrimaryKey() { 148 return _pk; 149 } 150 151 public PartyPK getPartyPK() { 152 return _value.getPartyPK(); 153 } 154 155 public Party getParty(EntityPermission entityPermission) { 156 return PartyFactory.getInstance().getEntityFromPK(entityPermission, getPartyPK()); 157 } 158 159 public Party getParty() { 160 return getParty(EntityPermission.READ_ONLY); 161 } 162 163 public Party getPartyForUpdate() { 164 return getParty(EntityPermission.READ_WRITE); 165 } 166 167 public void setPartyPK(PartyPK partyPK) 168 throws PersistenceNotNullException, PersistenceReadOnlyException { 169 checkReadWrite(); 170 _value.setPartyPK(partyPK); 171 } 172 173 public void setParty(Party entity) { 174 setPartyPK(entity == null? null: entity.getPrimaryKey()); 175 } 176 177 public boolean getPartyPKHasBeenModified() { 178 return _value.getPartyPKHasBeenModified(); 179 } 180 181 public String getCustomerName() { 182 return _value.getCustomerName(); 183 } 184 185 public void setCustomerName(String customerName) 186 throws PersistenceNotNullException, PersistenceReadOnlyException { 187 checkReadWrite(); 188 _value.setCustomerName(customerName); 189 } 190 191 public boolean getCustomerNameHasBeenModified() { 192 return _value.getCustomerNameHasBeenModified(); 193 } 194 195 public CustomerTypePK getCustomerTypePK() { 196 return _value.getCustomerTypePK(); 197 } 198 199 public CustomerType getCustomerType(EntityPermission entityPermission) { 200 return CustomerTypeFactory.getInstance().getEntityFromPK(entityPermission, getCustomerTypePK()); 201 } 202 203 public CustomerType getCustomerType() { 204 return getCustomerType(EntityPermission.READ_ONLY); 205 } 206 207 public CustomerType getCustomerTypeForUpdate() { 208 return getCustomerType(EntityPermission.READ_WRITE); 209 } 210 211 public void setCustomerTypePK(CustomerTypePK customerTypePK) 212 throws PersistenceNotNullException, PersistenceReadOnlyException { 213 checkReadWrite(); 214 _value.setCustomerTypePK(customerTypePK); 215 } 216 217 public void setCustomerType(CustomerType entity) { 218 setCustomerTypePK(entity == null? null: entity.getPrimaryKey()); 219 } 220 221 public boolean getCustomerTypePKHasBeenModified() { 222 return _value.getCustomerTypePKHasBeenModified(); 223 } 224 225 public OfferUsePK getInitialOfferUsePK() { 226 return _value.getInitialOfferUsePK(); 227 } 228 229 public OfferUse getInitialOfferUse(EntityPermission entityPermission) { 230 return OfferUseFactory.getInstance().getEntityFromPK(entityPermission, getInitialOfferUsePK()); 231 } 232 233 public OfferUse getInitialOfferUse() { 234 return getInitialOfferUse(EntityPermission.READ_ONLY); 235 } 236 237 public OfferUse getInitialOfferUseForUpdate() { 238 return getInitialOfferUse(EntityPermission.READ_WRITE); 239 } 240 241 public void setInitialOfferUsePK(OfferUsePK initialOfferUsePK) 242 throws PersistenceNotNullException, PersistenceReadOnlyException { 243 checkReadWrite(); 244 _value.setInitialOfferUsePK(initialOfferUsePK); 245 } 246 247 public void setInitialOfferUse(OfferUse entity) { 248 setInitialOfferUsePK(entity == null? null: entity.getPrimaryKey()); 249 } 250 251 public boolean getInitialOfferUsePKHasBeenModified() { 252 return _value.getInitialOfferUsePKHasBeenModified(); 253 } 254 255 public CancellationPolicyPK getCancellationPolicyPK() { 256 return _value.getCancellationPolicyPK(); 257 } 258 259 public CancellationPolicy getCancellationPolicy(EntityPermission entityPermission) { 260 CancellationPolicyPK pk = getCancellationPolicyPK(); 261 CancellationPolicy entity = pk == null? null: CancellationPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk); 262 263 return entity; 264 } 265 266 public CancellationPolicy getCancellationPolicy() { 267 return getCancellationPolicy(EntityPermission.READ_ONLY); 268 } 269 270 public CancellationPolicy getCancellationPolicyForUpdate() { 271 return getCancellationPolicy(EntityPermission.READ_WRITE); 272 } 273 274 public void setCancellationPolicyPK(CancellationPolicyPK cancellationPolicyPK) 275 throws PersistenceNotNullException, PersistenceReadOnlyException { 276 checkReadWrite(); 277 _value.setCancellationPolicyPK(cancellationPolicyPK); 278 } 279 280 public void setCancellationPolicy(CancellationPolicy entity) { 281 setCancellationPolicyPK(entity == null? null: entity.getPrimaryKey()); 282 } 283 284 public boolean getCancellationPolicyPKHasBeenModified() { 285 return _value.getCancellationPolicyPKHasBeenModified(); 286 } 287 288 public ReturnPolicyPK getReturnPolicyPK() { 289 return _value.getReturnPolicyPK(); 290 } 291 292 public ReturnPolicy getReturnPolicy(EntityPermission entityPermission) { 293 ReturnPolicyPK pk = getReturnPolicyPK(); 294 ReturnPolicy entity = pk == null? null: ReturnPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk); 295 296 return entity; 297 } 298 299 public ReturnPolicy getReturnPolicy() { 300 return getReturnPolicy(EntityPermission.READ_ONLY); 301 } 302 303 public ReturnPolicy getReturnPolicyForUpdate() { 304 return getReturnPolicy(EntityPermission.READ_WRITE); 305 } 306 307 public void setReturnPolicyPK(ReturnPolicyPK returnPolicyPK) 308 throws PersistenceNotNullException, PersistenceReadOnlyException { 309 checkReadWrite(); 310 _value.setReturnPolicyPK(returnPolicyPK); 311 } 312 313 public void setReturnPolicy(ReturnPolicy entity) { 314 setReturnPolicyPK(entity == null? null: entity.getPrimaryKey()); 315 } 316 317 public boolean getReturnPolicyPKHasBeenModified() { 318 return _value.getReturnPolicyPKHasBeenModified(); 319 } 320 321 public GlAccountPK getArGlAccountPK() { 322 return _value.getArGlAccountPK(); 323 } 324 325 public GlAccount getArGlAccount(EntityPermission entityPermission) { 326 GlAccountPK pk = getArGlAccountPK(); 327 GlAccount entity = pk == null? null: GlAccountFactory.getInstance().getEntityFromPK(entityPermission, pk); 328 329 return entity; 330 } 331 332 public GlAccount getArGlAccount() { 333 return getArGlAccount(EntityPermission.READ_ONLY); 334 } 335 336 public GlAccount getArGlAccountForUpdate() { 337 return getArGlAccount(EntityPermission.READ_WRITE); 338 } 339 340 public void setArGlAccountPK(GlAccountPK arGlAccountPK) 341 throws PersistenceNotNullException, PersistenceReadOnlyException { 342 checkReadWrite(); 343 _value.setArGlAccountPK(arGlAccountPK); 344 } 345 346 public void setArGlAccount(GlAccount entity) { 347 setArGlAccountPK(entity == null? null: entity.getPrimaryKey()); 348 } 349 350 public boolean getArGlAccountPKHasBeenModified() { 351 return _value.getArGlAccountPKHasBeenModified(); 352 } 353 354 public Boolean getHoldUntilComplete() { 355 return _value.getHoldUntilComplete(); 356 } 357 358 public void setHoldUntilComplete(Boolean holdUntilComplete) 359 throws PersistenceNotNullException, PersistenceReadOnlyException { 360 checkReadWrite(); 361 _value.setHoldUntilComplete(holdUntilComplete); 362 } 363 364 public boolean getHoldUntilCompleteHasBeenModified() { 365 return _value.getHoldUntilCompleteHasBeenModified(); 366 } 367 368 public Boolean getAllowBackorders() { 369 return _value.getAllowBackorders(); 370 } 371 372 public void setAllowBackorders(Boolean allowBackorders) 373 throws PersistenceNotNullException, PersistenceReadOnlyException { 374 checkReadWrite(); 375 _value.setAllowBackorders(allowBackorders); 376 } 377 378 public boolean getAllowBackordersHasBeenModified() { 379 return _value.getAllowBackordersHasBeenModified(); 380 } 381 382 public Boolean getAllowSubstitutions() { 383 return _value.getAllowSubstitutions(); 384 } 385 386 public void setAllowSubstitutions(Boolean allowSubstitutions) 387 throws PersistenceNotNullException, PersistenceReadOnlyException { 388 checkReadWrite(); 389 _value.setAllowSubstitutions(allowSubstitutions); 390 } 391 392 public boolean getAllowSubstitutionsHasBeenModified() { 393 return _value.getAllowSubstitutionsHasBeenModified(); 394 } 395 396 public Boolean getAllowCombiningShipments() { 397 return _value.getAllowCombiningShipments(); 398 } 399 400 public void setAllowCombiningShipments(Boolean allowCombiningShipments) 401 throws PersistenceNotNullException, PersistenceReadOnlyException { 402 checkReadWrite(); 403 _value.setAllowCombiningShipments(allowCombiningShipments); 404 } 405 406 public boolean getAllowCombiningShipmentsHasBeenModified() { 407 return _value.getAllowCombiningShipmentsHasBeenModified(); 408 } 409 410 public Boolean getRequireReference() { 411 return _value.getRequireReference(); 412 } 413 414 public void setRequireReference(Boolean requireReference) 415 throws PersistenceNotNullException, PersistenceReadOnlyException { 416 checkReadWrite(); 417 _value.setRequireReference(requireReference); 418 } 419 420 public boolean getRequireReferenceHasBeenModified() { 421 return _value.getRequireReferenceHasBeenModified(); 422 } 423 424 public Boolean getAllowReferenceDuplicates() { 425 return _value.getAllowReferenceDuplicates(); 426 } 427 428 public void setAllowReferenceDuplicates(Boolean allowReferenceDuplicates) 429 throws PersistenceNotNullException, PersistenceReadOnlyException { 430 checkReadWrite(); 431 _value.setAllowReferenceDuplicates(allowReferenceDuplicates); 432 } 433 434 public boolean getAllowReferenceDuplicatesHasBeenModified() { 435 return _value.getAllowReferenceDuplicatesHasBeenModified(); 436 } 437 438 public String getReferenceValidationPattern() { 439 return _value.getReferenceValidationPattern(); 440 } 441 442 public void setReferenceValidationPattern(String referenceValidationPattern) 443 throws PersistenceNotNullException, PersistenceReadOnlyException { 444 checkReadWrite(); 445 _value.setReferenceValidationPattern(referenceValidationPattern); 446 } 447 448 public boolean getReferenceValidationPatternHasBeenModified() { 449 return _value.getReferenceValidationPatternHasBeenModified(); 450 } 451 452 public Long getFromTime() { 453 return _value.getFromTime(); 454 } 455 456 public void setFromTime(Long fromTime) 457 throws PersistenceNotNullException, PersistenceReadOnlyException { 458 checkReadWrite(); 459 _value.setFromTime(fromTime); 460 } 461 462 public boolean getFromTimeHasBeenModified() { 463 return _value.getFromTimeHasBeenModified(); 464 } 465 466 public Long getThruTime() { 467 return _value.getThruTime(); 468 } 469 470 public void setThruTime(Long thruTime) 471 throws PersistenceNotNullException, PersistenceReadOnlyException { 472 checkReadWrite(); 473 _value.setThruTime(thruTime); 474 } 475 476 public boolean getThruTimeHasBeenModified() { 477 return _value.getThruTimeHasBeenModified(); 478 } 479 480}