001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 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 * LocationDetailValue.java
021 */
022
023package com.echothree.model.data.warehouse.server.value;
024
025import com.echothree.model.data.warehouse.common.pk.LocationDetailPK;
026
027import com.echothree.model.data.warehouse.server.factory.LocationDetailFactory;
028
029import com.echothree.model.data.warehouse.common.pk.LocationPK;
030import com.echothree.model.data.party.common.pk.PartyPK;
031import com.echothree.model.data.warehouse.common.pk.LocationTypePK;
032import com.echothree.model.data.warehouse.common.pk.LocationUseTypePK;
033import com.echothree.model.data.inventory.common.pk.InventoryLocationGroupPK;
034
035import com.echothree.util.common.exception.PersistenceCloneException;
036import com.echothree.util.common.exception.PersistenceNotNullException;
037
038import com.echothree.util.server.persistence.BaseValue;
039
040import java.io.Serializable;
041
042public class LocationDetailValue
043        extends BaseValue<LocationDetailPK>
044        implements Cloneable, Serializable {
045    
046    private LocationPK locationPK;
047    private boolean locationPKHasBeenModified = false;
048    private PartyPK warehousePartyPK;
049    private boolean warehousePartyPKHasBeenModified = false;
050    private String locationName;
051    private boolean locationNameHasBeenModified = false;
052    private LocationTypePK locationTypePK;
053    private boolean locationTypePKHasBeenModified = false;
054    private LocationUseTypePK locationUseTypePK;
055    private boolean locationUseTypePKHasBeenModified = false;
056    private Integer velocity;
057    private boolean velocityHasBeenModified = false;
058    private InventoryLocationGroupPK inventoryLocationGroupPK;
059    private boolean inventoryLocationGroupPKHasBeenModified = false;
060    private Long fromTime;
061    private boolean fromTimeHasBeenModified = false;
062    private Long thruTime;
063    private boolean thruTimeHasBeenModified = false;
064    
065    private transient Integer _hashCode = null;
066    private transient String _stringValue = null;
067    
068    private void constructFields(LocationPK locationPK, PartyPK warehousePartyPK, String locationName, LocationTypePK locationTypePK, LocationUseTypePK locationUseTypePK, Integer velocity, InventoryLocationGroupPK inventoryLocationGroupPK, Long fromTime, Long thruTime)
069            throws PersistenceNotNullException {
070        checkForNull(locationPK);
071        this.locationPK = locationPK;
072        checkForNull(warehousePartyPK);
073        this.warehousePartyPK = warehousePartyPK;
074        checkForNull(locationName);
075        this.locationName = locationName;
076        checkForNull(locationTypePK);
077        this.locationTypePK = locationTypePK;
078        checkForNull(locationUseTypePK);
079        this.locationUseTypePK = locationUseTypePK;
080        checkForNull(velocity);
081        this.velocity = velocity;
082        checkForNull(inventoryLocationGroupPK);
083        this.inventoryLocationGroupPK = inventoryLocationGroupPK;
084        checkForNull(fromTime);
085        this.fromTime = fromTime;
086        checkForNull(thruTime);
087        this.thruTime = thruTime;
088    }
089    
090    /** Creates a new instance of LocationDetailValue */
091    public LocationDetailValue(LocationDetailPK locationDetailPK, LocationPK locationPK, PartyPK warehousePartyPK, String locationName, LocationTypePK locationTypePK, LocationUseTypePK locationUseTypePK, Integer velocity, InventoryLocationGroupPK inventoryLocationGroupPK, Long fromTime, Long thruTime)
092            throws PersistenceNotNullException {
093        super(locationDetailPK);
094        constructFields(locationPK, warehousePartyPK, locationName, locationTypePK, locationUseTypePK, velocity, inventoryLocationGroupPK, fromTime, thruTime);
095    }
096    
097    /** Creates a new instance of LocationDetailValue */
098    public LocationDetailValue(LocationPK locationPK, PartyPK warehousePartyPK, String locationName, LocationTypePK locationTypePK, LocationUseTypePK locationUseTypePK, Integer velocity, InventoryLocationGroupPK inventoryLocationGroupPK, Long fromTime, Long thruTime)
099            throws PersistenceNotNullException {
100        super();
101        constructFields(locationPK, warehousePartyPK, locationName, locationTypePK, locationUseTypePK, velocity, inventoryLocationGroupPK, fromTime, thruTime);
102    }
103    
104   @Override
105   public LocationDetailFactory getBaseFactoryInstance() {
106        return LocationDetailFactory.getInstance();
107    }
108    
109    @Override
110    public LocationDetailValue 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 (LocationDetailValue)result;
121    }
122    
123   @Override
124    public LocationDetailPK getPrimaryKey() {
125        if(_primaryKey == null) {
126            _primaryKey = new LocationDetailPK(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 + ((locationPK != null) ? locationPK.hashCode() : 0);
145            hashCode = 37 * hashCode + ((warehousePartyPK != null) ? warehousePartyPK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((locationName != null) ? locationName.hashCode() : 0);
147            hashCode = 37 * hashCode + ((locationTypePK != null) ? locationTypePK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((locationUseTypePK != null) ? locationUseTypePK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((velocity != null) ? velocity.hashCode() : 0);
150            hashCode = 37 * hashCode + ((inventoryLocationGroupPK != null) ? inventoryLocationGroupPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
152            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
153            
154            _hashCode = hashCode;
155        }
156        
157        return _hashCode;
158    }
159    
160    @Override
161    public String toString() {
162        if(_stringValue == null) {
163            _stringValue = "{" + 
164                    "entityId=" + getEntityId() +
165                    ", locationPK=" + getLocationPK() +
166                    ", warehousePartyPK=" + getWarehousePartyPK() +
167                    ", locationName=" + getLocationName() +
168                    ", locationTypePK=" + getLocationTypePK() +
169                    ", locationUseTypePK=" + getLocationUseTypePK() +
170                    ", velocity=" + getVelocity() +
171                    ", inventoryLocationGroupPK=" + getInventoryLocationGroupPK() +
172                    ", fromTime=" + getFromTime() +
173                    ", thruTime=" + getThruTime() +
174                    "}";
175        }
176        return _stringValue;
177    }
178    
179    @Override
180    public boolean equals(Object other) {
181        if(this == other)
182            return true;
183        
184        if(!hasIdentity())
185            return false;
186        
187        if(other instanceof  LocationDetailValue that) {
188            if(!that.hasIdentity())
189                return false;
190            
191            Long thisEntityId = getEntityId();
192            Long thatEntityId = that.getEntityId();
193            
194            boolean objectsEqual = thisEntityId.equals(thatEntityId);
195            if(objectsEqual)
196                objectsEqual = isIdentical(that);
197            
198            return objectsEqual;
199        } else {
200            return false;
201        }
202    }
203    
204    public boolean isIdentical(Object other) {
205        if(other instanceof LocationDetailValue that) {
206            boolean objectsEqual = true;
207            
208            
209            if(objectsEqual) {
210                LocationPK thisLocationPK = getLocationPK();
211                LocationPK thatLocationPK = that.getLocationPK();
212                
213                if(thisLocationPK == null) {
214                    objectsEqual = objectsEqual && (thatLocationPK == null);
215                } else {
216                    objectsEqual = objectsEqual && thisLocationPK.equals(thatLocationPK);
217                }
218            }
219            
220            if(objectsEqual) {
221                PartyPK thisWarehousePartyPK = getWarehousePartyPK();
222                PartyPK thatWarehousePartyPK = that.getWarehousePartyPK();
223                
224                if(thisWarehousePartyPK == null) {
225                    objectsEqual = objectsEqual && (thatWarehousePartyPK == null);
226                } else {
227                    objectsEqual = objectsEqual && thisWarehousePartyPK.equals(thatWarehousePartyPK);
228                }
229            }
230            
231            if(objectsEqual) {
232                String thisLocationName = getLocationName();
233                String thatLocationName = that.getLocationName();
234                
235                if(thisLocationName == null) {
236                    objectsEqual = objectsEqual && (thatLocationName == null);
237                } else {
238                    objectsEqual = objectsEqual && thisLocationName.equals(thatLocationName);
239                }
240            }
241            
242            if(objectsEqual) {
243                LocationTypePK thisLocationTypePK = getLocationTypePK();
244                LocationTypePK thatLocationTypePK = that.getLocationTypePK();
245                
246                if(thisLocationTypePK == null) {
247                    objectsEqual = objectsEqual && (thatLocationTypePK == null);
248                } else {
249                    objectsEqual = objectsEqual && thisLocationTypePK.equals(thatLocationTypePK);
250                }
251            }
252            
253            if(objectsEqual) {
254                LocationUseTypePK thisLocationUseTypePK = getLocationUseTypePK();
255                LocationUseTypePK thatLocationUseTypePK = that.getLocationUseTypePK();
256                
257                if(thisLocationUseTypePK == null) {
258                    objectsEqual = objectsEqual && (thatLocationUseTypePK == null);
259                } else {
260                    objectsEqual = objectsEqual && thisLocationUseTypePK.equals(thatLocationUseTypePK);
261                }
262            }
263            
264            if(objectsEqual) {
265                Integer thisVelocity = getVelocity();
266                Integer thatVelocity = that.getVelocity();
267                
268                if(thisVelocity == null) {
269                    objectsEqual = objectsEqual && (thatVelocity == null);
270                } else {
271                    objectsEqual = objectsEqual && thisVelocity.equals(thatVelocity);
272                }
273            }
274            
275            if(objectsEqual) {
276                InventoryLocationGroupPK thisInventoryLocationGroupPK = getInventoryLocationGroupPK();
277                InventoryLocationGroupPK thatInventoryLocationGroupPK = that.getInventoryLocationGroupPK();
278                
279                if(thisInventoryLocationGroupPK == null) {
280                    objectsEqual = objectsEqual && (thatInventoryLocationGroupPK == null);
281                } else {
282                    objectsEqual = objectsEqual && thisInventoryLocationGroupPK.equals(thatInventoryLocationGroupPK);
283                }
284            }
285            
286            if(objectsEqual) {
287                Long thisFromTime = getFromTime();
288                Long thatFromTime = that.getFromTime();
289                
290                if(thisFromTime == null) {
291                    objectsEqual = objectsEqual && (thatFromTime == null);
292                } else {
293                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
294                }
295            }
296            
297            if(objectsEqual) {
298                Long thisThruTime = getThruTime();
299                Long thatThruTime = that.getThruTime();
300                
301                if(thisThruTime == null) {
302                    objectsEqual = objectsEqual && (thatThruTime == null);
303                } else {
304                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
305                }
306            }
307            
308            return objectsEqual;
309        } else {
310            return false;
311        }
312    }
313    
314    @Override
315    public boolean hasBeenModified() {
316        return locationPKHasBeenModified || warehousePartyPKHasBeenModified || locationNameHasBeenModified || locationTypePKHasBeenModified || locationUseTypePKHasBeenModified || velocityHasBeenModified || inventoryLocationGroupPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
317    }
318    
319    @Override
320    public void clearHasBeenModified() {
321        locationPKHasBeenModified = false;
322        warehousePartyPKHasBeenModified = false;
323        locationNameHasBeenModified = false;
324        locationTypePKHasBeenModified = false;
325        locationUseTypePKHasBeenModified = false;
326        velocityHasBeenModified = false;
327        inventoryLocationGroupPKHasBeenModified = false;
328        fromTimeHasBeenModified = false;
329        thruTimeHasBeenModified = false;
330    }
331    
332    public LocationPK getLocationPK() {
333        return locationPK;
334    }
335    
336    public void setLocationPK(LocationPK locationPK)
337            throws PersistenceNotNullException {
338        checkForNull(locationPK);
339        
340        boolean update = true;
341        
342        if(this.locationPK != null) {
343            if(this.locationPK.equals(locationPK)) {
344                update = false;
345            }
346        } else if(locationPK == null) {
347            update = false;
348        }
349        
350        if(update) {
351            this.locationPK = locationPK;
352            locationPKHasBeenModified = true;
353            clearHashAndString();
354        }
355    }
356    
357    public boolean getLocationPKHasBeenModified() {
358        return locationPKHasBeenModified;
359    }
360    
361    public PartyPK getWarehousePartyPK() {
362        return warehousePartyPK;
363    }
364    
365    public void setWarehousePartyPK(PartyPK warehousePartyPK)
366            throws PersistenceNotNullException {
367        checkForNull(warehousePartyPK);
368        
369        boolean update = true;
370        
371        if(this.warehousePartyPK != null) {
372            if(this.warehousePartyPK.equals(warehousePartyPK)) {
373                update = false;
374            }
375        } else if(warehousePartyPK == null) {
376            update = false;
377        }
378        
379        if(update) {
380            this.warehousePartyPK = warehousePartyPK;
381            warehousePartyPKHasBeenModified = true;
382            clearHashAndString();
383        }
384    }
385    
386    public boolean getWarehousePartyPKHasBeenModified() {
387        return warehousePartyPKHasBeenModified;
388    }
389    
390    public String getLocationName() {
391        return locationName;
392    }
393    
394    public void setLocationName(String locationName)
395            throws PersistenceNotNullException {
396        checkForNull(locationName);
397        
398        boolean update = true;
399        
400        if(this.locationName != null) {
401            if(this.locationName.equals(locationName)) {
402                update = false;
403            }
404        } else if(locationName == null) {
405            update = false;
406        }
407        
408        if(update) {
409            this.locationName = locationName;
410            locationNameHasBeenModified = true;
411            clearHashAndString();
412        }
413    }
414    
415    public boolean getLocationNameHasBeenModified() {
416        return locationNameHasBeenModified;
417    }
418    
419    public LocationTypePK getLocationTypePK() {
420        return locationTypePK;
421    }
422    
423    public void setLocationTypePK(LocationTypePK locationTypePK)
424            throws PersistenceNotNullException {
425        checkForNull(locationTypePK);
426        
427        boolean update = true;
428        
429        if(this.locationTypePK != null) {
430            if(this.locationTypePK.equals(locationTypePK)) {
431                update = false;
432            }
433        } else if(locationTypePK == null) {
434            update = false;
435        }
436        
437        if(update) {
438            this.locationTypePK = locationTypePK;
439            locationTypePKHasBeenModified = true;
440            clearHashAndString();
441        }
442    }
443    
444    public boolean getLocationTypePKHasBeenModified() {
445        return locationTypePKHasBeenModified;
446    }
447    
448    public LocationUseTypePK getLocationUseTypePK() {
449        return locationUseTypePK;
450    }
451    
452    public void setLocationUseTypePK(LocationUseTypePK locationUseTypePK)
453            throws PersistenceNotNullException {
454        checkForNull(locationUseTypePK);
455        
456        boolean update = true;
457        
458        if(this.locationUseTypePK != null) {
459            if(this.locationUseTypePK.equals(locationUseTypePK)) {
460                update = false;
461            }
462        } else if(locationUseTypePK == null) {
463            update = false;
464        }
465        
466        if(update) {
467            this.locationUseTypePK = locationUseTypePK;
468            locationUseTypePKHasBeenModified = true;
469            clearHashAndString();
470        }
471    }
472    
473    public boolean getLocationUseTypePKHasBeenModified() {
474        return locationUseTypePKHasBeenModified;
475    }
476    
477    public Integer getVelocity() {
478        return velocity;
479    }
480    
481    public void setVelocity(Integer velocity)
482            throws PersistenceNotNullException {
483        checkForNull(velocity);
484        
485        boolean update = true;
486        
487        if(this.velocity != null) {
488            if(this.velocity.equals(velocity)) {
489                update = false;
490            }
491        } else if(velocity == null) {
492            update = false;
493        }
494        
495        if(update) {
496            this.velocity = velocity;
497            velocityHasBeenModified = true;
498            clearHashAndString();
499        }
500    }
501    
502    public boolean getVelocityHasBeenModified() {
503        return velocityHasBeenModified;
504    }
505    
506    public InventoryLocationGroupPK getInventoryLocationGroupPK() {
507        return inventoryLocationGroupPK;
508    }
509    
510    public void setInventoryLocationGroupPK(InventoryLocationGroupPK inventoryLocationGroupPK)
511            throws PersistenceNotNullException {
512        checkForNull(inventoryLocationGroupPK);
513        
514        boolean update = true;
515        
516        if(this.inventoryLocationGroupPK != null) {
517            if(this.inventoryLocationGroupPK.equals(inventoryLocationGroupPK)) {
518                update = false;
519            }
520        } else if(inventoryLocationGroupPK == null) {
521            update = false;
522        }
523        
524        if(update) {
525            this.inventoryLocationGroupPK = inventoryLocationGroupPK;
526            inventoryLocationGroupPKHasBeenModified = true;
527            clearHashAndString();
528        }
529    }
530    
531    public boolean getInventoryLocationGroupPKHasBeenModified() {
532        return inventoryLocationGroupPKHasBeenModified;
533    }
534    
535    public Long getFromTime() {
536        return fromTime;
537    }
538    
539    public void setFromTime(Long fromTime)
540            throws PersistenceNotNullException {
541        checkForNull(fromTime);
542        
543        boolean update = true;
544        
545        if(this.fromTime != null) {
546            if(this.fromTime.equals(fromTime)) {
547                update = false;
548            }
549        } else if(fromTime == null) {
550            update = false;
551        }
552        
553        if(update) {
554            this.fromTime = fromTime;
555            fromTimeHasBeenModified = true;
556            clearHashAndString();
557        }
558    }
559    
560    public boolean getFromTimeHasBeenModified() {
561        return fromTimeHasBeenModified;
562    }
563    
564    public Long getThruTime() {
565        return thruTime;
566    }
567    
568    public void setThruTime(Long thruTime)
569            throws PersistenceNotNullException {
570        checkForNull(thruTime);
571        
572        boolean update = true;
573        
574        if(this.thruTime != null) {
575            if(this.thruTime.equals(thruTime)) {
576                update = false;
577            }
578        } else if(thruTime == null) {
579            update = false;
580        }
581        
582        if(update) {
583            this.thruTime = thruTime;
584            thruTimeHasBeenModified = true;
585            clearHashAndString();
586        }
587    }
588    
589    public boolean getThruTimeHasBeenModified() {
590        return thruTimeHasBeenModified;
591    }
592    
593}