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