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 * ItemShippingTimeValue.java 021 */ 022 023package com.echothree.model.data.item.server.value; 024 025import com.echothree.model.data.item.common.pk.ItemShippingTimePK; 026 027import com.echothree.model.data.item.server.factory.ItemShippingTimeFactory; 028 029import com.echothree.model.data.item.common.pk.ItemPK; 030import com.echothree.model.data.customer.common.pk.CustomerTypePK; 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 ItemShippingTimeValue 040 extends BaseValue<ItemShippingTimePK> 041 implements Cloneable, Serializable { 042 043 private ItemPK itemPK; 044 private boolean itemPKHasBeenModified = false; 045 private CustomerTypePK customerTypePK; 046 private boolean customerTypePKHasBeenModified = false; 047 private Long shippingStartTime; 048 private boolean shippingStartTimeHasBeenModified = false; 049 private Long shippingEndTime; 050 private boolean shippingEndTimeHasBeenModified = false; 051 private Long fromTime; 052 private boolean fromTimeHasBeenModified = false; 053 private Long thruTime; 054 private boolean thruTimeHasBeenModified = false; 055 056 private transient Integer _hashCode = null; 057 private transient String _stringValue = null; 058 059 private void constructFields(ItemPK itemPK, CustomerTypePK customerTypePK, Long shippingStartTime, Long shippingEndTime, Long fromTime, Long thruTime) 060 throws PersistenceNotNullException { 061 checkForNull(itemPK); 062 this.itemPK = itemPK; 063 checkForNull(customerTypePK); 064 this.customerTypePK = customerTypePK; 065 checkForNull(shippingStartTime); 066 this.shippingStartTime = shippingStartTime; 067 this.shippingEndTime = shippingEndTime; 068 checkForNull(fromTime); 069 this.fromTime = fromTime; 070 checkForNull(thruTime); 071 this.thruTime = thruTime; 072 } 073 074 /** Creates a new instance of ItemShippingTimeValue */ 075 public ItemShippingTimeValue(ItemShippingTimePK itemShippingTimePK, ItemPK itemPK, CustomerTypePK customerTypePK, Long shippingStartTime, Long shippingEndTime, Long fromTime, Long thruTime) 076 throws PersistenceNotNullException { 077 super(itemShippingTimePK); 078 constructFields(itemPK, customerTypePK, shippingStartTime, shippingEndTime, fromTime, thruTime); 079 } 080 081 /** Creates a new instance of ItemShippingTimeValue */ 082 public ItemShippingTimeValue(ItemPK itemPK, CustomerTypePK customerTypePK, Long shippingStartTime, Long shippingEndTime, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(); 085 constructFields(itemPK, customerTypePK, shippingStartTime, shippingEndTime, fromTime, thruTime); 086 } 087 088 @Override 089 public ItemShippingTimeFactory getBaseFactoryInstance() { 090 return ItemShippingTimeFactory.getInstance(); 091 } 092 093 @Override 094 public ItemShippingTimeValue 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 (ItemShippingTimeValue)result; 105 } 106 107 @Override 108 public ItemShippingTimePK getPrimaryKey() { 109 if(_primaryKey == null) { 110 _primaryKey = new ItemShippingTimePK(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 + ((itemPK != null) ? itemPK.hashCode() : 0); 129 hashCode = 37 * hashCode + ((customerTypePK != null) ? customerTypePK.hashCode() : 0); 130 hashCode = 37 * hashCode + ((shippingStartTime != null) ? shippingStartTime.hashCode() : 0); 131 hashCode = 37 * hashCode + ((shippingEndTime != null) ? shippingEndTime.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 ", itemPK=" + getItemPK() + 147 ", customerTypePK=" + getCustomerTypePK() + 148 ", shippingStartTime=" + getShippingStartTime() + 149 ", shippingEndTime=" + getShippingEndTime() + 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 ItemShippingTimeValue 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 ItemShippingTimeValue that) { 184 boolean objectsEqual = true; 185 186 187 if(objectsEqual) { 188 ItemPK thisItemPK = getItemPK(); 189 ItemPK thatItemPK = that.getItemPK(); 190 191 if(thisItemPK == null) { 192 objectsEqual = objectsEqual && (thatItemPK == null); 193 } else { 194 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 195 } 196 } 197 198 if(objectsEqual) { 199 CustomerTypePK thisCustomerTypePK = getCustomerTypePK(); 200 CustomerTypePK thatCustomerTypePK = that.getCustomerTypePK(); 201 202 if(thisCustomerTypePK == null) { 203 objectsEqual = objectsEqual && (thatCustomerTypePK == null); 204 } else { 205 objectsEqual = objectsEqual && thisCustomerTypePK.equals(thatCustomerTypePK); 206 } 207 } 208 209 if(objectsEqual) { 210 Long thisShippingStartTime = getShippingStartTime(); 211 Long thatShippingStartTime = that.getShippingStartTime(); 212 213 if(thisShippingStartTime == null) { 214 objectsEqual = objectsEqual && (thatShippingStartTime == null); 215 } else { 216 objectsEqual = objectsEqual && thisShippingStartTime.equals(thatShippingStartTime); 217 } 218 } 219 220 if(objectsEqual) { 221 Long thisShippingEndTime = getShippingEndTime(); 222 Long thatShippingEndTime = that.getShippingEndTime(); 223 224 if(thisShippingEndTime == null) { 225 objectsEqual = objectsEqual && (thatShippingEndTime == null); 226 } else { 227 objectsEqual = objectsEqual && thisShippingEndTime.equals(thatShippingEndTime); 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 itemPKHasBeenModified || customerTypePKHasBeenModified || shippingStartTimeHasBeenModified || shippingEndTimeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 262 } 263 264 @Override 265 public void clearHasBeenModified() { 266 itemPKHasBeenModified = false; 267 customerTypePKHasBeenModified = false; 268 shippingStartTimeHasBeenModified = false; 269 shippingEndTimeHasBeenModified = false; 270 fromTimeHasBeenModified = false; 271 thruTimeHasBeenModified = false; 272 } 273 274 public ItemPK getItemPK() { 275 return itemPK; 276 } 277 278 public void setItemPK(ItemPK itemPK) 279 throws PersistenceNotNullException { 280 checkForNull(itemPK); 281 282 boolean update = true; 283 284 if(this.itemPK != null) { 285 if(this.itemPK.equals(itemPK)) { 286 update = false; 287 } 288 } else if(itemPK == null) { 289 update = false; 290 } 291 292 if(update) { 293 this.itemPK = itemPK; 294 itemPKHasBeenModified = true; 295 clearHashAndString(); 296 } 297 } 298 299 public boolean getItemPKHasBeenModified() { 300 return itemPKHasBeenModified; 301 } 302 303 public CustomerTypePK getCustomerTypePK() { 304 return customerTypePK; 305 } 306 307 public void setCustomerTypePK(CustomerTypePK customerTypePK) 308 throws PersistenceNotNullException { 309 checkForNull(customerTypePK); 310 311 boolean update = true; 312 313 if(this.customerTypePK != null) { 314 if(this.customerTypePK.equals(customerTypePK)) { 315 update = false; 316 } 317 } else if(customerTypePK == null) { 318 update = false; 319 } 320 321 if(update) { 322 this.customerTypePK = customerTypePK; 323 customerTypePKHasBeenModified = true; 324 clearHashAndString(); 325 } 326 } 327 328 public boolean getCustomerTypePKHasBeenModified() { 329 return customerTypePKHasBeenModified; 330 } 331 332 public Long getShippingStartTime() { 333 return shippingStartTime; 334 } 335 336 public void setShippingStartTime(Long shippingStartTime) 337 throws PersistenceNotNullException { 338 checkForNull(shippingStartTime); 339 340 boolean update = true; 341 342 if(this.shippingStartTime != null) { 343 if(this.shippingStartTime.equals(shippingStartTime)) { 344 update = false; 345 } 346 } else if(shippingStartTime == null) { 347 update = false; 348 } 349 350 if(update) { 351 this.shippingStartTime = shippingStartTime; 352 shippingStartTimeHasBeenModified = true; 353 clearHashAndString(); 354 } 355 } 356 357 public boolean getShippingStartTimeHasBeenModified() { 358 return shippingStartTimeHasBeenModified; 359 } 360 361 public Long getShippingEndTime() { 362 return shippingEndTime; 363 } 364 365 public void setShippingEndTime(Long shippingEndTime) { 366 boolean update = true; 367 368 if(this.shippingEndTime != null) { 369 if(this.shippingEndTime.equals(shippingEndTime)) { 370 update = false; 371 } 372 } else if(shippingEndTime == null) { 373 update = false; 374 } 375 376 if(update) { 377 this.shippingEndTime = shippingEndTime; 378 shippingEndTimeHasBeenModified = true; 379 clearHashAndString(); 380 } 381 } 382 383 public boolean getShippingEndTimeHasBeenModified() { 384 return shippingEndTimeHasBeenModified; 385 } 386 387 public Long getFromTime() { 388 return fromTime; 389 } 390 391 public void setFromTime(Long fromTime) 392 throws PersistenceNotNullException { 393 checkForNull(fromTime); 394 395 boolean update = true; 396 397 if(this.fromTime != null) { 398 if(this.fromTime.equals(fromTime)) { 399 update = false; 400 } 401 } else if(fromTime == null) { 402 update = false; 403 } 404 405 if(update) { 406 this.fromTime = fromTime; 407 fromTimeHasBeenModified = true; 408 clearHashAndString(); 409 } 410 } 411 412 public boolean getFromTimeHasBeenModified() { 413 return fromTimeHasBeenModified; 414 } 415 416 public Long getThruTime() { 417 return thruTime; 418 } 419 420 public void setThruTime(Long thruTime) 421 throws PersistenceNotNullException { 422 checkForNull(thruTime); 423 424 boolean update = true; 425 426 if(this.thruTime != null) { 427 if(this.thruTime.equals(thruTime)) { 428 update = false; 429 } 430 } else if(thruTime == null) { 431 update = false; 432 } 433 434 if(update) { 435 this.thruTime = thruTime; 436 thruTimeHasBeenModified = true; 437 clearHashAndString(); 438 } 439 } 440 441 public boolean getThruTimeHasBeenModified() { 442 return thruTimeHasBeenModified; 443 } 444 445}