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 * WorkRequirementStatusValue.java 021 */ 022 023package com.echothree.model.data.workrequirement.server.value; 024 025import com.echothree.model.data.workrequirement.common.pk.WorkRequirementStatusPK; 026 027import com.echothree.model.data.workrequirement.server.factory.WorkRequirementStatusFactory; 028 029import com.echothree.model.data.workrequirement.common.pk.WorkRequirementPK; 030import com.echothree.model.data.workrequirement.common.pk.WorkAssignmentPK; 031import com.echothree.model.data.workrequirement.common.pk.WorkTimePK; 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 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class WorkRequirementStatusValue 044 extends BaseValue<WorkRequirementStatusPK> 045 implements Cloneable, Serializable { 046 047 private WorkRequirementPK workRequirementPK; 048 private boolean workRequirementPKHasBeenModified = false; 049 private Integer workAssignmentSequence; 050 private boolean workAssignmentSequenceHasBeenModified = false; 051 private WorkAssignmentPK lastWorkAssignmentPK; 052 private boolean lastWorkAssignmentPKHasBeenModified = false; 053 private Integer workTimeSequence; 054 private boolean workTimeSequenceHasBeenModified = false; 055 private WorkTimePK lastWorkTimePK; 056 private boolean lastWorkTimePKHasBeenModified = false; 057 058 private transient Integer _hashCode = null; 059 private transient String _stringValue = null; 060 061 private void constructFields(WorkRequirementPK workRequirementPK, Integer workAssignmentSequence, WorkAssignmentPK lastWorkAssignmentPK, Integer workTimeSequence, WorkTimePK lastWorkTimePK) 062 throws PersistenceNotNullException { 063 checkForNull(workRequirementPK); 064 this.workRequirementPK = workRequirementPK; 065 checkForNull(workAssignmentSequence); 066 this.workAssignmentSequence = workAssignmentSequence; 067 this.lastWorkAssignmentPK = lastWorkAssignmentPK; 068 checkForNull(workTimeSequence); 069 this.workTimeSequence = workTimeSequence; 070 this.lastWorkTimePK = lastWorkTimePK; 071 } 072 073 /** Creates a new instance of WorkRequirementStatusValue */ 074 public WorkRequirementStatusValue(WorkRequirementStatusPK workRequirementStatusPK, WorkRequirementPK workRequirementPK, Integer workAssignmentSequence, WorkAssignmentPK lastWorkAssignmentPK, Integer workTimeSequence, WorkTimePK lastWorkTimePK) 075 throws PersistenceNotNullException { 076 super(workRequirementStatusPK); 077 constructFields(workRequirementPK, workAssignmentSequence, lastWorkAssignmentPK, workTimeSequence, lastWorkTimePK); 078 } 079 080 /** Creates a new instance of WorkRequirementStatusValue */ 081 public WorkRequirementStatusValue(WorkRequirementPK workRequirementPK, Integer workAssignmentSequence, WorkAssignmentPK lastWorkAssignmentPK, Integer workTimeSequence, WorkTimePK lastWorkTimePK) 082 throws PersistenceNotNullException { 083 super(); 084 constructFields(workRequirementPK, workAssignmentSequence, lastWorkAssignmentPK, workTimeSequence, lastWorkTimePK); 085 } 086 087 @Override 088 @Nonnull 089 public WorkRequirementStatusFactory getBaseFactoryInstance() { 090 return WorkRequirementStatusFactory.getInstance(); 091 } 092 093 @Override 094 @Nonnull 095 public WorkRequirementStatusValue 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 (WorkRequirementStatusValue)result; 106 } 107 108 @Override 109 @Nonnull 110 public WorkRequirementStatusPK getPrimaryKey() { 111 if(_primaryKey == null) { 112 _primaryKey = new WorkRequirementStatusPK(entityId); 113 } 114 115 return _primaryKey; 116 } 117 118 private void clearHashAndString() { 119 _hashCode = null; 120 _stringValue = null; 121 } 122 123 @Override 124 public int hashCode() { 125 if(_hashCode == null) { 126 int hashCode = 17; 127 128 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 129 130 hashCode = 37 * hashCode + ((workRequirementPK != null) ? workRequirementPK.hashCode() : 0); 131 hashCode = 37 * hashCode + ((workAssignmentSequence != null) ? workAssignmentSequence.hashCode() : 0); 132 hashCode = 37 * hashCode + ((lastWorkAssignmentPK != null) ? lastWorkAssignmentPK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((workTimeSequence != null) ? workTimeSequence.hashCode() : 0); 134 hashCode = 37 * hashCode + ((lastWorkTimePK != null) ? lastWorkTimePK.hashCode() : 0); 135 136 _hashCode = hashCode; 137 } 138 139 return _hashCode; 140 } 141 142 @Override 143 @Nonnull 144 public String toString() { 145 if(_stringValue == null) { 146 _stringValue = "{" + 147 "entityId=" + getEntityId() + 148 ", workRequirementPK=" + getWorkRequirementPK() + 149 ", workAssignmentSequence=" + getWorkAssignmentSequence() + 150 ", lastWorkAssignmentPK=" + getLastWorkAssignmentPK() + 151 ", workTimeSequence=" + getWorkTimeSequence() + 152 ", lastWorkTimePK=" + getLastWorkTimePK() + 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 WorkRequirementStatusValue 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 WorkRequirementStatusValue that) { 185 boolean objectsEqual = true; 186 187 188 if(objectsEqual) { 189 WorkRequirementPK thisWorkRequirementPK = getWorkRequirementPK(); 190 WorkRequirementPK thatWorkRequirementPK = that.getWorkRequirementPK(); 191 192 if(thisWorkRequirementPK == null) { 193 objectsEqual = objectsEqual && (thatWorkRequirementPK == null); 194 } else { 195 objectsEqual = objectsEqual && thisWorkRequirementPK.equals(thatWorkRequirementPK); 196 } 197 } 198 199 if(objectsEqual) { 200 Integer thisWorkAssignmentSequence = getWorkAssignmentSequence(); 201 Integer thatWorkAssignmentSequence = that.getWorkAssignmentSequence(); 202 203 if(thisWorkAssignmentSequence == null) { 204 objectsEqual = objectsEqual && (thatWorkAssignmentSequence == null); 205 } else { 206 objectsEqual = objectsEqual && thisWorkAssignmentSequence.equals(thatWorkAssignmentSequence); 207 } 208 } 209 210 if(objectsEqual) { 211 WorkAssignmentPK thisLastWorkAssignmentPK = getLastWorkAssignmentPK(); 212 WorkAssignmentPK thatLastWorkAssignmentPK = that.getLastWorkAssignmentPK(); 213 214 if(thisLastWorkAssignmentPK == null) { 215 objectsEqual = objectsEqual && (thatLastWorkAssignmentPK == null); 216 } else { 217 objectsEqual = objectsEqual && thisLastWorkAssignmentPK.equals(thatLastWorkAssignmentPK); 218 } 219 } 220 221 if(objectsEqual) { 222 Integer thisWorkTimeSequence = getWorkTimeSequence(); 223 Integer thatWorkTimeSequence = that.getWorkTimeSequence(); 224 225 if(thisWorkTimeSequence == null) { 226 objectsEqual = objectsEqual && (thatWorkTimeSequence == null); 227 } else { 228 objectsEqual = objectsEqual && thisWorkTimeSequence.equals(thatWorkTimeSequence); 229 } 230 } 231 232 if(objectsEqual) { 233 WorkTimePK thisLastWorkTimePK = getLastWorkTimePK(); 234 WorkTimePK thatLastWorkTimePK = that.getLastWorkTimePK(); 235 236 if(thisLastWorkTimePK == null) { 237 objectsEqual = objectsEqual && (thatLastWorkTimePK == null); 238 } else { 239 objectsEqual = objectsEqual && thisLastWorkTimePK.equals(thatLastWorkTimePK); 240 } 241 } 242 243 return objectsEqual; 244 } else { 245 return false; 246 } 247 } 248 249 @Override 250 public boolean hasBeenModified() { 251 return workRequirementPKHasBeenModified || workAssignmentSequenceHasBeenModified || lastWorkAssignmentPKHasBeenModified || workTimeSequenceHasBeenModified || lastWorkTimePKHasBeenModified; 252 } 253 254 @Override 255 public void clearHasBeenModified() { 256 workRequirementPKHasBeenModified = false; 257 workAssignmentSequenceHasBeenModified = false; 258 lastWorkAssignmentPKHasBeenModified = false; 259 workTimeSequenceHasBeenModified = false; 260 lastWorkTimePKHasBeenModified = false; 261 } 262 263 @Nonnull 264 public WorkRequirementPK getWorkRequirementPK() { 265 return workRequirementPK; 266 } 267 268 public void setWorkRequirementPK(@Nonnull WorkRequirementPK workRequirementPK) 269 throws PersistenceNotNullException { 270 checkForNull(workRequirementPK); 271 272 boolean update = true; 273 274 if(this.workRequirementPK != null) { 275 if(this.workRequirementPK.equals(workRequirementPK)) { 276 update = false; 277 } 278 } else if(workRequirementPK == null) { 279 update = false; 280 } 281 282 if(update) { 283 this.workRequirementPK = workRequirementPK; 284 workRequirementPKHasBeenModified = true; 285 clearHashAndString(); 286 } 287 } 288 289 public boolean getWorkRequirementPKHasBeenModified() { 290 return workRequirementPKHasBeenModified; 291 } 292 293 @Nonnull 294 public Integer getWorkAssignmentSequence() { 295 return workAssignmentSequence; 296 } 297 298 public void setWorkAssignmentSequence(@Nonnull Integer workAssignmentSequence) 299 throws PersistenceNotNullException { 300 checkForNull(workAssignmentSequence); 301 302 boolean update = true; 303 304 if(this.workAssignmentSequence != null) { 305 if(this.workAssignmentSequence.equals(workAssignmentSequence)) { 306 update = false; 307 } 308 } else if(workAssignmentSequence == null) { 309 update = false; 310 } 311 312 if(update) { 313 this.workAssignmentSequence = workAssignmentSequence; 314 workAssignmentSequenceHasBeenModified = true; 315 clearHashAndString(); 316 } 317 } 318 319 public boolean getWorkAssignmentSequenceHasBeenModified() { 320 return workAssignmentSequenceHasBeenModified; 321 } 322 323 @Nullable 324 public WorkAssignmentPK getLastWorkAssignmentPK() { 325 return lastWorkAssignmentPK; 326 } 327 328 public void setLastWorkAssignmentPK(@Nullable WorkAssignmentPK lastWorkAssignmentPK) { 329 boolean update = true; 330 331 if(this.lastWorkAssignmentPK != null) { 332 if(this.lastWorkAssignmentPK.equals(lastWorkAssignmentPK)) { 333 update = false; 334 } 335 } else if(lastWorkAssignmentPK == null) { 336 update = false; 337 } 338 339 if(update) { 340 this.lastWorkAssignmentPK = lastWorkAssignmentPK; 341 lastWorkAssignmentPKHasBeenModified = true; 342 clearHashAndString(); 343 } 344 } 345 346 public boolean getLastWorkAssignmentPKHasBeenModified() { 347 return lastWorkAssignmentPKHasBeenModified; 348 } 349 350 @Nonnull 351 public Integer getWorkTimeSequence() { 352 return workTimeSequence; 353 } 354 355 public void setWorkTimeSequence(@Nonnull Integer workTimeSequence) 356 throws PersistenceNotNullException { 357 checkForNull(workTimeSequence); 358 359 boolean update = true; 360 361 if(this.workTimeSequence != null) { 362 if(this.workTimeSequence.equals(workTimeSequence)) { 363 update = false; 364 } 365 } else if(workTimeSequence == null) { 366 update = false; 367 } 368 369 if(update) { 370 this.workTimeSequence = workTimeSequence; 371 workTimeSequenceHasBeenModified = true; 372 clearHashAndString(); 373 } 374 } 375 376 public boolean getWorkTimeSequenceHasBeenModified() { 377 return workTimeSequenceHasBeenModified; 378 } 379 380 @Nullable 381 public WorkTimePK getLastWorkTimePK() { 382 return lastWorkTimePK; 383 } 384 385 public void setLastWorkTimePK(@Nullable WorkTimePK lastWorkTimePK) { 386 boolean update = true; 387 388 if(this.lastWorkTimePK != null) { 389 if(this.lastWorkTimePK.equals(lastWorkTimePK)) { 390 update = false; 391 } 392 } else if(lastWorkTimePK == null) { 393 update = false; 394 } 395 396 if(update) { 397 this.lastWorkTimePK = lastWorkTimePK; 398 lastWorkTimePKHasBeenModified = true; 399 clearHashAndString(); 400 } 401 } 402 403 public boolean getLastWorkTimePKHasBeenModified() { 404 return lastWorkTimePKHasBeenModified; 405 } 406 407}