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 * 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(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 EventValue getEventValue() {
134        return _value;
135    }
136    
137    public void setEventValue(EventValue value)
138            throws PersistenceReadOnlyException {
139        checkReadWrite();
140        _value = value;
141    }
142    
143    @Override
144    public EventPK getPrimaryKey() {
145        return _pk;
146    }
147    
148    public EventGroupPK getEventGroupPK() {
149        return _value.getEventGroupPK();
150    }
151    
152    public EventGroup getEventGroup(Session session, EntityPermission entityPermission) {
153        EventGroupPK pk = getEventGroupPK();
154        EventGroup entity = pk == null? null: EventGroupFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
155        
156        return entity;
157    }
158    
159    public EventGroup getEventGroup(EntityPermission entityPermission) {
160        return getEventGroup(ThreadSession.currentSession(), entityPermission);
161    }
162    
163    public EventGroup getEventGroup(Session session) {
164        return getEventGroup(session, EntityPermission.READ_ONLY);
165    }
166    
167    public EventGroup getEventGroup() {
168        return getEventGroup(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
169    }
170    
171    public EventGroup getEventGroupForUpdate(Session session) {
172        return getEventGroup(session, EntityPermission.READ_WRITE);
173    }
174    
175    public EventGroup getEventGroupForUpdate() {
176        return getEventGroup(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
177    }
178    
179    public void setEventGroupPK(EventGroupPK eventGroupPK)
180            throws PersistenceNotNullException, PersistenceReadOnlyException {
181        checkReadWrite();
182        _value.setEventGroupPK(eventGroupPK);
183    }
184    
185    public void setEventGroup(EventGroup entity) {
186        setEventGroupPK(entity == null? null: entity.getPrimaryKey());
187    }
188    
189    public boolean getEventGroupPKHasBeenModified() {
190        return _value.getEventGroupPKHasBeenModified();
191    }
192    
193    public Long getEventTime() {
194        return _value.getEventTime();
195    }
196    
197    public void setEventTime(Long eventTime)
198            throws PersistenceNotNullException, PersistenceReadOnlyException {
199        checkReadWrite();
200        _value.setEventTime(eventTime);
201    }
202    
203    public boolean getEventTimeHasBeenModified() {
204        return _value.getEventTimeHasBeenModified();
205    }
206    
207    public Integer getEventTimeSequence() {
208        return _value.getEventTimeSequence();
209    }
210    
211    public void setEventTimeSequence(Integer eventTimeSequence)
212            throws PersistenceNotNullException, PersistenceReadOnlyException {
213        checkReadWrite();
214        _value.setEventTimeSequence(eventTimeSequence);
215    }
216    
217    public boolean getEventTimeSequenceHasBeenModified() {
218        return _value.getEventTimeSequenceHasBeenModified();
219    }
220    
221    public EntityInstancePK getEntityInstancePK() {
222        return _value.getEntityInstancePK();
223    }
224    
225    public EntityInstance getEntityInstance(Session session, EntityPermission entityPermission) {
226        return EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, getEntityInstancePK());
227    }
228    
229    public EntityInstance getEntityInstance(EntityPermission entityPermission) {
230        return getEntityInstance(ThreadSession.currentSession(), entityPermission);
231    }
232    
233    public EntityInstance getEntityInstance(Session session) {
234        return getEntityInstance(session, EntityPermission.READ_ONLY);
235    }
236    
237    public EntityInstance getEntityInstance() {
238        return getEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
239    }
240    
241    public EntityInstance getEntityInstanceForUpdate(Session session) {
242        return getEntityInstance(session, EntityPermission.READ_WRITE);
243    }
244    
245    public EntityInstance getEntityInstanceForUpdate() {
246        return getEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
247    }
248    
249    public void setEntityInstancePK(EntityInstancePK entityInstancePK)
250            throws PersistenceNotNullException, PersistenceReadOnlyException {
251        checkReadWrite();
252        _value.setEntityInstancePK(entityInstancePK);
253    }
254    
255    public void setEntityInstance(EntityInstance entity) {
256        setEntityInstancePK(entity == null? null: entity.getPrimaryKey());
257    }
258    
259    public boolean getEntityInstancePKHasBeenModified() {
260        return _value.getEntityInstancePKHasBeenModified();
261    }
262    
263    public EventTypePK getEventTypePK() {
264        return _value.getEventTypePK();
265    }
266    
267    public EventType getEventType(Session session, EntityPermission entityPermission) {
268        return EventTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getEventTypePK());
269    }
270    
271    public EventType getEventType(EntityPermission entityPermission) {
272        return getEventType(ThreadSession.currentSession(), entityPermission);
273    }
274    
275    public EventType getEventType(Session session) {
276        return getEventType(session, EntityPermission.READ_ONLY);
277    }
278    
279    public EventType getEventType() {
280        return getEventType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
281    }
282    
283    public EventType getEventTypeForUpdate(Session session) {
284        return getEventType(session, EntityPermission.READ_WRITE);
285    }
286    
287    public EventType getEventTypeForUpdate() {
288        return getEventType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
289    }
290    
291    public void setEventTypePK(EventTypePK eventTypePK)
292            throws PersistenceNotNullException, PersistenceReadOnlyException {
293        checkReadWrite();
294        _value.setEventTypePK(eventTypePK);
295    }
296    
297    public void setEventType(EventType entity) {
298        setEventTypePK(entity == null? null: entity.getPrimaryKey());
299    }
300    
301    public boolean getEventTypePKHasBeenModified() {
302        return _value.getEventTypePKHasBeenModified();
303    }
304    
305    public EntityInstancePK getRelatedEntityInstancePK() {
306        return _value.getRelatedEntityInstancePK();
307    }
308    
309    public EntityInstance getRelatedEntityInstance(Session session, EntityPermission entityPermission) {
310        EntityInstancePK pk = getRelatedEntityInstancePK();
311        EntityInstance entity = pk == null? null: EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
312        
313        return entity;
314    }
315    
316    public EntityInstance getRelatedEntityInstance(EntityPermission entityPermission) {
317        return getRelatedEntityInstance(ThreadSession.currentSession(), entityPermission);
318    }
319    
320    public EntityInstance getRelatedEntityInstance(Session session) {
321        return getRelatedEntityInstance(session, EntityPermission.READ_ONLY);
322    }
323    
324    public EntityInstance getRelatedEntityInstance() {
325        return getRelatedEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
326    }
327    
328    public EntityInstance getRelatedEntityInstanceForUpdate(Session session) {
329        return getRelatedEntityInstance(session, EntityPermission.READ_WRITE);
330    }
331    
332    public EntityInstance getRelatedEntityInstanceForUpdate() {
333        return getRelatedEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
334    }
335    
336    public void setRelatedEntityInstancePK(EntityInstancePK relatedEntityInstancePK)
337            throws PersistenceNotNullException, PersistenceReadOnlyException {
338        checkReadWrite();
339        _value.setRelatedEntityInstancePK(relatedEntityInstancePK);
340    }
341    
342    public void setRelatedEntityInstance(EntityInstance entity) {
343        setRelatedEntityInstancePK(entity == null? null: entity.getPrimaryKey());
344    }
345    
346    public boolean getRelatedEntityInstancePKHasBeenModified() {
347        return _value.getRelatedEntityInstancePKHasBeenModified();
348    }
349    
350    public EventTypePK getRelatedEventTypePK() {
351        return _value.getRelatedEventTypePK();
352    }
353    
354    public EventType getRelatedEventType(Session session, EntityPermission entityPermission) {
355        EventTypePK pk = getRelatedEventTypePK();
356        EventType entity = pk == null? null: EventTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
357        
358        return entity;
359    }
360    
361    public EventType getRelatedEventType(EntityPermission entityPermission) {
362        return getRelatedEventType(ThreadSession.currentSession(), entityPermission);
363    }
364    
365    public EventType getRelatedEventType(Session session) {
366        return getRelatedEventType(session, EntityPermission.READ_ONLY);
367    }
368    
369    public EventType getRelatedEventType() {
370        return getRelatedEventType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
371    }
372    
373    public EventType getRelatedEventTypeForUpdate(Session session) {
374        return getRelatedEventType(session, EntityPermission.READ_WRITE);
375    }
376    
377    public EventType getRelatedEventTypeForUpdate() {
378        return getRelatedEventType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
379    }
380    
381    public void setRelatedEventTypePK(EventTypePK relatedEventTypePK)
382            throws PersistenceNotNullException, PersistenceReadOnlyException {
383        checkReadWrite();
384        _value.setRelatedEventTypePK(relatedEventTypePK);
385    }
386    
387    public void setRelatedEventType(EventType entity) {
388        setRelatedEventTypePK(entity == null? null: entity.getPrimaryKey());
389    }
390    
391    public boolean getRelatedEventTypePKHasBeenModified() {
392        return _value.getRelatedEventTypePKHasBeenModified();
393    }
394    
395    public EntityInstancePK getCreatedByPK() {
396        return _value.getCreatedByPK();
397    }
398    
399    public EntityInstance getCreatedBy(Session session, EntityPermission entityPermission) {
400        EntityInstancePK pk = getCreatedByPK();
401        EntityInstance entity = pk == null? null: EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
402        
403        return entity;
404    }
405    
406    public EntityInstance getCreatedBy(EntityPermission entityPermission) {
407        return getCreatedBy(ThreadSession.currentSession(), entityPermission);
408    }
409    
410    public EntityInstance getCreatedBy(Session session) {
411        return getCreatedBy(session, EntityPermission.READ_ONLY);
412    }
413    
414    public EntityInstance getCreatedBy() {
415        return getCreatedBy(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
416    }
417    
418    public EntityInstance getCreatedByForUpdate(Session session) {
419        return getCreatedBy(session, EntityPermission.READ_WRITE);
420    }
421    
422    public EntityInstance getCreatedByForUpdate() {
423        return getCreatedBy(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
424    }
425    
426    public void setCreatedByPK(EntityInstancePK createdByPK)
427            throws PersistenceNotNullException, PersistenceReadOnlyException {
428        checkReadWrite();
429        _value.setCreatedByPK(createdByPK);
430    }
431    
432    public void setCreatedBy(EntityInstance entity) {
433        setCreatedByPK(entity == null? null: entity.getPrimaryKey());
434    }
435    
436    public boolean getCreatedByPKHasBeenModified() {
437        return _value.getCreatedByPKHasBeenModified();
438    }
439    
440}