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 * IdempotentResponseValue.java
021 */
022
023package com.echothree.model.data.graphql.server.value;
024
025import com.echothree.model.data.graphql.common.pk.IdempotentResponsePK;
026
027import com.echothree.model.data.graphql.server.factory.IdempotentResponseFactory;
028
029import com.echothree.model.data.user.common.pk.UserVisitPK;
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 IdempotentResponseValue
042        extends BaseValue<IdempotentResponsePK>
043        implements Cloneable, Serializable {
044    
045    private UserVisitPK userVisitPK;
046    private boolean userVisitPKHasBeenModified = false;
047    private String idempotencyKeyHash;
048    private boolean idempotencyKeyHashHasBeenModified = false;
049    private String queryHash;
050    private boolean queryHashHasBeenModified = false;
051    private String variablesHash;
052    private boolean variablesHashHasBeenModified = false;
053    private String operationNameHash;
054    private boolean operationNameHashHasBeenModified = false;
055    private Long startTime;
056    private boolean startTimeHasBeenModified = false;
057    private Long completedTime;
058    private boolean completedTimeHasBeenModified = false;
059    private String response;
060    private boolean responseHasBeenModified = false;
061    private Long retainUntilTime;
062    private boolean retainUntilTimeHasBeenModified = false;
063    private String initializationVector;
064    private boolean initializationVectorHasBeenModified = false;
065    
066    private transient Integer _hashCode = null;
067    private transient String _stringValue = null;
068    
069    private void constructFields(UserVisitPK userVisitPK, String idempotencyKeyHash, String queryHash, String variablesHash, String operationNameHash, Long startTime, Long completedTime, String response, Long retainUntilTime, String initializationVector)
070            throws PersistenceNotNullException {
071        checkForNull(userVisitPK);
072        this.userVisitPK = userVisitPK;
073        checkForNull(idempotencyKeyHash);
074        this.idempotencyKeyHash = idempotencyKeyHash;
075        checkForNull(queryHash);
076        this.queryHash = queryHash;
077        this.variablesHash = variablesHash;
078        this.operationNameHash = operationNameHash;
079        checkForNull(startTime);
080        this.startTime = startTime;
081        this.completedTime = completedTime;
082        this.response = response;
083        this.retainUntilTime = retainUntilTime;
084        checkForNull(initializationVector);
085        this.initializationVector = initializationVector;
086    }
087    
088    /** Creates a new instance of IdempotentResponseValue */
089    public IdempotentResponseValue(IdempotentResponsePK idempotentResponsePK, UserVisitPK userVisitPK, String idempotencyKeyHash, String queryHash, String variablesHash, String operationNameHash, Long startTime, Long completedTime, String response, Long retainUntilTime, String initializationVector)
090            throws PersistenceNotNullException {
091        super(idempotentResponsePK);
092        constructFields(userVisitPK, idempotencyKeyHash, queryHash, variablesHash, operationNameHash, startTime, completedTime, response, retainUntilTime, initializationVector);
093    }
094    
095    /** Creates a new instance of IdempotentResponseValue */
096    public IdempotentResponseValue(UserVisitPK userVisitPK, String idempotencyKeyHash, String queryHash, String variablesHash, String operationNameHash, Long startTime, Long completedTime, String response, Long retainUntilTime, String initializationVector)
097            throws PersistenceNotNullException {
098        super();
099        constructFields(userVisitPK, idempotencyKeyHash, queryHash, variablesHash, operationNameHash, startTime, completedTime, response, retainUntilTime, initializationVector);
100    }
101    
102    @Override
103    @Nonnull
104    public IdempotentResponseFactory getBaseFactoryInstance() {
105        return IdempotentResponseFactory.getInstance();
106    }
107    
108    @Override
109    @Nonnull
110    public IdempotentResponseValue clone() {
111        Object result;
112        
113        try {
114            result = super.clone();
115        } catch (CloneNotSupportedException cnse) {
116            // This shouldn't happen, fail when it does.
117            throw new PersistenceCloneException(cnse);
118        }
119        
120        return (IdempotentResponseValue)result;
121    }
122    
123    @Override
124    @Nonnull
125    public IdempotentResponsePK getPrimaryKey() {
126        if(_primaryKey == null) {
127            _primaryKey = new IdempotentResponsePK(entityId);
128        }
129        
130        return _primaryKey;
131    }
132    
133    private void clearHashAndString() {
134        _hashCode = null;
135        _stringValue = null;
136    }
137    
138    @Override
139    public int hashCode() {
140        if(_hashCode == null) {
141            int hashCode = 17;
142            
143            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
144            
145            hashCode = 37 * hashCode + ((userVisitPK != null) ? userVisitPK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((idempotencyKeyHash != null) ? idempotencyKeyHash.hashCode() : 0);
147            hashCode = 37 * hashCode + ((queryHash != null) ? queryHash.hashCode() : 0);
148            hashCode = 37 * hashCode + ((variablesHash != null) ? variablesHash.hashCode() : 0);
149            hashCode = 37 * hashCode + ((operationNameHash != null) ? operationNameHash.hashCode() : 0);
150            hashCode = 37 * hashCode + ((startTime != null) ? startTime.hashCode() : 0);
151            hashCode = 37 * hashCode + ((completedTime != null) ? completedTime.hashCode() : 0);
152            hashCode = 37 * hashCode + ((response != null) ? response.hashCode() : 0);
153            hashCode = 37 * hashCode + ((retainUntilTime != null) ? retainUntilTime.hashCode() : 0);
154            hashCode = 37 * hashCode + ((initializationVector != null) ? initializationVector.hashCode() : 0);
155            
156            _hashCode = hashCode;
157        }
158        
159        return _hashCode;
160    }
161    
162    @Override
163    @Nonnull
164    public String toString() {
165        if(_stringValue == null) {
166            _stringValue = "{" + 
167                    "entityId=" + getEntityId() +
168                    ", userVisitPK=" + getUserVisitPK() +
169                    ", idempotencyKeyHash=" + getIdempotencyKeyHash() +
170                    ", queryHash=" + getQueryHash() +
171                    ", variablesHash=" + getVariablesHash() +
172                    ", operationNameHash=" + getOperationNameHash() +
173                    ", startTime=" + getStartTime() +
174                    ", completedTime=" + getCompletedTime() +
175                    ", response=" + getResponse() +
176                    ", retainUntilTime=" + getRetainUntilTime() +
177                    ", initializationVector=" + getInitializationVector() +
178                    "}";
179        }
180        return _stringValue;
181    }
182    
183    @Override
184    public boolean equals(Object other) {
185        if(this == other)
186            return true;
187        
188        if(!hasIdentity())
189            return false;
190        
191        if(other instanceof  IdempotentResponseValue that) {
192            if(!that.hasIdentity())
193                return false;
194            
195            Long thisEntityId = getEntityId();
196            Long thatEntityId = that.getEntityId();
197            
198            boolean objectsEqual = thisEntityId.equals(thatEntityId);
199            if(objectsEqual)
200                objectsEqual = isIdentical(that);
201            
202            return objectsEqual;
203        } else {
204            return false;
205        }
206    }
207    
208    public boolean isIdentical(Object other) {
209        if(other instanceof IdempotentResponseValue that) {
210            boolean objectsEqual = true;
211            
212            
213            if(objectsEqual) {
214                UserVisitPK thisUserVisitPK = getUserVisitPK();
215                UserVisitPK thatUserVisitPK = that.getUserVisitPK();
216                
217                if(thisUserVisitPK == null) {
218                    objectsEqual = objectsEqual && (thatUserVisitPK == null);
219                } else {
220                    objectsEqual = objectsEqual && thisUserVisitPK.equals(thatUserVisitPK);
221                }
222            }
223            
224            if(objectsEqual) {
225                String thisIdempotencyKeyHash = getIdempotencyKeyHash();
226                String thatIdempotencyKeyHash = that.getIdempotencyKeyHash();
227                
228                if(thisIdempotencyKeyHash == null) {
229                    objectsEqual = objectsEqual && (thatIdempotencyKeyHash == null);
230                } else {
231                    objectsEqual = objectsEqual && thisIdempotencyKeyHash.equals(thatIdempotencyKeyHash);
232                }
233            }
234            
235            if(objectsEqual) {
236                String thisQueryHash = getQueryHash();
237                String thatQueryHash = that.getQueryHash();
238                
239                if(thisQueryHash == null) {
240                    objectsEqual = objectsEqual && (thatQueryHash == null);
241                } else {
242                    objectsEqual = objectsEqual && thisQueryHash.equals(thatQueryHash);
243                }
244            }
245            
246            if(objectsEqual) {
247                String thisVariablesHash = getVariablesHash();
248                String thatVariablesHash = that.getVariablesHash();
249                
250                if(thisVariablesHash == null) {
251                    objectsEqual = objectsEqual && (thatVariablesHash == null);
252                } else {
253                    objectsEqual = objectsEqual && thisVariablesHash.equals(thatVariablesHash);
254                }
255            }
256            
257            if(objectsEqual) {
258                String thisOperationNameHash = getOperationNameHash();
259                String thatOperationNameHash = that.getOperationNameHash();
260                
261                if(thisOperationNameHash == null) {
262                    objectsEqual = objectsEqual && (thatOperationNameHash == null);
263                } else {
264                    objectsEqual = objectsEqual && thisOperationNameHash.equals(thatOperationNameHash);
265                }
266            }
267            
268            if(objectsEqual) {
269                Long thisStartTime = getStartTime();
270                Long thatStartTime = that.getStartTime();
271                
272                if(thisStartTime == null) {
273                    objectsEqual = objectsEqual && (thatStartTime == null);
274                } else {
275                    objectsEqual = objectsEqual && thisStartTime.equals(thatStartTime);
276                }
277            }
278            
279            if(objectsEqual) {
280                Long thisCompletedTime = getCompletedTime();
281                Long thatCompletedTime = that.getCompletedTime();
282                
283                if(thisCompletedTime == null) {
284                    objectsEqual = objectsEqual && (thatCompletedTime == null);
285                } else {
286                    objectsEqual = objectsEqual && thisCompletedTime.equals(thatCompletedTime);
287                }
288            }
289            
290            if(objectsEqual) {
291                String thisResponse = getResponse();
292                String thatResponse = that.getResponse();
293                
294                if(thisResponse == null) {
295                    objectsEqual = objectsEqual && (thatResponse == null);
296                } else {
297                    objectsEqual = objectsEqual && thisResponse.equals(thatResponse);
298                }
299            }
300            
301            if(objectsEqual) {
302                Long thisRetainUntilTime = getRetainUntilTime();
303                Long thatRetainUntilTime = that.getRetainUntilTime();
304                
305                if(thisRetainUntilTime == null) {
306                    objectsEqual = objectsEqual && (thatRetainUntilTime == null);
307                } else {
308                    objectsEqual = objectsEqual && thisRetainUntilTime.equals(thatRetainUntilTime);
309                }
310            }
311            
312            if(objectsEqual) {
313                String thisInitializationVector = getInitializationVector();
314                String thatInitializationVector = that.getInitializationVector();
315                
316                if(thisInitializationVector == null) {
317                    objectsEqual = objectsEqual && (thatInitializationVector == null);
318                } else {
319                    objectsEqual = objectsEqual && thisInitializationVector.equals(thatInitializationVector);
320                }
321            }
322            
323            return objectsEqual;
324        } else {
325            return false;
326        }
327    }
328    
329    @Override
330    public boolean hasBeenModified() {
331        return userVisitPKHasBeenModified || idempotencyKeyHashHasBeenModified || queryHashHasBeenModified || variablesHashHasBeenModified || operationNameHashHasBeenModified || startTimeHasBeenModified || completedTimeHasBeenModified || responseHasBeenModified || retainUntilTimeHasBeenModified || initializationVectorHasBeenModified;
332    }
333    
334    @Override
335    public void clearHasBeenModified() {
336        userVisitPKHasBeenModified = false;
337        idempotencyKeyHashHasBeenModified = false;
338        queryHashHasBeenModified = false;
339        variablesHashHasBeenModified = false;
340        operationNameHashHasBeenModified = false;
341        startTimeHasBeenModified = false;
342        completedTimeHasBeenModified = false;
343        responseHasBeenModified = false;
344        retainUntilTimeHasBeenModified = false;
345        initializationVectorHasBeenModified = false;
346    }
347    
348    @Nonnull
349    public UserVisitPK getUserVisitPK() {
350        return userVisitPK;
351    }
352    
353    public void setUserVisitPK(@Nonnull UserVisitPK userVisitPK)
354            throws PersistenceNotNullException {
355        checkForNull(userVisitPK);
356        
357        boolean update = true;
358        
359        if(this.userVisitPK != null) {
360            if(this.userVisitPK.equals(userVisitPK)) {
361                update = false;
362            }
363        } else if(userVisitPK == null) {
364            update = false;
365        }
366        
367        if(update) {
368            this.userVisitPK = userVisitPK;
369            userVisitPKHasBeenModified = true;
370            clearHashAndString();
371        }
372    }
373    
374    public boolean getUserVisitPKHasBeenModified() {
375        return userVisitPKHasBeenModified;
376    }
377    
378    @Nonnull
379    public String getIdempotencyKeyHash() {
380        return idempotencyKeyHash;
381    }
382    
383    public void setIdempotencyKeyHash(@Nonnull String idempotencyKeyHash)
384            throws PersistenceNotNullException {
385        checkForNull(idempotencyKeyHash);
386        
387        boolean update = true;
388        
389        if(this.idempotencyKeyHash != null) {
390            if(this.idempotencyKeyHash.equals(idempotencyKeyHash)) {
391                update = false;
392            }
393        } else if(idempotencyKeyHash == null) {
394            update = false;
395        }
396        
397        if(update) {
398            this.idempotencyKeyHash = idempotencyKeyHash;
399            idempotencyKeyHashHasBeenModified = true;
400            clearHashAndString();
401        }
402    }
403    
404    public boolean getIdempotencyKeyHashHasBeenModified() {
405        return idempotencyKeyHashHasBeenModified;
406    }
407    
408    @Nonnull
409    public String getQueryHash() {
410        return queryHash;
411    }
412    
413    public void setQueryHash(@Nonnull String queryHash)
414            throws PersistenceNotNullException {
415        checkForNull(queryHash);
416        
417        boolean update = true;
418        
419        if(this.queryHash != null) {
420            if(this.queryHash.equals(queryHash)) {
421                update = false;
422            }
423        } else if(queryHash == null) {
424            update = false;
425        }
426        
427        if(update) {
428            this.queryHash = queryHash;
429            queryHashHasBeenModified = true;
430            clearHashAndString();
431        }
432    }
433    
434    public boolean getQueryHashHasBeenModified() {
435        return queryHashHasBeenModified;
436    }
437    
438    @Nullable
439    public String getVariablesHash() {
440        return variablesHash;
441    }
442    
443    public void setVariablesHash(@Nullable String variablesHash) {
444        boolean update = true;
445        
446        if(this.variablesHash != null) {
447            if(this.variablesHash.equals(variablesHash)) {
448                update = false;
449            }
450        } else if(variablesHash == null) {
451            update = false;
452        }
453        
454        if(update) {
455            this.variablesHash = variablesHash;
456            variablesHashHasBeenModified = true;
457            clearHashAndString();
458        }
459    }
460    
461    public boolean getVariablesHashHasBeenModified() {
462        return variablesHashHasBeenModified;
463    }
464    
465    @Nullable
466    public String getOperationNameHash() {
467        return operationNameHash;
468    }
469    
470    public void setOperationNameHash(@Nullable String operationNameHash) {
471        boolean update = true;
472        
473        if(this.operationNameHash != null) {
474            if(this.operationNameHash.equals(operationNameHash)) {
475                update = false;
476            }
477        } else if(operationNameHash == null) {
478            update = false;
479        }
480        
481        if(update) {
482            this.operationNameHash = operationNameHash;
483            operationNameHashHasBeenModified = true;
484            clearHashAndString();
485        }
486    }
487    
488    public boolean getOperationNameHashHasBeenModified() {
489        return operationNameHashHasBeenModified;
490    }
491    
492    @Nonnull
493    public Long getStartTime() {
494        return startTime;
495    }
496    
497    public void setStartTime(@Nonnull Long startTime)
498            throws PersistenceNotNullException {
499        checkForNull(startTime);
500        
501        boolean update = true;
502        
503        if(this.startTime != null) {
504            if(this.startTime.equals(startTime)) {
505                update = false;
506            }
507        } else if(startTime == null) {
508            update = false;
509        }
510        
511        if(update) {
512            this.startTime = startTime;
513            startTimeHasBeenModified = true;
514            clearHashAndString();
515        }
516    }
517    
518    public boolean getStartTimeHasBeenModified() {
519        return startTimeHasBeenModified;
520    }
521    
522    @Nullable
523    public Long getCompletedTime() {
524        return completedTime;
525    }
526    
527    public void setCompletedTime(@Nullable Long completedTime) {
528        boolean update = true;
529        
530        if(this.completedTime != null) {
531            if(this.completedTime.equals(completedTime)) {
532                update = false;
533            }
534        } else if(completedTime == null) {
535            update = false;
536        }
537        
538        if(update) {
539            this.completedTime = completedTime;
540            completedTimeHasBeenModified = true;
541            clearHashAndString();
542        }
543    }
544    
545    public boolean getCompletedTimeHasBeenModified() {
546        return completedTimeHasBeenModified;
547    }
548    
549    @Nullable
550    public String getResponse() {
551        return response;
552    }
553    
554    public void setResponse(@Nullable String response) {
555        boolean update = true;
556        
557        if(this.response != null) {
558            if(this.response.equals(response)) {
559                update = false;
560            }
561        } else if(response == null) {
562            update = false;
563        }
564        
565        if(update) {
566            this.response = response;
567            responseHasBeenModified = true;
568            clearHashAndString();
569        }
570    }
571    
572    public boolean getResponseHasBeenModified() {
573        return responseHasBeenModified;
574    }
575    
576    @Nullable
577    public Long getRetainUntilTime() {
578        return retainUntilTime;
579    }
580    
581    public void setRetainUntilTime(@Nullable Long retainUntilTime) {
582        boolean update = true;
583        
584        if(this.retainUntilTime != null) {
585            if(this.retainUntilTime.equals(retainUntilTime)) {
586                update = false;
587            }
588        } else if(retainUntilTime == null) {
589            update = false;
590        }
591        
592        if(update) {
593            this.retainUntilTime = retainUntilTime;
594            retainUntilTimeHasBeenModified = true;
595            clearHashAndString();
596        }
597    }
598    
599    public boolean getRetainUntilTimeHasBeenModified() {
600        return retainUntilTimeHasBeenModified;
601    }
602    
603    @Nonnull
604    public String getInitializationVector() {
605        return initializationVector;
606    }
607    
608    public void setInitializationVector(@Nonnull String initializationVector)
609            throws PersistenceNotNullException {
610        checkForNull(initializationVector);
611        
612        boolean update = true;
613        
614        if(this.initializationVector != null) {
615            if(this.initializationVector.equals(initializationVector)) {
616                update = false;
617            }
618        } else if(initializationVector == null) {
619            update = false;
620        }
621        
622        if(update) {
623            this.initializationVector = initializationVector;
624            initializationVectorHasBeenModified = true;
625            clearHashAndString();
626        }
627    }
628    
629    public boolean getInitializationVectorHasBeenModified() {
630        return initializationVectorHasBeenModified;
631    }
632    
633}