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