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
064public class CachedSearch
065        extends BaseEntity
066        implements Serializable {
067    
068    private CachedSearchPK _pk;
069    private CachedSearchValue _value;
070    
071    /** Creates a new instance of CachedSearch */
072    public CachedSearch()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of CachedSearch */
078    public CachedSearch(CachedSearchValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public CachedSearchFactory getBaseFactoryInstance() {
087        return CachedSearchFactory.getInstance();
088    }
089    
090    @Override
091    public boolean hasBeenModified() {
092        return _value.hasBeenModified();
093    }
094    
095    @Override
096    public int hashCode() {
097        return _pk.hashCode();
098    }
099    
100    @Override
101    public String toString() {
102        return _pk.toString();
103    }
104    
105    @Override
106    public boolean equals(Object other) {
107        if(this == other)
108            return true;
109        
110        if(other instanceof CachedSearch that) {
111            CachedSearchValue thatValue = that.getCachedSearchValue();
112            return _value.equals(thatValue);
113        } else {
114            return false;
115        }
116    }
117    
118    @Override
119    public void store()
120            throws PersistenceDatabaseException {
121        getBaseFactoryInstance().store(this);
122    }
123    
124    @Override
125    public void remove()
126            throws PersistenceDatabaseException {
127        getBaseFactoryInstance().remove(this);
128    }
129    
130    public CachedSearchValue getCachedSearchValue() {
131        return _value;
132    }
133    
134    public void setCachedSearchValue(CachedSearchValue value)
135            throws PersistenceReadOnlyException {
136        checkReadWrite();
137        _value = value;
138    }
139    
140    @Override
141    public CachedSearchPK getPrimaryKey() {
142        return _pk;
143    }
144    
145    public IndexPK getIndexPK() {
146        return _value.getIndexPK();
147    }
148    
149    public Index getIndex(EntityPermission entityPermission) {
150        return IndexFactory.getInstance().getEntityFromPK(entityPermission, getIndexPK());
151    }
152    
153    public Index getIndex() {
154        return getIndex(EntityPermission.READ_ONLY);
155    }
156    
157    public Index getIndexForUpdate() {
158        return getIndex(EntityPermission.READ_WRITE);
159    }
160    
161    public void setIndexPK(IndexPK indexPK)
162            throws PersistenceNotNullException, PersistenceReadOnlyException {
163        checkReadWrite();
164        _value.setIndexPK(indexPK);
165    }
166    
167    public void setIndex(Index entity) {
168        setIndexPK(entity == null? null: entity.getPrimaryKey());
169    }
170    
171    public boolean getIndexPKHasBeenModified() {
172        return _value.getIndexPKHasBeenModified();
173    }
174    
175    public String getQuerySha1Hash() {
176        return _value.getQuerySha1Hash();
177    }
178    
179    public void setQuerySha1Hash(String querySha1Hash)
180            throws PersistenceNotNullException, PersistenceReadOnlyException {
181        checkReadWrite();
182        _value.setQuerySha1Hash(querySha1Hash);
183    }
184    
185    public boolean getQuerySha1HashHasBeenModified() {
186        return _value.getQuerySha1HashHasBeenModified();
187    }
188    
189    public String getQuery() {
190        return _value.getQuery();
191    }
192    
193    public void setQuery(String query)
194            throws PersistenceNotNullException, PersistenceReadOnlyException {
195        checkReadWrite();
196        _value.setQuery(query);
197    }
198    
199    public boolean getQueryHasBeenModified() {
200        return _value.getQueryHasBeenModified();
201    }
202    
203    public String getParsedQuerySha1Hash() {
204        return _value.getParsedQuerySha1Hash();
205    }
206    
207    public void setParsedQuerySha1Hash(String parsedQuerySha1Hash)
208            throws PersistenceNotNullException, PersistenceReadOnlyException {
209        checkReadWrite();
210        _value.setParsedQuerySha1Hash(parsedQuerySha1Hash);
211    }
212    
213    public boolean getParsedQuerySha1HashHasBeenModified() {
214        return _value.getParsedQuerySha1HashHasBeenModified();
215    }
216    
217    public String getParsedQuery() {
218        return _value.getParsedQuery();
219    }
220    
221    public void setParsedQuery(String parsedQuery)
222            throws PersistenceNotNullException, PersistenceReadOnlyException {
223        checkReadWrite();
224        _value.setParsedQuery(parsedQuery);
225    }
226    
227    public boolean getParsedQueryHasBeenModified() {
228        return _value.getParsedQueryHasBeenModified();
229    }
230    
231    public SearchDefaultOperatorPK getSearchDefaultOperatorPK() {
232        return _value.getSearchDefaultOperatorPK();
233    }
234    
235    public SearchDefaultOperator getSearchDefaultOperator(EntityPermission entityPermission) {
236        return SearchDefaultOperatorFactory.getInstance().getEntityFromPK(entityPermission, getSearchDefaultOperatorPK());
237    }
238    
239    public SearchDefaultOperator getSearchDefaultOperator() {
240        return getSearchDefaultOperator(EntityPermission.READ_ONLY);
241    }
242    
243    public SearchDefaultOperator getSearchDefaultOperatorForUpdate() {
244        return getSearchDefaultOperator(EntityPermission.READ_WRITE);
245    }
246    
247    public void setSearchDefaultOperatorPK(SearchDefaultOperatorPK searchDefaultOperatorPK)
248            throws PersistenceNotNullException, PersistenceReadOnlyException {
249        checkReadWrite();
250        _value.setSearchDefaultOperatorPK(searchDefaultOperatorPK);
251    }
252    
253    public void setSearchDefaultOperator(SearchDefaultOperator entity) {
254        setSearchDefaultOperatorPK(entity == null? null: entity.getPrimaryKey());
255    }
256    
257    public boolean getSearchDefaultOperatorPKHasBeenModified() {
258        return _value.getSearchDefaultOperatorPKHasBeenModified();
259    }
260    
261    public SearchSortOrderPK getSearchSortOrderPK() {
262        return _value.getSearchSortOrderPK();
263    }
264    
265    public SearchSortOrder getSearchSortOrder(EntityPermission entityPermission) {
266        return SearchSortOrderFactory.getInstance().getEntityFromPK(entityPermission, getSearchSortOrderPK());
267    }
268    
269    public SearchSortOrder getSearchSortOrder() {
270        return getSearchSortOrder(EntityPermission.READ_ONLY);
271    }
272    
273    public SearchSortOrder getSearchSortOrderForUpdate() {
274        return getSearchSortOrder(EntityPermission.READ_WRITE);
275    }
276    
277    public void setSearchSortOrderPK(SearchSortOrderPK searchSortOrderPK)
278            throws PersistenceNotNullException, PersistenceReadOnlyException {
279        checkReadWrite();
280        _value.setSearchSortOrderPK(searchSortOrderPK);
281    }
282    
283    public void setSearchSortOrder(SearchSortOrder entity) {
284        setSearchSortOrderPK(entity == null? null: entity.getPrimaryKey());
285    }
286    
287    public boolean getSearchSortOrderPKHasBeenModified() {
288        return _value.getSearchSortOrderPKHasBeenModified();
289    }
290    
291    public SearchSortDirectionPK getSearchSortDirectionPK() {
292        return _value.getSearchSortDirectionPK();
293    }
294    
295    public SearchSortDirection getSearchSortDirection(EntityPermission entityPermission) {
296        return SearchSortDirectionFactory.getInstance().getEntityFromPK(entityPermission, getSearchSortDirectionPK());
297    }
298    
299    public SearchSortDirection getSearchSortDirection() {
300        return getSearchSortDirection(EntityPermission.READ_ONLY);
301    }
302    
303    public SearchSortDirection getSearchSortDirectionForUpdate() {
304        return getSearchSortDirection(EntityPermission.READ_WRITE);
305    }
306    
307    public void setSearchSortDirectionPK(SearchSortDirectionPK searchSortDirectionPK)
308            throws PersistenceNotNullException, PersistenceReadOnlyException {
309        checkReadWrite();
310        _value.setSearchSortDirectionPK(searchSortDirectionPK);
311    }
312    
313    public void setSearchSortDirection(SearchSortDirection entity) {
314        setSearchSortDirectionPK(entity == null? null: entity.getPrimaryKey());
315    }
316    
317    public boolean getSearchSortDirectionPKHasBeenModified() {
318        return _value.getSearchSortDirectionPKHasBeenModified();
319    }
320    
321    public Long getFromTime() {
322        return _value.getFromTime();
323    }
324    
325    public void setFromTime(Long fromTime)
326            throws PersistenceNotNullException, PersistenceReadOnlyException {
327        checkReadWrite();
328        _value.setFromTime(fromTime);
329    }
330    
331    public boolean getFromTimeHasBeenModified() {
332        return _value.getFromTimeHasBeenModified();
333    }
334    
335    public Long getThruTime() {
336        return _value.getThruTime();
337    }
338    
339    public void setThruTime(Long thruTime)
340            throws PersistenceNotNullException, PersistenceReadOnlyException {
341        checkReadWrite();
342        _value.setThruTime(thruTime);
343    }
344    
345    public boolean getThruTimeHasBeenModified() {
346        return _value.getThruTimeHasBeenModified();
347    }
348    
349}