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 * UserLoginStatusValue.java
021 */
022
023package com.echothree.model.data.user.server.value;
024
025import com.echothree.model.data.user.common.pk.UserLoginStatusPK;
026
027import com.echothree.model.data.user.server.factory.UserLoginStatusFactory;
028
029import com.echothree.model.data.party.common.pk.PartyPK;
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
038public class UserLoginStatusValue
039        extends BaseValue<UserLoginStatusPK>
040        implements Cloneable, Serializable {
041    
042    private PartyPK partyPK;
043    private boolean partyPKHasBeenModified = false;
044    private Long lastLoginTime;
045    private boolean lastLoginTimeHasBeenModified = false;
046    private Integer failureCount;
047    private boolean failureCountHasBeenModified = false;
048    private Long firstFailureTime;
049    private boolean firstFailureTimeHasBeenModified = false;
050    private Long lastFailureTime;
051    private boolean lastFailureTimeHasBeenModified = false;
052    private Integer expiredCount;
053    private boolean expiredCountHasBeenModified = false;
054    private Boolean forceChange;
055    private boolean forceChangeHasBeenModified = false;
056    
057    private transient Integer _hashCode = null;
058    private transient String _stringValue = null;
059    
060    private void constructFields(PartyPK partyPK, Long lastLoginTime, Integer failureCount, Long firstFailureTime, Long lastFailureTime, Integer expiredCount, Boolean forceChange)
061            throws PersistenceNotNullException {
062        checkForNull(partyPK);
063        this.partyPK = partyPK;
064        this.lastLoginTime = lastLoginTime;
065        checkForNull(failureCount);
066        this.failureCount = failureCount;
067        this.firstFailureTime = firstFailureTime;
068        this.lastFailureTime = lastFailureTime;
069        checkForNull(expiredCount);
070        this.expiredCount = expiredCount;
071        checkForNull(forceChange);
072        this.forceChange = forceChange;
073    }
074    
075    /** Creates a new instance of UserLoginStatusValue */
076    public UserLoginStatusValue(UserLoginStatusPK userLoginStatusPK, PartyPK partyPK, Long lastLoginTime, Integer failureCount, Long firstFailureTime, Long lastFailureTime, Integer expiredCount, Boolean forceChange)
077            throws PersistenceNotNullException {
078        super(userLoginStatusPK);
079        constructFields(partyPK, lastLoginTime, failureCount, firstFailureTime, lastFailureTime, expiredCount, forceChange);
080    }
081    
082    /** Creates a new instance of UserLoginStatusValue */
083    public UserLoginStatusValue(PartyPK partyPK, Long lastLoginTime, Integer failureCount, Long firstFailureTime, Long lastFailureTime, Integer expiredCount, Boolean forceChange)
084            throws PersistenceNotNullException {
085        super();
086        constructFields(partyPK, lastLoginTime, failureCount, firstFailureTime, lastFailureTime, expiredCount, forceChange);
087    }
088    
089   @Override
090   public UserLoginStatusFactory getBaseFactoryInstance() {
091        return UserLoginStatusFactory.getInstance();
092    }
093    
094    @Override
095    public UserLoginStatusValue 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 (UserLoginStatusValue)result;
106    }
107    
108   @Override
109    public UserLoginStatusPK getPrimaryKey() {
110        if(_primaryKey == null) {
111            _primaryKey = new UserLoginStatusPK(entityId);
112        }
113        
114        return _primaryKey;
115    }
116    
117    private void clearHashAndString() {
118        _hashCode = null;
119        _stringValue = null;
120    }
121    
122    @Override
123    public int hashCode() {
124        if(_hashCode == null) {
125            int hashCode = 17;
126            
127            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
128            
129            hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0);
130            hashCode = 37 * hashCode + ((lastLoginTime != null) ? lastLoginTime.hashCode() : 0);
131            hashCode = 37 * hashCode + ((failureCount != null) ? failureCount.hashCode() : 0);
132            hashCode = 37 * hashCode + ((firstFailureTime != null) ? firstFailureTime.hashCode() : 0);
133            hashCode = 37 * hashCode + ((lastFailureTime != null) ? lastFailureTime.hashCode() : 0);
134            hashCode = 37 * hashCode + ((expiredCount != null) ? expiredCount.hashCode() : 0);
135            hashCode = 37 * hashCode + ((forceChange != null) ? forceChange.hashCode() : 0);
136            
137            _hashCode = hashCode;
138        }
139        
140        return _hashCode;
141    }
142    
143    @Override
144    public String toString() {
145        if(_stringValue == null) {
146            StringBuilder stringValue = new StringBuilder("{");
147            
148            stringValue.append("entityId=").append(getEntityId());
149            
150            stringValue.append(", partyPK=").append(getPartyPK());
151            stringValue.append(", lastLoginTime=").append(getLastLoginTime());
152            stringValue.append(", failureCount=").append(getFailureCount());
153            stringValue.append(", firstFailureTime=").append(getFirstFailureTime());
154            stringValue.append(", lastFailureTime=").append(getLastFailureTime());
155            stringValue.append(", expiredCount=").append(getExpiredCount());
156            stringValue.append(", forceChange=").append(getForceChange());
157            
158            stringValue.append('}');
159            
160            _stringValue = stringValue.toString();
161        }
162        return _stringValue;
163    }
164    
165    @Override
166    public boolean equals(Object other) {
167        if(this == other)
168            return true;
169        
170        if(!hasIdentity())
171            return false;
172        
173        if(other instanceof  UserLoginStatusValue) {
174            UserLoginStatusValue that = (UserLoginStatusValue)other;
175            
176            if(!that.hasIdentity())
177                return false;
178            
179            Long thisEntityId = getEntityId();
180            Long thatEntityId = that.getEntityId();
181            
182            boolean objectsEqual = thisEntityId.equals(thatEntityId);
183            if(objectsEqual)
184                objectsEqual = objectsEqual && isIdentical(that);
185            
186            return objectsEqual;
187        } else {
188            return false;
189        }
190    }
191    
192    public boolean isIdentical(Object other) {
193        if(other instanceof UserLoginStatusValue) {
194            UserLoginStatusValue that = (UserLoginStatusValue)other;
195            boolean objectsEqual = true;
196            
197            
198            if(objectsEqual) {
199                PartyPK thisPartyPK = getPartyPK();
200                PartyPK thatPartyPK = that.getPartyPK();
201                
202                if(thisPartyPK == null) {
203                    objectsEqual = objectsEqual && (thatPartyPK == null);
204                } else {
205                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
206                }
207            }
208            
209            if(objectsEqual) {
210                Long thisLastLoginTime = getLastLoginTime();
211                Long thatLastLoginTime = that.getLastLoginTime();
212                
213                if(thisLastLoginTime == null) {
214                    objectsEqual = objectsEqual && (thatLastLoginTime == null);
215                } else {
216                    objectsEqual = objectsEqual && thisLastLoginTime.equals(thatLastLoginTime);
217                }
218            }
219            
220            if(objectsEqual) {
221                Integer thisFailureCount = getFailureCount();
222                Integer thatFailureCount = that.getFailureCount();
223                
224                if(thisFailureCount == null) {
225                    objectsEqual = objectsEqual && (thatFailureCount == null);
226                } else {
227                    objectsEqual = objectsEqual && thisFailureCount.equals(thatFailureCount);
228                }
229            }
230            
231            if(objectsEqual) {
232                Long thisFirstFailureTime = getFirstFailureTime();
233                Long thatFirstFailureTime = that.getFirstFailureTime();
234                
235                if(thisFirstFailureTime == null) {
236                    objectsEqual = objectsEqual && (thatFirstFailureTime == null);
237                } else {
238                    objectsEqual = objectsEqual && thisFirstFailureTime.equals(thatFirstFailureTime);
239                }
240            }
241            
242            if(objectsEqual) {
243                Long thisLastFailureTime = getLastFailureTime();
244                Long thatLastFailureTime = that.getLastFailureTime();
245                
246                if(thisLastFailureTime == null) {
247                    objectsEqual = objectsEqual && (thatLastFailureTime == null);
248                } else {
249                    objectsEqual = objectsEqual && thisLastFailureTime.equals(thatLastFailureTime);
250                }
251            }
252            
253            if(objectsEqual) {
254                Integer thisExpiredCount = getExpiredCount();
255                Integer thatExpiredCount = that.getExpiredCount();
256                
257                if(thisExpiredCount == null) {
258                    objectsEqual = objectsEqual && (thatExpiredCount == null);
259                } else {
260                    objectsEqual = objectsEqual && thisExpiredCount.equals(thatExpiredCount);
261                }
262            }
263            
264            if(objectsEqual) {
265                Boolean thisForceChange = getForceChange();
266                Boolean thatForceChange = that.getForceChange();
267                
268                if(thisForceChange == null) {
269                    objectsEqual = objectsEqual && (thatForceChange == null);
270                } else {
271                    objectsEqual = objectsEqual && thisForceChange.equals(thatForceChange);
272                }
273            }
274            
275            return objectsEqual;
276        } else {
277            return false;
278        }
279    }
280    
281    @Override
282    public boolean hasBeenModified() {
283        return partyPKHasBeenModified || lastLoginTimeHasBeenModified || failureCountHasBeenModified || firstFailureTimeHasBeenModified || lastFailureTimeHasBeenModified || expiredCountHasBeenModified || forceChangeHasBeenModified;
284    }
285    
286    @Override
287    public void clearHasBeenModified() {
288        partyPKHasBeenModified = false;
289        lastLoginTimeHasBeenModified = false;
290        failureCountHasBeenModified = false;
291        firstFailureTimeHasBeenModified = false;
292        lastFailureTimeHasBeenModified = false;
293        expiredCountHasBeenModified = false;
294        forceChangeHasBeenModified = false;
295    }
296    
297    public PartyPK getPartyPK() {
298        return partyPK;
299    }
300    
301    public void setPartyPK(PartyPK partyPK)
302            throws PersistenceNotNullException {
303        checkForNull(partyPK);
304        
305        boolean update = true;
306        
307        if(this.partyPK != null) {
308            if(this.partyPK.equals(partyPK)) {
309                update = false;
310            }
311        } else if(partyPK == null) {
312            update = false;
313        }
314        
315        if(update) {
316            this.partyPK = partyPK;
317            partyPKHasBeenModified = true;
318            clearHashAndString();
319        }
320    }
321    
322    public boolean getPartyPKHasBeenModified() {
323        return partyPKHasBeenModified;
324    }
325    
326    public Long getLastLoginTime() {
327        return lastLoginTime;
328    }
329    
330    public void setLastLoginTime(Long lastLoginTime) {
331        boolean update = true;
332        
333        if(this.lastLoginTime != null) {
334            if(this.lastLoginTime.equals(lastLoginTime)) {
335                update = false;
336            }
337        } else if(lastLoginTime == null) {
338            update = false;
339        }
340        
341        if(update) {
342            this.lastLoginTime = lastLoginTime;
343            lastLoginTimeHasBeenModified = true;
344            clearHashAndString();
345        }
346    }
347    
348    public boolean getLastLoginTimeHasBeenModified() {
349        return lastLoginTimeHasBeenModified;
350    }
351    
352    public Integer getFailureCount() {
353        return failureCount;
354    }
355    
356    public void setFailureCount(Integer failureCount)
357            throws PersistenceNotNullException {
358        checkForNull(failureCount);
359        
360        boolean update = true;
361        
362        if(this.failureCount != null) {
363            if(this.failureCount.equals(failureCount)) {
364                update = false;
365            }
366        } else if(failureCount == null) {
367            update = false;
368        }
369        
370        if(update) {
371            this.failureCount = failureCount;
372            failureCountHasBeenModified = true;
373            clearHashAndString();
374        }
375    }
376    
377    public boolean getFailureCountHasBeenModified() {
378        return failureCountHasBeenModified;
379    }
380    
381    public Long getFirstFailureTime() {
382        return firstFailureTime;
383    }
384    
385    public void setFirstFailureTime(Long firstFailureTime) {
386        boolean update = true;
387        
388        if(this.firstFailureTime != null) {
389            if(this.firstFailureTime.equals(firstFailureTime)) {
390                update = false;
391            }
392        } else if(firstFailureTime == null) {
393            update = false;
394        }
395        
396        if(update) {
397            this.firstFailureTime = firstFailureTime;
398            firstFailureTimeHasBeenModified = true;
399            clearHashAndString();
400        }
401    }
402    
403    public boolean getFirstFailureTimeHasBeenModified() {
404        return firstFailureTimeHasBeenModified;
405    }
406    
407    public Long getLastFailureTime() {
408        return lastFailureTime;
409    }
410    
411    public void setLastFailureTime(Long lastFailureTime) {
412        boolean update = true;
413        
414        if(this.lastFailureTime != null) {
415            if(this.lastFailureTime.equals(lastFailureTime)) {
416                update = false;
417            }
418        } else if(lastFailureTime == null) {
419            update = false;
420        }
421        
422        if(update) {
423            this.lastFailureTime = lastFailureTime;
424            lastFailureTimeHasBeenModified = true;
425            clearHashAndString();
426        }
427    }
428    
429    public boolean getLastFailureTimeHasBeenModified() {
430        return lastFailureTimeHasBeenModified;
431    }
432    
433    public Integer getExpiredCount() {
434        return expiredCount;
435    }
436    
437    public void setExpiredCount(Integer expiredCount)
438            throws PersistenceNotNullException {
439        checkForNull(expiredCount);
440        
441        boolean update = true;
442        
443        if(this.expiredCount != null) {
444            if(this.expiredCount.equals(expiredCount)) {
445                update = false;
446            }
447        } else if(expiredCount == null) {
448            update = false;
449        }
450        
451        if(update) {
452            this.expiredCount = expiredCount;
453            expiredCountHasBeenModified = true;
454            clearHashAndString();
455        }
456    }
457    
458    public boolean getExpiredCountHasBeenModified() {
459        return expiredCountHasBeenModified;
460    }
461    
462    public Boolean getForceChange() {
463        return forceChange;
464    }
465    
466    public void setForceChange(Boolean forceChange)
467            throws PersistenceNotNullException {
468        checkForNull(forceChange);
469        
470        boolean update = true;
471        
472        if(this.forceChange != null) {
473            if(this.forceChange.equals(forceChange)) {
474                update = false;
475            }
476        } else if(forceChange == null) {
477            update = false;
478        }
479        
480        if(update) {
481            this.forceChange = forceChange;
482            forceChangeHasBeenModified = true;
483            clearHashAndString();
484        }
485    }
486    
487    public boolean getForceChangeHasBeenModified() {
488        return forceChangeHasBeenModified;
489    }
490    
491}