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 * OfferDetail.java 021 */ 022 023package com.echothree.model.data.offer.server.entity; 024 025import com.echothree.model.data.offer.common.pk.OfferDetailPK; 026 027import com.echothree.model.data.offer.common.pk.OfferPK; 028import com.echothree.model.data.sequence.common.pk.SequencePK; 029import com.echothree.model.data.party.common.pk.PartyPK; 030import com.echothree.model.data.selector.common.pk.SelectorPK; 031import com.echothree.model.data.filter.common.pk.FilterPK; 032 033import com.echothree.model.data.offer.server.entity.Offer; 034import com.echothree.model.data.sequence.server.entity.Sequence; 035import com.echothree.model.data.party.server.entity.Party; 036import com.echothree.model.data.selector.server.entity.Selector; 037import com.echothree.model.data.filter.server.entity.Filter; 038 039import com.echothree.model.data.offer.server.factory.OfferFactory; 040import com.echothree.model.data.sequence.server.factory.SequenceFactory; 041import com.echothree.model.data.party.server.factory.PartyFactory; 042import com.echothree.model.data.selector.server.factory.SelectorFactory; 043import com.echothree.model.data.filter.server.factory.FilterFactory; 044 045import com.echothree.model.data.offer.common.pk.OfferDetailPK; 046 047import com.echothree.model.data.offer.server.value.OfferDetailValue; 048 049import com.echothree.model.data.offer.server.factory.OfferDetailFactory; 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 OfferDetail 071 extends BaseEntity 072 implements Serializable { 073 074 private OfferDetailPK _pk; 075 private OfferDetailValue _value; 076 077 /** Creates a new instance of OfferDetail */ 078 public OfferDetail() 079 throws PersistenceException { 080 super(); 081 } 082 083 /** Creates a new instance of OfferDetail */ 084 public OfferDetail(OfferDetailValue value, EntityPermission entityPermission) { 085 super(entityPermission); 086 087 _value = value; 088 _pk = value.getPrimaryKey(); 089 } 090 091 @Override 092 @Nonnull 093 public OfferDetailFactory getBaseFactoryInstance() { 094 return OfferDetailFactory.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 OfferDetail that) { 119 OfferDetailValue thatValue = that.getOfferDetailValue(); 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 OfferDetailValue getOfferDetailValue() { 140 return _value; 141 } 142 143 public void setOfferDetailValue(@Nonnull OfferDetailValue value) 144 throws PersistenceReadOnlyException { 145 checkReadWrite(); 146 _value = value; 147 } 148 149 @Override 150 @Nonnull 151 public OfferDetailPK getPrimaryKey() { 152 return _pk; 153 } 154 155 @Nonnull 156 public OfferPK getOfferPK() { 157 return _value.getOfferPK(); 158 } 159 160 @Nonnull 161 public Offer getOffer(EntityPermission entityPermission) { 162 return OfferFactory.getInstance().getEntityFromPK(entityPermission, getOfferPK()); 163 } 164 165 @Nonnull 166 public Offer getOffer() { 167 return getOffer(EntityPermission.READ_ONLY); 168 } 169 170 @Nonnull 171 public Offer getOfferForUpdate() { 172 return getOffer(EntityPermission.READ_WRITE); 173 } 174 175 public void setOfferPK(@Nonnull OfferPK offerPK) 176 throws PersistenceNotNullException, PersistenceReadOnlyException { 177 checkReadWrite(); 178 _value.setOfferPK(offerPK); 179 } 180 181 public void setOffer(@Nonnull Offer entity) { 182 setOfferPK(entity == null ? null : entity.getPrimaryKey()); 183 } 184 185 public boolean getOfferPKHasBeenModified() { 186 return _value.getOfferPKHasBeenModified(); 187 } 188 189 @Nonnull 190 public String getOfferName() { 191 return _value.getOfferName(); 192 } 193 194 public void setOfferName(@Nonnull String offerName) 195 throws PersistenceNotNullException, PersistenceReadOnlyException { 196 checkReadWrite(); 197 _value.setOfferName(offerName); 198 } 199 200 public boolean getOfferNameHasBeenModified() { 201 return _value.getOfferNameHasBeenModified(); 202 } 203 204 @Nullable 205 public SequencePK getSalesOrderSequencePK() { 206 return _value.getSalesOrderSequencePK(); 207 } 208 209 @Nullable 210 public Sequence getSalesOrderSequence(EntityPermission entityPermission) { 211 SequencePK pk = getSalesOrderSequencePK(); 212 Sequence entity = pk == null? null: SequenceFactory.getInstance().getEntityFromPK(entityPermission, pk); 213 214 return entity; 215 } 216 217 @Nullable 218 public Sequence getSalesOrderSequence() { 219 return getSalesOrderSequence(EntityPermission.READ_ONLY); 220 } 221 222 @Nullable 223 public Sequence getSalesOrderSequenceForUpdate() { 224 return getSalesOrderSequence(EntityPermission.READ_WRITE); 225 } 226 227 public void setSalesOrderSequencePK(@Nullable SequencePK salesOrderSequencePK) 228 throws PersistenceNotNullException, PersistenceReadOnlyException { 229 checkReadWrite(); 230 _value.setSalesOrderSequencePK(salesOrderSequencePK); 231 } 232 233 public void setSalesOrderSequence(@Nullable Sequence entity) { 234 setSalesOrderSequencePK(entity == null ? null : entity.getPrimaryKey()); 235 } 236 237 public boolean getSalesOrderSequencePKHasBeenModified() { 238 return _value.getSalesOrderSequencePKHasBeenModified(); 239 } 240 241 @Nonnull 242 public PartyPK getDepartmentPartyPK() { 243 return _value.getDepartmentPartyPK(); 244 } 245 246 @Nonnull 247 public Party getDepartmentParty(EntityPermission entityPermission) { 248 return PartyFactory.getInstance().getEntityFromPK(entityPermission, getDepartmentPartyPK()); 249 } 250 251 @Nonnull 252 public Party getDepartmentParty() { 253 return getDepartmentParty(EntityPermission.READ_ONLY); 254 } 255 256 @Nonnull 257 public Party getDepartmentPartyForUpdate() { 258 return getDepartmentParty(EntityPermission.READ_WRITE); 259 } 260 261 public void setDepartmentPartyPK(@Nonnull PartyPK departmentPartyPK) 262 throws PersistenceNotNullException, PersistenceReadOnlyException { 263 checkReadWrite(); 264 _value.setDepartmentPartyPK(departmentPartyPK); 265 } 266 267 public void setDepartmentParty(@Nonnull Party entity) { 268 setDepartmentPartyPK(entity == null ? null : entity.getPrimaryKey()); 269 } 270 271 public boolean getDepartmentPartyPKHasBeenModified() { 272 return _value.getDepartmentPartyPKHasBeenModified(); 273 } 274 275 @Nullable 276 public SelectorPK getOfferItemSelectorPK() { 277 return _value.getOfferItemSelectorPK(); 278 } 279 280 @Nullable 281 public Selector getOfferItemSelector(EntityPermission entityPermission) { 282 SelectorPK pk = getOfferItemSelectorPK(); 283 Selector entity = pk == null? null: SelectorFactory.getInstance().getEntityFromPK(entityPermission, pk); 284 285 return entity; 286 } 287 288 @Nullable 289 public Selector getOfferItemSelector() { 290 return getOfferItemSelector(EntityPermission.READ_ONLY); 291 } 292 293 @Nullable 294 public Selector getOfferItemSelectorForUpdate() { 295 return getOfferItemSelector(EntityPermission.READ_WRITE); 296 } 297 298 public void setOfferItemSelectorPK(@Nullable SelectorPK offerItemSelectorPK) 299 throws PersistenceNotNullException, PersistenceReadOnlyException { 300 checkReadWrite(); 301 _value.setOfferItemSelectorPK(offerItemSelectorPK); 302 } 303 304 public void setOfferItemSelector(@Nullable Selector entity) { 305 setOfferItemSelectorPK(entity == null ? null : entity.getPrimaryKey()); 306 } 307 308 public boolean getOfferItemSelectorPKHasBeenModified() { 309 return _value.getOfferItemSelectorPKHasBeenModified(); 310 } 311 312 @Nullable 313 public FilterPK getOfferItemPriceFilterPK() { 314 return _value.getOfferItemPriceFilterPK(); 315 } 316 317 @Nullable 318 public Filter getOfferItemPriceFilter(EntityPermission entityPermission) { 319 FilterPK pk = getOfferItemPriceFilterPK(); 320 Filter entity = pk == null? null: FilterFactory.getInstance().getEntityFromPK(entityPermission, pk); 321 322 return entity; 323 } 324 325 @Nullable 326 public Filter getOfferItemPriceFilter() { 327 return getOfferItemPriceFilter(EntityPermission.READ_ONLY); 328 } 329 330 @Nullable 331 public Filter getOfferItemPriceFilterForUpdate() { 332 return getOfferItemPriceFilter(EntityPermission.READ_WRITE); 333 } 334 335 public void setOfferItemPriceFilterPK(@Nullable FilterPK offerItemPriceFilterPK) 336 throws PersistenceNotNullException, PersistenceReadOnlyException { 337 checkReadWrite(); 338 _value.setOfferItemPriceFilterPK(offerItemPriceFilterPK); 339 } 340 341 public void setOfferItemPriceFilter(@Nullable Filter entity) { 342 setOfferItemPriceFilterPK(entity == null ? null : entity.getPrimaryKey()); 343 } 344 345 public boolean getOfferItemPriceFilterPKHasBeenModified() { 346 return _value.getOfferItemPriceFilterPKHasBeenModified(); 347 } 348 349 @Nonnull 350 public Boolean getIsDefault() { 351 return _value.getIsDefault(); 352 } 353 354 public void setIsDefault(@Nonnull Boolean isDefault) 355 throws PersistenceNotNullException, PersistenceReadOnlyException { 356 checkReadWrite(); 357 _value.setIsDefault(isDefault); 358 } 359 360 public boolean getIsDefaultHasBeenModified() { 361 return _value.getIsDefaultHasBeenModified(); 362 } 363 364 @Nonnull 365 public Integer getSortOrder() { 366 return _value.getSortOrder(); 367 } 368 369 public void setSortOrder(@Nonnull Integer sortOrder) 370 throws PersistenceNotNullException, PersistenceReadOnlyException { 371 checkReadWrite(); 372 _value.setSortOrder(sortOrder); 373 } 374 375 public boolean getSortOrderHasBeenModified() { 376 return _value.getSortOrderHasBeenModified(); 377 } 378 379 @Nonnull 380 public Long getFromTime() { 381 return _value.getFromTime(); 382 } 383 384 public void setFromTime(@Nonnull Long fromTime) 385 throws PersistenceNotNullException, PersistenceReadOnlyException { 386 checkReadWrite(); 387 _value.setFromTime(fromTime); 388 } 389 390 public boolean getFromTimeHasBeenModified() { 391 return _value.getFromTimeHasBeenModified(); 392 } 393 394 @Nonnull 395 public Long getThruTime() { 396 return _value.getThruTime(); 397 } 398 399 public void setThruTime(@Nonnull Long thruTime) 400 throws PersistenceNotNullException, PersistenceReadOnlyException { 401 checkReadWrite(); 402 _value.setThruTime(thruTime); 403 } 404 405 public boolean getThruTimeHasBeenModified() { 406 return _value.getThruTimeHasBeenModified(); 407 } 408 409}