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 * Event.java
021 */
022
023package com.echothree.model.data.core.server.entity;
024
025import com.echothree.model.data.core.common.pk.EventPK;
026
027import com.echothree.model.data.core.common.pk.EventGroupPK;
028import com.echothree.model.data.core.common.pk.EntityInstancePK;
029import com.echothree.model.data.core.common.pk.EventTypePK;
030
031import com.echothree.model.data.core.server.entity.EventGroup;
032import com.echothree.model.data.core.server.entity.EntityInstance;
033import com.echothree.model.data.core.server.entity.EventType;
034
035import com.echothree.model.data.core.server.factory.EventGroupFactory;
036import com.echothree.model.data.core.server.factory.EntityInstanceFactory;
037import com.echothree.model.data.core.server.factory.EventTypeFactory;
038
039import com.echothree.model.data.core.common.pk.EventPK;
040
041import com.echothree.model.data.core.server.value.EventValue;
042
043import com.echothree.model.data.core.server.factory.EventFactory;
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 Event
062        extends BaseEntity
063        implements Serializable {
064    
065    private EventPK _pk;
066    private EventValue _value;
067    
068    /** Creates a new instance of Event */
069    public Event()
070            throws PersistenceException {
071        super();
072    }
073    
074    /** Creates a new instance of Event */
075    public Event(EventValue value, EntityPermission entityPermission) {
076        super(entityPermission);
077        
078        _value = value;
079        _pk = value.getPrimaryKey();
080    }
081    
082    @Override
083    public EventFactory getBaseFactoryInstance() {
084        return EventFactory.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 Event that) {
108            EventValue thatValue = that.getEventValue();
109            return _value.equals(thatValue);
110        } else {
111            return false;
112        }
113    }
114    
115    @Override
116    public void store()
117            throws PersistenceDatabaseException {
118        getBaseFactoryInstance().store(this);
119    }
120    
121    @Override
122    public void remove()
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().remove(this);
125    }
126    
127    public EventValue getEventValue() {
128        return _value;
129    }
130    
131    public void setEventValue(EventValue value)
132            throws PersistenceReadOnlyException {
133        checkReadWrite();
134        _value = value;
135    }
136    
137    @Override
138    public EventPK getPrimaryKey() {
139        return _pk;
140    }
141    
142    public EventGroupPK getEventGroupPK() {
143        return _value.getEventGroupPK();
144    }
145    
146    public EventGroup getEventGroup(EntityPermission entityPermission) {
147        EventGroupPK pk = getEventGroupPK();
148        EventGroup entity = pk == null? null: EventGroupFactory.getInstance().getEntityFromPK(entityPermission, pk);
149        
150        return entity;
151    }
152    
153    public EventGroup getEventGroup() {
154        return getEventGroup(EntityPermission.READ_ONLY);
155    }
156    
157    public EventGroup getEventGroupForUpdate() {
158        return getEventGroup(EntityPermission.READ_WRITE);
159    }
160    
161    public void setEventGroupPK(EventGroupPK eventGroupPK)
162            throws PersistenceNotNullException, PersistenceReadOnlyException {
163        checkReadWrite();
164        _value.setEventGroupPK(eventGroupPK);
165    }
166    
167    public void setEventGroup(EventGroup entity) {
168        setEventGroupPK(entity == null? null: entity.getPrimaryKey());
169    }
170    
171    public boolean getEventGroupPKHasBeenModified() {
172        return _value.getEventGroupPKHasBeenModified();
173    }
174    
175    public Long getEventTime() {
176        return _value.getEventTime();
177    }
178    
179    public void setEventTime(Long eventTime)
180            throws PersistenceNotNullException, PersistenceReadOnlyException {
181        checkReadWrite();
182        _value.setEventTime(eventTime);
183    }
184    
185    public boolean getEventTimeHasBeenModified() {
186        return _value.getEventTimeHasBeenModified();
187    }
188    
189    public Integer getEventTimeSequence() {
190        return _value.getEventTimeSequence();
191    }
192    
193    public void setEventTimeSequence(Integer eventTimeSequence)
194            throws PersistenceNotNullException, PersistenceReadOnlyException {
195        checkReadWrite();
196        _value.setEventTimeSequence(eventTimeSequence);
197    }
198    
199    public boolean getEventTimeSequenceHasBeenModified() {
200        return _value.getEventTimeSequenceHasBeenModified();
201    }
202    
203    public EntityInstancePK getEntityInstancePK() {
204        return _value.getEntityInstancePK();
205    }
206    
207    public EntityInstance getEntityInstance(EntityPermission entityPermission) {
208        return EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, getEntityInstancePK());
209    }
210    
211    public EntityInstance getEntityInstance() {
212        return getEntityInstance(EntityPermission.READ_ONLY);
213    }
214    
215    public EntityInstance getEntityInstanceForUpdate() {
216        return getEntityInstance(EntityPermission.READ_WRITE);
217    }
218    
219    public void setEntityInstancePK(EntityInstancePK entityInstancePK)
220            throws PersistenceNotNullException, PersistenceReadOnlyException {
221        checkReadWrite();
222        _value.setEntityInstancePK(entityInstancePK);
223    }
224    
225    public void setEntityInstance(EntityInstance entity) {
226        setEntityInstancePK(entity == null? null: entity.getPrimaryKey());
227    }
228    
229    public boolean getEntityInstancePKHasBeenModified() {
230        return _value.getEntityInstancePKHasBeenModified();
231    }
232    
233    public EventTypePK getEventTypePK() {
234        return _value.getEventTypePK();
235    }
236    
237    public EventType getEventType(EntityPermission entityPermission) {
238        return EventTypeFactory.getInstance().getEntityFromPK(entityPermission, getEventTypePK());
239    }
240    
241    public EventType getEventType() {
242        return getEventType(EntityPermission.READ_ONLY);
243    }
244    
245    public EventType getEventTypeForUpdate() {
246        return getEventType(EntityPermission.READ_WRITE);
247    }
248    
249    public void setEventTypePK(EventTypePK eventTypePK)
250            throws PersistenceNotNullException, PersistenceReadOnlyException {
251        checkReadWrite();
252        _value.setEventTypePK(eventTypePK);
253    }
254    
255    public void setEventType(EventType entity) {
256        setEventTypePK(entity == null? null: entity.getPrimaryKey());
257    }
258    
259    public boolean getEventTypePKHasBeenModified() {
260        return _value.getEventTypePKHasBeenModified();
261    }
262    
263    public EntityInstancePK getRelatedEntityInstancePK() {
264        return _value.getRelatedEntityInstancePK();
265    }
266    
267    public EntityInstance getRelatedEntityInstance(EntityPermission entityPermission) {
268        EntityInstancePK pk = getRelatedEntityInstancePK();
269        EntityInstance entity = pk == null? null: EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, pk);
270        
271        return entity;
272    }
273    
274    public EntityInstance getRelatedEntityInstance() {
275        return getRelatedEntityInstance(EntityPermission.READ_ONLY);
276    }
277    
278    public EntityInstance getRelatedEntityInstanceForUpdate() {
279        return getRelatedEntityInstance(EntityPermission.READ_WRITE);
280    }
281    
282    public void setRelatedEntityInstancePK(EntityInstancePK relatedEntityInstancePK)
283            throws PersistenceNotNullException, PersistenceReadOnlyException {
284        checkReadWrite();
285        _value.setRelatedEntityInstancePK(relatedEntityInstancePK);
286    }
287    
288    public void setRelatedEntityInstance(EntityInstance entity) {
289        setRelatedEntityInstancePK(entity == null? null: entity.getPrimaryKey());
290    }
291    
292    public boolean getRelatedEntityInstancePKHasBeenModified() {
293        return _value.getRelatedEntityInstancePKHasBeenModified();
294    }
295    
296    public EventTypePK getRelatedEventTypePK() {
297        return _value.getRelatedEventTypePK();
298    }
299    
300    public EventType getRelatedEventType(EntityPermission entityPermission) {
301        EventTypePK pk = getRelatedEventTypePK();
302        EventType entity = pk == null? null: EventTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
303        
304        return entity;
305    }
306    
307    public EventType getRelatedEventType() {
308        return getRelatedEventType(EntityPermission.READ_ONLY);
309    }
310    
311    public EventType getRelatedEventTypeForUpdate() {
312        return getRelatedEventType(EntityPermission.READ_WRITE);
313    }
314    
315    public void setRelatedEventTypePK(EventTypePK relatedEventTypePK)
316            throws PersistenceNotNullException, PersistenceReadOnlyException {
317        checkReadWrite();
318        _value.setRelatedEventTypePK(relatedEventTypePK);
319    }
320    
321    public void setRelatedEventType(EventType entity) {
322        setRelatedEventTypePK(entity == null? null: entity.getPrimaryKey());
323    }
324    
325    public boolean getRelatedEventTypePKHasBeenModified() {
326        return _value.getRelatedEventTypePKHasBeenModified();
327    }
328    
329    public EntityInstancePK getCreatedByPK() {
330        return _value.getCreatedByPK();
331    }
332    
333    public EntityInstance getCreatedBy(EntityPermission entityPermission) {
334        EntityInstancePK pk = getCreatedByPK();
335        EntityInstance entity = pk == null? null: EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, pk);
336        
337        return entity;
338    }
339    
340    public EntityInstance getCreatedBy() {
341        return getCreatedBy(EntityPermission.READ_ONLY);
342    }
343    
344    public EntityInstance getCreatedByForUpdate() {
345        return getCreatedBy(EntityPermission.READ_WRITE);
346    }
347    
348    public void setCreatedByPK(EntityInstancePK createdByPK)
349            throws PersistenceNotNullException, PersistenceReadOnlyException {
350        checkReadWrite();
351        _value.setCreatedByPK(createdByPK);
352    }
353    
354    public void setCreatedBy(EntityInstance entity) {
355        setCreatedByPK(entity == null? null: entity.getPrimaryKey());
356    }
357    
358    public boolean getCreatedByPKHasBeenModified() {
359        return _value.getCreatedByPKHasBeenModified();
360    }
361    
362}