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 * OfferUseDetail.java
021 */
022
023package com.echothree.model.data.offer.server.entity;
024
025import com.echothree.model.data.offer.common.pk.OfferUseDetailPK;
026
027import com.echothree.model.data.offer.common.pk.OfferUsePK;
028import com.echothree.model.data.offer.common.pk.OfferPK;
029import com.echothree.model.data.offer.common.pk.UsePK;
030import com.echothree.model.data.sequence.common.pk.SequencePK;
031
032import com.echothree.model.data.offer.server.entity.OfferUse;
033import com.echothree.model.data.offer.server.entity.Offer;
034import com.echothree.model.data.offer.server.entity.Use;
035import com.echothree.model.data.sequence.server.entity.Sequence;
036
037import com.echothree.model.data.offer.server.factory.OfferUseFactory;
038import com.echothree.model.data.offer.server.factory.OfferFactory;
039import com.echothree.model.data.offer.server.factory.UseFactory;
040import com.echothree.model.data.sequence.server.factory.SequenceFactory;
041
042import com.echothree.model.data.offer.common.pk.OfferUseDetailPK;
043
044import com.echothree.model.data.offer.server.value.OfferUseDetailValue;
045
046import com.echothree.model.data.offer.server.factory.OfferUseDetailFactory;
047
048import com.echothree.util.common.exception.PersistenceException;
049import com.echothree.util.common.exception.PersistenceDatabaseException;
050import com.echothree.util.common.exception.PersistenceNotNullException;
051import com.echothree.util.common.exception.PersistenceReadOnlyException;
052
053import com.echothree.util.common.persistence.BasePK;
054
055import com.echothree.util.common.persistence.type.ByteArray;
056
057import com.echothree.util.server.persistence.BaseEntity;
058import com.echothree.util.server.persistence.EntityPermission;
059import com.echothree.util.server.persistence.Session;
060import com.echothree.util.server.persistence.ThreadSession;
061
062import java.io.Serializable;
063
064public class OfferUseDetail
065        extends BaseEntity
066        implements Serializable {
067    
068    private OfferUseDetailPK _pk;
069    private OfferUseDetailValue _value;
070    
071    /** Creates a new instance of OfferUseDetail */
072    public OfferUseDetail()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of OfferUseDetail */
078    public OfferUseDetail(OfferUseDetailValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public OfferUseDetailFactory getBaseFactoryInstance() {
087        return OfferUseDetailFactory.getInstance();
088    }
089    
090    @Override
091    public boolean hasBeenModified() {
092        return _value.hasBeenModified();
093    }
094    
095    @Override
096    public int hashCode() {
097        return _pk.hashCode();
098    }
099    
100    @Override
101    public String toString() {
102        return _pk.toString();
103    }
104    
105    @Override
106    public boolean equals(Object other) {
107        if(this == other)
108            return true;
109        
110        if(other instanceof OfferUseDetail that) {
111            OfferUseDetailValue thatValue = that.getOfferUseDetailValue();
112            return _value.equals(thatValue);
113        } else {
114            return false;
115        }
116    }
117    
118    @Override
119    public void store()
120            throws PersistenceDatabaseException {
121        getBaseFactoryInstance().store(this);
122    }
123    
124    @Override
125    public void remove()
126            throws PersistenceDatabaseException {
127        getBaseFactoryInstance().remove(this);
128    }
129    
130    public OfferUseDetailValue getOfferUseDetailValue() {
131        return _value;
132    }
133    
134    public void setOfferUseDetailValue(OfferUseDetailValue value)
135            throws PersistenceReadOnlyException {
136        checkReadWrite();
137        _value = value;
138    }
139    
140    @Override
141    public OfferUseDetailPK getPrimaryKey() {
142        return _pk;
143    }
144    
145    public OfferUsePK getOfferUsePK() {
146        return _value.getOfferUsePK();
147    }
148    
149    public OfferUse getOfferUse(EntityPermission entityPermission) {
150        return OfferUseFactory.getInstance().getEntityFromPK(entityPermission, getOfferUsePK());
151    }
152    
153    public OfferUse getOfferUse() {
154        return getOfferUse(EntityPermission.READ_ONLY);
155    }
156    
157    public OfferUse getOfferUseForUpdate() {
158        return getOfferUse(EntityPermission.READ_WRITE);
159    }
160    
161    public void setOfferUsePK(OfferUsePK offerUsePK)
162            throws PersistenceNotNullException, PersistenceReadOnlyException {
163        checkReadWrite();
164        _value.setOfferUsePK(offerUsePK);
165    }
166    
167    public void setOfferUse(OfferUse entity) {
168        setOfferUsePK(entity == null? null: entity.getPrimaryKey());
169    }
170    
171    public boolean getOfferUsePKHasBeenModified() {
172        return _value.getOfferUsePKHasBeenModified();
173    }
174    
175    public OfferPK getOfferPK() {
176        return _value.getOfferPK();
177    }
178    
179    public Offer getOffer(EntityPermission entityPermission) {
180        return OfferFactory.getInstance().getEntityFromPK(entityPermission, getOfferPK());
181    }
182    
183    public Offer getOffer() {
184        return getOffer(EntityPermission.READ_ONLY);
185    }
186    
187    public Offer getOfferForUpdate() {
188        return getOffer(EntityPermission.READ_WRITE);
189    }
190    
191    public void setOfferPK(OfferPK offerPK)
192            throws PersistenceNotNullException, PersistenceReadOnlyException {
193        checkReadWrite();
194        _value.setOfferPK(offerPK);
195    }
196    
197    public void setOffer(Offer entity) {
198        setOfferPK(entity == null? null: entity.getPrimaryKey());
199    }
200    
201    public boolean getOfferPKHasBeenModified() {
202        return _value.getOfferPKHasBeenModified();
203    }
204    
205    public UsePK getUsePK() {
206        return _value.getUsePK();
207    }
208    
209    public Use getUse(EntityPermission entityPermission) {
210        return UseFactory.getInstance().getEntityFromPK(entityPermission, getUsePK());
211    }
212    
213    public Use getUse() {
214        return getUse(EntityPermission.READ_ONLY);
215    }
216    
217    public Use getUseForUpdate() {
218        return getUse(EntityPermission.READ_WRITE);
219    }
220    
221    public void setUsePK(UsePK usePK)
222            throws PersistenceNotNullException, PersistenceReadOnlyException {
223        checkReadWrite();
224        _value.setUsePK(usePK);
225    }
226    
227    public void setUse(Use entity) {
228        setUsePK(entity == null? null: entity.getPrimaryKey());
229    }
230    
231    public boolean getUsePKHasBeenModified() {
232        return _value.getUsePKHasBeenModified();
233    }
234    
235    public SequencePK getSalesOrderSequencePK() {
236        return _value.getSalesOrderSequencePK();
237    }
238    
239    public Sequence getSalesOrderSequence(EntityPermission entityPermission) {
240        SequencePK pk = getSalesOrderSequencePK();
241        Sequence entity = pk == null? null: SequenceFactory.getInstance().getEntityFromPK(entityPermission, pk);
242        
243        return entity;
244    }
245    
246    public Sequence getSalesOrderSequence() {
247        return getSalesOrderSequence(EntityPermission.READ_ONLY);
248    }
249    
250    public Sequence getSalesOrderSequenceForUpdate() {
251        return getSalesOrderSequence(EntityPermission.READ_WRITE);
252    }
253    
254    public void setSalesOrderSequencePK(SequencePK salesOrderSequencePK)
255            throws PersistenceNotNullException, PersistenceReadOnlyException {
256        checkReadWrite();
257        _value.setSalesOrderSequencePK(salesOrderSequencePK);
258    }
259    
260    public void setSalesOrderSequence(Sequence entity) {
261        setSalesOrderSequencePK(entity == null? null: entity.getPrimaryKey());
262    }
263    
264    public boolean getSalesOrderSequencePKHasBeenModified() {
265        return _value.getSalesOrderSequencePKHasBeenModified();
266    }
267    
268    public Long getFromTime() {
269        return _value.getFromTime();
270    }
271    
272    public void setFromTime(Long fromTime)
273            throws PersistenceNotNullException, PersistenceReadOnlyException {
274        checkReadWrite();
275        _value.setFromTime(fromTime);
276    }
277    
278    public boolean getFromTimeHasBeenModified() {
279        return _value.getFromTimeHasBeenModified();
280    }
281    
282    public Long getThruTime() {
283        return _value.getThruTime();
284    }
285    
286    public void setThruTime(Long thruTime)
287            throws PersistenceNotNullException, PersistenceReadOnlyException {
288        checkReadWrite();
289        _value.setThruTime(thruTime);
290    }
291    
292    public boolean getThruTimeHasBeenModified() {
293        return _value.getThruTimeHasBeenModified();
294    }
295    
296}