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 * VendorItemDetail.java 021 */ 022 023package com.echothree.model.data.vendor.server.entity; 024 025import com.echothree.model.data.vendor.common.pk.VendorItemDetailPK; 026 027import com.echothree.model.data.vendor.common.pk.VendorItemPK; 028import com.echothree.model.data.item.common.pk.ItemPK; 029import com.echothree.model.data.party.common.pk.PartyPK; 030import com.echothree.model.data.cancellationpolicy.common.pk.CancellationPolicyPK; 031import com.echothree.model.data.returnpolicy.common.pk.ReturnPolicyPK; 032 033import com.echothree.model.data.vendor.server.entity.VendorItem; 034import com.echothree.model.data.item.server.entity.Item; 035import com.echothree.model.data.party.server.entity.Party; 036import com.echothree.model.data.cancellationpolicy.server.entity.CancellationPolicy; 037import com.echothree.model.data.returnpolicy.server.entity.ReturnPolicy; 038 039import com.echothree.model.data.vendor.server.factory.VendorItemFactory; 040import com.echothree.model.data.item.server.factory.ItemFactory; 041import com.echothree.model.data.party.server.factory.PartyFactory; 042import com.echothree.model.data.cancellationpolicy.server.factory.CancellationPolicyFactory; 043import com.echothree.model.data.returnpolicy.server.factory.ReturnPolicyFactory; 044 045import com.echothree.model.data.vendor.common.pk.VendorItemDetailPK; 046 047import com.echothree.model.data.vendor.server.value.VendorItemDetailValue; 048 049import com.echothree.model.data.vendor.server.factory.VendorItemDetailFactory; 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 067import javax.annotation.Nonnull; 068import javax.annotation.Nullable; 069 070public class VendorItemDetail 071 extends BaseEntity 072 implements Serializable { 073 074 private VendorItemDetailPK _pk; 075 private VendorItemDetailValue _value; 076 077 /** Creates a new instance of VendorItemDetail */ 078 public VendorItemDetail() 079 throws PersistenceException { 080 super(); 081 } 082 083 /** Creates a new instance of VendorItemDetail */ 084 public VendorItemDetail(VendorItemDetailValue value, EntityPermission entityPermission) { 085 super(entityPermission); 086 087 _value = value; 088 _pk = value.getPrimaryKey(); 089 } 090 091 @Override 092 @Nonnull 093 public VendorItemDetailFactory getBaseFactoryInstance() { 094 return VendorItemDetailFactory.getInstance(); 095 } 096 097 @Override 098 public boolean hasBeenModified() { 099 return _value.hasBeenModified(); 100 } 101 102 @Override 103 public int hashCode() { 104 return _pk.hashCode(); 105 } 106 107 @Override 108 @Nonnull 109 public String toString() { 110 return _pk.toString(); 111 } 112 113 @Override 114 public boolean equals(Object other) { 115 if(this == other) 116 return true; 117 118 if(other instanceof VendorItemDetail that) { 119 VendorItemDetailValue thatValue = that.getVendorItemDetailValue(); 120 return _value.equals(thatValue); 121 } else { 122 return false; 123 } 124 } 125 126 @Override 127 public void store() 128 throws PersistenceDatabaseException { 129 getBaseFactoryInstance().store(this); 130 } 131 132 @Override 133 public void remove() 134 throws PersistenceDatabaseException { 135 getBaseFactoryInstance().remove(this); 136 } 137 138 @Nonnull 139 public VendorItemDetailValue getVendorItemDetailValue() { 140 return _value; 141 } 142 143 public void setVendorItemDetailValue(@Nonnull VendorItemDetailValue value) 144 throws PersistenceReadOnlyException { 145 checkReadWrite(); 146 _value = value; 147 } 148 149 @Override 150 @Nonnull 151 public VendorItemDetailPK getPrimaryKey() { 152 return _pk; 153 } 154 155 @Nonnull 156 public VendorItemPK getVendorItemPK() { 157 return _value.getVendorItemPK(); 158 } 159 160 @Nonnull 161 public VendorItem getVendorItem(EntityPermission entityPermission) { 162 return VendorItemFactory.getInstance().getEntityFromPK(entityPermission, getVendorItemPK()); 163 } 164 165 @Nonnull 166 public VendorItem getVendorItem() { 167 return getVendorItem(EntityPermission.READ_ONLY); 168 } 169 170 @Nonnull 171 public VendorItem getVendorItemForUpdate() { 172 return getVendorItem(EntityPermission.READ_WRITE); 173 } 174 175 public void setVendorItemPK(@Nonnull VendorItemPK vendorItemPK) 176 throws PersistenceNotNullException, PersistenceReadOnlyException { 177 checkReadWrite(); 178 _value.setVendorItemPK(vendorItemPK); 179 } 180 181 public void setVendorItem(@Nonnull VendorItem entity) { 182 setVendorItemPK(entity == null ? null : entity.getPrimaryKey()); 183 } 184 185 public boolean getVendorItemPKHasBeenModified() { 186 return _value.getVendorItemPKHasBeenModified(); 187 } 188 189 @Nonnull 190 public ItemPK getItemPK() { 191 return _value.getItemPK(); 192 } 193 194 @Nonnull 195 public Item getItem(EntityPermission entityPermission) { 196 return ItemFactory.getInstance().getEntityFromPK(entityPermission, getItemPK()); 197 } 198 199 @Nonnull 200 public Item getItem() { 201 return getItem(EntityPermission.READ_ONLY); 202 } 203 204 @Nonnull 205 public Item getItemForUpdate() { 206 return getItem(EntityPermission.READ_WRITE); 207 } 208 209 public void setItemPK(@Nonnull ItemPK itemPK) 210 throws PersistenceNotNullException, PersistenceReadOnlyException { 211 checkReadWrite(); 212 _value.setItemPK(itemPK); 213 } 214 215 public void setItem(@Nonnull Item entity) { 216 setItemPK(entity == null ? null : entity.getPrimaryKey()); 217 } 218 219 public boolean getItemPKHasBeenModified() { 220 return _value.getItemPKHasBeenModified(); 221 } 222 223 @Nonnull 224 public PartyPK getVendorPartyPK() { 225 return _value.getVendorPartyPK(); 226 } 227 228 @Nonnull 229 public Party getVendorParty(EntityPermission entityPermission) { 230 return PartyFactory.getInstance().getEntityFromPK(entityPermission, getVendorPartyPK()); 231 } 232 233 @Nonnull 234 public Party getVendorParty() { 235 return getVendorParty(EntityPermission.READ_ONLY); 236 } 237 238 @Nonnull 239 public Party getVendorPartyForUpdate() { 240 return getVendorParty(EntityPermission.READ_WRITE); 241 } 242 243 public void setVendorPartyPK(@Nonnull PartyPK vendorPartyPK) 244 throws PersistenceNotNullException, PersistenceReadOnlyException { 245 checkReadWrite(); 246 _value.setVendorPartyPK(vendorPartyPK); 247 } 248 249 public void setVendorParty(@Nonnull Party entity) { 250 setVendorPartyPK(entity == null ? null : entity.getPrimaryKey()); 251 } 252 253 public boolean getVendorPartyPKHasBeenModified() { 254 return _value.getVendorPartyPKHasBeenModified(); 255 } 256 257 @Nonnull 258 public String getVendorItemName() { 259 return _value.getVendorItemName(); 260 } 261 262 public void setVendorItemName(@Nonnull String vendorItemName) 263 throws PersistenceNotNullException, PersistenceReadOnlyException { 264 checkReadWrite(); 265 _value.setVendorItemName(vendorItemName); 266 } 267 268 public boolean getVendorItemNameHasBeenModified() { 269 return _value.getVendorItemNameHasBeenModified(); 270 } 271 272 @Nullable 273 public String getDescription() { 274 return _value.getDescription(); 275 } 276 277 public void setDescription(@Nullable String description) 278 throws PersistenceNotNullException, PersistenceReadOnlyException { 279 checkReadWrite(); 280 _value.setDescription(description); 281 } 282 283 public boolean getDescriptionHasBeenModified() { 284 return _value.getDescriptionHasBeenModified(); 285 } 286 287 @Nonnull 288 public Integer getPriority() { 289 return _value.getPriority(); 290 } 291 292 public void setPriority(@Nonnull Integer priority) 293 throws PersistenceNotNullException, PersistenceReadOnlyException { 294 checkReadWrite(); 295 _value.setPriority(priority); 296 } 297 298 public boolean getPriorityHasBeenModified() { 299 return _value.getPriorityHasBeenModified(); 300 } 301 302 @Nullable 303 public CancellationPolicyPK getCancellationPolicyPK() { 304 return _value.getCancellationPolicyPK(); 305 } 306 307 @Nullable 308 public CancellationPolicy getCancellationPolicy(EntityPermission entityPermission) { 309 CancellationPolicyPK pk = getCancellationPolicyPK(); 310 CancellationPolicy entity = pk == null? null: CancellationPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk); 311 312 return entity; 313 } 314 315 @Nullable 316 public CancellationPolicy getCancellationPolicy() { 317 return getCancellationPolicy(EntityPermission.READ_ONLY); 318 } 319 320 @Nullable 321 public CancellationPolicy getCancellationPolicyForUpdate() { 322 return getCancellationPolicy(EntityPermission.READ_WRITE); 323 } 324 325 public void setCancellationPolicyPK(@Nullable CancellationPolicyPK cancellationPolicyPK) 326 throws PersistenceNotNullException, PersistenceReadOnlyException { 327 checkReadWrite(); 328 _value.setCancellationPolicyPK(cancellationPolicyPK); 329 } 330 331 public void setCancellationPolicy(@Nullable CancellationPolicy entity) { 332 setCancellationPolicyPK(entity == null ? null : entity.getPrimaryKey()); 333 } 334 335 public boolean getCancellationPolicyPKHasBeenModified() { 336 return _value.getCancellationPolicyPKHasBeenModified(); 337 } 338 339 @Nullable 340 public ReturnPolicyPK getReturnPolicyPK() { 341 return _value.getReturnPolicyPK(); 342 } 343 344 @Nullable 345 public ReturnPolicy getReturnPolicy(EntityPermission entityPermission) { 346 ReturnPolicyPK pk = getReturnPolicyPK(); 347 ReturnPolicy entity = pk == null? null: ReturnPolicyFactory.getInstance().getEntityFromPK(entityPermission, pk); 348 349 return entity; 350 } 351 352 @Nullable 353 public ReturnPolicy getReturnPolicy() { 354 return getReturnPolicy(EntityPermission.READ_ONLY); 355 } 356 357 @Nullable 358 public ReturnPolicy getReturnPolicyForUpdate() { 359 return getReturnPolicy(EntityPermission.READ_WRITE); 360 } 361 362 public void setReturnPolicyPK(@Nullable ReturnPolicyPK returnPolicyPK) 363 throws PersistenceNotNullException, PersistenceReadOnlyException { 364 checkReadWrite(); 365 _value.setReturnPolicyPK(returnPolicyPK); 366 } 367 368 public void setReturnPolicy(@Nullable ReturnPolicy entity) { 369 setReturnPolicyPK(entity == null ? null : entity.getPrimaryKey()); 370 } 371 372 public boolean getReturnPolicyPKHasBeenModified() { 373 return _value.getReturnPolicyPKHasBeenModified(); 374 } 375 376 @Nonnull 377 public Long getFromTime() { 378 return _value.getFromTime(); 379 } 380 381 public void setFromTime(@Nonnull Long fromTime) 382 throws PersistenceNotNullException, PersistenceReadOnlyException { 383 checkReadWrite(); 384 _value.setFromTime(fromTime); 385 } 386 387 public boolean getFromTimeHasBeenModified() { 388 return _value.getFromTimeHasBeenModified(); 389 } 390 391 @Nonnull 392 public Long getThruTime() { 393 return _value.getThruTime(); 394 } 395 396 public void setThruTime(@Nonnull Long thruTime) 397 throws PersistenceNotNullException, PersistenceReadOnlyException { 398 checkReadWrite(); 399 _value.setThruTime(thruTime); 400 } 401 402 public boolean getThruTimeHasBeenModified() { 403 return _value.getThruTimeHasBeenModified(); 404 } 405 406}