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