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 * VendorItemDetail.java
021 */
022
023package com.echothree.model.data.vendor.server.entity;
024
025import com.echothree.model.data.vendor.common.pk.VendorItemDetailPK;
026
027import com.echothree.model.data.vendor.common.pk.VendorItemPK;
028import com.echothree.model.data.item.common.pk.ItemPK;
029import com.echothree.model.data.party.common.pk.PartyPK;
030import com.echothree.model.data.cancellationpolicy.common.pk.CancellationPolicyPK;
031import com.echothree.model.data.returnpolicy.common.pk.ReturnPolicyPK;
032
033import com.echothree.model.data.vendor.server.entity.VendorItem;
034import com.echothree.model.data.item.server.entity.Item;
035import com.echothree.model.data.party.server.entity.Party;
036import com.echothree.model.data.cancellationpolicy.server.entity.CancellationPolicy;
037import com.echothree.model.data.returnpolicy.server.entity.ReturnPolicy;
038
039import com.echothree.model.data.vendor.server.factory.VendorItemFactory;
040import com.echothree.model.data.item.server.factory.ItemFactory;
041import com.echothree.model.data.party.server.factory.PartyFactory;
042import com.echothree.model.data.cancellationpolicy.server.factory.CancellationPolicyFactory;
043import com.echothree.model.data.returnpolicy.server.factory.ReturnPolicyFactory;
044
045import com.echothree.model.data.vendor.common.pk.VendorItemDetailPK;
046
047import com.echothree.model.data.vendor.server.value.VendorItemDetailValue;
048
049import com.echothree.model.data.vendor.server.factory.VendorItemDetailFactory;
050
051import com.echothree.util.common.exception.PersistenceException;
052import com.echothree.util.common.exception.PersistenceDatabaseException;
053import com.echothree.util.common.exception.PersistenceNotNullException;
054import com.echothree.util.common.exception.PersistenceReadOnlyException;
055
056import com.echothree.util.common.persistence.BasePK;
057
058import com.echothree.util.common.persistence.type.ByteArray;
059
060import com.echothree.util.server.persistence.BaseEntity;
061import com.echothree.util.server.persistence.EntityPermission;
062import com.echothree.util.server.persistence.Session;
063import com.echothree.util.server.persistence.ThreadSession;
064
065import java.io.Serializable;
066
067public class VendorItemDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private VendorItemDetailPK _pk;
072    private VendorItemDetailValue _value;
073    
074    /** Creates a new instance of VendorItemDetail */
075    public VendorItemDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of VendorItemDetail */
081    public VendorItemDetail(VendorItemDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    public VendorItemDetailFactory getBaseFactoryInstance() {
090        return VendorItemDetailFactory.getInstance();
091    }
092    
093    @Override
094    public boolean hasBeenModified() {
095        return _value.hasBeenModified();
096    }
097    
098    @Override
099    public int hashCode() {
100        return _pk.hashCode();
101    }
102    
103    @Override
104    public String toString() {
105        return _pk.toString();
106    }
107    
108    @Override
109    public boolean equals(Object other) {
110        if(this == other)
111            return true;
112        
113        if(other instanceof VendorItemDetail that) {
114            VendorItemDetailValue thatValue = that.getVendorItemDetailValue();
115            return _value.equals(thatValue);
116        } else {
117            return false;
118        }
119    }
120    
121    @Override
122    public void store()
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().store(this);
125    }
126    
127    @Override
128    public void remove()
129            throws PersistenceDatabaseException {
130        getBaseFactoryInstance().remove(this);
131    }
132    
133    public VendorItemDetailValue getVendorItemDetailValue() {
134        return _value;
135    }
136    
137    public void setVendorItemDetailValue(VendorItemDetailValue value)
138            throws PersistenceReadOnlyException {
139        checkReadWrite();
140        _value = value;
141    }
142    
143    @Override
144    public VendorItemDetailPK getPrimaryKey() {
145        return _pk;
146    }
147    
148    public VendorItemPK getVendorItemPK() {
149        return _value.getVendorItemPK();
150    }
151    
152    public VendorItem getVendorItem(EntityPermission entityPermission) {
153        return VendorItemFactory.getInstance().getEntityFromPK(entityPermission, getVendorItemPK());
154    }
155    
156    public VendorItem getVendorItem() {
157        return getVendorItem(EntityPermission.READ_ONLY);
158    }
159    
160    public VendorItem getVendorItemForUpdate() {
161        return getVendorItem(EntityPermission.READ_WRITE);
162    }
163    
164    public void setVendorItemPK(VendorItemPK vendorItemPK)
165            throws PersistenceNotNullException, PersistenceReadOnlyException {
166        checkReadWrite();
167        _value.setVendorItemPK(vendorItemPK);
168    }
169    
170    public void setVendorItem(VendorItem entity) {
171        setVendorItemPK(entity == null? null: entity.getPrimaryKey());
172    }
173    
174    public boolean getVendorItemPKHasBeenModified() {
175        return _value.getVendorItemPKHasBeenModified();
176    }
177    
178    public ItemPK getItemPK() {
179        return _value.getItemPK();
180    }
181    
182    public Item getItem(EntityPermission entityPermission) {
183        return ItemFactory.getInstance().getEntityFromPK(entityPermission, getItemPK());
184    }
185    
186    public Item getItem() {
187        return getItem(EntityPermission.READ_ONLY);
188    }
189    
190    public Item getItemForUpdate() {
191        return getItem(EntityPermission.READ_WRITE);
192    }
193    
194    public void setItemPK(ItemPK itemPK)
195            throws PersistenceNotNullException, PersistenceReadOnlyException {
196        checkReadWrite();
197        _value.setItemPK(itemPK);
198    }
199    
200    public void setItem(Item entity) {
201        setItemPK(entity == null? null: entity.getPrimaryKey());
202    }
203    
204    public boolean getItemPKHasBeenModified() {
205        return _value.getItemPKHasBeenModified();
206    }
207    
208    public PartyPK getVendorPartyPK() {
209        return _value.getVendorPartyPK();
210    }
211    
212    public Party getVendorParty(EntityPermission entityPermission) {
213        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getVendorPartyPK());
214    }
215    
216    public Party getVendorParty() {
217        return getVendorParty(EntityPermission.READ_ONLY);
218    }
219    
220    public Party getVendorPartyForUpdate() {
221        return getVendorParty(EntityPermission.READ_WRITE);
222    }
223    
224    public void setVendorPartyPK(PartyPK vendorPartyPK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setVendorPartyPK(vendorPartyPK);
228    }
229    
230    public void setVendorParty(Party entity) {
231        setVendorPartyPK(entity == null? null: entity.getPrimaryKey());
232    }
233    
234    public boolean getVendorPartyPKHasBeenModified() {
235        return _value.getVendorPartyPKHasBeenModified();
236    }
237    
238    public String getVendorItemName() {
239        return _value.getVendorItemName();
240    }
241    
242    public void setVendorItemName(String vendorItemName)
243            throws PersistenceNotNullException, PersistenceReadOnlyException {
244        checkReadWrite();
245        _value.setVendorItemName(vendorItemName);
246    }
247    
248    public boolean getVendorItemNameHasBeenModified() {
249        return _value.getVendorItemNameHasBeenModified();
250    }
251    
252    public String getDescription() {
253        return _value.getDescription();
254    }
255    
256    public void setDescription(String description)
257            throws PersistenceNotNullException, PersistenceReadOnlyException {
258        checkReadWrite();
259        _value.setDescription(description);
260    }
261    
262    public boolean getDescriptionHasBeenModified() {
263        return _value.getDescriptionHasBeenModified();
264    }
265    
266    public Integer getPriority() {
267        return _value.getPriority();
268    }
269    
270    public void setPriority(Integer priority)
271            throws PersistenceNotNullException, PersistenceReadOnlyException {
272        checkReadWrite();
273        _value.setPriority(priority);
274    }
275    
276    public boolean getPriorityHasBeenModified() {
277        return _value.getPriorityHasBeenModified();
278    }
279    
280    public CancellationPolicyPK getCancellationPolicyPK() {
281        return _value.getCancellationPolicyPK();
282    }
283    
284    public CancellationPolicy getCancellationPolicy(EntityPermission entityPermission) {
285        CancellationPolicyPK pk = getCancellationPolicyPK();
286        CancellationPolicy entity = pk == null? null: CancellationPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk);
287        
288        return entity;
289    }
290    
291    public CancellationPolicy getCancellationPolicy() {
292        return getCancellationPolicy(EntityPermission.READ_ONLY);
293    }
294    
295    public CancellationPolicy getCancellationPolicyForUpdate() {
296        return getCancellationPolicy(EntityPermission.READ_WRITE);
297    }
298    
299    public void setCancellationPolicyPK(CancellationPolicyPK cancellationPolicyPK)
300            throws PersistenceNotNullException, PersistenceReadOnlyException {
301        checkReadWrite();
302        _value.setCancellationPolicyPK(cancellationPolicyPK);
303    }
304    
305    public void setCancellationPolicy(CancellationPolicy entity) {
306        setCancellationPolicyPK(entity == null? null: entity.getPrimaryKey());
307    }
308    
309    public boolean getCancellationPolicyPKHasBeenModified() {
310        return _value.getCancellationPolicyPKHasBeenModified();
311    }
312    
313    public ReturnPolicyPK getReturnPolicyPK() {
314        return _value.getReturnPolicyPK();
315    }
316    
317    public ReturnPolicy getReturnPolicy(EntityPermission entityPermission) {
318        ReturnPolicyPK pk = getReturnPolicyPK();
319        ReturnPolicy entity = pk == null? null: ReturnPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk);
320        
321        return entity;
322    }
323    
324    public ReturnPolicy getReturnPolicy() {
325        return getReturnPolicy(EntityPermission.READ_ONLY);
326    }
327    
328    public ReturnPolicy getReturnPolicyForUpdate() {
329        return getReturnPolicy(EntityPermission.READ_WRITE);
330    }
331    
332    public void setReturnPolicyPK(ReturnPolicyPK returnPolicyPK)
333            throws PersistenceNotNullException, PersistenceReadOnlyException {
334        checkReadWrite();
335        _value.setReturnPolicyPK(returnPolicyPK);
336    }
337    
338    public void setReturnPolicy(ReturnPolicy entity) {
339        setReturnPolicyPK(entity == null? null: entity.getPrimaryKey());
340    }
341    
342    public boolean getReturnPolicyPKHasBeenModified() {
343        return _value.getReturnPolicyPKHasBeenModified();
344    }
345    
346    public Long getFromTime() {
347        return _value.getFromTime();
348    }
349    
350    public void setFromTime(Long fromTime)
351            throws PersistenceNotNullException, PersistenceReadOnlyException {
352        checkReadWrite();
353        _value.setFromTime(fromTime);
354    }
355    
356    public boolean getFromTimeHasBeenModified() {
357        return _value.getFromTimeHasBeenModified();
358    }
359    
360    public Long getThruTime() {
361        return _value.getThruTime();
362    }
363    
364    public void setThruTime(Long thruTime)
365            throws PersistenceNotNullException, PersistenceReadOnlyException {
366        checkReadWrite();
367        _value.setThruTime(thruTime);
368    }
369    
370    public boolean getThruTimeHasBeenModified() {
371        return _value.getThruTimeHasBeenModified();
372    }
373    
374}