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