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 * WorkflowTriggerValue.java 021 */ 022 023package com.echothree.model.data.workflow.server.value; 024 025import com.echothree.model.data.workflow.common.pk.WorkflowTriggerPK; 026 027import com.echothree.model.data.workflow.server.factory.WorkflowTriggerFactory; 028 029import com.echothree.model.data.workflow.common.pk.WorkflowEntityStatusPK; 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 038import javax.annotation.Nonnull; 039import javax.annotation.Nullable; 040 041public class WorkflowTriggerValue 042 extends BaseValue<WorkflowTriggerPK> 043 implements Cloneable, Serializable { 044 045 private WorkflowEntityStatusPK workflowEntityStatusPK; 046 private boolean workflowEntityStatusPKHasBeenModified = false; 047 private Long triggerTime; 048 private boolean triggerTimeHasBeenModified = false; 049 private Boolean errorsOccurred; 050 private boolean errorsOccurredHasBeenModified = false; 051 052 private transient Integer _hashCode = null; 053 private transient String _stringValue = null; 054 055 private void constructFields(WorkflowEntityStatusPK workflowEntityStatusPK, Long triggerTime, Boolean errorsOccurred) 056 throws PersistenceNotNullException { 057 checkForNull(workflowEntityStatusPK); 058 this.workflowEntityStatusPK = workflowEntityStatusPK; 059 checkForNull(triggerTime); 060 this.triggerTime = triggerTime; 061 this.errorsOccurred = errorsOccurred; 062 } 063 064 /** Creates a new instance of WorkflowTriggerValue */ 065 public WorkflowTriggerValue(WorkflowTriggerPK workflowTriggerPK, WorkflowEntityStatusPK workflowEntityStatusPK, Long triggerTime, Boolean errorsOccurred) 066 throws PersistenceNotNullException { 067 super(workflowTriggerPK); 068 constructFields(workflowEntityStatusPK, triggerTime, errorsOccurred); 069 } 070 071 /** Creates a new instance of WorkflowTriggerValue */ 072 public WorkflowTriggerValue(WorkflowEntityStatusPK workflowEntityStatusPK, Long triggerTime, Boolean errorsOccurred) 073 throws PersistenceNotNullException { 074 super(); 075 constructFields(workflowEntityStatusPK, triggerTime, errorsOccurred); 076 } 077 078 @Override 079 @Nonnull 080 public WorkflowTriggerFactory getBaseFactoryInstance() { 081 return WorkflowTriggerFactory.getInstance(); 082 } 083 084 @Override 085 @Nonnull 086 public WorkflowTriggerValue clone() { 087 Object result; 088 089 try { 090 result = super.clone(); 091 } catch (CloneNotSupportedException cnse) { 092 // This shouldn't happen, fail when it does. 093 throw new PersistenceCloneException(cnse); 094 } 095 096 return (WorkflowTriggerValue)result; 097 } 098 099 @Override 100 @Nonnull 101 public WorkflowTriggerPK getPrimaryKey() { 102 if(_primaryKey == null) { 103 _primaryKey = new WorkflowTriggerPK(entityId); 104 } 105 106 return _primaryKey; 107 } 108 109 private void clearHashAndString() { 110 _hashCode = null; 111 _stringValue = null; 112 } 113 114 @Override 115 public int hashCode() { 116 if(_hashCode == null) { 117 int hashCode = 17; 118 119 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 120 121 hashCode = 37 * hashCode + ((workflowEntityStatusPK != null) ? workflowEntityStatusPK.hashCode() : 0); 122 hashCode = 37 * hashCode + ((triggerTime != null) ? triggerTime.hashCode() : 0); 123 hashCode = 37 * hashCode + ((errorsOccurred != null) ? errorsOccurred.hashCode() : 0); 124 125 _hashCode = hashCode; 126 } 127 128 return _hashCode; 129 } 130 131 @Override 132 @Nonnull 133 public String toString() { 134 if(_stringValue == null) { 135 _stringValue = "{" + 136 "entityId=" + getEntityId() + 137 ", workflowEntityStatusPK=" + getWorkflowEntityStatusPK() + 138 ", triggerTime=" + getTriggerTime() + 139 ", errorsOccurred=" + getErrorsOccurred() + 140 "}"; 141 } 142 return _stringValue; 143 } 144 145 @Override 146 public boolean equals(Object other) { 147 if(this == other) 148 return true; 149 150 if(!hasIdentity()) 151 return false; 152 153 if(other instanceof WorkflowTriggerValue that) { 154 if(!that.hasIdentity()) 155 return false; 156 157 Long thisEntityId = getEntityId(); 158 Long thatEntityId = that.getEntityId(); 159 160 boolean objectsEqual = thisEntityId.equals(thatEntityId); 161 if(objectsEqual) 162 objectsEqual = isIdentical(that); 163 164 return objectsEqual; 165 } else { 166 return false; 167 } 168 } 169 170 public boolean isIdentical(Object other) { 171 if(other instanceof WorkflowTriggerValue that) { 172 boolean objectsEqual = true; 173 174 175 if(objectsEqual) { 176 WorkflowEntityStatusPK thisWorkflowEntityStatusPK = getWorkflowEntityStatusPK(); 177 WorkflowEntityStatusPK thatWorkflowEntityStatusPK = that.getWorkflowEntityStatusPK(); 178 179 if(thisWorkflowEntityStatusPK == null) { 180 objectsEqual = objectsEqual && (thatWorkflowEntityStatusPK == null); 181 } else { 182 objectsEqual = objectsEqual && thisWorkflowEntityStatusPK.equals(thatWorkflowEntityStatusPK); 183 } 184 } 185 186 if(objectsEqual) { 187 Long thisTriggerTime = getTriggerTime(); 188 Long thatTriggerTime = that.getTriggerTime(); 189 190 if(thisTriggerTime == null) { 191 objectsEqual = objectsEqual && (thatTriggerTime == null); 192 } else { 193 objectsEqual = objectsEqual && thisTriggerTime.equals(thatTriggerTime); 194 } 195 } 196 197 if(objectsEqual) { 198 Boolean thisErrorsOccurred = getErrorsOccurred(); 199 Boolean thatErrorsOccurred = that.getErrorsOccurred(); 200 201 if(thisErrorsOccurred == null) { 202 objectsEqual = objectsEqual && (thatErrorsOccurred == null); 203 } else { 204 objectsEqual = objectsEqual && thisErrorsOccurred.equals(thatErrorsOccurred); 205 } 206 } 207 208 return objectsEqual; 209 } else { 210 return false; 211 } 212 } 213 214 @Override 215 public boolean hasBeenModified() { 216 return workflowEntityStatusPKHasBeenModified || triggerTimeHasBeenModified || errorsOccurredHasBeenModified; 217 } 218 219 @Override 220 public void clearHasBeenModified() { 221 workflowEntityStatusPKHasBeenModified = false; 222 triggerTimeHasBeenModified = false; 223 errorsOccurredHasBeenModified = false; 224 } 225 226 @Nonnull 227 public WorkflowEntityStatusPK getWorkflowEntityStatusPK() { 228 return workflowEntityStatusPK; 229 } 230 231 public void setWorkflowEntityStatusPK(@Nonnull WorkflowEntityStatusPK workflowEntityStatusPK) 232 throws PersistenceNotNullException { 233 checkForNull(workflowEntityStatusPK); 234 235 boolean update = true; 236 237 if(this.workflowEntityStatusPK != null) { 238 if(this.workflowEntityStatusPK.equals(workflowEntityStatusPK)) { 239 update = false; 240 } 241 } else if(workflowEntityStatusPK == null) { 242 update = false; 243 } 244 245 if(update) { 246 this.workflowEntityStatusPK = workflowEntityStatusPK; 247 workflowEntityStatusPKHasBeenModified = true; 248 clearHashAndString(); 249 } 250 } 251 252 public boolean getWorkflowEntityStatusPKHasBeenModified() { 253 return workflowEntityStatusPKHasBeenModified; 254 } 255 256 @Nonnull 257 public Long getTriggerTime() { 258 return triggerTime; 259 } 260 261 public void setTriggerTime(@Nonnull Long triggerTime) 262 throws PersistenceNotNullException { 263 checkForNull(triggerTime); 264 265 boolean update = true; 266 267 if(this.triggerTime != null) { 268 if(this.triggerTime.equals(triggerTime)) { 269 update = false; 270 } 271 } else if(triggerTime == null) { 272 update = false; 273 } 274 275 if(update) { 276 this.triggerTime = triggerTime; 277 triggerTimeHasBeenModified = true; 278 clearHashAndString(); 279 } 280 } 281 282 public boolean getTriggerTimeHasBeenModified() { 283 return triggerTimeHasBeenModified; 284 } 285 286 @Nullable 287 public Boolean getErrorsOccurred() { 288 return errorsOccurred; 289 } 290 291 public void setErrorsOccurred(@Nullable Boolean errorsOccurred) { 292 boolean update = true; 293 294 if(this.errorsOccurred != null) { 295 if(this.errorsOccurred.equals(errorsOccurred)) { 296 update = false; 297 } 298 } else if(errorsOccurred == null) { 299 update = false; 300 } 301 302 if(update) { 303 this.errorsOccurred = errorsOccurred; 304 errorsOccurredHasBeenModified = true; 305 clearHashAndString(); 306 } 307 } 308 309 public boolean getErrorsOccurredHasBeenModified() { 310 return errorsOccurredHasBeenModified; 311 } 312 313}