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 * SelectorTimeValue.java 021 */ 022 023package com.echothree.model.data.selector.server.value; 024 025import com.echothree.model.data.selector.common.pk.SelectorTimePK; 026 027import com.echothree.model.data.selector.server.factory.SelectorTimeFactory; 028 029import com.echothree.model.data.selector.common.pk.SelectorPK; 030 031import com.echothree.util.common.exception.PersistenceCloneException; 032import com.echothree.util.common.exception.PersistenceNotNullException; 033 034import com.echothree.util.server.persistence.BaseValue; 035 036import java.io.Serializable; 037 038import javax.annotation.Nonnull; 039import javax.annotation.Nullable; 040 041public class SelectorTimeValue 042 extends BaseValue<SelectorTimePK> 043 implements Cloneable, Serializable { 044 045 private SelectorPK selectorPK; 046 private boolean selectorPKHasBeenModified = false; 047 private Long lastEvaluationTime; 048 private boolean lastEvaluationTimeHasBeenModified = false; 049 private Long maxEntityCreatedTime; 050 private boolean maxEntityCreatedTimeHasBeenModified = false; 051 private Long maxEntityModifiedTime; 052 private boolean maxEntityModifiedTimeHasBeenModified = false; 053 private Long maxEntityDeletedTime; 054 private boolean maxEntityDeletedTimeHasBeenModified = false; 055 056 private transient Integer _hashCode = null; 057 private transient String _stringValue = null; 058 059 private void constructFields(SelectorPK selectorPK, Long lastEvaluationTime, Long maxEntityCreatedTime, Long maxEntityModifiedTime, Long maxEntityDeletedTime) 060 throws PersistenceNotNullException { 061 checkForNull(selectorPK); 062 this.selectorPK = selectorPK; 063 this.lastEvaluationTime = lastEvaluationTime; 064 this.maxEntityCreatedTime = maxEntityCreatedTime; 065 this.maxEntityModifiedTime = maxEntityModifiedTime; 066 this.maxEntityDeletedTime = maxEntityDeletedTime; 067 } 068 069 /** Creates a new instance of SelectorTimeValue */ 070 public SelectorTimeValue(SelectorTimePK selectorDetailPK, SelectorPK selectorPK, Long lastEvaluationTime, Long maxEntityCreatedTime, Long maxEntityModifiedTime, Long maxEntityDeletedTime) 071 throws PersistenceNotNullException { 072 super(selectorDetailPK); 073 constructFields(selectorPK, lastEvaluationTime, maxEntityCreatedTime, maxEntityModifiedTime, maxEntityDeletedTime); 074 } 075 076 /** Creates a new instance of SelectorTimeValue */ 077 public SelectorTimeValue(SelectorPK selectorPK, Long lastEvaluationTime, Long maxEntityCreatedTime, Long maxEntityModifiedTime, Long maxEntityDeletedTime) 078 throws PersistenceNotNullException { 079 super(); 080 constructFields(selectorPK, lastEvaluationTime, maxEntityCreatedTime, maxEntityModifiedTime, maxEntityDeletedTime); 081 } 082 083 @Override 084 @Nonnull 085 public SelectorTimeFactory getBaseFactoryInstance() { 086 return SelectorTimeFactory.getInstance(); 087 } 088 089 @Override 090 @Nonnull 091 public SelectorTimeValue clone() { 092 Object result; 093 094 try { 095 result = super.clone(); 096 } catch (CloneNotSupportedException cnse) { 097 // This shouldn't happen, fail when it does. 098 throw new PersistenceCloneException(cnse); 099 } 100 101 return (SelectorTimeValue)result; 102 } 103 104 @Override 105 @Nonnull 106 public SelectorTimePK getPrimaryKey() { 107 if(_primaryKey == null) { 108 _primaryKey = new SelectorTimePK(entityId); 109 } 110 111 return _primaryKey; 112 } 113 114 private void clearHashAndString() { 115 _hashCode = null; 116 _stringValue = null; 117 } 118 119 @Override 120 public int hashCode() { 121 if(_hashCode == null) { 122 int hashCode = 17; 123 124 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 125 126 hashCode = 37 * hashCode + ((selectorPK != null) ? selectorPK.hashCode() : 0); 127 hashCode = 37 * hashCode + ((lastEvaluationTime != null) ? lastEvaluationTime.hashCode() : 0); 128 hashCode = 37 * hashCode + ((maxEntityCreatedTime != null) ? maxEntityCreatedTime.hashCode() : 0); 129 hashCode = 37 * hashCode + ((maxEntityModifiedTime != null) ? maxEntityModifiedTime.hashCode() : 0); 130 hashCode = 37 * hashCode + ((maxEntityDeletedTime != null) ? maxEntityDeletedTime.hashCode() : 0); 131 132 _hashCode = hashCode; 133 } 134 135 return _hashCode; 136 } 137 138 @Override 139 @Nonnull 140 public String toString() { 141 if(_stringValue == null) { 142 _stringValue = "{" + 143 "entityId=" + getEntityId() + 144 ", selectorPK=" + getSelectorPK() + 145 ", lastEvaluationTime=" + getLastEvaluationTime() + 146 ", maxEntityCreatedTime=" + getMaxEntityCreatedTime() + 147 ", maxEntityModifiedTime=" + getMaxEntityModifiedTime() + 148 ", maxEntityDeletedTime=" + getMaxEntityDeletedTime() + 149 "}"; 150 } 151 return _stringValue; 152 } 153 154 @Override 155 public boolean equals(Object other) { 156 if(this == other) 157 return true; 158 159 if(!hasIdentity()) 160 return false; 161 162 if(other instanceof SelectorTimeValue that) { 163 if(!that.hasIdentity()) 164 return false; 165 166 Long thisEntityId = getEntityId(); 167 Long thatEntityId = that.getEntityId(); 168 169 boolean objectsEqual = thisEntityId.equals(thatEntityId); 170 if(objectsEqual) 171 objectsEqual = isIdentical(that); 172 173 return objectsEqual; 174 } else { 175 return false; 176 } 177 } 178 179 public boolean isIdentical(Object other) { 180 if(other instanceof SelectorTimeValue that) { 181 boolean objectsEqual = true; 182 183 184 if(objectsEqual) { 185 SelectorPK thisSelectorPK = getSelectorPK(); 186 SelectorPK thatSelectorPK = that.getSelectorPK(); 187 188 if(thisSelectorPK == null) { 189 objectsEqual = objectsEqual && (thatSelectorPK == null); 190 } else { 191 objectsEqual = objectsEqual && thisSelectorPK.equals(thatSelectorPK); 192 } 193 } 194 195 if(objectsEqual) { 196 Long thisLastEvaluationTime = getLastEvaluationTime(); 197 Long thatLastEvaluationTime = that.getLastEvaluationTime(); 198 199 if(thisLastEvaluationTime == null) { 200 objectsEqual = objectsEqual && (thatLastEvaluationTime == null); 201 } else { 202 objectsEqual = objectsEqual && thisLastEvaluationTime.equals(thatLastEvaluationTime); 203 } 204 } 205 206 if(objectsEqual) { 207 Long thisMaxEntityCreatedTime = getMaxEntityCreatedTime(); 208 Long thatMaxEntityCreatedTime = that.getMaxEntityCreatedTime(); 209 210 if(thisMaxEntityCreatedTime == null) { 211 objectsEqual = objectsEqual && (thatMaxEntityCreatedTime == null); 212 } else { 213 objectsEqual = objectsEqual && thisMaxEntityCreatedTime.equals(thatMaxEntityCreatedTime); 214 } 215 } 216 217 if(objectsEqual) { 218 Long thisMaxEntityModifiedTime = getMaxEntityModifiedTime(); 219 Long thatMaxEntityModifiedTime = that.getMaxEntityModifiedTime(); 220 221 if(thisMaxEntityModifiedTime == null) { 222 objectsEqual = objectsEqual && (thatMaxEntityModifiedTime == null); 223 } else { 224 objectsEqual = objectsEqual && thisMaxEntityModifiedTime.equals(thatMaxEntityModifiedTime); 225 } 226 } 227 228 if(objectsEqual) { 229 Long thisMaxEntityDeletedTime = getMaxEntityDeletedTime(); 230 Long thatMaxEntityDeletedTime = that.getMaxEntityDeletedTime(); 231 232 if(thisMaxEntityDeletedTime == null) { 233 objectsEqual = objectsEqual && (thatMaxEntityDeletedTime == null); 234 } else { 235 objectsEqual = objectsEqual && thisMaxEntityDeletedTime.equals(thatMaxEntityDeletedTime); 236 } 237 } 238 239 return objectsEqual; 240 } else { 241 return false; 242 } 243 } 244 245 @Override 246 public boolean hasBeenModified() { 247 return selectorPKHasBeenModified || lastEvaluationTimeHasBeenModified || maxEntityCreatedTimeHasBeenModified || maxEntityModifiedTimeHasBeenModified || maxEntityDeletedTimeHasBeenModified; 248 } 249 250 @Override 251 public void clearHasBeenModified() { 252 selectorPKHasBeenModified = false; 253 lastEvaluationTimeHasBeenModified = false; 254 maxEntityCreatedTimeHasBeenModified = false; 255 maxEntityModifiedTimeHasBeenModified = false; 256 maxEntityDeletedTimeHasBeenModified = false; 257 } 258 259 @Nonnull 260 public SelectorPK getSelectorPK() { 261 return selectorPK; 262 } 263 264 public void setSelectorPK(@Nonnull SelectorPK selectorPK) 265 throws PersistenceNotNullException { 266 checkForNull(selectorPK); 267 268 boolean update = true; 269 270 if(this.selectorPK != null) { 271 if(this.selectorPK.equals(selectorPK)) { 272 update = false; 273 } 274 } else if(selectorPK == null) { 275 update = false; 276 } 277 278 if(update) { 279 this.selectorPK = selectorPK; 280 selectorPKHasBeenModified = true; 281 clearHashAndString(); 282 } 283 } 284 285 public boolean getSelectorPKHasBeenModified() { 286 return selectorPKHasBeenModified; 287 } 288 289 @Nullable 290 public Long getLastEvaluationTime() { 291 return lastEvaluationTime; 292 } 293 294 public void setLastEvaluationTime(@Nullable Long lastEvaluationTime) { 295 boolean update = true; 296 297 if(this.lastEvaluationTime != null) { 298 if(this.lastEvaluationTime.equals(lastEvaluationTime)) { 299 update = false; 300 } 301 } else if(lastEvaluationTime == null) { 302 update = false; 303 } 304 305 if(update) { 306 this.lastEvaluationTime = lastEvaluationTime; 307 lastEvaluationTimeHasBeenModified = true; 308 clearHashAndString(); 309 } 310 } 311 312 public boolean getLastEvaluationTimeHasBeenModified() { 313 return lastEvaluationTimeHasBeenModified; 314 } 315 316 @Nullable 317 public Long getMaxEntityCreatedTime() { 318 return maxEntityCreatedTime; 319 } 320 321 public void setMaxEntityCreatedTime(@Nullable Long maxEntityCreatedTime) { 322 boolean update = true; 323 324 if(this.maxEntityCreatedTime != null) { 325 if(this.maxEntityCreatedTime.equals(maxEntityCreatedTime)) { 326 update = false; 327 } 328 } else if(maxEntityCreatedTime == null) { 329 update = false; 330 } 331 332 if(update) { 333 this.maxEntityCreatedTime = maxEntityCreatedTime; 334 maxEntityCreatedTimeHasBeenModified = true; 335 clearHashAndString(); 336 } 337 } 338 339 public boolean getMaxEntityCreatedTimeHasBeenModified() { 340 return maxEntityCreatedTimeHasBeenModified; 341 } 342 343 @Nullable 344 public Long getMaxEntityModifiedTime() { 345 return maxEntityModifiedTime; 346 } 347 348 public void setMaxEntityModifiedTime(@Nullable Long maxEntityModifiedTime) { 349 boolean update = true; 350 351 if(this.maxEntityModifiedTime != null) { 352 if(this.maxEntityModifiedTime.equals(maxEntityModifiedTime)) { 353 update = false; 354 } 355 } else if(maxEntityModifiedTime == null) { 356 update = false; 357 } 358 359 if(update) { 360 this.maxEntityModifiedTime = maxEntityModifiedTime; 361 maxEntityModifiedTimeHasBeenModified = true; 362 clearHashAndString(); 363 } 364 } 365 366 public boolean getMaxEntityModifiedTimeHasBeenModified() { 367 return maxEntityModifiedTimeHasBeenModified; 368 } 369 370 @Nullable 371 public Long getMaxEntityDeletedTime() { 372 return maxEntityDeletedTime; 373 } 374 375 public void setMaxEntityDeletedTime(@Nullable Long maxEntityDeletedTime) { 376 boolean update = true; 377 378 if(this.maxEntityDeletedTime != null) { 379 if(this.maxEntityDeletedTime.equals(maxEntityDeletedTime)) { 380 update = false; 381 } 382 } else if(maxEntityDeletedTime == null) { 383 update = false; 384 } 385 386 if(update) { 387 this.maxEntityDeletedTime = maxEntityDeletedTime; 388 maxEntityDeletedTimeHasBeenModified = true; 389 clearHashAndString(); 390 } 391 } 392 393 public boolean getMaxEntityDeletedTimeHasBeenModified() { 394 return maxEntityDeletedTimeHasBeenModified; 395 } 396 397}