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 064public class Search 065 extends BaseEntity 066 implements Serializable { 067 068 private SearchPK _pk; 069 private SearchValue _value; 070 071 /** Creates a new instance of Search */ 072 public Search() 073 throws PersistenceException { 074 super(); 075 } 076 077 /** Creates a new instance of Search */ 078 public Search(SearchValue value, EntityPermission entityPermission) { 079 super(entityPermission); 080 081 _value = value; 082 _pk = value.getPrimaryKey(); 083 } 084 085 @Override 086 public SearchFactory getBaseFactoryInstance() { 087 return SearchFactory.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 Search that) { 111 SearchValue thatValue = that.getSearchValue(); 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 SearchValue getSearchValue() { 131 return _value; 132 } 133 134 public void setSearchValue(SearchValue value) 135 throws PersistenceReadOnlyException { 136 checkReadWrite(); 137 _value = value; 138 } 139 140 @Override 141 public SearchPK getPrimaryKey() { 142 return _pk; 143 } 144 145 public PartyPK getPartyPK() { 146 return _value.getPartyPK(); 147 } 148 149 public Party getParty(EntityPermission entityPermission) { 150 PartyPK pk = getPartyPK(); 151 Party entity = pk == null? null: PartyFactory.getInstance().getEntityFromPK(entityPermission, pk); 152 153 return entity; 154 } 155 156 public Party getParty() { 157 return getParty(EntityPermission.READ_ONLY); 158 } 159 160 public Party getPartyForUpdate() { 161 return getParty(EntityPermission.READ_WRITE); 162 } 163 164 public void setPartyPK(PartyPK partyPK) 165 throws PersistenceNotNullException, PersistenceReadOnlyException { 166 checkReadWrite(); 167 _value.setPartyPK(partyPK); 168 } 169 170 public void setParty(Party entity) { 171 setPartyPK(entity == null? null: entity.getPrimaryKey()); 172 } 173 174 public boolean getPartyPKHasBeenModified() { 175 return _value.getPartyPKHasBeenModified(); 176 } 177 178 public Boolean getPartyVerified() { 179 return _value.getPartyVerified(); 180 } 181 182 public void setPartyVerified(Boolean partyVerified) 183 throws PersistenceNotNullException, PersistenceReadOnlyException { 184 checkReadWrite(); 185 _value.setPartyVerified(partyVerified); 186 } 187 188 public boolean getPartyVerifiedHasBeenModified() { 189 return _value.getPartyVerifiedHasBeenModified(); 190 } 191 192 public SearchTypePK getSearchTypePK() { 193 return _value.getSearchTypePK(); 194 } 195 196 public SearchType getSearchType(EntityPermission entityPermission) { 197 return SearchTypeFactory.getInstance().getEntityFromPK(entityPermission, getSearchTypePK()); 198 } 199 200 public SearchType getSearchType() { 201 return getSearchType(EntityPermission.READ_ONLY); 202 } 203 204 public SearchType getSearchTypeForUpdate() { 205 return getSearchType(EntityPermission.READ_WRITE); 206 } 207 208 public void setSearchTypePK(SearchTypePK searchTypePK) 209 throws PersistenceNotNullException, PersistenceReadOnlyException { 210 checkReadWrite(); 211 _value.setSearchTypePK(searchTypePK); 212 } 213 214 public void setSearchType(SearchType entity) { 215 setSearchTypePK(entity == null? null: entity.getPrimaryKey()); 216 } 217 218 public boolean getSearchTypePKHasBeenModified() { 219 return _value.getSearchTypePKHasBeenModified(); 220 } 221 222 public Long getExecutedTime() { 223 return _value.getExecutedTime(); 224 } 225 226 public void setExecutedTime(Long executedTime) 227 throws PersistenceNotNullException, PersistenceReadOnlyException { 228 checkReadWrite(); 229 _value.setExecutedTime(executedTime); 230 } 231 232 public boolean getExecutedTimeHasBeenModified() { 233 return _value.getExecutedTimeHasBeenModified(); 234 } 235 236 public SearchUseTypePK getSearchUseTypePK() { 237 return _value.getSearchUseTypePK(); 238 } 239 240 public SearchUseType getSearchUseType(EntityPermission entityPermission) { 241 SearchUseTypePK pk = getSearchUseTypePK(); 242 SearchUseType entity = pk == null? null: SearchUseTypeFactory.getInstance().getEntityFromPK(entityPermission, pk); 243 244 return entity; 245 } 246 247 public SearchUseType getSearchUseType() { 248 return getSearchUseType(EntityPermission.READ_ONLY); 249 } 250 251 public SearchUseType getSearchUseTypeForUpdate() { 252 return getSearchUseType(EntityPermission.READ_WRITE); 253 } 254 255 public void setSearchUseTypePK(SearchUseTypePK searchUseTypePK) 256 throws PersistenceNotNullException, PersistenceReadOnlyException { 257 checkReadWrite(); 258 _value.setSearchUseTypePK(searchUseTypePK); 259 } 260 261 public void setSearchUseType(SearchUseType entity) { 262 setSearchUseTypePK(entity == null? null: entity.getPrimaryKey()); 263 } 264 265 public boolean getSearchUseTypePKHasBeenModified() { 266 return _value.getSearchUseTypePKHasBeenModified(); 267 } 268 269 public CachedSearchPK getCachedSearchPK() { 270 return _value.getCachedSearchPK(); 271 } 272 273 public CachedSearch getCachedSearch(EntityPermission entityPermission) { 274 CachedSearchPK pk = getCachedSearchPK(); 275 CachedSearch entity = pk == null? null: CachedSearchFactory.getInstance().getEntityFromPK(entityPermission, pk); 276 277 return entity; 278 } 279 280 public CachedSearch getCachedSearch() { 281 return getCachedSearch(EntityPermission.READ_ONLY); 282 } 283 284 public CachedSearch getCachedSearchForUpdate() { 285 return getCachedSearch(EntityPermission.READ_WRITE); 286 } 287 288 public void setCachedSearchPK(CachedSearchPK cachedSearchPK) 289 throws PersistenceNotNullException, PersistenceReadOnlyException { 290 checkReadWrite(); 291 _value.setCachedSearchPK(cachedSearchPK); 292 } 293 294 public void setCachedSearch(CachedSearch entity) { 295 setCachedSearchPK(entity == null? null: entity.getPrimaryKey()); 296 } 297 298 public boolean getCachedSearchPKHasBeenModified() { 299 return _value.getCachedSearchPKHasBeenModified(); 300 } 301 302 public Long getFromTime() { 303 return _value.getFromTime(); 304 } 305 306 public void setFromTime(Long fromTime) 307 throws PersistenceNotNullException, PersistenceReadOnlyException { 308 checkReadWrite(); 309 _value.setFromTime(fromTime); 310 } 311 312 public boolean getFromTimeHasBeenModified() { 313 return _value.getFromTimeHasBeenModified(); 314 } 315 316 public Long getThruTime() { 317 return _value.getThruTime(); 318 } 319 320 public void setThruTime(Long thruTime) 321 throws PersistenceNotNullException, PersistenceReadOnlyException { 322 checkReadWrite(); 323 _value.setThruTime(thruTime); 324 } 325 326 public boolean getThruTimeHasBeenModified() { 327 return _value.getThruTimeHasBeenModified(); 328 } 329 330}