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 * SearchValue.java 021 */ 022 023package com.echothree.model.data.search.server.value; 024 025import com.echothree.model.data.search.common.pk.SearchPK; 026 027import com.echothree.model.data.search.server.factory.SearchFactory; 028 029import com.echothree.model.data.party.common.pk.PartyPK; 030import com.echothree.model.data.search.common.pk.SearchTypePK; 031import com.echothree.model.data.search.common.pk.SearchUseTypePK; 032import com.echothree.model.data.search.common.pk.CachedSearchPK; 033 034import com.echothree.util.common.exception.PersistenceCloneException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036 037import com.echothree.util.server.persistence.BaseValue; 038 039import java.io.Serializable; 040 041public class SearchValue 042 extends BaseValue<SearchPK> 043 implements Cloneable, Serializable { 044 045 private PartyPK partyPK; 046 private boolean partyPKHasBeenModified = false; 047 private Boolean partyVerified; 048 private boolean partyVerifiedHasBeenModified = false; 049 private SearchTypePK searchTypePK; 050 private boolean searchTypePKHasBeenModified = false; 051 private Long executedTime; 052 private boolean executedTimeHasBeenModified = false; 053 private SearchUseTypePK searchUseTypePK; 054 private boolean searchUseTypePKHasBeenModified = false; 055 private CachedSearchPK cachedSearchPK; 056 private boolean cachedSearchPKHasBeenModified = false; 057 private Long fromTime; 058 private boolean fromTimeHasBeenModified = false; 059 private Long thruTime; 060 private boolean thruTimeHasBeenModified = false; 061 062 private transient Integer _hashCode = null; 063 private transient String _stringValue = null; 064 065 private void constructFields(PartyPK partyPK, Boolean partyVerified, SearchTypePK searchTypePK, Long executedTime, SearchUseTypePK searchUseTypePK, CachedSearchPK cachedSearchPK, Long fromTime, Long thruTime) 066 throws PersistenceNotNullException { 067 this.partyPK = partyPK; 068 this.partyVerified = partyVerified; 069 checkForNull(searchTypePK); 070 this.searchTypePK = searchTypePK; 071 checkForNull(executedTime); 072 this.executedTime = executedTime; 073 this.searchUseTypePK = searchUseTypePK; 074 this.cachedSearchPK = cachedSearchPK; 075 checkForNull(fromTime); 076 this.fromTime = fromTime; 077 checkForNull(thruTime); 078 this.thruTime = thruTime; 079 } 080 081 /** Creates a new instance of SearchValue */ 082 public SearchValue(SearchPK searchPK, PartyPK partyPK, Boolean partyVerified, SearchTypePK searchTypePK, Long executedTime, SearchUseTypePK searchUseTypePK, CachedSearchPK cachedSearchPK, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(searchPK); 085 constructFields(partyPK, partyVerified, searchTypePK, executedTime, searchUseTypePK, cachedSearchPK, fromTime, thruTime); 086 } 087 088 /** Creates a new instance of SearchValue */ 089 public SearchValue(PartyPK partyPK, Boolean partyVerified, SearchTypePK searchTypePK, Long executedTime, SearchUseTypePK searchUseTypePK, CachedSearchPK cachedSearchPK, Long fromTime, Long thruTime) 090 throws PersistenceNotNullException { 091 super(); 092 constructFields(partyPK, partyVerified, searchTypePK, executedTime, searchUseTypePK, cachedSearchPK, fromTime, thruTime); 093 } 094 095 @Override 096 public SearchFactory getBaseFactoryInstance() { 097 return SearchFactory.getInstance(); 098 } 099 100 @Override 101 public SearchValue clone() { 102 Object result; 103 104 try { 105 result = super.clone(); 106 } catch (CloneNotSupportedException cnse) { 107 // This shouldn't happen, fail when it does. 108 throw new PersistenceCloneException(cnse); 109 } 110 111 return (SearchValue)result; 112 } 113 114 @Override 115 public SearchPK getPrimaryKey() { 116 if(_primaryKey == null) { 117 _primaryKey = new SearchPK(entityId); 118 } 119 120 return _primaryKey; 121 } 122 123 private void clearHashAndString() { 124 _hashCode = null; 125 _stringValue = null; 126 } 127 128 @Override 129 public int hashCode() { 130 if(_hashCode == null) { 131 int hashCode = 17; 132 133 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 134 135 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 136 hashCode = 37 * hashCode + ((partyVerified != null) ? partyVerified.hashCode() : 0); 137 hashCode = 37 * hashCode + ((searchTypePK != null) ? searchTypePK.hashCode() : 0); 138 hashCode = 37 * hashCode + ((executedTime != null) ? executedTime.hashCode() : 0); 139 hashCode = 37 * hashCode + ((searchUseTypePK != null) ? searchUseTypePK.hashCode() : 0); 140 hashCode = 37 * hashCode + ((cachedSearchPK != null) ? cachedSearchPK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 142 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 143 144 _hashCode = hashCode; 145 } 146 147 return _hashCode; 148 } 149 150 @Override 151 public String toString() { 152 if(_stringValue == null) { 153 _stringValue = "{" + 154 "entityId=" + getEntityId() + 155 ", partyPK=" + getPartyPK() + 156 ", partyVerified=" + getPartyVerified() + 157 ", searchTypePK=" + getSearchTypePK() + 158 ", executedTime=" + getExecutedTime() + 159 ", searchUseTypePK=" + getSearchUseTypePK() + 160 ", cachedSearchPK=" + getCachedSearchPK() + 161 ", fromTime=" + getFromTime() + 162 ", thruTime=" + getThruTime() + 163 "}"; 164 } 165 return _stringValue; 166 } 167 168 @Override 169 public boolean equals(Object other) { 170 if(this == other) 171 return true; 172 173 if(!hasIdentity()) 174 return false; 175 176 if(other instanceof SearchValue that) { 177 if(!that.hasIdentity()) 178 return false; 179 180 Long thisEntityId = getEntityId(); 181 Long thatEntityId = that.getEntityId(); 182 183 boolean objectsEqual = thisEntityId.equals(thatEntityId); 184 if(objectsEqual) 185 objectsEqual = isIdentical(that); 186 187 return objectsEqual; 188 } else { 189 return false; 190 } 191 } 192 193 public boolean isIdentical(Object other) { 194 if(other instanceof SearchValue that) { 195 boolean objectsEqual = true; 196 197 198 if(objectsEqual) { 199 PartyPK thisPartyPK = getPartyPK(); 200 PartyPK thatPartyPK = that.getPartyPK(); 201 202 if(thisPartyPK == null) { 203 objectsEqual = objectsEqual && (thatPartyPK == null); 204 } else { 205 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 206 } 207 } 208 209 if(objectsEqual) { 210 Boolean thisPartyVerified = getPartyVerified(); 211 Boolean thatPartyVerified = that.getPartyVerified(); 212 213 if(thisPartyVerified == null) { 214 objectsEqual = objectsEqual && (thatPartyVerified == null); 215 } else { 216 objectsEqual = objectsEqual && thisPartyVerified.equals(thatPartyVerified); 217 } 218 } 219 220 if(objectsEqual) { 221 SearchTypePK thisSearchTypePK = getSearchTypePK(); 222 SearchTypePK thatSearchTypePK = that.getSearchTypePK(); 223 224 if(thisSearchTypePK == null) { 225 objectsEqual = objectsEqual && (thatSearchTypePK == null); 226 } else { 227 objectsEqual = objectsEqual && thisSearchTypePK.equals(thatSearchTypePK); 228 } 229 } 230 231 if(objectsEqual) { 232 Long thisExecutedTime = getExecutedTime(); 233 Long thatExecutedTime = that.getExecutedTime(); 234 235 if(thisExecutedTime == null) { 236 objectsEqual = objectsEqual && (thatExecutedTime == null); 237 } else { 238 objectsEqual = objectsEqual && thisExecutedTime.equals(thatExecutedTime); 239 } 240 } 241 242 if(objectsEqual) { 243 SearchUseTypePK thisSearchUseTypePK = getSearchUseTypePK(); 244 SearchUseTypePK thatSearchUseTypePK = that.getSearchUseTypePK(); 245 246 if(thisSearchUseTypePK == null) { 247 objectsEqual = objectsEqual && (thatSearchUseTypePK == null); 248 } else { 249 objectsEqual = objectsEqual && thisSearchUseTypePK.equals(thatSearchUseTypePK); 250 } 251 } 252 253 if(objectsEqual) { 254 CachedSearchPK thisCachedSearchPK = getCachedSearchPK(); 255 CachedSearchPK thatCachedSearchPK = that.getCachedSearchPK(); 256 257 if(thisCachedSearchPK == null) { 258 objectsEqual = objectsEqual && (thatCachedSearchPK == null); 259 } else { 260 objectsEqual = objectsEqual && thisCachedSearchPK.equals(thatCachedSearchPK); 261 } 262 } 263 264 if(objectsEqual) { 265 Long thisFromTime = getFromTime(); 266 Long thatFromTime = that.getFromTime(); 267 268 if(thisFromTime == null) { 269 objectsEqual = objectsEqual && (thatFromTime == null); 270 } else { 271 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 272 } 273 } 274 275 if(objectsEqual) { 276 Long thisThruTime = getThruTime(); 277 Long thatThruTime = that.getThruTime(); 278 279 if(thisThruTime == null) { 280 objectsEqual = objectsEqual && (thatThruTime == null); 281 } else { 282 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 283 } 284 } 285 286 return objectsEqual; 287 } else { 288 return false; 289 } 290 } 291 292 @Override 293 public boolean hasBeenModified() { 294 return partyPKHasBeenModified || partyVerifiedHasBeenModified || searchTypePKHasBeenModified || executedTimeHasBeenModified || searchUseTypePKHasBeenModified || cachedSearchPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 295 } 296 297 @Override 298 public void clearHasBeenModified() { 299 partyPKHasBeenModified = false; 300 partyVerifiedHasBeenModified = false; 301 searchTypePKHasBeenModified = false; 302 executedTimeHasBeenModified = false; 303 searchUseTypePKHasBeenModified = false; 304 cachedSearchPKHasBeenModified = false; 305 fromTimeHasBeenModified = false; 306 thruTimeHasBeenModified = false; 307 } 308 309 public PartyPK getPartyPK() { 310 return partyPK; 311 } 312 313 public void setPartyPK(PartyPK partyPK) { 314 boolean update = true; 315 316 if(this.partyPK != null) { 317 if(this.partyPK.equals(partyPK)) { 318 update = false; 319 } 320 } else if(partyPK == null) { 321 update = false; 322 } 323 324 if(update) { 325 this.partyPK = partyPK; 326 partyPKHasBeenModified = true; 327 clearHashAndString(); 328 } 329 } 330 331 public boolean getPartyPKHasBeenModified() { 332 return partyPKHasBeenModified; 333 } 334 335 public Boolean getPartyVerified() { 336 return partyVerified; 337 } 338 339 public void setPartyVerified(Boolean partyVerified) { 340 boolean update = true; 341 342 if(this.partyVerified != null) { 343 if(this.partyVerified.equals(partyVerified)) { 344 update = false; 345 } 346 } else if(partyVerified == null) { 347 update = false; 348 } 349 350 if(update) { 351 this.partyVerified = partyVerified; 352 partyVerifiedHasBeenModified = true; 353 clearHashAndString(); 354 } 355 } 356 357 public boolean getPartyVerifiedHasBeenModified() { 358 return partyVerifiedHasBeenModified; 359 } 360 361 public SearchTypePK getSearchTypePK() { 362 return searchTypePK; 363 } 364 365 public void setSearchTypePK(SearchTypePK searchTypePK) 366 throws PersistenceNotNullException { 367 checkForNull(searchTypePK); 368 369 boolean update = true; 370 371 if(this.searchTypePK != null) { 372 if(this.searchTypePK.equals(searchTypePK)) { 373 update = false; 374 } 375 } else if(searchTypePK == null) { 376 update = false; 377 } 378 379 if(update) { 380 this.searchTypePK = searchTypePK; 381 searchTypePKHasBeenModified = true; 382 clearHashAndString(); 383 } 384 } 385 386 public boolean getSearchTypePKHasBeenModified() { 387 return searchTypePKHasBeenModified; 388 } 389 390 public Long getExecutedTime() { 391 return executedTime; 392 } 393 394 public void setExecutedTime(Long executedTime) 395 throws PersistenceNotNullException { 396 checkForNull(executedTime); 397 398 boolean update = true; 399 400 if(this.executedTime != null) { 401 if(this.executedTime.equals(executedTime)) { 402 update = false; 403 } 404 } else if(executedTime == null) { 405 update = false; 406 } 407 408 if(update) { 409 this.executedTime = executedTime; 410 executedTimeHasBeenModified = true; 411 clearHashAndString(); 412 } 413 } 414 415 public boolean getExecutedTimeHasBeenModified() { 416 return executedTimeHasBeenModified; 417 } 418 419 public SearchUseTypePK getSearchUseTypePK() { 420 return searchUseTypePK; 421 } 422 423 public void setSearchUseTypePK(SearchUseTypePK searchUseTypePK) { 424 boolean update = true; 425 426 if(this.searchUseTypePK != null) { 427 if(this.searchUseTypePK.equals(searchUseTypePK)) { 428 update = false; 429 } 430 } else if(searchUseTypePK == null) { 431 update = false; 432 } 433 434 if(update) { 435 this.searchUseTypePK = searchUseTypePK; 436 searchUseTypePKHasBeenModified = true; 437 clearHashAndString(); 438 } 439 } 440 441 public boolean getSearchUseTypePKHasBeenModified() { 442 return searchUseTypePKHasBeenModified; 443 } 444 445 public CachedSearchPK getCachedSearchPK() { 446 return cachedSearchPK; 447 } 448 449 public void setCachedSearchPK(CachedSearchPK cachedSearchPK) { 450 boolean update = true; 451 452 if(this.cachedSearchPK != null) { 453 if(this.cachedSearchPK.equals(cachedSearchPK)) { 454 update = false; 455 } 456 } else if(cachedSearchPK == null) { 457 update = false; 458 } 459 460 if(update) { 461 this.cachedSearchPK = cachedSearchPK; 462 cachedSearchPKHasBeenModified = true; 463 clearHashAndString(); 464 } 465 } 466 467 public boolean getCachedSearchPKHasBeenModified() { 468 return cachedSearchPKHasBeenModified; 469 } 470 471 public Long getFromTime() { 472 return fromTime; 473 } 474 475 public void setFromTime(Long fromTime) 476 throws PersistenceNotNullException { 477 checkForNull(fromTime); 478 479 boolean update = true; 480 481 if(this.fromTime != null) { 482 if(this.fromTime.equals(fromTime)) { 483 update = false; 484 } 485 } else if(fromTime == null) { 486 update = false; 487 } 488 489 if(update) { 490 this.fromTime = fromTime; 491 fromTimeHasBeenModified = true; 492 clearHashAndString(); 493 } 494 } 495 496 public boolean getFromTimeHasBeenModified() { 497 return fromTimeHasBeenModified; 498 } 499 500 public Long getThruTime() { 501 return thruTime; 502 } 503 504 public void setThruTime(Long thruTime) 505 throws PersistenceNotNullException { 506 checkForNull(thruTime); 507 508 boolean update = true; 509 510 if(this.thruTime != null) { 511 if(this.thruTime.equals(thruTime)) { 512 update = false; 513 } 514 } else if(thruTime == null) { 515 update = false; 516 } 517 518 if(update) { 519 this.thruTime = thruTime; 520 thruTimeHasBeenModified = true; 521 clearHashAndString(); 522 } 523 } 524 525 public boolean getThruTimeHasBeenModified() { 526 return thruTimeHasBeenModified; 527 } 528 529}