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 * ChainDetail.java
021 */
022
023package com.echothree.model.data.chain.server.entity;
024
025import com.echothree.model.data.chain.common.pk.ChainDetailPK;
026
027import com.echothree.model.data.chain.common.pk.ChainPK;
028import com.echothree.model.data.chain.common.pk.ChainTypePK;
029import com.echothree.model.data.sequence.common.pk.SequencePK;
030
031import com.echothree.model.data.chain.server.entity.Chain;
032import com.echothree.model.data.chain.server.entity.ChainType;
033import com.echothree.model.data.sequence.server.entity.Sequence;
034
035import com.echothree.model.data.chain.server.factory.ChainFactory;
036import com.echothree.model.data.chain.server.factory.ChainTypeFactory;
037import com.echothree.model.data.sequence.server.factory.SequenceFactory;
038
039import com.echothree.model.data.chain.common.pk.ChainDetailPK;
040
041import com.echothree.model.data.chain.server.value.ChainDetailValue;
042
043import com.echothree.model.data.chain.server.factory.ChainDetailFactory;
044
045import com.echothree.util.common.exception.PersistenceException;
046import com.echothree.util.common.exception.PersistenceDatabaseException;
047import com.echothree.util.common.exception.PersistenceNotNullException;
048import com.echothree.util.common.exception.PersistenceReadOnlyException;
049
050import com.echothree.util.common.persistence.BasePK;
051
052import com.echothree.util.common.persistence.type.ByteArray;
053
054import com.echothree.util.server.persistence.BaseEntity;
055import com.echothree.util.server.persistence.EntityPermission;
056import com.echothree.util.server.persistence.Session;
057import com.echothree.util.server.persistence.ThreadSession;
058
059import java.io.Serializable;
060
061public class ChainDetail
062        extends BaseEntity
063        implements Serializable {
064    
065    private ChainDetailPK _pk;
066    private ChainDetailValue _value;
067    
068    /** Creates a new instance of ChainDetail */
069    public ChainDetail()
070            throws PersistenceException {
071        super();
072    }
073    
074    /** Creates a new instance of ChainDetail */
075    public ChainDetail(ChainDetailValue value, EntityPermission entityPermission) {
076        super(entityPermission);
077        
078        _value = value;
079        _pk = value.getPrimaryKey();
080    }
081    
082    @Override
083    public ChainDetailFactory getBaseFactoryInstance() {
084        return ChainDetailFactory.getInstance();
085    }
086    
087    @Override
088    public boolean hasBeenModified() {
089        return _value.hasBeenModified();
090    }
091    
092    @Override
093    public int hashCode() {
094        return _pk.hashCode();
095    }
096    
097    @Override
098    public String toString() {
099        return _pk.toString();
100    }
101    
102    @Override
103    public boolean equals(Object other) {
104        if(this == other)
105            return true;
106        
107        if(other instanceof ChainDetail that) {
108            ChainDetailValue thatValue = that.getChainDetailValue();
109            return _value.equals(thatValue);
110        } else {
111            return false;
112        }
113    }
114    
115    @Override
116    public void store(Session session)
117            throws PersistenceDatabaseException {
118        getBaseFactoryInstance().store(session, this);
119    }
120    
121    @Override
122    public void remove(Session session)
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().remove(session, this);
125    }
126    
127    @Override
128    public void remove()
129            throws PersistenceDatabaseException {
130        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
131    }
132    
133    public ChainDetailValue getChainDetailValue() {
134        return _value;
135    }
136    
137    public void setChainDetailValue(ChainDetailValue value)
138            throws PersistenceReadOnlyException {
139        checkReadWrite();
140        _value = value;
141    }
142    
143    @Override
144    public ChainDetailPK getPrimaryKey() {
145        return _pk;
146    }
147    
148    public ChainPK getChainPK() {
149        return _value.getChainPK();
150    }
151    
152    public Chain getChain(Session session, EntityPermission entityPermission) {
153        return ChainFactory.getInstance().getEntityFromPK(session, entityPermission, getChainPK());
154    }
155    
156    public Chain getChain(EntityPermission entityPermission) {
157        return getChain(ThreadSession.currentSession(), entityPermission);
158    }
159    
160    public Chain getChain(Session session) {
161        return getChain(session, EntityPermission.READ_ONLY);
162    }
163    
164    public Chain getChain() {
165        return getChain(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
166    }
167    
168    public Chain getChainForUpdate(Session session) {
169        return getChain(session, EntityPermission.READ_WRITE);
170    }
171    
172    public Chain getChainForUpdate() {
173        return getChain(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
174    }
175    
176    public void setChainPK(ChainPK chainPK)
177            throws PersistenceNotNullException, PersistenceReadOnlyException {
178        checkReadWrite();
179        _value.setChainPK(chainPK);
180    }
181    
182    public void setChain(Chain entity) {
183        setChainPK(entity == null? null: entity.getPrimaryKey());
184    }
185    
186    public boolean getChainPKHasBeenModified() {
187        return _value.getChainPKHasBeenModified();
188    }
189    
190    public ChainTypePK getChainTypePK() {
191        return _value.getChainTypePK();
192    }
193    
194    public ChainType getChainType(Session session, EntityPermission entityPermission) {
195        return ChainTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getChainTypePK());
196    }
197    
198    public ChainType getChainType(EntityPermission entityPermission) {
199        return getChainType(ThreadSession.currentSession(), entityPermission);
200    }
201    
202    public ChainType getChainType(Session session) {
203        return getChainType(session, EntityPermission.READ_ONLY);
204    }
205    
206    public ChainType getChainType() {
207        return getChainType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
208    }
209    
210    public ChainType getChainTypeForUpdate(Session session) {
211        return getChainType(session, EntityPermission.READ_WRITE);
212    }
213    
214    public ChainType getChainTypeForUpdate() {
215        return getChainType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
216    }
217    
218    public void setChainTypePK(ChainTypePK chainTypePK)
219            throws PersistenceNotNullException, PersistenceReadOnlyException {
220        checkReadWrite();
221        _value.setChainTypePK(chainTypePK);
222    }
223    
224    public void setChainType(ChainType entity) {
225        setChainTypePK(entity == null? null: entity.getPrimaryKey());
226    }
227    
228    public boolean getChainTypePKHasBeenModified() {
229        return _value.getChainTypePKHasBeenModified();
230    }
231    
232    public String getChainName() {
233        return _value.getChainName();
234    }
235    
236    public void setChainName(String chainName)
237            throws PersistenceNotNullException, PersistenceReadOnlyException {
238        checkReadWrite();
239        _value.setChainName(chainName);
240    }
241    
242    public boolean getChainNameHasBeenModified() {
243        return _value.getChainNameHasBeenModified();
244    }
245    
246    public SequencePK getChainInstanceSequencePK() {
247        return _value.getChainInstanceSequencePK();
248    }
249    
250    public Sequence getChainInstanceSequence(Session session, EntityPermission entityPermission) {
251        SequencePK pk = getChainInstanceSequencePK();
252        Sequence entity = pk == null? null: SequenceFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
253        
254        return entity;
255    }
256    
257    public Sequence getChainInstanceSequence(EntityPermission entityPermission) {
258        return getChainInstanceSequence(ThreadSession.currentSession(), entityPermission);
259    }
260    
261    public Sequence getChainInstanceSequence(Session session) {
262        return getChainInstanceSequence(session, EntityPermission.READ_ONLY);
263    }
264    
265    public Sequence getChainInstanceSequence() {
266        return getChainInstanceSequence(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
267    }
268    
269    public Sequence getChainInstanceSequenceForUpdate(Session session) {
270        return getChainInstanceSequence(session, EntityPermission.READ_WRITE);
271    }
272    
273    public Sequence getChainInstanceSequenceForUpdate() {
274        return getChainInstanceSequence(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
275    }
276    
277    public void setChainInstanceSequencePK(SequencePK chainInstanceSequencePK)
278            throws PersistenceNotNullException, PersistenceReadOnlyException {
279        checkReadWrite();
280        _value.setChainInstanceSequencePK(chainInstanceSequencePK);
281    }
282    
283    public void setChainInstanceSequence(Sequence entity) {
284        setChainInstanceSequencePK(entity == null? null: entity.getPrimaryKey());
285    }
286    
287    public boolean getChainInstanceSequencePKHasBeenModified() {
288        return _value.getChainInstanceSequencePKHasBeenModified();
289    }
290    
291    public Boolean getIsDefault() {
292        return _value.getIsDefault();
293    }
294    
295    public void setIsDefault(Boolean isDefault)
296            throws PersistenceNotNullException, PersistenceReadOnlyException {
297        checkReadWrite();
298        _value.setIsDefault(isDefault);
299    }
300    
301    public boolean getIsDefaultHasBeenModified() {
302        return _value.getIsDefaultHasBeenModified();
303    }
304    
305    public Integer getSortOrder() {
306        return _value.getSortOrder();
307    }
308    
309    public void setSortOrder(Integer sortOrder)
310            throws PersistenceNotNullException, PersistenceReadOnlyException {
311        checkReadWrite();
312        _value.setSortOrder(sortOrder);
313    }
314    
315    public boolean getSortOrderHasBeenModified() {
316        return _value.getSortOrderHasBeenModified();
317    }
318    
319    public Long getFromTime() {
320        return _value.getFromTime();
321    }
322    
323    public void setFromTime(Long fromTime)
324            throws PersistenceNotNullException, PersistenceReadOnlyException {
325        checkReadWrite();
326        _value.setFromTime(fromTime);
327    }
328    
329    public boolean getFromTimeHasBeenModified() {
330        return _value.getFromTimeHasBeenModified();
331    }
332    
333    public Long getThruTime() {
334        return _value.getThruTime();
335    }
336    
337    public void setThruTime(Long thruTime)
338            throws PersistenceNotNullException, PersistenceReadOnlyException {
339        checkReadWrite();
340        _value.setThruTime(thruTime);
341    }
342    
343    public boolean getThruTimeHasBeenModified() {
344        return _value.getThruTimeHasBeenModified();
345    }
346    
347}