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 * ChainInstanceDetailValue.java 021 */ 022 023package com.echothree.model.data.chain.server.value; 024 025import com.echothree.model.data.chain.common.pk.ChainInstanceDetailPK; 026 027import com.echothree.model.data.chain.server.factory.ChainInstanceDetailFactory; 028 029import com.echothree.model.data.chain.common.pk.ChainInstancePK; 030import com.echothree.model.data.chain.common.pk.ChainPK; 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 ChainInstanceDetailValue 043 extends BaseValue<ChainInstanceDetailPK> 044 implements Cloneable, Serializable { 045 046 private ChainInstancePK chainInstancePK; 047 private boolean chainInstancePKHasBeenModified = false; 048 private String chainInstanceName; 049 private boolean chainInstanceNameHasBeenModified = false; 050 private ChainPK chainPK; 051 private boolean chainPKHasBeenModified = false; 052 private Long fromTime; 053 private boolean fromTimeHasBeenModified = false; 054 private Long thruTime; 055 private boolean thruTimeHasBeenModified = false; 056 057 private transient Integer _hashCode = null; 058 private transient String _stringValue = null; 059 060 private void constructFields(ChainInstancePK chainInstancePK, String chainInstanceName, ChainPK chainPK, Long fromTime, Long thruTime) 061 throws PersistenceNotNullException { 062 checkForNull(chainInstancePK); 063 this.chainInstancePK = chainInstancePK; 064 checkForNull(chainInstanceName); 065 this.chainInstanceName = chainInstanceName; 066 checkForNull(chainPK); 067 this.chainPK = chainPK; 068 checkForNull(fromTime); 069 this.fromTime = fromTime; 070 checkForNull(thruTime); 071 this.thruTime = thruTime; 072 } 073 074 /** Creates a new instance of ChainInstanceDetailValue */ 075 public ChainInstanceDetailValue(ChainInstanceDetailPK chainInstanceDetailPK, ChainInstancePK chainInstancePK, String chainInstanceName, ChainPK chainPK, Long fromTime, Long thruTime) 076 throws PersistenceNotNullException { 077 super(chainInstanceDetailPK); 078 constructFields(chainInstancePK, chainInstanceName, chainPK, fromTime, thruTime); 079 } 080 081 /** Creates a new instance of ChainInstanceDetailValue */ 082 public ChainInstanceDetailValue(ChainInstancePK chainInstancePK, String chainInstanceName, ChainPK chainPK, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(); 085 constructFields(chainInstancePK, chainInstanceName, chainPK, fromTime, thruTime); 086 } 087 088 @Override 089 @Nonnull 090 public ChainInstanceDetailFactory getBaseFactoryInstance() { 091 return ChainInstanceDetailFactory.getInstance(); 092 } 093 094 @Override 095 @Nonnull 096 public ChainInstanceDetailValue clone() { 097 Object result; 098 099 try { 100 result = super.clone(); 101 } catch (CloneNotSupportedException cnse) { 102 // This shouldn't happen, fail when it does. 103 throw new PersistenceCloneException(cnse); 104 } 105 106 return (ChainInstanceDetailValue)result; 107 } 108 109 @Override 110 @Nonnull 111 public ChainInstanceDetailPK getPrimaryKey() { 112 if(_primaryKey == null) { 113 _primaryKey = new ChainInstanceDetailPK(entityId); 114 } 115 116 return _primaryKey; 117 } 118 119 private void clearHashAndString() { 120 _hashCode = null; 121 _stringValue = null; 122 } 123 124 @Override 125 public int hashCode() { 126 if(_hashCode == null) { 127 int hashCode = 17; 128 129 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 130 131 hashCode = 37 * hashCode + ((chainInstancePK != null) ? chainInstancePK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((chainInstanceName != null) ? chainInstanceName.hashCode() : 0); 133 hashCode = 37 * hashCode + ((chainPK != null) ? chainPK.hashCode() : 0); 134 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 135 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 136 137 _hashCode = hashCode; 138 } 139 140 return _hashCode; 141 } 142 143 @Override 144 @Nonnull 145 public String toString() { 146 if(_stringValue == null) { 147 _stringValue = "{" + 148 "entityId=" + getEntityId() + 149 ", chainInstancePK=" + getChainInstancePK() + 150 ", chainInstanceName=" + getChainInstanceName() + 151 ", chainPK=" + getChainPK() + 152 ", fromTime=" + getFromTime() + 153 ", thruTime=" + getThruTime() + 154 "}"; 155 } 156 return _stringValue; 157 } 158 159 @Override 160 public boolean equals(Object other) { 161 if(this == other) 162 return true; 163 164 if(!hasIdentity()) 165 return false; 166 167 if(other instanceof ChainInstanceDetailValue that) { 168 if(!that.hasIdentity()) 169 return false; 170 171 Long thisEntityId = getEntityId(); 172 Long thatEntityId = that.getEntityId(); 173 174 boolean objectsEqual = thisEntityId.equals(thatEntityId); 175 if(objectsEqual) 176 objectsEqual = isIdentical(that); 177 178 return objectsEqual; 179 } else { 180 return false; 181 } 182 } 183 184 public boolean isIdentical(Object other) { 185 if(other instanceof ChainInstanceDetailValue that) { 186 boolean objectsEqual = true; 187 188 189 if(objectsEqual) { 190 ChainInstancePK thisChainInstancePK = getChainInstancePK(); 191 ChainInstancePK thatChainInstancePK = that.getChainInstancePK(); 192 193 if(thisChainInstancePK == null) { 194 objectsEqual = objectsEqual && (thatChainInstancePK == null); 195 } else { 196 objectsEqual = objectsEqual && thisChainInstancePK.equals(thatChainInstancePK); 197 } 198 } 199 200 if(objectsEqual) { 201 String thisChainInstanceName = getChainInstanceName(); 202 String thatChainInstanceName = that.getChainInstanceName(); 203 204 if(thisChainInstanceName == null) { 205 objectsEqual = objectsEqual && (thatChainInstanceName == null); 206 } else { 207 objectsEqual = objectsEqual && thisChainInstanceName.equals(thatChainInstanceName); 208 } 209 } 210 211 if(objectsEqual) { 212 ChainPK thisChainPK = getChainPK(); 213 ChainPK thatChainPK = that.getChainPK(); 214 215 if(thisChainPK == null) { 216 objectsEqual = objectsEqual && (thatChainPK == null); 217 } else { 218 objectsEqual = objectsEqual && thisChainPK.equals(thatChainPK); 219 } 220 } 221 222 if(objectsEqual) { 223 Long thisFromTime = getFromTime(); 224 Long thatFromTime = that.getFromTime(); 225 226 if(thisFromTime == null) { 227 objectsEqual = objectsEqual && (thatFromTime == null); 228 } else { 229 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 230 } 231 } 232 233 if(objectsEqual) { 234 Long thisThruTime = getThruTime(); 235 Long thatThruTime = that.getThruTime(); 236 237 if(thisThruTime == null) { 238 objectsEqual = objectsEqual && (thatThruTime == null); 239 } else { 240 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 241 } 242 } 243 244 return objectsEqual; 245 } else { 246 return false; 247 } 248 } 249 250 @Override 251 public boolean hasBeenModified() { 252 return chainInstancePKHasBeenModified || chainInstanceNameHasBeenModified || chainPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 253 } 254 255 @Override 256 public void clearHasBeenModified() { 257 chainInstancePKHasBeenModified = false; 258 chainInstanceNameHasBeenModified = false; 259 chainPKHasBeenModified = false; 260 fromTimeHasBeenModified = false; 261 thruTimeHasBeenModified = false; 262 } 263 264 @Nonnull 265 public ChainInstancePK getChainInstancePK() { 266 return chainInstancePK; 267 } 268 269 public void setChainInstancePK(@Nonnull ChainInstancePK chainInstancePK) 270 throws PersistenceNotNullException { 271 checkForNull(chainInstancePK); 272 273 boolean update = true; 274 275 if(this.chainInstancePK != null) { 276 if(this.chainInstancePK.equals(chainInstancePK)) { 277 update = false; 278 } 279 } else if(chainInstancePK == null) { 280 update = false; 281 } 282 283 if(update) { 284 this.chainInstancePK = chainInstancePK; 285 chainInstancePKHasBeenModified = true; 286 clearHashAndString(); 287 } 288 } 289 290 public boolean getChainInstancePKHasBeenModified() { 291 return chainInstancePKHasBeenModified; 292 } 293 294 @Nonnull 295 public String getChainInstanceName() { 296 return chainInstanceName; 297 } 298 299 public void setChainInstanceName(@Nonnull String chainInstanceName) 300 throws PersistenceNotNullException { 301 checkForNull(chainInstanceName); 302 303 boolean update = true; 304 305 if(this.chainInstanceName != null) { 306 if(this.chainInstanceName.equals(chainInstanceName)) { 307 update = false; 308 } 309 } else if(chainInstanceName == null) { 310 update = false; 311 } 312 313 if(update) { 314 this.chainInstanceName = chainInstanceName; 315 chainInstanceNameHasBeenModified = true; 316 clearHashAndString(); 317 } 318 } 319 320 public boolean getChainInstanceNameHasBeenModified() { 321 return chainInstanceNameHasBeenModified; 322 } 323 324 @Nonnull 325 public ChainPK getChainPK() { 326 return chainPK; 327 } 328 329 public void setChainPK(@Nonnull ChainPK chainPK) 330 throws PersistenceNotNullException { 331 checkForNull(chainPK); 332 333 boolean update = true; 334 335 if(this.chainPK != null) { 336 if(this.chainPK.equals(chainPK)) { 337 update = false; 338 } 339 } else if(chainPK == null) { 340 update = false; 341 } 342 343 if(update) { 344 this.chainPK = chainPK; 345 chainPKHasBeenModified = true; 346 clearHashAndString(); 347 } 348 } 349 350 public boolean getChainPKHasBeenModified() { 351 return chainPKHasBeenModified; 352 } 353 354 @Nonnull 355 public Long getFromTime() { 356 return fromTime; 357 } 358 359 public void setFromTime(@Nonnull Long fromTime) 360 throws PersistenceNotNullException { 361 checkForNull(fromTime); 362 363 boolean update = true; 364 365 if(this.fromTime != null) { 366 if(this.fromTime.equals(fromTime)) { 367 update = false; 368 } 369 } else if(fromTime == null) { 370 update = false; 371 } 372 373 if(update) { 374 this.fromTime = fromTime; 375 fromTimeHasBeenModified = true; 376 clearHashAndString(); 377 } 378 } 379 380 public boolean getFromTimeHasBeenModified() { 381 return fromTimeHasBeenModified; 382 } 383 384 @Nonnull 385 public Long getThruTime() { 386 return thruTime; 387 } 388 389 public void setThruTime(@Nonnull Long thruTime) 390 throws PersistenceNotNullException { 391 checkForNull(thruTime); 392 393 boolean update = true; 394 395 if(this.thruTime != null) { 396 if(this.thruTime.equals(thruTime)) { 397 update = false; 398 } 399 } else if(thruTime == null) { 400 update = false; 401 } 402 403 if(update) { 404 this.thruTime = thruTime; 405 thruTimeHasBeenModified = true; 406 clearHashAndString(); 407 } 408 } 409 410 public boolean getThruTimeHasBeenModified() { 411 return thruTimeHasBeenModified; 412 } 413 414}