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 * EntityAttributeDetail.java
021 */
022
023package com.echothree.model.data.core.server.entity;
024
025import com.echothree.model.data.core.common.pk.EntityAttributeDetailPK;
026
027import com.echothree.model.data.core.common.pk.EntityAttributePK;
028import com.echothree.model.data.core.common.pk.EntityTypePK;
029import com.echothree.model.data.core.common.pk.EntityAttributeTypePK;
030
031import com.echothree.model.data.core.server.entity.EntityAttribute;
032import com.echothree.model.data.core.server.entity.EntityType;
033import com.echothree.model.data.core.server.entity.EntityAttributeType;
034
035import com.echothree.model.data.core.server.factory.EntityAttributeFactory;
036import com.echothree.model.data.core.server.factory.EntityTypeFactory;
037import com.echothree.model.data.core.server.factory.EntityAttributeTypeFactory;
038
039import com.echothree.model.data.core.common.pk.EntityAttributeDetailPK;
040
041import com.echothree.model.data.core.server.value.EntityAttributeDetailValue;
042
043import com.echothree.model.data.core.server.factory.EntityAttributeDetailFactory;
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 EntityAttributeDetail
062        extends BaseEntity
063        implements Serializable {
064    
065    private EntityAttributeDetailPK _pk;
066    private EntityAttributeDetailValue _value;
067    
068    /** Creates a new instance of EntityAttributeDetail */
069    public EntityAttributeDetail()
070            throws PersistenceException {
071        super();
072    }
073    
074    /** Creates a new instance of EntityAttributeDetail */
075    public EntityAttributeDetail(EntityAttributeDetailValue value, EntityPermission entityPermission) {
076        super(entityPermission);
077        
078        _value = value;
079        _pk = value.getPrimaryKey();
080    }
081    
082    @Override
083    public EntityAttributeDetailFactory getBaseFactoryInstance() {
084        return EntityAttributeDetailFactory.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 EntityAttributeDetail that) {
108            EntityAttributeDetailValue thatValue = that.getEntityAttributeDetailValue();
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 EntityAttributeDetailValue getEntityAttributeDetailValue() {
134        return _value;
135    }
136    
137    public void setEntityAttributeDetailValue(EntityAttributeDetailValue value)
138            throws PersistenceReadOnlyException {
139        checkReadWrite();
140        _value = value;
141    }
142    
143    @Override
144    public EntityAttributeDetailPK getPrimaryKey() {
145        return _pk;
146    }
147    
148    public EntityAttributePK getEntityAttributePK() {
149        return _value.getEntityAttributePK();
150    }
151    
152    public EntityAttribute getEntityAttribute(Session session, EntityPermission entityPermission) {
153        return EntityAttributeFactory.getInstance().getEntityFromPK(session, entityPermission, getEntityAttributePK());
154    }
155    
156    public EntityAttribute getEntityAttribute(EntityPermission entityPermission) {
157        return getEntityAttribute(ThreadSession.currentSession(), entityPermission);
158    }
159    
160    public EntityAttribute getEntityAttribute(Session session) {
161        return getEntityAttribute(session, EntityPermission.READ_ONLY);
162    }
163    
164    public EntityAttribute getEntityAttribute() {
165        return getEntityAttribute(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
166    }
167    
168    public EntityAttribute getEntityAttributeForUpdate(Session session) {
169        return getEntityAttribute(session, EntityPermission.READ_WRITE);
170    }
171    
172    public EntityAttribute getEntityAttributeForUpdate() {
173        return getEntityAttribute(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
174    }
175    
176    public void setEntityAttributePK(EntityAttributePK entityAttributePK)
177            throws PersistenceNotNullException, PersistenceReadOnlyException {
178        checkReadWrite();
179        _value.setEntityAttributePK(entityAttributePK);
180    }
181    
182    public void setEntityAttribute(EntityAttribute entity) {
183        setEntityAttributePK(entity == null? null: entity.getPrimaryKey());
184    }
185    
186    public boolean getEntityAttributePKHasBeenModified() {
187        return _value.getEntityAttributePKHasBeenModified();
188    }
189    
190    public EntityTypePK getEntityTypePK() {
191        return _value.getEntityTypePK();
192    }
193    
194    public EntityType getEntityType(Session session, EntityPermission entityPermission) {
195        return EntityTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getEntityTypePK());
196    }
197    
198    public EntityType getEntityType(EntityPermission entityPermission) {
199        return getEntityType(ThreadSession.currentSession(), entityPermission);
200    }
201    
202    public EntityType getEntityType(Session session) {
203        return getEntityType(session, EntityPermission.READ_ONLY);
204    }
205    
206    public EntityType getEntityType() {
207        return getEntityType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
208    }
209    
210    public EntityType getEntityTypeForUpdate(Session session) {
211        return getEntityType(session, EntityPermission.READ_WRITE);
212    }
213    
214    public EntityType getEntityTypeForUpdate() {
215        return getEntityType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
216    }
217    
218    public void setEntityTypePK(EntityTypePK entityTypePK)
219            throws PersistenceNotNullException, PersistenceReadOnlyException {
220        checkReadWrite();
221        _value.setEntityTypePK(entityTypePK);
222    }
223    
224    public void setEntityType(EntityType entity) {
225        setEntityTypePK(entity == null? null: entity.getPrimaryKey());
226    }
227    
228    public boolean getEntityTypePKHasBeenModified() {
229        return _value.getEntityTypePKHasBeenModified();
230    }
231    
232    public String getEntityAttributeName() {
233        return _value.getEntityAttributeName();
234    }
235    
236    public void setEntityAttributeName(String entityAttributeName)
237            throws PersistenceNotNullException, PersistenceReadOnlyException {
238        checkReadWrite();
239        _value.setEntityAttributeName(entityAttributeName);
240    }
241    
242    public boolean getEntityAttributeNameHasBeenModified() {
243        return _value.getEntityAttributeNameHasBeenModified();
244    }
245    
246    public EntityAttributeTypePK getEntityAttributeTypePK() {
247        return _value.getEntityAttributeTypePK();
248    }
249    
250    public EntityAttributeType getEntityAttributeType(Session session, EntityPermission entityPermission) {
251        return EntityAttributeTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getEntityAttributeTypePK());
252    }
253    
254    public EntityAttributeType getEntityAttributeType(EntityPermission entityPermission) {
255        return getEntityAttributeType(ThreadSession.currentSession(), entityPermission);
256    }
257    
258    public EntityAttributeType getEntityAttributeType(Session session) {
259        return getEntityAttributeType(session, EntityPermission.READ_ONLY);
260    }
261    
262    public EntityAttributeType getEntityAttributeType() {
263        return getEntityAttributeType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
264    }
265    
266    public EntityAttributeType getEntityAttributeTypeForUpdate(Session session) {
267        return getEntityAttributeType(session, EntityPermission.READ_WRITE);
268    }
269    
270    public EntityAttributeType getEntityAttributeTypeForUpdate() {
271        return getEntityAttributeType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
272    }
273    
274    public void setEntityAttributeTypePK(EntityAttributeTypePK entityAttributeTypePK)
275            throws PersistenceNotNullException, PersistenceReadOnlyException {
276        checkReadWrite();
277        _value.setEntityAttributeTypePK(entityAttributeTypePK);
278    }
279    
280    public void setEntityAttributeType(EntityAttributeType entity) {
281        setEntityAttributeTypePK(entity == null? null: entity.getPrimaryKey());
282    }
283    
284    public boolean getEntityAttributeTypePKHasBeenModified() {
285        return _value.getEntityAttributeTypePKHasBeenModified();
286    }
287    
288    public Boolean getTrackRevisions() {
289        return _value.getTrackRevisions();
290    }
291    
292    public void setTrackRevisions(Boolean trackRevisions)
293            throws PersistenceNotNullException, PersistenceReadOnlyException {
294        checkReadWrite();
295        _value.setTrackRevisions(trackRevisions);
296    }
297    
298    public boolean getTrackRevisionsHasBeenModified() {
299        return _value.getTrackRevisionsHasBeenModified();
300    }
301    
302    public Integer getSortOrder() {
303        return _value.getSortOrder();
304    }
305    
306    public void setSortOrder(Integer sortOrder)
307            throws PersistenceNotNullException, PersistenceReadOnlyException {
308        checkReadWrite();
309        _value.setSortOrder(sortOrder);
310    }
311    
312    public boolean getSortOrderHasBeenModified() {
313        return _value.getSortOrderHasBeenModified();
314    }
315    
316    public Long getFromTime() {
317        return _value.getFromTime();
318    }
319    
320    public void setFromTime(Long fromTime)
321            throws PersistenceNotNullException, PersistenceReadOnlyException {
322        checkReadWrite();
323        _value.setFromTime(fromTime);
324    }
325    
326    public boolean getFromTimeHasBeenModified() {
327        return _value.getFromTimeHasBeenModified();
328    }
329    
330    public Long getThruTime() {
331        return _value.getThruTime();
332    }
333    
334    public void setThruTime(Long thruTime)
335            throws PersistenceNotNullException, PersistenceReadOnlyException {
336        checkReadWrite();
337        _value.setThruTime(thruTime);
338    }
339    
340    public boolean getThruTimeHasBeenModified() {
341        return _value.getThruTimeHasBeenModified();
342    }
343    
344}