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 * PrinterGroupJobDetailValue.java
021 */
022
023package com.echothree.model.data.printer.server.value;
024
025import com.echothree.model.data.printer.common.pk.PrinterGroupJobDetailPK;
026
027import com.echothree.model.data.printer.server.factory.PrinterGroupJobDetailFactory;
028
029import com.echothree.model.data.printer.common.pk.PrinterGroupJobPK;
030import com.echothree.model.data.printer.common.pk.PrinterGroupPK;
031import com.echothree.model.data.document.common.pk.DocumentPK;
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 PrinterGroupJobDetailValue
044        extends BaseValue<PrinterGroupJobDetailPK>
045        implements Cloneable, Serializable {
046    
047    private PrinterGroupJobPK printerGroupJobPK;
048    private boolean printerGroupJobPKHasBeenModified = false;
049    private String printerGroupJobName;
050    private boolean printerGroupJobNameHasBeenModified = false;
051    private PrinterGroupPK printerGroupPK;
052    private boolean printerGroupPKHasBeenModified = false;
053    private DocumentPK documentPK;
054    private boolean documentPKHasBeenModified = false;
055    private Integer copies;
056    private boolean copiesHasBeenModified = false;
057    private Integer priority;
058    private boolean priorityHasBeenModified = false;
059    private Long fromTime;
060    private boolean fromTimeHasBeenModified = false;
061    private Long thruTime;
062    private boolean thruTimeHasBeenModified = false;
063    
064    private transient Integer _hashCode = null;
065    private transient String _stringValue = null;
066    
067    private void constructFields(PrinterGroupJobPK printerGroupJobPK, String printerGroupJobName, PrinterGroupPK printerGroupPK, DocumentPK documentPK, Integer copies, Integer priority, Long fromTime, Long thruTime)
068            throws PersistenceNotNullException {
069        checkForNull(printerGroupJobPK);
070        this.printerGroupJobPK = printerGroupJobPK;
071        checkForNull(printerGroupJobName);
072        this.printerGroupJobName = printerGroupJobName;
073        checkForNull(printerGroupPK);
074        this.printerGroupPK = printerGroupPK;
075        checkForNull(documentPK);
076        this.documentPK = documentPK;
077        checkForNull(copies);
078        this.copies = copies;
079        checkForNull(priority);
080        this.priority = priority;
081        checkForNull(fromTime);
082        this.fromTime = fromTime;
083        checkForNull(thruTime);
084        this.thruTime = thruTime;
085    }
086    
087    /** Creates a new instance of PrinterGroupJobDetailValue */
088    public PrinterGroupJobDetailValue(PrinterGroupJobDetailPK printerGroupJobDetailPK, PrinterGroupJobPK printerGroupJobPK, String printerGroupJobName, PrinterGroupPK printerGroupPK, DocumentPK documentPK, Integer copies, Integer priority, Long fromTime, Long thruTime)
089            throws PersistenceNotNullException {
090        super(printerGroupJobDetailPK);
091        constructFields(printerGroupJobPK, printerGroupJobName, printerGroupPK, documentPK, copies, priority, fromTime, thruTime);
092    }
093    
094    /** Creates a new instance of PrinterGroupJobDetailValue */
095    public PrinterGroupJobDetailValue(PrinterGroupJobPK printerGroupJobPK, String printerGroupJobName, PrinterGroupPK printerGroupPK, DocumentPK documentPK, Integer copies, Integer priority, Long fromTime, Long thruTime)
096            throws PersistenceNotNullException {
097        super();
098        constructFields(printerGroupJobPK, printerGroupJobName, printerGroupPK, documentPK, copies, priority, fromTime, thruTime);
099    }
100    
101    @Override
102    @Nonnull
103    public PrinterGroupJobDetailFactory getBaseFactoryInstance() {
104        return PrinterGroupJobDetailFactory.getInstance();
105    }
106    
107    @Override
108    @Nonnull
109    public PrinterGroupJobDetailValue clone() {
110        Object result;
111        
112        try {
113            result = super.clone();
114        } catch (CloneNotSupportedException cnse) {
115            // This shouldn't happen, fail when it does.
116            throw new PersistenceCloneException(cnse);
117        }
118        
119        return (PrinterGroupJobDetailValue)result;
120    }
121    
122    @Override
123    @Nonnull
124    public PrinterGroupJobDetailPK getPrimaryKey() {
125        if(_primaryKey == null) {
126            _primaryKey = new PrinterGroupJobDetailPK(entityId);
127        }
128        
129        return _primaryKey;
130    }
131    
132    private void clearHashAndString() {
133        _hashCode = null;
134        _stringValue = null;
135    }
136    
137    @Override
138    public int hashCode() {
139        if(_hashCode == null) {
140            int hashCode = 17;
141            
142            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
143            
144            hashCode = 37 * hashCode + ((printerGroupJobPK != null) ? printerGroupJobPK.hashCode() : 0);
145            hashCode = 37 * hashCode + ((printerGroupJobName != null) ? printerGroupJobName.hashCode() : 0);
146            hashCode = 37 * hashCode + ((printerGroupPK != null) ? printerGroupPK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((documentPK != null) ? documentPK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((copies != null) ? copies.hashCode() : 0);
149            hashCode = 37 * hashCode + ((priority != null) ? priority.hashCode() : 0);
150            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
151            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
152            
153            _hashCode = hashCode;
154        }
155        
156        return _hashCode;
157    }
158    
159    @Override
160    @Nonnull
161    public String toString() {
162        if(_stringValue == null) {
163            _stringValue = "{" + 
164                    "entityId=" + getEntityId() +
165                    ", printerGroupJobPK=" + getPrinterGroupJobPK() +
166                    ", printerGroupJobName=" + getPrinterGroupJobName() +
167                    ", printerGroupPK=" + getPrinterGroupPK() +
168                    ", documentPK=" + getDocumentPK() +
169                    ", copies=" + getCopies() +
170                    ", priority=" + getPriority() +
171                    ", fromTime=" + getFromTime() +
172                    ", thruTime=" + getThruTime() +
173                    "}";
174        }
175        return _stringValue;
176    }
177    
178    @Override
179    public boolean equals(Object other) {
180        if(this == other)
181            return true;
182        
183        if(!hasIdentity())
184            return false;
185        
186        if(other instanceof  PrinterGroupJobDetailValue that) {
187            if(!that.hasIdentity())
188                return false;
189            
190            Long thisEntityId = getEntityId();
191            Long thatEntityId = that.getEntityId();
192            
193            boolean objectsEqual = thisEntityId.equals(thatEntityId);
194            if(objectsEqual)
195                objectsEqual = isIdentical(that);
196            
197            return objectsEqual;
198        } else {
199            return false;
200        }
201    }
202    
203    public boolean isIdentical(Object other) {
204        if(other instanceof PrinterGroupJobDetailValue that) {
205            boolean objectsEqual = true;
206            
207            
208            if(objectsEqual) {
209                PrinterGroupJobPK thisPrinterGroupJobPK = getPrinterGroupJobPK();
210                PrinterGroupJobPK thatPrinterGroupJobPK = that.getPrinterGroupJobPK();
211                
212                if(thisPrinterGroupJobPK == null) {
213                    objectsEqual = objectsEqual && (thatPrinterGroupJobPK == null);
214                } else {
215                    objectsEqual = objectsEqual && thisPrinterGroupJobPK.equals(thatPrinterGroupJobPK);
216                }
217            }
218            
219            if(objectsEqual) {
220                String thisPrinterGroupJobName = getPrinterGroupJobName();
221                String thatPrinterGroupJobName = that.getPrinterGroupJobName();
222                
223                if(thisPrinterGroupJobName == null) {
224                    objectsEqual = objectsEqual && (thatPrinterGroupJobName == null);
225                } else {
226                    objectsEqual = objectsEqual && thisPrinterGroupJobName.equals(thatPrinterGroupJobName);
227                }
228            }
229            
230            if(objectsEqual) {
231                PrinterGroupPK thisPrinterGroupPK = getPrinterGroupPK();
232                PrinterGroupPK thatPrinterGroupPK = that.getPrinterGroupPK();
233                
234                if(thisPrinterGroupPK == null) {
235                    objectsEqual = objectsEqual && (thatPrinterGroupPK == null);
236                } else {
237                    objectsEqual = objectsEqual && thisPrinterGroupPK.equals(thatPrinterGroupPK);
238                }
239            }
240            
241            if(objectsEqual) {
242                DocumentPK thisDocumentPK = getDocumentPK();
243                DocumentPK thatDocumentPK = that.getDocumentPK();
244                
245                if(thisDocumentPK == null) {
246                    objectsEqual = objectsEqual && (thatDocumentPK == null);
247                } else {
248                    objectsEqual = objectsEqual && thisDocumentPK.equals(thatDocumentPK);
249                }
250            }
251            
252            if(objectsEqual) {
253                Integer thisCopies = getCopies();
254                Integer thatCopies = that.getCopies();
255                
256                if(thisCopies == null) {
257                    objectsEqual = objectsEqual && (thatCopies == null);
258                } else {
259                    objectsEqual = objectsEqual && thisCopies.equals(thatCopies);
260                }
261            }
262            
263            if(objectsEqual) {
264                Integer thisPriority = getPriority();
265                Integer thatPriority = that.getPriority();
266                
267                if(thisPriority == null) {
268                    objectsEqual = objectsEqual && (thatPriority == null);
269                } else {
270                    objectsEqual = objectsEqual && thisPriority.equals(thatPriority);
271                }
272            }
273            
274            if(objectsEqual) {
275                Long thisFromTime = getFromTime();
276                Long thatFromTime = that.getFromTime();
277                
278                if(thisFromTime == null) {
279                    objectsEqual = objectsEqual && (thatFromTime == null);
280                } else {
281                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
282                }
283            }
284            
285            if(objectsEqual) {
286                Long thisThruTime = getThruTime();
287                Long thatThruTime = that.getThruTime();
288                
289                if(thisThruTime == null) {
290                    objectsEqual = objectsEqual && (thatThruTime == null);
291                } else {
292                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
293                }
294            }
295            
296            return objectsEqual;
297        } else {
298            return false;
299        }
300    }
301    
302    @Override
303    public boolean hasBeenModified() {
304        return printerGroupJobPKHasBeenModified || printerGroupJobNameHasBeenModified || printerGroupPKHasBeenModified || documentPKHasBeenModified || copiesHasBeenModified || priorityHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
305    }
306    
307    @Override
308    public void clearHasBeenModified() {
309        printerGroupJobPKHasBeenModified = false;
310        printerGroupJobNameHasBeenModified = false;
311        printerGroupPKHasBeenModified = false;
312        documentPKHasBeenModified = false;
313        copiesHasBeenModified = false;
314        priorityHasBeenModified = false;
315        fromTimeHasBeenModified = false;
316        thruTimeHasBeenModified = false;
317    }
318    
319    @Nonnull
320    public PrinterGroupJobPK getPrinterGroupJobPK() {
321        return printerGroupJobPK;
322    }
323    
324    public void setPrinterGroupJobPK(@Nonnull PrinterGroupJobPK printerGroupJobPK)
325            throws PersistenceNotNullException {
326        checkForNull(printerGroupJobPK);
327        
328        boolean update = true;
329        
330        if(this.printerGroupJobPK != null) {
331            if(this.printerGroupJobPK.equals(printerGroupJobPK)) {
332                update = false;
333            }
334        } else if(printerGroupJobPK == null) {
335            update = false;
336        }
337        
338        if(update) {
339            this.printerGroupJobPK = printerGroupJobPK;
340            printerGroupJobPKHasBeenModified = true;
341            clearHashAndString();
342        }
343    }
344    
345    public boolean getPrinterGroupJobPKHasBeenModified() {
346        return printerGroupJobPKHasBeenModified;
347    }
348    
349    @Nonnull
350    public String getPrinterGroupJobName() {
351        return printerGroupJobName;
352    }
353    
354    public void setPrinterGroupJobName(@Nonnull String printerGroupJobName)
355            throws PersistenceNotNullException {
356        checkForNull(printerGroupJobName);
357        
358        boolean update = true;
359        
360        if(this.printerGroupJobName != null) {
361            if(this.printerGroupJobName.equals(printerGroupJobName)) {
362                update = false;
363            }
364        } else if(printerGroupJobName == null) {
365            update = false;
366        }
367        
368        if(update) {
369            this.printerGroupJobName = printerGroupJobName;
370            printerGroupJobNameHasBeenModified = true;
371            clearHashAndString();
372        }
373    }
374    
375    public boolean getPrinterGroupJobNameHasBeenModified() {
376        return printerGroupJobNameHasBeenModified;
377    }
378    
379    @Nonnull
380    public PrinterGroupPK getPrinterGroupPK() {
381        return printerGroupPK;
382    }
383    
384    public void setPrinterGroupPK(@Nonnull PrinterGroupPK printerGroupPK)
385            throws PersistenceNotNullException {
386        checkForNull(printerGroupPK);
387        
388        boolean update = true;
389        
390        if(this.printerGroupPK != null) {
391            if(this.printerGroupPK.equals(printerGroupPK)) {
392                update = false;
393            }
394        } else if(printerGroupPK == null) {
395            update = false;
396        }
397        
398        if(update) {
399            this.printerGroupPK = printerGroupPK;
400            printerGroupPKHasBeenModified = true;
401            clearHashAndString();
402        }
403    }
404    
405    public boolean getPrinterGroupPKHasBeenModified() {
406        return printerGroupPKHasBeenModified;
407    }
408    
409    @Nonnull
410    public DocumentPK getDocumentPK() {
411        return documentPK;
412    }
413    
414    public void setDocumentPK(@Nonnull DocumentPK documentPK)
415            throws PersistenceNotNullException {
416        checkForNull(documentPK);
417        
418        boolean update = true;
419        
420        if(this.documentPK != null) {
421            if(this.documentPK.equals(documentPK)) {
422                update = false;
423            }
424        } else if(documentPK == null) {
425            update = false;
426        }
427        
428        if(update) {
429            this.documentPK = documentPK;
430            documentPKHasBeenModified = true;
431            clearHashAndString();
432        }
433    }
434    
435    public boolean getDocumentPKHasBeenModified() {
436        return documentPKHasBeenModified;
437    }
438    
439    @Nonnull
440    public Integer getCopies() {
441        return copies;
442    }
443    
444    public void setCopies(@Nonnull Integer copies)
445            throws PersistenceNotNullException {
446        checkForNull(copies);
447        
448        boolean update = true;
449        
450        if(this.copies != null) {
451            if(this.copies.equals(copies)) {
452                update = false;
453            }
454        } else if(copies == null) {
455            update = false;
456        }
457        
458        if(update) {
459            this.copies = copies;
460            copiesHasBeenModified = true;
461            clearHashAndString();
462        }
463    }
464    
465    public boolean getCopiesHasBeenModified() {
466        return copiesHasBeenModified;
467    }
468    
469    @Nonnull
470    public Integer getPriority() {
471        return priority;
472    }
473    
474    public void setPriority(@Nonnull Integer priority)
475            throws PersistenceNotNullException {
476        checkForNull(priority);
477        
478        boolean update = true;
479        
480        if(this.priority != null) {
481            if(this.priority.equals(priority)) {
482                update = false;
483            }
484        } else if(priority == null) {
485            update = false;
486        }
487        
488        if(update) {
489            this.priority = priority;
490            priorityHasBeenModified = true;
491            clearHashAndString();
492        }
493    }
494    
495    public boolean getPriorityHasBeenModified() {
496        return priorityHasBeenModified;
497    }
498    
499    @Nonnull
500    public Long getFromTime() {
501        return fromTime;
502    }
503    
504    public void setFromTime(@Nonnull Long fromTime)
505            throws PersistenceNotNullException {
506        checkForNull(fromTime);
507        
508        boolean update = true;
509        
510        if(this.fromTime != null) {
511            if(this.fromTime.equals(fromTime)) {
512                update = false;
513            }
514        } else if(fromTime == null) {
515            update = false;
516        }
517        
518        if(update) {
519            this.fromTime = fromTime;
520            fromTimeHasBeenModified = true;
521            clearHashAndString();
522        }
523    }
524    
525    public boolean getFromTimeHasBeenModified() {
526        return fromTimeHasBeenModified;
527    }
528    
529    @Nonnull
530    public Long getThruTime() {
531        return thruTime;
532    }
533    
534    public void setThruTime(@Nonnull Long thruTime)
535            throws PersistenceNotNullException {
536        checkForNull(thruTime);
537        
538        boolean update = true;
539        
540        if(this.thruTime != null) {
541            if(this.thruTime.equals(thruTime)) {
542                update = false;
543            }
544        } else if(thruTime == null) {
545            update = false;
546        }
547        
548        if(update) {
549            this.thruTime = thruTime;
550            thruTimeHasBeenModified = true;
551            clearHashAndString();
552        }
553    }
554    
555    public boolean getThruTimeHasBeenModified() {
556        return thruTimeHasBeenModified;
557    }
558    
559}