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 * Vendor.java
021 */
022
023package com.echothree.model.data.vendor.server.entity;
024
025import com.echothree.model.data.vendor.common.pk.VendorPK;
026
027import com.echothree.model.data.party.common.pk.PartyPK;
028import com.echothree.model.data.vendor.common.pk.VendorTypePK;
029import com.echothree.model.data.item.common.pk.ItemAliasTypePK;
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;
033import com.echothree.model.data.selector.common.pk.SelectorPK;
034import com.echothree.model.data.filter.common.pk.FilterPK;
035
036import com.echothree.model.data.party.server.entity.Party;
037import com.echothree.model.data.vendor.server.entity.VendorType;
038import com.echothree.model.data.item.server.entity.ItemAliasType;
039import com.echothree.model.data.cancellationpolicy.server.entity.CancellationPolicy;
040import com.echothree.model.data.returnpolicy.server.entity.ReturnPolicy;
041import com.echothree.model.data.accounting.server.entity.GlAccount;
042import com.echothree.model.data.selector.server.entity.Selector;
043import com.echothree.model.data.filter.server.entity.Filter;
044
045import com.echothree.model.data.party.server.factory.PartyFactory;
046import com.echothree.model.data.vendor.server.factory.VendorTypeFactory;
047import com.echothree.model.data.item.server.factory.ItemAliasTypeFactory;
048import com.echothree.model.data.cancellationpolicy.server.factory.CancellationPolicyFactory;
049import com.echothree.model.data.returnpolicy.server.factory.ReturnPolicyFactory;
050import com.echothree.model.data.accounting.server.factory.GlAccountFactory;
051import com.echothree.model.data.selector.server.factory.SelectorFactory;
052import com.echothree.model.data.filter.server.factory.FilterFactory;
053
054import com.echothree.model.data.vendor.common.pk.VendorPK;
055
056import com.echothree.model.data.vendor.server.value.VendorValue;
057
058import com.echothree.model.data.vendor.server.factory.VendorFactory;
059
060import com.echothree.util.common.exception.PersistenceException;
061import com.echothree.util.common.exception.PersistenceDatabaseException;
062import com.echothree.util.common.exception.PersistenceNotNullException;
063import com.echothree.util.common.exception.PersistenceReadOnlyException;
064
065import com.echothree.util.common.persistence.BasePK;
066
067import com.echothree.util.common.persistence.type.ByteArray;
068
069import com.echothree.util.server.persistence.BaseEntity;
070import com.echothree.util.server.persistence.EntityPermission;
071import com.echothree.util.server.persistence.Session;
072import com.echothree.util.server.persistence.ThreadSession;
073
074import java.io.Serializable;
075
076import javax.annotation.Nonnull;
077import javax.annotation.Nullable;
078
079public class Vendor
080        extends BaseEntity
081        implements Serializable {
082    
083    private VendorPK _pk;
084    private VendorValue _value;
085    
086    /** Creates a new instance of Vendor */
087    public Vendor()
088            throws PersistenceException {
089        super();
090    }
091    
092    /** Creates a new instance of Vendor */
093    public Vendor(VendorValue value, EntityPermission entityPermission) {
094        super(entityPermission);
095        
096        _value = value;
097        _pk = value.getPrimaryKey();
098    }
099    
100    @Override
101    @Nonnull
102    public VendorFactory getBaseFactoryInstance() {
103        return VendorFactory.getInstance();
104    }
105    
106    @Override
107    public boolean hasBeenModified() {
108        return _value.hasBeenModified();
109    }
110    
111    @Override
112    public int hashCode() {
113        return _pk.hashCode();
114    }
115    
116    @Override
117    @Nonnull
118    public String toString() {
119        return _pk.toString();
120    }
121    
122    @Override
123    public boolean equals(Object other) {
124        if(this == other)
125            return true;
126        
127        if(other instanceof Vendor that) {
128            VendorValue thatValue = that.getVendorValue();
129            return _value.equals(thatValue);
130        } else {
131            return false;
132        }
133    }
134    
135    @Override
136    public void store()
137            throws PersistenceDatabaseException {
138        getBaseFactoryInstance().store(this);
139    }
140    
141    @Override
142    public void remove()
143            throws PersistenceDatabaseException {
144        getBaseFactoryInstance().remove(this);
145    }
146    
147    @Nonnull
148    public VendorValue getVendorValue() {
149        return _value;
150    }
151    
152    public void setVendorValue(@Nonnull VendorValue value)
153            throws PersistenceReadOnlyException {
154        checkReadWrite();
155        _value = value;
156    }
157    
158    @Override
159    @Nonnull
160    public VendorPK getPrimaryKey() {
161        return _pk;
162    }
163    
164    @Nonnull
165    public PartyPK getPartyPK() {
166        return _value.getPartyPK();
167    }
168    
169    @Nonnull
170    public Party getParty(EntityPermission entityPermission) {
171        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getPartyPK());
172    }
173    
174    @Nonnull
175    public Party getParty() {
176        return getParty(EntityPermission.READ_ONLY);
177    }
178    
179    @Nonnull
180    public Party getPartyForUpdate() {
181        return getParty(EntityPermission.READ_WRITE);
182    }
183    
184    public void setPartyPK(@Nonnull PartyPK partyPK)
185            throws PersistenceNotNullException, PersistenceReadOnlyException {
186        checkReadWrite();
187        _value.setPartyPK(partyPK);
188    }
189    
190    public void setParty(@Nonnull Party entity) {
191        setPartyPK(entity == null ? null : entity.getPrimaryKey());
192    }
193    
194    public boolean getPartyPKHasBeenModified() {
195        return _value.getPartyPKHasBeenModified();
196    }
197    
198    @Nonnull
199    public String getVendorName() {
200        return _value.getVendorName();
201    }
202    
203    public void setVendorName(@Nonnull String vendorName)
204            throws PersistenceNotNullException, PersistenceReadOnlyException {
205        checkReadWrite();
206        _value.setVendorName(vendorName);
207    }
208    
209    public boolean getVendorNameHasBeenModified() {
210        return _value.getVendorNameHasBeenModified();
211    }
212    
213    @Nonnull
214    public VendorTypePK getVendorTypePK() {
215        return _value.getVendorTypePK();
216    }
217    
218    @Nonnull
219    public VendorType getVendorType(EntityPermission entityPermission) {
220        return VendorTypeFactory.getInstance().getEntityFromPK(entityPermission, getVendorTypePK());
221    }
222    
223    @Nonnull
224    public VendorType getVendorType() {
225        return getVendorType(EntityPermission.READ_ONLY);
226    }
227    
228    @Nonnull
229    public VendorType getVendorTypeForUpdate() {
230        return getVendorType(EntityPermission.READ_WRITE);
231    }
232    
233    public void setVendorTypePK(@Nonnull VendorTypePK vendorTypePK)
234            throws PersistenceNotNullException, PersistenceReadOnlyException {
235        checkReadWrite();
236        _value.setVendorTypePK(vendorTypePK);
237    }
238    
239    public void setVendorType(@Nonnull VendorType entity) {
240        setVendorTypePK(entity == null ? null : entity.getPrimaryKey());
241    }
242    
243    public boolean getVendorTypePKHasBeenModified() {
244        return _value.getVendorTypePKHasBeenModified();
245    }
246    
247    @Nullable
248    public Integer getMinimumPurchaseOrderLines() {
249        return _value.getMinimumPurchaseOrderLines();
250    }
251    
252    public void setMinimumPurchaseOrderLines(@Nullable Integer minimumPurchaseOrderLines)
253            throws PersistenceNotNullException, PersistenceReadOnlyException {
254        checkReadWrite();
255        _value.setMinimumPurchaseOrderLines(minimumPurchaseOrderLines);
256    }
257    
258    public boolean getMinimumPurchaseOrderLinesHasBeenModified() {
259        return _value.getMinimumPurchaseOrderLinesHasBeenModified();
260    }
261    
262    @Nullable
263    public Integer getMaximumPurchaseOrderLines() {
264        return _value.getMaximumPurchaseOrderLines();
265    }
266    
267    public void setMaximumPurchaseOrderLines(@Nullable Integer maximumPurchaseOrderLines)
268            throws PersistenceNotNullException, PersistenceReadOnlyException {
269        checkReadWrite();
270        _value.setMaximumPurchaseOrderLines(maximumPurchaseOrderLines);
271    }
272    
273    public boolean getMaximumPurchaseOrderLinesHasBeenModified() {
274        return _value.getMaximumPurchaseOrderLinesHasBeenModified();
275    }
276    
277    @Nullable
278    public Long getMinimumPurchaseOrderAmount() {
279        return _value.getMinimumPurchaseOrderAmount();
280    }
281    
282    public void setMinimumPurchaseOrderAmount(@Nullable Long minimumPurchaseOrderAmount)
283            throws PersistenceNotNullException, PersistenceReadOnlyException {
284        checkReadWrite();
285        _value.setMinimumPurchaseOrderAmount(minimumPurchaseOrderAmount);
286    }
287    
288    public boolean getMinimumPurchaseOrderAmountHasBeenModified() {
289        return _value.getMinimumPurchaseOrderAmountHasBeenModified();
290    }
291    
292    @Nullable
293    public Long getMaximumPurchaseOrderAmount() {
294        return _value.getMaximumPurchaseOrderAmount();
295    }
296    
297    public void setMaximumPurchaseOrderAmount(@Nullable Long maximumPurchaseOrderAmount)
298            throws PersistenceNotNullException, PersistenceReadOnlyException {
299        checkReadWrite();
300        _value.setMaximumPurchaseOrderAmount(maximumPurchaseOrderAmount);
301    }
302    
303    public boolean getMaximumPurchaseOrderAmountHasBeenModified() {
304        return _value.getMaximumPurchaseOrderAmountHasBeenModified();
305    }
306    
307    @Nonnull
308    public Boolean getUseItemPurchasingCategories() {
309        return _value.getUseItemPurchasingCategories();
310    }
311    
312    public void setUseItemPurchasingCategories(@Nonnull Boolean useItemPurchasingCategories)
313            throws PersistenceNotNullException, PersistenceReadOnlyException {
314        checkReadWrite();
315        _value.setUseItemPurchasingCategories(useItemPurchasingCategories);
316    }
317    
318    public boolean getUseItemPurchasingCategoriesHasBeenModified() {
319        return _value.getUseItemPurchasingCategoriesHasBeenModified();
320    }
321    
322    @Nullable
323    public ItemAliasTypePK getDefaultItemAliasTypePK() {
324        return _value.getDefaultItemAliasTypePK();
325    }
326    
327    @Nullable
328    public ItemAliasType getDefaultItemAliasType(EntityPermission entityPermission) {
329        ItemAliasTypePK pk = getDefaultItemAliasTypePK();
330        ItemAliasType entity = pk == null? null: ItemAliasTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
331        
332        return entity;
333    }
334    
335    @Nullable
336    public ItemAliasType getDefaultItemAliasType() {
337        return getDefaultItemAliasType(EntityPermission.READ_ONLY);
338    }
339    
340    @Nullable
341    public ItemAliasType getDefaultItemAliasTypeForUpdate() {
342        return getDefaultItemAliasType(EntityPermission.READ_WRITE);
343    }
344    
345    public void setDefaultItemAliasTypePK(@Nullable ItemAliasTypePK defaultItemAliasTypePK)
346            throws PersistenceNotNullException, PersistenceReadOnlyException {
347        checkReadWrite();
348        _value.setDefaultItemAliasTypePK(defaultItemAliasTypePK);
349    }
350    
351    public void setDefaultItemAliasType(@Nullable ItemAliasType entity) {
352        setDefaultItemAliasTypePK(entity == null ? null : entity.getPrimaryKey());
353    }
354    
355    public boolean getDefaultItemAliasTypePKHasBeenModified() {
356        return _value.getDefaultItemAliasTypePKHasBeenModified();
357    }
358    
359    @Nullable
360    public CancellationPolicyPK getCancellationPolicyPK() {
361        return _value.getCancellationPolicyPK();
362    }
363    
364    @Nullable
365    public CancellationPolicy getCancellationPolicy(EntityPermission entityPermission) {
366        CancellationPolicyPK pk = getCancellationPolicyPK();
367        CancellationPolicy entity = pk == null? null: CancellationPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk);
368        
369        return entity;
370    }
371    
372    @Nullable
373    public CancellationPolicy getCancellationPolicy() {
374        return getCancellationPolicy(EntityPermission.READ_ONLY);
375    }
376    
377    @Nullable
378    public CancellationPolicy getCancellationPolicyForUpdate() {
379        return getCancellationPolicy(EntityPermission.READ_WRITE);
380    }
381    
382    public void setCancellationPolicyPK(@Nullable CancellationPolicyPK cancellationPolicyPK)
383            throws PersistenceNotNullException, PersistenceReadOnlyException {
384        checkReadWrite();
385        _value.setCancellationPolicyPK(cancellationPolicyPK);
386    }
387    
388    public void setCancellationPolicy(@Nullable CancellationPolicy entity) {
389        setCancellationPolicyPK(entity == null ? null : entity.getPrimaryKey());
390    }
391    
392    public boolean getCancellationPolicyPKHasBeenModified() {
393        return _value.getCancellationPolicyPKHasBeenModified();
394    }
395    
396    @Nullable
397    public ReturnPolicyPK getReturnPolicyPK() {
398        return _value.getReturnPolicyPK();
399    }
400    
401    @Nullable
402    public ReturnPolicy getReturnPolicy(EntityPermission entityPermission) {
403        ReturnPolicyPK pk = getReturnPolicyPK();
404        ReturnPolicy entity = pk == null? null: ReturnPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk);
405        
406        return entity;
407    }
408    
409    @Nullable
410    public ReturnPolicy getReturnPolicy() {
411        return getReturnPolicy(EntityPermission.READ_ONLY);
412    }
413    
414    @Nullable
415    public ReturnPolicy getReturnPolicyForUpdate() {
416        return getReturnPolicy(EntityPermission.READ_WRITE);
417    }
418    
419    public void setReturnPolicyPK(@Nullable ReturnPolicyPK returnPolicyPK)
420            throws PersistenceNotNullException, PersistenceReadOnlyException {
421        checkReadWrite();
422        _value.setReturnPolicyPK(returnPolicyPK);
423    }
424    
425    public void setReturnPolicy(@Nullable ReturnPolicy entity) {
426        setReturnPolicyPK(entity == null ? null : entity.getPrimaryKey());
427    }
428    
429    public boolean getReturnPolicyPKHasBeenModified() {
430        return _value.getReturnPolicyPKHasBeenModified();
431    }
432    
433    @Nullable
434    public GlAccountPK getApGlAccountPK() {
435        return _value.getApGlAccountPK();
436    }
437    
438    @Nullable
439    public GlAccount getApGlAccount(EntityPermission entityPermission) {
440        GlAccountPK pk = getApGlAccountPK();
441        GlAccount entity = pk == null? null: GlAccountFactory.getInstance().getEntityFromPK(entityPermission, pk);
442        
443        return entity;
444    }
445    
446    @Nullable
447    public GlAccount getApGlAccount() {
448        return getApGlAccount(EntityPermission.READ_ONLY);
449    }
450    
451    @Nullable
452    public GlAccount getApGlAccountForUpdate() {
453        return getApGlAccount(EntityPermission.READ_WRITE);
454    }
455    
456    public void setApGlAccountPK(@Nullable GlAccountPK apGlAccountPK)
457            throws PersistenceNotNullException, PersistenceReadOnlyException {
458        checkReadWrite();
459        _value.setApGlAccountPK(apGlAccountPK);
460    }
461    
462    public void setApGlAccount(@Nullable GlAccount entity) {
463        setApGlAccountPK(entity == null ? null : entity.getPrimaryKey());
464    }
465    
466    public boolean getApGlAccountPKHasBeenModified() {
467        return _value.getApGlAccountPKHasBeenModified();
468    }
469    
470    @Nonnull
471    public Boolean getHoldUntilComplete() {
472        return _value.getHoldUntilComplete();
473    }
474    
475    public void setHoldUntilComplete(@Nonnull Boolean holdUntilComplete)
476            throws PersistenceNotNullException, PersistenceReadOnlyException {
477        checkReadWrite();
478        _value.setHoldUntilComplete(holdUntilComplete);
479    }
480    
481    public boolean getHoldUntilCompleteHasBeenModified() {
482        return _value.getHoldUntilCompleteHasBeenModified();
483    }
484    
485    @Nonnull
486    public Boolean getAllowBackorders() {
487        return _value.getAllowBackorders();
488    }
489    
490    public void setAllowBackorders(@Nonnull Boolean allowBackorders)
491            throws PersistenceNotNullException, PersistenceReadOnlyException {
492        checkReadWrite();
493        _value.setAllowBackorders(allowBackorders);
494    }
495    
496    public boolean getAllowBackordersHasBeenModified() {
497        return _value.getAllowBackordersHasBeenModified();
498    }
499    
500    @Nonnull
501    public Boolean getAllowSubstitutions() {
502        return _value.getAllowSubstitutions();
503    }
504    
505    public void setAllowSubstitutions(@Nonnull Boolean allowSubstitutions)
506            throws PersistenceNotNullException, PersistenceReadOnlyException {
507        checkReadWrite();
508        _value.setAllowSubstitutions(allowSubstitutions);
509    }
510    
511    public boolean getAllowSubstitutionsHasBeenModified() {
512        return _value.getAllowSubstitutionsHasBeenModified();
513    }
514    
515    @Nonnull
516    public Boolean getAllowCombiningShipments() {
517        return _value.getAllowCombiningShipments();
518    }
519    
520    public void setAllowCombiningShipments(@Nonnull Boolean allowCombiningShipments)
521            throws PersistenceNotNullException, PersistenceReadOnlyException {
522        checkReadWrite();
523        _value.setAllowCombiningShipments(allowCombiningShipments);
524    }
525    
526    public boolean getAllowCombiningShipmentsHasBeenModified() {
527        return _value.getAllowCombiningShipmentsHasBeenModified();
528    }
529    
530    @Nonnull
531    public Boolean getRequireReference() {
532        return _value.getRequireReference();
533    }
534    
535    public void setRequireReference(@Nonnull Boolean requireReference)
536            throws PersistenceNotNullException, PersistenceReadOnlyException {
537        checkReadWrite();
538        _value.setRequireReference(requireReference);
539    }
540    
541    public boolean getRequireReferenceHasBeenModified() {
542        return _value.getRequireReferenceHasBeenModified();
543    }
544    
545    @Nonnull
546    public Boolean getAllowReferenceDuplicates() {
547        return _value.getAllowReferenceDuplicates();
548    }
549    
550    public void setAllowReferenceDuplicates(@Nonnull Boolean allowReferenceDuplicates)
551            throws PersistenceNotNullException, PersistenceReadOnlyException {
552        checkReadWrite();
553        _value.setAllowReferenceDuplicates(allowReferenceDuplicates);
554    }
555    
556    public boolean getAllowReferenceDuplicatesHasBeenModified() {
557        return _value.getAllowReferenceDuplicatesHasBeenModified();
558    }
559    
560    @Nullable
561    public String getReferenceValidationPattern() {
562        return _value.getReferenceValidationPattern();
563    }
564    
565    public void setReferenceValidationPattern(@Nullable String referenceValidationPattern)
566            throws PersistenceNotNullException, PersistenceReadOnlyException {
567        checkReadWrite();
568        _value.setReferenceValidationPattern(referenceValidationPattern);
569    }
570    
571    public boolean getReferenceValidationPatternHasBeenModified() {
572        return _value.getReferenceValidationPatternHasBeenModified();
573    }
574    
575    @Nullable
576    public SelectorPK getVendorItemSelectorPK() {
577        return _value.getVendorItemSelectorPK();
578    }
579    
580    @Nullable
581    public Selector getVendorItemSelector(EntityPermission entityPermission) {
582        SelectorPK pk = getVendorItemSelectorPK();
583        Selector entity = pk == null? null: SelectorFactory.getInstance().getEntityFromPK(entityPermission, pk);
584        
585        return entity;
586    }
587    
588    @Nullable
589    public Selector getVendorItemSelector() {
590        return getVendorItemSelector(EntityPermission.READ_ONLY);
591    }
592    
593    @Nullable
594    public Selector getVendorItemSelectorForUpdate() {
595        return getVendorItemSelector(EntityPermission.READ_WRITE);
596    }
597    
598    public void setVendorItemSelectorPK(@Nullable SelectorPK vendorItemSelectorPK)
599            throws PersistenceNotNullException, PersistenceReadOnlyException {
600        checkReadWrite();
601        _value.setVendorItemSelectorPK(vendorItemSelectorPK);
602    }
603    
604    public void setVendorItemSelector(@Nullable Selector entity) {
605        setVendorItemSelectorPK(entity == null ? null : entity.getPrimaryKey());
606    }
607    
608    public boolean getVendorItemSelectorPKHasBeenModified() {
609        return _value.getVendorItemSelectorPKHasBeenModified();
610    }
611    
612    @Nullable
613    public FilterPK getVendorItemCostFilterPK() {
614        return _value.getVendorItemCostFilterPK();
615    }
616    
617    @Nullable
618    public Filter getVendorItemCostFilter(EntityPermission entityPermission) {
619        FilterPK pk = getVendorItemCostFilterPK();
620        Filter entity = pk == null? null: FilterFactory.getInstance().getEntityFromPK(entityPermission, pk);
621        
622        return entity;
623    }
624    
625    @Nullable
626    public Filter getVendorItemCostFilter() {
627        return getVendorItemCostFilter(EntityPermission.READ_ONLY);
628    }
629    
630    @Nullable
631    public Filter getVendorItemCostFilterForUpdate() {
632        return getVendorItemCostFilter(EntityPermission.READ_WRITE);
633    }
634    
635    public void setVendorItemCostFilterPK(@Nullable FilterPK vendorItemCostFilterPK)
636            throws PersistenceNotNullException, PersistenceReadOnlyException {
637        checkReadWrite();
638        _value.setVendorItemCostFilterPK(vendorItemCostFilterPK);
639    }
640    
641    public void setVendorItemCostFilter(@Nullable Filter entity) {
642        setVendorItemCostFilterPK(entity == null ? null : entity.getPrimaryKey());
643    }
644    
645    public boolean getVendorItemCostFilterPKHasBeenModified() {
646        return _value.getVendorItemCostFilterPKHasBeenModified();
647    }
648    
649    @Nonnull
650    public Long getFromTime() {
651        return _value.getFromTime();
652    }
653    
654    public void setFromTime(@Nonnull Long fromTime)
655            throws PersistenceNotNullException, PersistenceReadOnlyException {
656        checkReadWrite();
657        _value.setFromTime(fromTime);
658    }
659    
660    public boolean getFromTimeHasBeenModified() {
661        return _value.getFromTimeHasBeenModified();
662    }
663    
664    @Nonnull
665    public Long getThruTime() {
666        return _value.getThruTime();
667    }
668    
669    public void setThruTime(@Nonnull Long thruTime)
670            throws PersistenceNotNullException, PersistenceReadOnlyException {
671        checkReadWrite();
672        _value.setThruTime(thruTime);
673    }
674    
675    public boolean getThruTimeHasBeenModified() {
676        return _value.getThruTimeHasBeenModified();
677    }
678    
679}