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 * ChainInstanceStatusValue.java 021 */ 022 023package com.echothree.model.data.chain.server.value; 024 025import com.echothree.model.data.chain.common.pk.ChainInstanceStatusPK; 026 027import com.echothree.model.data.chain.server.factory.ChainInstanceStatusFactory; 028 029import com.echothree.model.data.chain.common.pk.ChainInstancePK; 030import com.echothree.model.data.chain.common.pk.ChainActionSetPK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039import javax.annotation.Nonnull; 040import javax.annotation.Nullable; 041 042public class ChainInstanceStatusValue 043 extends BaseValue<ChainInstanceStatusPK> 044 implements Cloneable, Serializable { 045 046 private ChainInstancePK chainInstancePK; 047 private boolean chainInstancePKHasBeenModified = false; 048 private ChainActionSetPK nextChainActionSetPK; 049 private boolean nextChainActionSetPKHasBeenModified = false; 050 private Long nextChainActionSetTime; 051 private boolean nextChainActionSetTimeHasBeenModified = false; 052 private Integer queuedLetterSequence; 053 private boolean queuedLetterSequenceHasBeenModified = false; 054 055 private transient Integer _hashCode = null; 056 private transient String _stringValue = null; 057 058 private void constructFields(ChainInstancePK chainInstancePK, ChainActionSetPK nextChainActionSetPK, Long nextChainActionSetTime, Integer queuedLetterSequence) 059 throws PersistenceNotNullException { 060 checkForNull(chainInstancePK); 061 this.chainInstancePK = chainInstancePK; 062 checkForNull(nextChainActionSetPK); 063 this.nextChainActionSetPK = nextChainActionSetPK; 064 checkForNull(nextChainActionSetTime); 065 this.nextChainActionSetTime = nextChainActionSetTime; 066 checkForNull(queuedLetterSequence); 067 this.queuedLetterSequence = queuedLetterSequence; 068 } 069 070 /** Creates a new instance of ChainInstanceStatusValue */ 071 public ChainInstanceStatusValue(ChainInstanceStatusPK chainInstanceStatusPK, ChainInstancePK chainInstancePK, ChainActionSetPK nextChainActionSetPK, Long nextChainActionSetTime, Integer queuedLetterSequence) 072 throws PersistenceNotNullException { 073 super(chainInstanceStatusPK); 074 constructFields(chainInstancePK, nextChainActionSetPK, nextChainActionSetTime, queuedLetterSequence); 075 } 076 077 /** Creates a new instance of ChainInstanceStatusValue */ 078 public ChainInstanceStatusValue(ChainInstancePK chainInstancePK, ChainActionSetPK nextChainActionSetPK, Long nextChainActionSetTime, Integer queuedLetterSequence) 079 throws PersistenceNotNullException { 080 super(); 081 constructFields(chainInstancePK, nextChainActionSetPK, nextChainActionSetTime, queuedLetterSequence); 082 } 083 084 @Override 085 @Nonnull 086 public ChainInstanceStatusFactory getBaseFactoryInstance() { 087 return ChainInstanceStatusFactory.getInstance(); 088 } 089 090 @Override 091 @Nonnull 092 public ChainInstanceStatusValue clone() { 093 Object result; 094 095 try { 096 result = super.clone(); 097 } catch (CloneNotSupportedException cnse) { 098 // This shouldn't happen, fail when it does. 099 throw new PersistenceCloneException(cnse); 100 } 101 102 return (ChainInstanceStatusValue)result; 103 } 104 105 @Override 106 @Nonnull 107 public ChainInstanceStatusPK getPrimaryKey() { 108 if(_primaryKey == null) { 109 _primaryKey = new ChainInstanceStatusPK(entityId); 110 } 111 112 return _primaryKey; 113 } 114 115 private void clearHashAndString() { 116 _hashCode = null; 117 _stringValue = null; 118 } 119 120 @Override 121 public int hashCode() { 122 if(_hashCode == null) { 123 int hashCode = 17; 124 125 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 126 127 hashCode = 37 * hashCode + ((chainInstancePK != null) ? chainInstancePK.hashCode() : 0); 128 hashCode = 37 * hashCode + ((nextChainActionSetPK != null) ? nextChainActionSetPK.hashCode() : 0); 129 hashCode = 37 * hashCode + ((nextChainActionSetTime != null) ? nextChainActionSetTime.hashCode() : 0); 130 hashCode = 37 * hashCode + ((queuedLetterSequence != null) ? queuedLetterSequence.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 ", chainInstancePK=" + getChainInstancePK() + 145 ", nextChainActionSetPK=" + getNextChainActionSetPK() + 146 ", nextChainActionSetTime=" + getNextChainActionSetTime() + 147 ", queuedLetterSequence=" + getQueuedLetterSequence() + 148 "}"; 149 } 150 return _stringValue; 151 } 152 153 @Override 154 public boolean equals(Object other) { 155 if(this == other) 156 return true; 157 158 if(!hasIdentity()) 159 return false; 160 161 if(other instanceof ChainInstanceStatusValue that) { 162 if(!that.hasIdentity()) 163 return false; 164 165 Long thisEntityId = getEntityId(); 166 Long thatEntityId = that.getEntityId(); 167 168 boolean objectsEqual = thisEntityId.equals(thatEntityId); 169 if(objectsEqual) 170 objectsEqual = isIdentical(that); 171 172 return objectsEqual; 173 } else { 174 return false; 175 } 176 } 177 178 public boolean isIdentical(Object other) { 179 if(other instanceof ChainInstanceStatusValue that) { 180 boolean objectsEqual = true; 181 182 183 if(objectsEqual) { 184 ChainInstancePK thisChainInstancePK = getChainInstancePK(); 185 ChainInstancePK thatChainInstancePK = that.getChainInstancePK(); 186 187 if(thisChainInstancePK == null) { 188 objectsEqual = objectsEqual && (thatChainInstancePK == null); 189 } else { 190 objectsEqual = objectsEqual && thisChainInstancePK.equals(thatChainInstancePK); 191 } 192 } 193 194 if(objectsEqual) { 195 ChainActionSetPK thisNextChainActionSetPK = getNextChainActionSetPK(); 196 ChainActionSetPK thatNextChainActionSetPK = that.getNextChainActionSetPK(); 197 198 if(thisNextChainActionSetPK == null) { 199 objectsEqual = objectsEqual && (thatNextChainActionSetPK == null); 200 } else { 201 objectsEqual = objectsEqual && thisNextChainActionSetPK.equals(thatNextChainActionSetPK); 202 } 203 } 204 205 if(objectsEqual) { 206 Long thisNextChainActionSetTime = getNextChainActionSetTime(); 207 Long thatNextChainActionSetTime = that.getNextChainActionSetTime(); 208 209 if(thisNextChainActionSetTime == null) { 210 objectsEqual = objectsEqual && (thatNextChainActionSetTime == null); 211 } else { 212 objectsEqual = objectsEqual && thisNextChainActionSetTime.equals(thatNextChainActionSetTime); 213 } 214 } 215 216 if(objectsEqual) { 217 Integer thisQueuedLetterSequence = getQueuedLetterSequence(); 218 Integer thatQueuedLetterSequence = that.getQueuedLetterSequence(); 219 220 if(thisQueuedLetterSequence == null) { 221 objectsEqual = objectsEqual && (thatQueuedLetterSequence == null); 222 } else { 223 objectsEqual = objectsEqual && thisQueuedLetterSequence.equals(thatQueuedLetterSequence); 224 } 225 } 226 227 return objectsEqual; 228 } else { 229 return false; 230 } 231 } 232 233 @Override 234 public boolean hasBeenModified() { 235 return chainInstancePKHasBeenModified || nextChainActionSetPKHasBeenModified || nextChainActionSetTimeHasBeenModified || queuedLetterSequenceHasBeenModified; 236 } 237 238 @Override 239 public void clearHasBeenModified() { 240 chainInstancePKHasBeenModified = false; 241 nextChainActionSetPKHasBeenModified = false; 242 nextChainActionSetTimeHasBeenModified = false; 243 queuedLetterSequenceHasBeenModified = false; 244 } 245 246 @Nonnull 247 public ChainInstancePK getChainInstancePK() { 248 return chainInstancePK; 249 } 250 251 public void setChainInstancePK(@Nonnull ChainInstancePK chainInstancePK) 252 throws PersistenceNotNullException { 253 checkForNull(chainInstancePK); 254 255 boolean update = true; 256 257 if(this.chainInstancePK != null) { 258 if(this.chainInstancePK.equals(chainInstancePK)) { 259 update = false; 260 } 261 } else if(chainInstancePK == null) { 262 update = false; 263 } 264 265 if(update) { 266 this.chainInstancePK = chainInstancePK; 267 chainInstancePKHasBeenModified = true; 268 clearHashAndString(); 269 } 270 } 271 272 public boolean getChainInstancePKHasBeenModified() { 273 return chainInstancePKHasBeenModified; 274 } 275 276 @Nonnull 277 public ChainActionSetPK getNextChainActionSetPK() { 278 return nextChainActionSetPK; 279 } 280 281 public void setNextChainActionSetPK(@Nonnull ChainActionSetPK nextChainActionSetPK) 282 throws PersistenceNotNullException { 283 checkForNull(nextChainActionSetPK); 284 285 boolean update = true; 286 287 if(this.nextChainActionSetPK != null) { 288 if(this.nextChainActionSetPK.equals(nextChainActionSetPK)) { 289 update = false; 290 } 291 } else if(nextChainActionSetPK == null) { 292 update = false; 293 } 294 295 if(update) { 296 this.nextChainActionSetPK = nextChainActionSetPK; 297 nextChainActionSetPKHasBeenModified = true; 298 clearHashAndString(); 299 } 300 } 301 302 public boolean getNextChainActionSetPKHasBeenModified() { 303 return nextChainActionSetPKHasBeenModified; 304 } 305 306 @Nonnull 307 public Long getNextChainActionSetTime() { 308 return nextChainActionSetTime; 309 } 310 311 public void setNextChainActionSetTime(@Nonnull Long nextChainActionSetTime) 312 throws PersistenceNotNullException { 313 checkForNull(nextChainActionSetTime); 314 315 boolean update = true; 316 317 if(this.nextChainActionSetTime != null) { 318 if(this.nextChainActionSetTime.equals(nextChainActionSetTime)) { 319 update = false; 320 } 321 } else if(nextChainActionSetTime == null) { 322 update = false; 323 } 324 325 if(update) { 326 this.nextChainActionSetTime = nextChainActionSetTime; 327 nextChainActionSetTimeHasBeenModified = true; 328 clearHashAndString(); 329 } 330 } 331 332 public boolean getNextChainActionSetTimeHasBeenModified() { 333 return nextChainActionSetTimeHasBeenModified; 334 } 335 336 @Nonnull 337 public Integer getQueuedLetterSequence() { 338 return queuedLetterSequence; 339 } 340 341 public void setQueuedLetterSequence(@Nonnull Integer queuedLetterSequence) 342 throws PersistenceNotNullException { 343 checkForNull(queuedLetterSequence); 344 345 boolean update = true; 346 347 if(this.queuedLetterSequence != null) { 348 if(this.queuedLetterSequence.equals(queuedLetterSequence)) { 349 update = false; 350 } 351 } else if(queuedLetterSequence == null) { 352 update = false; 353 } 354 355 if(update) { 356 this.queuedLetterSequence = queuedLetterSequence; 357 queuedLetterSequenceHasBeenModified = true; 358 clearHashAndString(); 359 } 360 } 361 362 public boolean getQueuedLetterSequenceHasBeenModified() { 363 return queuedLetterSequenceHasBeenModified; 364 } 365 366}