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