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 * Search.java
021 */
022
023package com.echothree.model.data.search.server.entity;
024
025import com.echothree.model.data.search.common.pk.SearchPK;
026
027import com.echothree.model.data.party.common.pk.PartyPK;
028import com.echothree.model.data.search.common.pk.SearchTypePK;
029import com.echothree.model.data.search.common.pk.SearchUseTypePK;
030import com.echothree.model.data.search.common.pk.CachedSearchPK;
031
032import com.echothree.model.data.party.server.entity.Party;
033import com.echothree.model.data.search.server.entity.SearchType;
034import com.echothree.model.data.search.server.entity.SearchUseType;
035import com.echothree.model.data.search.server.entity.CachedSearch;
036
037import com.echothree.model.data.party.server.factory.PartyFactory;
038import com.echothree.model.data.search.server.factory.SearchTypeFactory;
039import com.echothree.model.data.search.server.factory.SearchUseTypeFactory;
040import com.echothree.model.data.search.server.factory.CachedSearchFactory;
041
042import com.echothree.model.data.search.common.pk.SearchPK;
043
044import com.echothree.model.data.search.server.value.SearchValue;
045
046import com.echothree.model.data.search.server.factory.SearchFactory;
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
064import javax.annotation.Nonnull;
065import javax.annotation.Nullable;
066
067public class Search
068        extends BaseEntity
069        implements Serializable {
070    
071    private SearchPK _pk;
072    private SearchValue _value;
073    
074    /** Creates a new instance of Search */
075    public Search()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of Search */
081    public Search(SearchValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public SearchFactory getBaseFactoryInstance() {
091        return SearchFactory.getInstance();
092    }
093    
094    @Override
095    public boolean hasBeenModified() {
096        return _value.hasBeenModified();
097    }
098    
099    @Override
100    public int hashCode() {
101        return _pk.hashCode();
102    }
103    
104    @Override
105    @Nonnull
106    public String toString() {
107        return _pk.toString();
108    }
109    
110    @Override
111    public boolean equals(Object other) {
112        if(this == other)
113            return true;
114        
115        if(other instanceof Search that) {
116            SearchValue thatValue = that.getSearchValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store()
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(this);
127    }
128    
129    @Override
130    public void remove()
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(this);
133    }
134    
135    @Nonnull
136    public SearchValue getSearchValue() {
137        return _value;
138    }
139    
140    public void setSearchValue(@Nonnull SearchValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public SearchPK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nullable
153    public PartyPK getPartyPK() {
154        return _value.getPartyPK();
155    }
156    
157    @Nullable
158    public Party getParty(EntityPermission entityPermission) {
159        PartyPK pk = getPartyPK();
160        Party entity = pk == null? null: PartyFactory.getInstance().getEntityFromPK(entityPermission, pk);
161        
162        return entity;
163    }
164    
165    @Nullable
166    public Party getParty() {
167        return getParty(EntityPermission.READ_ONLY);
168    }
169    
170    @Nullable
171    public Party getPartyForUpdate() {
172        return getParty(EntityPermission.READ_WRITE);
173    }
174    
175    public void setPartyPK(@Nullable PartyPK partyPK)
176            throws PersistenceNotNullException, PersistenceReadOnlyException {
177        checkReadWrite();
178        _value.setPartyPK(partyPK);
179    }
180    
181    public void setParty(@Nullable Party entity) {
182        setPartyPK(entity == null ? null : entity.getPrimaryKey());
183    }
184    
185    public boolean getPartyPKHasBeenModified() {
186        return _value.getPartyPKHasBeenModified();
187    }
188    
189    @Nullable
190    public Boolean getPartyVerified() {
191        return _value.getPartyVerified();
192    }
193    
194    public void setPartyVerified(@Nullable Boolean partyVerified)
195            throws PersistenceNotNullException, PersistenceReadOnlyException {
196        checkReadWrite();
197        _value.setPartyVerified(partyVerified);
198    }
199    
200    public boolean getPartyVerifiedHasBeenModified() {
201        return _value.getPartyVerifiedHasBeenModified();
202    }
203    
204    @Nonnull
205    public SearchTypePK getSearchTypePK() {
206        return _value.getSearchTypePK();
207    }
208    
209    @Nonnull
210    public SearchType getSearchType(EntityPermission entityPermission) {
211        return SearchTypeFactory.getInstance().getEntityFromPK(entityPermission, getSearchTypePK());
212    }
213    
214    @Nonnull
215    public SearchType getSearchType() {
216        return getSearchType(EntityPermission.READ_ONLY);
217    }
218    
219    @Nonnull
220    public SearchType getSearchTypeForUpdate() {
221        return getSearchType(EntityPermission.READ_WRITE);
222    }
223    
224    public void setSearchTypePK(@Nonnull SearchTypePK searchTypePK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setSearchTypePK(searchTypePK);
228    }
229    
230    public void setSearchType(@Nonnull SearchType entity) {
231        setSearchTypePK(entity == null ? null : entity.getPrimaryKey());
232    }
233    
234    public boolean getSearchTypePKHasBeenModified() {
235        return _value.getSearchTypePKHasBeenModified();
236    }
237    
238    @Nonnull
239    public Long getExecutedTime() {
240        return _value.getExecutedTime();
241    }
242    
243    public void setExecutedTime(@Nonnull Long executedTime)
244            throws PersistenceNotNullException, PersistenceReadOnlyException {
245        checkReadWrite();
246        _value.setExecutedTime(executedTime);
247    }
248    
249    public boolean getExecutedTimeHasBeenModified() {
250        return _value.getExecutedTimeHasBeenModified();
251    }
252    
253    @Nullable
254    public SearchUseTypePK getSearchUseTypePK() {
255        return _value.getSearchUseTypePK();
256    }
257    
258    @Nullable
259    public SearchUseType getSearchUseType(EntityPermission entityPermission) {
260        SearchUseTypePK pk = getSearchUseTypePK();
261        SearchUseType entity = pk == null? null: SearchUseTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
262        
263        return entity;
264    }
265    
266    @Nullable
267    public SearchUseType getSearchUseType() {
268        return getSearchUseType(EntityPermission.READ_ONLY);
269    }
270    
271    @Nullable
272    public SearchUseType getSearchUseTypeForUpdate() {
273        return getSearchUseType(EntityPermission.READ_WRITE);
274    }
275    
276    public void setSearchUseTypePK(@Nullable SearchUseTypePK searchUseTypePK)
277            throws PersistenceNotNullException, PersistenceReadOnlyException {
278        checkReadWrite();
279        _value.setSearchUseTypePK(searchUseTypePK);
280    }
281    
282    public void setSearchUseType(@Nullable SearchUseType entity) {
283        setSearchUseTypePK(entity == null ? null : entity.getPrimaryKey());
284    }
285    
286    public boolean getSearchUseTypePKHasBeenModified() {
287        return _value.getSearchUseTypePKHasBeenModified();
288    }
289    
290    @Nullable
291    public CachedSearchPK getCachedSearchPK() {
292        return _value.getCachedSearchPK();
293    }
294    
295    @Nullable
296    public CachedSearch getCachedSearch(EntityPermission entityPermission) {
297        CachedSearchPK pk = getCachedSearchPK();
298        CachedSearch entity = pk == null? null: CachedSearchFactory.getInstance().getEntityFromPK(entityPermission, pk);
299        
300        return entity;
301    }
302    
303    @Nullable
304    public CachedSearch getCachedSearch() {
305        return getCachedSearch(EntityPermission.READ_ONLY);
306    }
307    
308    @Nullable
309    public CachedSearch getCachedSearchForUpdate() {
310        return getCachedSearch(EntityPermission.READ_WRITE);
311    }
312    
313    public void setCachedSearchPK(@Nullable CachedSearchPK cachedSearchPK)
314            throws PersistenceNotNullException, PersistenceReadOnlyException {
315        checkReadWrite();
316        _value.setCachedSearchPK(cachedSearchPK);
317    }
318    
319    public void setCachedSearch(@Nullable CachedSearch entity) {
320        setCachedSearchPK(entity == null ? null : entity.getPrimaryKey());
321    }
322    
323    public boolean getCachedSearchPKHasBeenModified() {
324        return _value.getCachedSearchPKHasBeenModified();
325    }
326    
327    @Nonnull
328    public Long getFromTime() {
329        return _value.getFromTime();
330    }
331    
332    public void setFromTime(@Nonnull Long fromTime)
333            throws PersistenceNotNullException, PersistenceReadOnlyException {
334        checkReadWrite();
335        _value.setFromTime(fromTime);
336    }
337    
338    public boolean getFromTimeHasBeenModified() {
339        return _value.getFromTimeHasBeenModified();
340    }
341    
342    @Nonnull
343    public Long getThruTime() {
344        return _value.getThruTime();
345    }
346    
347    public void setThruTime(@Nonnull Long thruTime)
348            throws PersistenceNotNullException, PersistenceReadOnlyException {
349        checkReadWrite();
350        _value.setThruTime(thruTime);
351    }
352    
353    public boolean getThruTimeHasBeenModified() {
354        return _value.getThruTimeHasBeenModified();
355    }
356    
357}