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 * 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(Session session) 126 throws PersistenceDatabaseException { 127 getBaseFactoryInstance().store(session, this); 128 } 129 130 @Override 131 public void remove(Session session) 132 throws PersistenceDatabaseException { 133 getBaseFactoryInstance().remove(session, this); 134 } 135 136 @Override 137 public void remove() 138 throws PersistenceDatabaseException { 139 getBaseFactoryInstance().remove(ThreadSession.currentSession(), this); 140 } 141 142 public CustomerValue getCustomerValue() { 143 return _value; 144 } 145 146 public void setCustomerValue(CustomerValue value) 147 throws PersistenceReadOnlyException { 148 checkReadWrite(); 149 _value = value; 150 } 151 152 @Override 153 public CustomerPK getPrimaryKey() { 154 return _pk; 155 } 156 157 public PartyPK getPartyPK() { 158 return _value.getPartyPK(); 159 } 160 161 public Party getParty(Session session, EntityPermission entityPermission) { 162 return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyPK()); 163 } 164 165 public Party getParty(EntityPermission entityPermission) { 166 return getParty(ThreadSession.currentSession(), entityPermission); 167 } 168 169 public Party getParty(Session session) { 170 return getParty(session, EntityPermission.READ_ONLY); 171 } 172 173 public Party getParty() { 174 return getParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 175 } 176 177 public Party getPartyForUpdate(Session session) { 178 return getParty(session, EntityPermission.READ_WRITE); 179 } 180 181 public Party getPartyForUpdate() { 182 return getParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 183 } 184 185 public void setPartyPK(PartyPK partyPK) 186 throws PersistenceNotNullException, PersistenceReadOnlyException { 187 checkReadWrite(); 188 _value.setPartyPK(partyPK); 189 } 190 191 public void setParty(Party entity) { 192 setPartyPK(entity == null? null: entity.getPrimaryKey()); 193 } 194 195 public boolean getPartyPKHasBeenModified() { 196 return _value.getPartyPKHasBeenModified(); 197 } 198 199 public String getCustomerName() { 200 return _value.getCustomerName(); 201 } 202 203 public void setCustomerName(String customerName) 204 throws PersistenceNotNullException, PersistenceReadOnlyException { 205 checkReadWrite(); 206 _value.setCustomerName(customerName); 207 } 208 209 public boolean getCustomerNameHasBeenModified() { 210 return _value.getCustomerNameHasBeenModified(); 211 } 212 213 public CustomerTypePK getCustomerTypePK() { 214 return _value.getCustomerTypePK(); 215 } 216 217 public CustomerType getCustomerType(Session session, EntityPermission entityPermission) { 218 return CustomerTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getCustomerTypePK()); 219 } 220 221 public CustomerType getCustomerType(EntityPermission entityPermission) { 222 return getCustomerType(ThreadSession.currentSession(), entityPermission); 223 } 224 225 public CustomerType getCustomerType(Session session) { 226 return getCustomerType(session, EntityPermission.READ_ONLY); 227 } 228 229 public CustomerType getCustomerType() { 230 return getCustomerType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 231 } 232 233 public CustomerType getCustomerTypeForUpdate(Session session) { 234 return getCustomerType(session, EntityPermission.READ_WRITE); 235 } 236 237 public CustomerType getCustomerTypeForUpdate() { 238 return getCustomerType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 239 } 240 241 public void setCustomerTypePK(CustomerTypePK customerTypePK) 242 throws PersistenceNotNullException, PersistenceReadOnlyException { 243 checkReadWrite(); 244 _value.setCustomerTypePK(customerTypePK); 245 } 246 247 public void setCustomerType(CustomerType entity) { 248 setCustomerTypePK(entity == null? null: entity.getPrimaryKey()); 249 } 250 251 public boolean getCustomerTypePKHasBeenModified() { 252 return _value.getCustomerTypePKHasBeenModified(); 253 } 254 255 public OfferUsePK getInitialOfferUsePK() { 256 return _value.getInitialOfferUsePK(); 257 } 258 259 public OfferUse getInitialOfferUse(Session session, EntityPermission entityPermission) { 260 return OfferUseFactory.getInstance().getEntityFromPK(session, entityPermission, getInitialOfferUsePK()); 261 } 262 263 public OfferUse getInitialOfferUse(EntityPermission entityPermission) { 264 return getInitialOfferUse(ThreadSession.currentSession(), entityPermission); 265 } 266 267 public OfferUse getInitialOfferUse(Session session) { 268 return getInitialOfferUse(session, EntityPermission.READ_ONLY); 269 } 270 271 public OfferUse getInitialOfferUse() { 272 return getInitialOfferUse(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 273 } 274 275 public OfferUse getInitialOfferUseForUpdate(Session session) { 276 return getInitialOfferUse(session, EntityPermission.READ_WRITE); 277 } 278 279 public OfferUse getInitialOfferUseForUpdate() { 280 return getInitialOfferUse(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 281 } 282 283 public void setInitialOfferUsePK(OfferUsePK initialOfferUsePK) 284 throws PersistenceNotNullException, PersistenceReadOnlyException { 285 checkReadWrite(); 286 _value.setInitialOfferUsePK(initialOfferUsePK); 287 } 288 289 public void setInitialOfferUse(OfferUse entity) { 290 setInitialOfferUsePK(entity == null? null: entity.getPrimaryKey()); 291 } 292 293 public boolean getInitialOfferUsePKHasBeenModified() { 294 return _value.getInitialOfferUsePKHasBeenModified(); 295 } 296 297 public CancellationPolicyPK getCancellationPolicyPK() { 298 return _value.getCancellationPolicyPK(); 299 } 300 301 public CancellationPolicy getCancellationPolicy(Session session, EntityPermission entityPermission) { 302 CancellationPolicyPK pk = getCancellationPolicyPK(); 303 CancellationPolicy entity = pk == null? null: CancellationPolicyFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 304 305 return entity; 306 } 307 308 public CancellationPolicy getCancellationPolicy(EntityPermission entityPermission) { 309 return getCancellationPolicy(ThreadSession.currentSession(), entityPermission); 310 } 311 312 public CancellationPolicy getCancellationPolicy(Session session) { 313 return getCancellationPolicy(session, EntityPermission.READ_ONLY); 314 } 315 316 public CancellationPolicy getCancellationPolicy() { 317 return getCancellationPolicy(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 318 } 319 320 public CancellationPolicy getCancellationPolicyForUpdate(Session session) { 321 return getCancellationPolicy(session, EntityPermission.READ_WRITE); 322 } 323 324 public CancellationPolicy getCancellationPolicyForUpdate() { 325 return getCancellationPolicy(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 326 } 327 328 public void setCancellationPolicyPK(CancellationPolicyPK cancellationPolicyPK) 329 throws PersistenceNotNullException, PersistenceReadOnlyException { 330 checkReadWrite(); 331 _value.setCancellationPolicyPK(cancellationPolicyPK); 332 } 333 334 public void setCancellationPolicy(CancellationPolicy entity) { 335 setCancellationPolicyPK(entity == null? null: entity.getPrimaryKey()); 336 } 337 338 public boolean getCancellationPolicyPKHasBeenModified() { 339 return _value.getCancellationPolicyPKHasBeenModified(); 340 } 341 342 public ReturnPolicyPK getReturnPolicyPK() { 343 return _value.getReturnPolicyPK(); 344 } 345 346 public ReturnPolicy getReturnPolicy(Session session, EntityPermission entityPermission) { 347 ReturnPolicyPK pk = getReturnPolicyPK(); 348 ReturnPolicy entity = pk == null? null: ReturnPolicyFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 349 350 return entity; 351 } 352 353 public ReturnPolicy getReturnPolicy(EntityPermission entityPermission) { 354 return getReturnPolicy(ThreadSession.currentSession(), entityPermission); 355 } 356 357 public ReturnPolicy getReturnPolicy(Session session) { 358 return getReturnPolicy(session, EntityPermission.READ_ONLY); 359 } 360 361 public ReturnPolicy getReturnPolicy() { 362 return getReturnPolicy(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 363 } 364 365 public ReturnPolicy getReturnPolicyForUpdate(Session session) { 366 return getReturnPolicy(session, EntityPermission.READ_WRITE); 367 } 368 369 public ReturnPolicy getReturnPolicyForUpdate() { 370 return getReturnPolicy(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 371 } 372 373 public void setReturnPolicyPK(ReturnPolicyPK returnPolicyPK) 374 throws PersistenceNotNullException, PersistenceReadOnlyException { 375 checkReadWrite(); 376 _value.setReturnPolicyPK(returnPolicyPK); 377 } 378 379 public void setReturnPolicy(ReturnPolicy entity) { 380 setReturnPolicyPK(entity == null? null: entity.getPrimaryKey()); 381 } 382 383 public boolean getReturnPolicyPKHasBeenModified() { 384 return _value.getReturnPolicyPKHasBeenModified(); 385 } 386 387 public GlAccountPK getArGlAccountPK() { 388 return _value.getArGlAccountPK(); 389 } 390 391 public GlAccount getArGlAccount(Session session, EntityPermission entityPermission) { 392 GlAccountPK pk = getArGlAccountPK(); 393 GlAccount entity = pk == null? null: GlAccountFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 394 395 return entity; 396 } 397 398 public GlAccount getArGlAccount(EntityPermission entityPermission) { 399 return getArGlAccount(ThreadSession.currentSession(), entityPermission); 400 } 401 402 public GlAccount getArGlAccount(Session session) { 403 return getArGlAccount(session, EntityPermission.READ_ONLY); 404 } 405 406 public GlAccount getArGlAccount() { 407 return getArGlAccount(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 408 } 409 410 public GlAccount getArGlAccountForUpdate(Session session) { 411 return getArGlAccount(session, EntityPermission.READ_WRITE); 412 } 413 414 public GlAccount getArGlAccountForUpdate() { 415 return getArGlAccount(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 416 } 417 418 public void setArGlAccountPK(GlAccountPK arGlAccountPK) 419 throws PersistenceNotNullException, PersistenceReadOnlyException { 420 checkReadWrite(); 421 _value.setArGlAccountPK(arGlAccountPK); 422 } 423 424 public void setArGlAccount(GlAccount entity) { 425 setArGlAccountPK(entity == null? null: entity.getPrimaryKey()); 426 } 427 428 public boolean getArGlAccountPKHasBeenModified() { 429 return _value.getArGlAccountPKHasBeenModified(); 430 } 431 432 public Boolean getHoldUntilComplete() { 433 return _value.getHoldUntilComplete(); 434 } 435 436 public void setHoldUntilComplete(Boolean holdUntilComplete) 437 throws PersistenceNotNullException, PersistenceReadOnlyException { 438 checkReadWrite(); 439 _value.setHoldUntilComplete(holdUntilComplete); 440 } 441 442 public boolean getHoldUntilCompleteHasBeenModified() { 443 return _value.getHoldUntilCompleteHasBeenModified(); 444 } 445 446 public Boolean getAllowBackorders() { 447 return _value.getAllowBackorders(); 448 } 449 450 public void setAllowBackorders(Boolean allowBackorders) 451 throws PersistenceNotNullException, PersistenceReadOnlyException { 452 checkReadWrite(); 453 _value.setAllowBackorders(allowBackorders); 454 } 455 456 public boolean getAllowBackordersHasBeenModified() { 457 return _value.getAllowBackordersHasBeenModified(); 458 } 459 460 public Boolean getAllowSubstitutions() { 461 return _value.getAllowSubstitutions(); 462 } 463 464 public void setAllowSubstitutions(Boolean allowSubstitutions) 465 throws PersistenceNotNullException, PersistenceReadOnlyException { 466 checkReadWrite(); 467 _value.setAllowSubstitutions(allowSubstitutions); 468 } 469 470 public boolean getAllowSubstitutionsHasBeenModified() { 471 return _value.getAllowSubstitutionsHasBeenModified(); 472 } 473 474 public Boolean getAllowCombiningShipments() { 475 return _value.getAllowCombiningShipments(); 476 } 477 478 public void setAllowCombiningShipments(Boolean allowCombiningShipments) 479 throws PersistenceNotNullException, PersistenceReadOnlyException { 480 checkReadWrite(); 481 _value.setAllowCombiningShipments(allowCombiningShipments); 482 } 483 484 public boolean getAllowCombiningShipmentsHasBeenModified() { 485 return _value.getAllowCombiningShipmentsHasBeenModified(); 486 } 487 488 public Boolean getRequireReference() { 489 return _value.getRequireReference(); 490 } 491 492 public void setRequireReference(Boolean requireReference) 493 throws PersistenceNotNullException, PersistenceReadOnlyException { 494 checkReadWrite(); 495 _value.setRequireReference(requireReference); 496 } 497 498 public boolean getRequireReferenceHasBeenModified() { 499 return _value.getRequireReferenceHasBeenModified(); 500 } 501 502 public Boolean getAllowReferenceDuplicates() { 503 return _value.getAllowReferenceDuplicates(); 504 } 505 506 public void setAllowReferenceDuplicates(Boolean allowReferenceDuplicates) 507 throws PersistenceNotNullException, PersistenceReadOnlyException { 508 checkReadWrite(); 509 _value.setAllowReferenceDuplicates(allowReferenceDuplicates); 510 } 511 512 public boolean getAllowReferenceDuplicatesHasBeenModified() { 513 return _value.getAllowReferenceDuplicatesHasBeenModified(); 514 } 515 516 public String getReferenceValidationPattern() { 517 return _value.getReferenceValidationPattern(); 518 } 519 520 public void setReferenceValidationPattern(String referenceValidationPattern) 521 throws PersistenceNotNullException, PersistenceReadOnlyException { 522 checkReadWrite(); 523 _value.setReferenceValidationPattern(referenceValidationPattern); 524 } 525 526 public boolean getReferenceValidationPatternHasBeenModified() { 527 return _value.getReferenceValidationPatternHasBeenModified(); 528 } 529 530 public Long getFromTime() { 531 return _value.getFromTime(); 532 } 533 534 public void setFromTime(Long fromTime) 535 throws PersistenceNotNullException, PersistenceReadOnlyException { 536 checkReadWrite(); 537 _value.setFromTime(fromTime); 538 } 539 540 public boolean getFromTimeHasBeenModified() { 541 return _value.getFromTimeHasBeenModified(); 542 } 543 544 public Long getThruTime() { 545 return _value.getThruTime(); 546 } 547 548 public void setThruTime(Long thruTime) 549 throws PersistenceNotNullException, PersistenceReadOnlyException { 550 checkReadWrite(); 551 _value.setThruTime(thruTime); 552 } 553 554 public boolean getThruTimeHasBeenModified() { 555 return _value.getThruTimeHasBeenModified(); 556 } 557 558}