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 * SelectorNodeEntityBooleanValue.java 021 */ 022 023package com.echothree.model.data.selector.server.value; 024 025import com.echothree.model.data.selector.common.pk.SelectorNodeEntityBooleanPK; 026 027import com.echothree.model.data.selector.server.factory.SelectorNodeEntityBooleanFactory; 028 029import com.echothree.model.data.selector.common.pk.SelectorNodePK; 030import com.echothree.model.data.core.common.pk.EntityAttributePK; 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 SelectorNodeEntityBooleanValue 043 extends BaseValue<SelectorNodeEntityBooleanPK> 044 implements Cloneable, Serializable { 045 046 private SelectorNodePK selectorNodePK; 047 private boolean selectorNodePKHasBeenModified = false; 048 private EntityAttributePK entityAttributePK; 049 private boolean entityAttributePKHasBeenModified = false; 050 private Long fromTime; 051 private boolean fromTimeHasBeenModified = false; 052 private Long thruTime; 053 private boolean thruTimeHasBeenModified = false; 054 055 private transient Integer _hashCode = null; 056 private transient String _stringValue = null; 057 058 private void constructFields(SelectorNodePK selectorNodePK, EntityAttributePK entityAttributePK, Long fromTime, Long thruTime) 059 throws PersistenceNotNullException { 060 checkForNull(selectorNodePK); 061 this.selectorNodePK = selectorNodePK; 062 checkForNull(entityAttributePK); 063 this.entityAttributePK = entityAttributePK; 064 checkForNull(fromTime); 065 this.fromTime = fromTime; 066 checkForNull(thruTime); 067 this.thruTime = thruTime; 068 } 069 070 /** Creates a new instance of SelectorNodeEntityBooleanValue */ 071 public SelectorNodeEntityBooleanValue(SelectorNodeEntityBooleanPK selectorNodeEntityBooleanPK, SelectorNodePK selectorNodePK, EntityAttributePK entityAttributePK, Long fromTime, Long thruTime) 072 throws PersistenceNotNullException { 073 super(selectorNodeEntityBooleanPK); 074 constructFields(selectorNodePK, entityAttributePK, fromTime, thruTime); 075 } 076 077 /** Creates a new instance of SelectorNodeEntityBooleanValue */ 078 public SelectorNodeEntityBooleanValue(SelectorNodePK selectorNodePK, EntityAttributePK entityAttributePK, Long fromTime, Long thruTime) 079 throws PersistenceNotNullException { 080 super(); 081 constructFields(selectorNodePK, entityAttributePK, fromTime, thruTime); 082 } 083 084 @Override 085 @Nonnull 086 public SelectorNodeEntityBooleanFactory getBaseFactoryInstance() { 087 return SelectorNodeEntityBooleanFactory.getInstance(); 088 } 089 090 @Override 091 @Nonnull 092 public SelectorNodeEntityBooleanValue 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 (SelectorNodeEntityBooleanValue)result; 103 } 104 105 @Override 106 @Nonnull 107 public SelectorNodeEntityBooleanPK getPrimaryKey() { 108 if(_primaryKey == null) { 109 _primaryKey = new SelectorNodeEntityBooleanPK(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 + ((selectorNodePK != null) ? selectorNodePK.hashCode() : 0); 128 hashCode = 37 * hashCode + ((entityAttributePK != null) ? entityAttributePK.hashCode() : 0); 129 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 130 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.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 ", selectorNodePK=" + getSelectorNodePK() + 145 ", entityAttributePK=" + getEntityAttributePK() + 146 ", fromTime=" + getFromTime() + 147 ", thruTime=" + getThruTime() + 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 SelectorNodeEntityBooleanValue 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 SelectorNodeEntityBooleanValue that) { 180 boolean objectsEqual = true; 181 182 183 if(objectsEqual) { 184 SelectorNodePK thisSelectorNodePK = getSelectorNodePK(); 185 SelectorNodePK thatSelectorNodePK = that.getSelectorNodePK(); 186 187 if(thisSelectorNodePK == null) { 188 objectsEqual = objectsEqual && (thatSelectorNodePK == null); 189 } else { 190 objectsEqual = objectsEqual && thisSelectorNodePK.equals(thatSelectorNodePK); 191 } 192 } 193 194 if(objectsEqual) { 195 EntityAttributePK thisEntityAttributePK = getEntityAttributePK(); 196 EntityAttributePK thatEntityAttributePK = that.getEntityAttributePK(); 197 198 if(thisEntityAttributePK == null) { 199 objectsEqual = objectsEqual && (thatEntityAttributePK == null); 200 } else { 201 objectsEqual = objectsEqual && thisEntityAttributePK.equals(thatEntityAttributePK); 202 } 203 } 204 205 if(objectsEqual) { 206 Long thisFromTime = getFromTime(); 207 Long thatFromTime = that.getFromTime(); 208 209 if(thisFromTime == null) { 210 objectsEqual = objectsEqual && (thatFromTime == null); 211 } else { 212 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 213 } 214 } 215 216 if(objectsEqual) { 217 Long thisThruTime = getThruTime(); 218 Long thatThruTime = that.getThruTime(); 219 220 if(thisThruTime == null) { 221 objectsEqual = objectsEqual && (thatThruTime == null); 222 } else { 223 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 224 } 225 } 226 227 return objectsEqual; 228 } else { 229 return false; 230 } 231 } 232 233 @Override 234 public boolean hasBeenModified() { 235 return selectorNodePKHasBeenModified || entityAttributePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 236 } 237 238 @Override 239 public void clearHasBeenModified() { 240 selectorNodePKHasBeenModified = false; 241 entityAttributePKHasBeenModified = false; 242 fromTimeHasBeenModified = false; 243 thruTimeHasBeenModified = false; 244 } 245 246 @Nonnull 247 public SelectorNodePK getSelectorNodePK() { 248 return selectorNodePK; 249 } 250 251 public void setSelectorNodePK(@Nonnull SelectorNodePK selectorNodePK) 252 throws PersistenceNotNullException { 253 checkForNull(selectorNodePK); 254 255 boolean update = true; 256 257 if(this.selectorNodePK != null) { 258 if(this.selectorNodePK.equals(selectorNodePK)) { 259 update = false; 260 } 261 } else if(selectorNodePK == null) { 262 update = false; 263 } 264 265 if(update) { 266 this.selectorNodePK = selectorNodePK; 267 selectorNodePKHasBeenModified = true; 268 clearHashAndString(); 269 } 270 } 271 272 public boolean getSelectorNodePKHasBeenModified() { 273 return selectorNodePKHasBeenModified; 274 } 275 276 @Nonnull 277 public EntityAttributePK getEntityAttributePK() { 278 return entityAttributePK; 279 } 280 281 public void setEntityAttributePK(@Nonnull EntityAttributePK entityAttributePK) 282 throws PersistenceNotNullException { 283 checkForNull(entityAttributePK); 284 285 boolean update = true; 286 287 if(this.entityAttributePK != null) { 288 if(this.entityAttributePK.equals(entityAttributePK)) { 289 update = false; 290 } 291 } else if(entityAttributePK == null) { 292 update = false; 293 } 294 295 if(update) { 296 this.entityAttributePK = entityAttributePK; 297 entityAttributePKHasBeenModified = true; 298 clearHashAndString(); 299 } 300 } 301 302 public boolean getEntityAttributePKHasBeenModified() { 303 return entityAttributePKHasBeenModified; 304 } 305 306 @Nonnull 307 public Long getFromTime() { 308 return fromTime; 309 } 310 311 public void setFromTime(@Nonnull Long fromTime) 312 throws PersistenceNotNullException { 313 checkForNull(fromTime); 314 315 boolean update = true; 316 317 if(this.fromTime != null) { 318 if(this.fromTime.equals(fromTime)) { 319 update = false; 320 } 321 } else if(fromTime == null) { 322 update = false; 323 } 324 325 if(update) { 326 this.fromTime = fromTime; 327 fromTimeHasBeenModified = true; 328 clearHashAndString(); 329 } 330 } 331 332 public boolean getFromTimeHasBeenModified() { 333 return fromTimeHasBeenModified; 334 } 335 336 @Nonnull 337 public Long getThruTime() { 338 return thruTime; 339 } 340 341 public void setThruTime(@Nonnull Long thruTime) 342 throws PersistenceNotNullException { 343 checkForNull(thruTime); 344 345 boolean update = true; 346 347 if(this.thruTime != null) { 348 if(this.thruTime.equals(thruTime)) { 349 update = false; 350 } 351 } else if(thruTime == null) { 352 update = false; 353 } 354 355 if(update) { 356 this.thruTime = thruTime; 357 thruTimeHasBeenModified = true; 358 clearHashAndString(); 359 } 360 } 361 362 public boolean getThruTimeHasBeenModified() { 363 return thruTimeHasBeenModified; 364 } 365 366}