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