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 * InventoryCostingPoolStatusValue.java 021 */ 022 023package com.echothree.model.data.inventory.server.value; 024 025import com.echothree.model.data.inventory.common.pk.InventoryCostingPoolStatusPK; 026 027import com.echothree.model.data.inventory.server.factory.InventoryCostingPoolStatusFactory; 028 029import com.echothree.model.data.inventory.common.pk.InventoryCostingPoolPK; 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 InventoryCostingPoolStatusValue 042 extends BaseValue<InventoryCostingPoolStatusPK> 043 implements Cloneable, Serializable { 044 045 private InventoryCostingPoolPK inventoryCostingPoolPK; 046 private boolean inventoryCostingPoolPKHasBeenModified = false; 047 private Integer inventoryLayerSequence; 048 private boolean inventoryLayerSequenceHasBeenModified = false; 049 050 private transient Integer _hashCode = null; 051 private transient String _stringValue = null; 052 053 private void constructFields(InventoryCostingPoolPK inventoryCostingPoolPK, Integer inventoryLayerSequence) 054 throws PersistenceNotNullException { 055 checkForNull(inventoryCostingPoolPK); 056 this.inventoryCostingPoolPK = inventoryCostingPoolPK; 057 checkForNull(inventoryLayerSequence); 058 this.inventoryLayerSequence = inventoryLayerSequence; 059 } 060 061 /** Creates a new instance of InventoryCostingPoolStatusValue */ 062 public InventoryCostingPoolStatusValue(InventoryCostingPoolStatusPK inventoryLayerStatusPK, InventoryCostingPoolPK inventoryCostingPoolPK, Integer inventoryLayerSequence) 063 throws PersistenceNotNullException { 064 super(inventoryLayerStatusPK); 065 constructFields(inventoryCostingPoolPK, inventoryLayerSequence); 066 } 067 068 /** Creates a new instance of InventoryCostingPoolStatusValue */ 069 public InventoryCostingPoolStatusValue(InventoryCostingPoolPK inventoryCostingPoolPK, Integer inventoryLayerSequence) 070 throws PersistenceNotNullException { 071 super(); 072 constructFields(inventoryCostingPoolPK, inventoryLayerSequence); 073 } 074 075 @Override 076 @Nonnull 077 public InventoryCostingPoolStatusFactory getBaseFactoryInstance() { 078 return InventoryCostingPoolStatusFactory.getInstance(); 079 } 080 081 @Override 082 @Nonnull 083 public InventoryCostingPoolStatusValue clone() { 084 Object result; 085 086 try { 087 result = super.clone(); 088 } catch (CloneNotSupportedException cnse) { 089 // This shouldn't happen, fail when it does. 090 throw new PersistenceCloneException(cnse); 091 } 092 093 return (InventoryCostingPoolStatusValue)result; 094 } 095 096 @Override 097 @Nonnull 098 public InventoryCostingPoolStatusPK getPrimaryKey() { 099 if(_primaryKey == null) { 100 _primaryKey = new InventoryCostingPoolStatusPK(entityId); 101 } 102 103 return _primaryKey; 104 } 105 106 private void clearHashAndString() { 107 _hashCode = null; 108 _stringValue = null; 109 } 110 111 @Override 112 public int hashCode() { 113 if(_hashCode == null) { 114 int hashCode = 17; 115 116 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 117 118 hashCode = 37 * hashCode + ((inventoryCostingPoolPK != null) ? inventoryCostingPoolPK.hashCode() : 0); 119 hashCode = 37 * hashCode + ((inventoryLayerSequence != null) ? inventoryLayerSequence.hashCode() : 0); 120 121 _hashCode = hashCode; 122 } 123 124 return _hashCode; 125 } 126 127 @Override 128 @Nonnull 129 public String toString() { 130 if(_stringValue == null) { 131 _stringValue = "{" + 132 "entityId=" + getEntityId() + 133 ", inventoryCostingPoolPK=" + getInventoryCostingPoolPK() + 134 ", inventoryLayerSequence=" + getInventoryLayerSequence() + 135 "}"; 136 } 137 return _stringValue; 138 } 139 140 @Override 141 public boolean equals(Object other) { 142 if(this == other) 143 return true; 144 145 if(!hasIdentity()) 146 return false; 147 148 if(other instanceof InventoryCostingPoolStatusValue that) { 149 if(!that.hasIdentity()) 150 return false; 151 152 Long thisEntityId = getEntityId(); 153 Long thatEntityId = that.getEntityId(); 154 155 boolean objectsEqual = thisEntityId.equals(thatEntityId); 156 if(objectsEqual) 157 objectsEqual = isIdentical(that); 158 159 return objectsEqual; 160 } else { 161 return false; 162 } 163 } 164 165 public boolean isIdentical(Object other) { 166 if(other instanceof InventoryCostingPoolStatusValue that) { 167 boolean objectsEqual = true; 168 169 170 if(objectsEqual) { 171 InventoryCostingPoolPK thisInventoryCostingPoolPK = getInventoryCostingPoolPK(); 172 InventoryCostingPoolPK thatInventoryCostingPoolPK = that.getInventoryCostingPoolPK(); 173 174 if(thisInventoryCostingPoolPK == null) { 175 objectsEqual = objectsEqual && (thatInventoryCostingPoolPK == null); 176 } else { 177 objectsEqual = objectsEqual && thisInventoryCostingPoolPK.equals(thatInventoryCostingPoolPK); 178 } 179 } 180 181 if(objectsEqual) { 182 Integer thisInventoryLayerSequence = getInventoryLayerSequence(); 183 Integer thatInventoryLayerSequence = that.getInventoryLayerSequence(); 184 185 if(thisInventoryLayerSequence == null) { 186 objectsEqual = objectsEqual && (thatInventoryLayerSequence == null); 187 } else { 188 objectsEqual = objectsEqual && thisInventoryLayerSequence.equals(thatInventoryLayerSequence); 189 } 190 } 191 192 return objectsEqual; 193 } else { 194 return false; 195 } 196 } 197 198 @Override 199 public boolean hasBeenModified() { 200 return inventoryCostingPoolPKHasBeenModified || inventoryLayerSequenceHasBeenModified; 201 } 202 203 @Override 204 public void clearHasBeenModified() { 205 inventoryCostingPoolPKHasBeenModified = false; 206 inventoryLayerSequenceHasBeenModified = false; 207 } 208 209 @Nonnull 210 public InventoryCostingPoolPK getInventoryCostingPoolPK() { 211 return inventoryCostingPoolPK; 212 } 213 214 public void setInventoryCostingPoolPK(@Nonnull InventoryCostingPoolPK inventoryCostingPoolPK) 215 throws PersistenceNotNullException { 216 checkForNull(inventoryCostingPoolPK); 217 218 boolean update = true; 219 220 if(this.inventoryCostingPoolPK != null) { 221 if(this.inventoryCostingPoolPK.equals(inventoryCostingPoolPK)) { 222 update = false; 223 } 224 } else if(inventoryCostingPoolPK == null) { 225 update = false; 226 } 227 228 if(update) { 229 this.inventoryCostingPoolPK = inventoryCostingPoolPK; 230 inventoryCostingPoolPKHasBeenModified = true; 231 clearHashAndString(); 232 } 233 } 234 235 public boolean getInventoryCostingPoolPKHasBeenModified() { 236 return inventoryCostingPoolPKHasBeenModified; 237 } 238 239 @Nonnull 240 public Integer getInventoryLayerSequence() { 241 return inventoryLayerSequence; 242 } 243 244 public void setInventoryLayerSequence(@Nonnull Integer inventoryLayerSequence) 245 throws PersistenceNotNullException { 246 checkForNull(inventoryLayerSequence); 247 248 boolean update = true; 249 250 if(this.inventoryLayerSequence != null) { 251 if(this.inventoryLayerSequence.equals(inventoryLayerSequence)) { 252 update = false; 253 } 254 } else if(inventoryLayerSequence == null) { 255 update = false; 256 } 257 258 if(update) { 259 this.inventoryLayerSequence = inventoryLayerSequence; 260 inventoryLayerSequenceHasBeenModified = true; 261 clearHashAndString(); 262 } 263 } 264 265 public boolean getInventoryLayerSequenceHasBeenModified() { 266 return inventoryLayerSequenceHasBeenModified; 267 } 268 269}