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