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