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 * ItemAdditionalCharge.java 021 */ 022 023package com.echothree.model.data.item.server.entity; 024 025import com.echothree.model.data.item.common.pk.ItemAdditionalChargePK; 026 027import com.echothree.model.data.item.common.pk.ItemPK; 028import com.echothree.model.data.item.common.pk.ItemAdditionalChargeTypePK; 029import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK; 030import com.echothree.model.data.accounting.common.pk.CurrencyPK; 031 032import com.echothree.model.data.item.server.entity.Item; 033import com.echothree.model.data.item.server.entity.ItemAdditionalChargeType; 034import com.echothree.model.data.uom.server.entity.UnitOfMeasureType; 035import com.echothree.model.data.accounting.server.entity.Currency; 036 037import com.echothree.model.data.item.server.factory.ItemFactory; 038import com.echothree.model.data.item.server.factory.ItemAdditionalChargeTypeFactory; 039import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory; 040import com.echothree.model.data.accounting.server.factory.CurrencyFactory; 041 042import com.echothree.model.data.item.common.pk.ItemAdditionalChargePK; 043 044import com.echothree.model.data.item.server.value.ItemAdditionalChargeValue; 045 046import com.echothree.model.data.item.server.factory.ItemAdditionalChargeFactory; 047 048import com.echothree.util.common.exception.PersistenceException; 049import com.echothree.util.common.exception.PersistenceDatabaseException; 050import com.echothree.util.common.exception.PersistenceNotNullException; 051import com.echothree.util.common.exception.PersistenceReadOnlyException; 052 053import com.echothree.util.common.persistence.BasePK; 054 055import com.echothree.util.common.persistence.type.ByteArray; 056 057import com.echothree.util.server.persistence.BaseEntity; 058import com.echothree.util.server.persistence.EntityPermission; 059import com.echothree.util.server.persistence.Session; 060import com.echothree.util.server.persistence.ThreadSession; 061 062import java.io.Serializable; 063 064public class ItemAdditionalCharge 065 extends BaseEntity 066 implements Serializable { 067 068 private ItemAdditionalChargePK _pk; 069 private ItemAdditionalChargeValue _value; 070 071 /** Creates a new instance of ItemAdditionalCharge */ 072 public ItemAdditionalCharge() 073 throws PersistenceException { 074 super(); 075 } 076 077 /** Creates a new instance of ItemAdditionalCharge */ 078 public ItemAdditionalCharge(ItemAdditionalChargeValue value, EntityPermission entityPermission) { 079 super(entityPermission); 080 081 _value = value; 082 _pk = value.getPrimaryKey(); 083 } 084 085 @Override 086 public ItemAdditionalChargeFactory getBaseFactoryInstance() { 087 return ItemAdditionalChargeFactory.getInstance(); 088 } 089 090 @Override 091 public boolean hasBeenModified() { 092 return _value.hasBeenModified(); 093 } 094 095 @Override 096 public int hashCode() { 097 return _pk.hashCode(); 098 } 099 100 @Override 101 public String toString() { 102 return _pk.toString(); 103 } 104 105 @Override 106 public boolean equals(Object other) { 107 if(this == other) 108 return true; 109 110 if(other instanceof ItemAdditionalCharge that) { 111 ItemAdditionalChargeValue thatValue = that.getItemAdditionalChargeValue(); 112 return _value.equals(thatValue); 113 } else { 114 return false; 115 } 116 } 117 118 @Override 119 public void store(Session session) 120 throws PersistenceDatabaseException { 121 getBaseFactoryInstance().store(session, this); 122 } 123 124 @Override 125 public void remove(Session session) 126 throws PersistenceDatabaseException { 127 getBaseFactoryInstance().remove(session, this); 128 } 129 130 @Override 131 public void remove() 132 throws PersistenceDatabaseException { 133 getBaseFactoryInstance().remove(ThreadSession.currentSession(), this); 134 } 135 136 public ItemAdditionalChargeValue getItemAdditionalChargeValue() { 137 return _value; 138 } 139 140 public void setItemAdditionalChargeValue(ItemAdditionalChargeValue value) 141 throws PersistenceReadOnlyException { 142 checkReadWrite(); 143 _value = value; 144 } 145 146 @Override 147 public ItemAdditionalChargePK getPrimaryKey() { 148 return _pk; 149 } 150 151 public ItemPK getItemPK() { 152 return _value.getItemPK(); 153 } 154 155 public Item getItem(Session session, EntityPermission entityPermission) { 156 return ItemFactory.getInstance().getEntityFromPK(session, entityPermission, getItemPK()); 157 } 158 159 public Item getItem(EntityPermission entityPermission) { 160 return getItem(ThreadSession.currentSession(), entityPermission); 161 } 162 163 public Item getItem(Session session) { 164 return getItem(session, EntityPermission.READ_ONLY); 165 } 166 167 public Item getItem() { 168 return getItem(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 169 } 170 171 public Item getItemForUpdate(Session session) { 172 return getItem(session, EntityPermission.READ_WRITE); 173 } 174 175 public Item getItemForUpdate() { 176 return getItem(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 177 } 178 179 public void setItemPK(ItemPK itemPK) 180 throws PersistenceNotNullException, PersistenceReadOnlyException { 181 checkReadWrite(); 182 _value.setItemPK(itemPK); 183 } 184 185 public void setItem(Item entity) { 186 setItemPK(entity == null? null: entity.getPrimaryKey()); 187 } 188 189 public boolean getItemPKHasBeenModified() { 190 return _value.getItemPKHasBeenModified(); 191 } 192 193 public ItemAdditionalChargeTypePK getItemAdditionalChargeTypePK() { 194 return _value.getItemAdditionalChargeTypePK(); 195 } 196 197 public ItemAdditionalChargeType getItemAdditionalChargeType(Session session, EntityPermission entityPermission) { 198 return ItemAdditionalChargeTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getItemAdditionalChargeTypePK()); 199 } 200 201 public ItemAdditionalChargeType getItemAdditionalChargeType(EntityPermission entityPermission) { 202 return getItemAdditionalChargeType(ThreadSession.currentSession(), entityPermission); 203 } 204 205 public ItemAdditionalChargeType getItemAdditionalChargeType(Session session) { 206 return getItemAdditionalChargeType(session, EntityPermission.READ_ONLY); 207 } 208 209 public ItemAdditionalChargeType getItemAdditionalChargeType() { 210 return getItemAdditionalChargeType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 211 } 212 213 public ItemAdditionalChargeType getItemAdditionalChargeTypeForUpdate(Session session) { 214 return getItemAdditionalChargeType(session, EntityPermission.READ_WRITE); 215 } 216 217 public ItemAdditionalChargeType getItemAdditionalChargeTypeForUpdate() { 218 return getItemAdditionalChargeType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 219 } 220 221 public void setItemAdditionalChargeTypePK(ItemAdditionalChargeTypePK itemAdditionalChargeTypePK) 222 throws PersistenceNotNullException, PersistenceReadOnlyException { 223 checkReadWrite(); 224 _value.setItemAdditionalChargeTypePK(itemAdditionalChargeTypePK); 225 } 226 227 public void setItemAdditionalChargeType(ItemAdditionalChargeType entity) { 228 setItemAdditionalChargeTypePK(entity == null? null: entity.getPrimaryKey()); 229 } 230 231 public boolean getItemAdditionalChargeTypePKHasBeenModified() { 232 return _value.getItemAdditionalChargeTypePKHasBeenModified(); 233 } 234 235 public UnitOfMeasureTypePK getUnitOfMeasureTypePK() { 236 return _value.getUnitOfMeasureTypePK(); 237 } 238 239 public UnitOfMeasureType getUnitOfMeasureType(Session session, EntityPermission entityPermission) { 240 UnitOfMeasureTypePK pk = getUnitOfMeasureTypePK(); 241 UnitOfMeasureType entity = pk == null? null: UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 242 243 return entity; 244 } 245 246 public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) { 247 return getUnitOfMeasureType(ThreadSession.currentSession(), entityPermission); 248 } 249 250 public UnitOfMeasureType getUnitOfMeasureType(Session session) { 251 return getUnitOfMeasureType(session, EntityPermission.READ_ONLY); 252 } 253 254 public UnitOfMeasureType getUnitOfMeasureType() { 255 return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 256 } 257 258 public UnitOfMeasureType getUnitOfMeasureTypeForUpdate(Session session) { 259 return getUnitOfMeasureType(session, EntityPermission.READ_WRITE); 260 } 261 262 public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() { 263 return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 264 } 265 266 public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK) 267 throws PersistenceNotNullException, PersistenceReadOnlyException { 268 checkReadWrite(); 269 _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK); 270 } 271 272 public void setUnitOfMeasureType(UnitOfMeasureType entity) { 273 setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey()); 274 } 275 276 public boolean getUnitOfMeasureTypePKHasBeenModified() { 277 return _value.getUnitOfMeasureTypePKHasBeenModified(); 278 } 279 280 public Long getMinimumQuantity() { 281 return _value.getMinimumQuantity(); 282 } 283 284 public void setMinimumQuantity(Long minimumQuantity) 285 throws PersistenceNotNullException, PersistenceReadOnlyException { 286 checkReadWrite(); 287 _value.setMinimumQuantity(minimumQuantity); 288 } 289 290 public boolean getMinimumQuantityHasBeenModified() { 291 return _value.getMinimumQuantityHasBeenModified(); 292 } 293 294 public Long getMaximumQuantity() { 295 return _value.getMaximumQuantity(); 296 } 297 298 public void setMaximumQuantity(Long maximumQuantity) 299 throws PersistenceNotNullException, PersistenceReadOnlyException { 300 checkReadWrite(); 301 _value.setMaximumQuantity(maximumQuantity); 302 } 303 304 public boolean getMaximumQuantityHasBeenModified() { 305 return _value.getMaximumQuantityHasBeenModified(); 306 } 307 308 public CurrencyPK getCurrencyPK() { 309 return _value.getCurrencyPK(); 310 } 311 312 public Currency getCurrency(Session session, EntityPermission entityPermission) { 313 return CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, getCurrencyPK()); 314 } 315 316 public Currency getCurrency(EntityPermission entityPermission) { 317 return getCurrency(ThreadSession.currentSession(), entityPermission); 318 } 319 320 public Currency getCurrency(Session session) { 321 return getCurrency(session, EntityPermission.READ_ONLY); 322 } 323 324 public Currency getCurrency() { 325 return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 326 } 327 328 public Currency getCurrencyForUpdate(Session session) { 329 return getCurrency(session, EntityPermission.READ_WRITE); 330 } 331 332 public Currency getCurrencyForUpdate() { 333 return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 334 } 335 336 public void setCurrencyPK(CurrencyPK currencyPK) 337 throws PersistenceNotNullException, PersistenceReadOnlyException { 338 checkReadWrite(); 339 _value.setCurrencyPK(currencyPK); 340 } 341 342 public void setCurrency(Currency entity) { 343 setCurrencyPK(entity == null? null: entity.getPrimaryKey()); 344 } 345 346 public boolean getCurrencyPKHasBeenModified() { 347 return _value.getCurrencyPKHasBeenModified(); 348 } 349 350 public Long getUnitPrice() { 351 return _value.getUnitPrice(); 352 } 353 354 public void setUnitPrice(Long unitPrice) 355 throws PersistenceNotNullException, PersistenceReadOnlyException { 356 checkReadWrite(); 357 _value.setUnitPrice(unitPrice); 358 } 359 360 public boolean getUnitPriceHasBeenModified() { 361 return _value.getUnitPriceHasBeenModified(); 362 } 363 364 public Long getFromTime() { 365 return _value.getFromTime(); 366 } 367 368 public void setFromTime(Long fromTime) 369 throws PersistenceNotNullException, PersistenceReadOnlyException { 370 checkReadWrite(); 371 _value.setFromTime(fromTime); 372 } 373 374 public boolean getFromTimeHasBeenModified() { 375 return _value.getFromTimeHasBeenModified(); 376 } 377 378 public Long getThruTime() { 379 return _value.getThruTime(); 380 } 381 382 public void setThruTime(Long thruTime) 383 throws PersistenceNotNullException, PersistenceReadOnlyException { 384 checkReadWrite(); 385 _value.setThruTime(thruTime); 386 } 387 388 public boolean getThruTimeHasBeenModified() { 389 return _value.getThruTimeHasBeenModified(); 390 } 391 392}