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 * CachedSearch.java
021 */
022
023package com.echothree.model.data.search.server.entity;
024
025import com.echothree.model.data.search.common.pk.CachedSearchPK;
026
027import com.echothree.model.data.index.common.pk.IndexPK;
028import com.echothree.model.data.search.common.pk.SearchDefaultOperatorPK;
029import com.echothree.model.data.search.common.pk.SearchSortOrderPK;
030import com.echothree.model.data.search.common.pk.SearchSortDirectionPK;
031
032import com.echothree.model.data.index.server.entity.Index;
033import com.echothree.model.data.search.server.entity.SearchDefaultOperator;
034import com.echothree.model.data.search.server.entity.SearchSortOrder;
035import com.echothree.model.data.search.server.entity.SearchSortDirection;
036
037import com.echothree.model.data.index.server.factory.IndexFactory;
038import com.echothree.model.data.search.server.factory.SearchDefaultOperatorFactory;
039import com.echothree.model.data.search.server.factory.SearchSortOrderFactory;
040import com.echothree.model.data.search.server.factory.SearchSortDirectionFactory;
041
042import com.echothree.model.data.search.common.pk.CachedSearchPK;
043
044import com.echothree.model.data.search.server.value.CachedSearchValue;
045
046import com.echothree.model.data.search.server.factory.CachedSearchFactory;
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 CachedSearch
068        extends BaseEntity
069        implements Serializable {
070    
071    private CachedSearchPK _pk;
072    private CachedSearchValue _value;
073    
074    /** Creates a new instance of CachedSearch */
075    public CachedSearch()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of CachedSearch */
081    public CachedSearch(CachedSearchValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public CachedSearchFactory getBaseFactoryInstance() {
091        return CachedSearchFactory.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 CachedSearch that) {
116            CachedSearchValue thatValue = that.getCachedSearchValue();
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 CachedSearchValue getCachedSearchValue() {
137        return _value;
138    }
139    
140    public void setCachedSearchValue(@Nonnull CachedSearchValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public CachedSearchPK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nonnull
153    public IndexPK getIndexPK() {
154        return _value.getIndexPK();
155    }
156    
157    @Nonnull
158    public Index getIndex(EntityPermission entityPermission) {
159        return IndexFactory.getInstance().getEntityFromPK(entityPermission, getIndexPK());
160    }
161    
162    @Nonnull
163    public Index getIndex() {
164        return getIndex(EntityPermission.READ_ONLY);
165    }
166    
167    @Nonnull
168    public Index getIndexForUpdate() {
169        return getIndex(EntityPermission.READ_WRITE);
170    }
171    
172    public void setIndexPK(@Nonnull IndexPK indexPK)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setIndexPK(indexPK);
176    }
177    
178    public void setIndex(@Nonnull Index entity) {
179        setIndexPK(entity == null ? null : entity.getPrimaryKey());
180    }
181    
182    public boolean getIndexPKHasBeenModified() {
183        return _value.getIndexPKHasBeenModified();
184    }
185    
186    @Nonnull
187    public String getQuerySha1Hash() {
188        return _value.getQuerySha1Hash();
189    }
190    
191    public void setQuerySha1Hash(@Nonnull String querySha1Hash)
192            throws PersistenceNotNullException, PersistenceReadOnlyException {
193        checkReadWrite();
194        _value.setQuerySha1Hash(querySha1Hash);
195    }
196    
197    public boolean getQuerySha1HashHasBeenModified() {
198        return _value.getQuerySha1HashHasBeenModified();
199    }
200    
201    @Nonnull
202    public String getQuery() {
203        return _value.getQuery();
204    }
205    
206    public void setQuery(@Nonnull String query)
207            throws PersistenceNotNullException, PersistenceReadOnlyException {
208        checkReadWrite();
209        _value.setQuery(query);
210    }
211    
212    public boolean getQueryHasBeenModified() {
213        return _value.getQueryHasBeenModified();
214    }
215    
216    @Nonnull
217    public String getParsedQuerySha1Hash() {
218        return _value.getParsedQuerySha1Hash();
219    }
220    
221    public void setParsedQuerySha1Hash(@Nonnull String parsedQuerySha1Hash)
222            throws PersistenceNotNullException, PersistenceReadOnlyException {
223        checkReadWrite();
224        _value.setParsedQuerySha1Hash(parsedQuerySha1Hash);
225    }
226    
227    public boolean getParsedQuerySha1HashHasBeenModified() {
228        return _value.getParsedQuerySha1HashHasBeenModified();
229    }
230    
231    @Nonnull
232    public String getParsedQuery() {
233        return _value.getParsedQuery();
234    }
235    
236    public void setParsedQuery(@Nonnull String parsedQuery)
237            throws PersistenceNotNullException, PersistenceReadOnlyException {
238        checkReadWrite();
239        _value.setParsedQuery(parsedQuery);
240    }
241    
242    public boolean getParsedQueryHasBeenModified() {
243        return _value.getParsedQueryHasBeenModified();
244    }
245    
246    @Nonnull
247    public SearchDefaultOperatorPK getSearchDefaultOperatorPK() {
248        return _value.getSearchDefaultOperatorPK();
249    }
250    
251    @Nonnull
252    public SearchDefaultOperator getSearchDefaultOperator(EntityPermission entityPermission) {
253        return SearchDefaultOperatorFactory.getInstance().getEntityFromPK(entityPermission, getSearchDefaultOperatorPK());
254    }
255    
256    @Nonnull
257    public SearchDefaultOperator getSearchDefaultOperator() {
258        return getSearchDefaultOperator(EntityPermission.READ_ONLY);
259    }
260    
261    @Nonnull
262    public SearchDefaultOperator getSearchDefaultOperatorForUpdate() {
263        return getSearchDefaultOperator(EntityPermission.READ_WRITE);
264    }
265    
266    public void setSearchDefaultOperatorPK(@Nonnull SearchDefaultOperatorPK searchDefaultOperatorPK)
267            throws PersistenceNotNullException, PersistenceReadOnlyException {
268        checkReadWrite();
269        _value.setSearchDefaultOperatorPK(searchDefaultOperatorPK);
270    }
271    
272    public void setSearchDefaultOperator(@Nonnull SearchDefaultOperator entity) {
273        setSearchDefaultOperatorPK(entity == null ? null : entity.getPrimaryKey());
274    }
275    
276    public boolean getSearchDefaultOperatorPKHasBeenModified() {
277        return _value.getSearchDefaultOperatorPKHasBeenModified();
278    }
279    
280    @Nonnull
281    public SearchSortOrderPK getSearchSortOrderPK() {
282        return _value.getSearchSortOrderPK();
283    }
284    
285    @Nonnull
286    public SearchSortOrder getSearchSortOrder(EntityPermission entityPermission) {
287        return SearchSortOrderFactory.getInstance().getEntityFromPK(entityPermission, getSearchSortOrderPK());
288    }
289    
290    @Nonnull
291    public SearchSortOrder getSearchSortOrder() {
292        return getSearchSortOrder(EntityPermission.READ_ONLY);
293    }
294    
295    @Nonnull
296    public SearchSortOrder getSearchSortOrderForUpdate() {
297        return getSearchSortOrder(EntityPermission.READ_WRITE);
298    }
299    
300    public void setSearchSortOrderPK(@Nonnull SearchSortOrderPK searchSortOrderPK)
301            throws PersistenceNotNullException, PersistenceReadOnlyException {
302        checkReadWrite();
303        _value.setSearchSortOrderPK(searchSortOrderPK);
304    }
305    
306    public void setSearchSortOrder(@Nonnull SearchSortOrder entity) {
307        setSearchSortOrderPK(entity == null ? null : entity.getPrimaryKey());
308    }
309    
310    public boolean getSearchSortOrderPKHasBeenModified() {
311        return _value.getSearchSortOrderPKHasBeenModified();
312    }
313    
314    @Nonnull
315    public SearchSortDirectionPK getSearchSortDirectionPK() {
316        return _value.getSearchSortDirectionPK();
317    }
318    
319    @Nonnull
320    public SearchSortDirection getSearchSortDirection(EntityPermission entityPermission) {
321        return SearchSortDirectionFactory.getInstance().getEntityFromPK(entityPermission, getSearchSortDirectionPK());
322    }
323    
324    @Nonnull
325    public SearchSortDirection getSearchSortDirection() {
326        return getSearchSortDirection(EntityPermission.READ_ONLY);
327    }
328    
329    @Nonnull
330    public SearchSortDirection getSearchSortDirectionForUpdate() {
331        return getSearchSortDirection(EntityPermission.READ_WRITE);
332    }
333    
334    public void setSearchSortDirectionPK(@Nonnull SearchSortDirectionPK searchSortDirectionPK)
335            throws PersistenceNotNullException, PersistenceReadOnlyException {
336        checkReadWrite();
337        _value.setSearchSortDirectionPK(searchSortDirectionPK);
338    }
339    
340    public void setSearchSortDirection(@Nonnull SearchSortDirection entity) {
341        setSearchSortDirectionPK(entity == null ? null : entity.getPrimaryKey());
342    }
343    
344    public boolean getSearchSortDirectionPKHasBeenModified() {
345        return _value.getSearchSortDirectionPKHasBeenModified();
346    }
347    
348    @Nonnull
349    public Long getFromTime() {
350        return _value.getFromTime();
351    }
352    
353    public void setFromTime(@Nonnull Long fromTime)
354            throws PersistenceNotNullException, PersistenceReadOnlyException {
355        checkReadWrite();
356        _value.setFromTime(fromTime);
357    }
358    
359    public boolean getFromTimeHasBeenModified() {
360        return _value.getFromTimeHasBeenModified();
361    }
362    
363    @Nonnull
364    public Long getThruTime() {
365        return _value.getThruTime();
366    }
367    
368    public void setThruTime(@Nonnull Long thruTime)
369            throws PersistenceNotNullException, PersistenceReadOnlyException {
370        checkReadWrite();
371        _value.setThruTime(thruTime);
372    }
373    
374    public boolean getThruTimeHasBeenModified() {
375        return _value.getThruTimeHasBeenModified();
376    }
377    
378}