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