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