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 * InvoiceDetail.java 021 */ 022 023package com.echothree.model.data.invoice.server.entity; 024 025import com.echothree.model.data.invoice.common.pk.InvoiceDetailPK; 026 027import com.echothree.model.data.invoice.common.pk.InvoicePK; 028import com.echothree.model.data.invoice.common.pk.InvoiceTypePK; 029import com.echothree.model.data.payment.common.pk.BillingAccountPK; 030import com.echothree.model.data.accounting.common.pk.GlAccountPK; 031import com.echothree.model.data.term.common.pk.TermPK; 032import com.echothree.model.data.shipment.common.pk.FreeOnBoardPK; 033 034import com.echothree.model.data.invoice.server.entity.Invoice; 035import com.echothree.model.data.invoice.server.entity.InvoiceType; 036import com.echothree.model.data.payment.server.entity.BillingAccount; 037import com.echothree.model.data.accounting.server.entity.GlAccount; 038import com.echothree.model.data.term.server.entity.Term; 039import com.echothree.model.data.shipment.server.entity.FreeOnBoard; 040 041import com.echothree.model.data.invoice.server.factory.InvoiceFactory; 042import com.echothree.model.data.invoice.server.factory.InvoiceTypeFactory; 043import com.echothree.model.data.payment.server.factory.BillingAccountFactory; 044import com.echothree.model.data.accounting.server.factory.GlAccountFactory; 045import com.echothree.model.data.term.server.factory.TermFactory; 046import com.echothree.model.data.shipment.server.factory.FreeOnBoardFactory; 047 048import com.echothree.model.data.invoice.common.pk.InvoiceDetailPK; 049 050import com.echothree.model.data.invoice.server.value.InvoiceDetailValue; 051 052import com.echothree.model.data.invoice.server.factory.InvoiceDetailFactory; 053 054import com.echothree.util.common.exception.PersistenceException; 055import com.echothree.util.common.exception.PersistenceDatabaseException; 056import com.echothree.util.common.exception.PersistenceNotNullException; 057import com.echothree.util.common.exception.PersistenceReadOnlyException; 058 059import com.echothree.util.common.persistence.BasePK; 060 061import com.echothree.util.common.persistence.type.ByteArray; 062 063import com.echothree.util.server.persistence.BaseEntity; 064import com.echothree.util.server.persistence.EntityPermission; 065import com.echothree.util.server.persistence.Session; 066import com.echothree.util.server.persistence.ThreadSession; 067 068import java.io.Serializable; 069 070import javax.annotation.Nonnull; 071import javax.annotation.Nullable; 072 073public class InvoiceDetail 074 extends BaseEntity 075 implements Serializable { 076 077 private InvoiceDetailPK _pk; 078 private InvoiceDetailValue _value; 079 080 /** Creates a new instance of InvoiceDetail */ 081 public InvoiceDetail() 082 throws PersistenceException { 083 super(); 084 } 085 086 /** Creates a new instance of InvoiceDetail */ 087 public InvoiceDetail(InvoiceDetailValue value, EntityPermission entityPermission) { 088 super(entityPermission); 089 090 _value = value; 091 _pk = value.getPrimaryKey(); 092 } 093 094 @Override 095 @Nonnull 096 public InvoiceDetailFactory getBaseFactoryInstance() { 097 return InvoiceDetailFactory.getInstance(); 098 } 099 100 @Override 101 public boolean hasBeenModified() { 102 return _value.hasBeenModified(); 103 } 104 105 @Override 106 public int hashCode() { 107 return _pk.hashCode(); 108 } 109 110 @Override 111 @Nonnull 112 public String toString() { 113 return _pk.toString(); 114 } 115 116 @Override 117 public boolean equals(Object other) { 118 if(this == other) 119 return true; 120 121 if(other instanceof InvoiceDetail that) { 122 InvoiceDetailValue thatValue = that.getInvoiceDetailValue(); 123 return _value.equals(thatValue); 124 } else { 125 return false; 126 } 127 } 128 129 @Override 130 public void store() 131 throws PersistenceDatabaseException { 132 getBaseFactoryInstance().store(this); 133 } 134 135 @Override 136 public void remove() 137 throws PersistenceDatabaseException { 138 getBaseFactoryInstance().remove(this); 139 } 140 141 @Nonnull 142 public InvoiceDetailValue getInvoiceDetailValue() { 143 return _value; 144 } 145 146 public void setInvoiceDetailValue(@Nonnull InvoiceDetailValue value) 147 throws PersistenceReadOnlyException { 148 checkReadWrite(); 149 _value = value; 150 } 151 152 @Override 153 @Nonnull 154 public InvoiceDetailPK getPrimaryKey() { 155 return _pk; 156 } 157 158 @Nonnull 159 public InvoicePK getInvoicePK() { 160 return _value.getInvoicePK(); 161 } 162 163 @Nonnull 164 public Invoice getInvoice(EntityPermission entityPermission) { 165 return InvoiceFactory.getInstance().getEntityFromPK(entityPermission, getInvoicePK()); 166 } 167 168 @Nonnull 169 public Invoice getInvoice() { 170 return getInvoice(EntityPermission.READ_ONLY); 171 } 172 173 @Nonnull 174 public Invoice getInvoiceForUpdate() { 175 return getInvoice(EntityPermission.READ_WRITE); 176 } 177 178 public void setInvoicePK(@Nonnull InvoicePK invoicePK) 179 throws PersistenceNotNullException, PersistenceReadOnlyException { 180 checkReadWrite(); 181 _value.setInvoicePK(invoicePK); 182 } 183 184 public void setInvoice(@Nonnull Invoice entity) { 185 setInvoicePK(entity == null ? null : entity.getPrimaryKey()); 186 } 187 188 public boolean getInvoicePKHasBeenModified() { 189 return _value.getInvoicePKHasBeenModified(); 190 } 191 192 @Nonnull 193 public InvoiceTypePK getInvoiceTypePK() { 194 return _value.getInvoiceTypePK(); 195 } 196 197 @Nonnull 198 public InvoiceType getInvoiceType(EntityPermission entityPermission) { 199 return InvoiceTypeFactory.getInstance().getEntityFromPK(entityPermission, getInvoiceTypePK()); 200 } 201 202 @Nonnull 203 public InvoiceType getInvoiceType() { 204 return getInvoiceType(EntityPermission.READ_ONLY); 205 } 206 207 @Nonnull 208 public InvoiceType getInvoiceTypeForUpdate() { 209 return getInvoiceType(EntityPermission.READ_WRITE); 210 } 211 212 public void setInvoiceTypePK(@Nonnull InvoiceTypePK invoiceTypePK) 213 throws PersistenceNotNullException, PersistenceReadOnlyException { 214 checkReadWrite(); 215 _value.setInvoiceTypePK(invoiceTypePK); 216 } 217 218 public void setInvoiceType(@Nonnull InvoiceType entity) { 219 setInvoiceTypePK(entity == null ? null : entity.getPrimaryKey()); 220 } 221 222 public boolean getInvoiceTypePKHasBeenModified() { 223 return _value.getInvoiceTypePKHasBeenModified(); 224 } 225 226 @Nonnull 227 public String getInvoiceName() { 228 return _value.getInvoiceName(); 229 } 230 231 public void setInvoiceName(@Nonnull String invoiceName) 232 throws PersistenceNotNullException, PersistenceReadOnlyException { 233 checkReadWrite(); 234 _value.setInvoiceName(invoiceName); 235 } 236 237 public boolean getInvoiceNameHasBeenModified() { 238 return _value.getInvoiceNameHasBeenModified(); 239 } 240 241 @Nonnull 242 public BillingAccountPK getBillingAccountPK() { 243 return _value.getBillingAccountPK(); 244 } 245 246 @Nonnull 247 public BillingAccount getBillingAccount(EntityPermission entityPermission) { 248 return BillingAccountFactory.getInstance().getEntityFromPK(entityPermission, getBillingAccountPK()); 249 } 250 251 @Nonnull 252 public BillingAccount getBillingAccount() { 253 return getBillingAccount(EntityPermission.READ_ONLY); 254 } 255 256 @Nonnull 257 public BillingAccount getBillingAccountForUpdate() { 258 return getBillingAccount(EntityPermission.READ_WRITE); 259 } 260 261 public void setBillingAccountPK(@Nonnull BillingAccountPK billingAccountPK) 262 throws PersistenceNotNullException, PersistenceReadOnlyException { 263 checkReadWrite(); 264 _value.setBillingAccountPK(billingAccountPK); 265 } 266 267 public void setBillingAccount(@Nonnull BillingAccount entity) { 268 setBillingAccountPK(entity == null ? null : entity.getPrimaryKey()); 269 } 270 271 public boolean getBillingAccountPKHasBeenModified() { 272 return _value.getBillingAccountPKHasBeenModified(); 273 } 274 275 @Nonnull 276 public GlAccountPK getGlAccountPK() { 277 return _value.getGlAccountPK(); 278 } 279 280 @Nonnull 281 public GlAccount getGlAccount(EntityPermission entityPermission) { 282 return GlAccountFactory.getInstance().getEntityFromPK(entityPermission, getGlAccountPK()); 283 } 284 285 @Nonnull 286 public GlAccount getGlAccount() { 287 return getGlAccount(EntityPermission.READ_ONLY); 288 } 289 290 @Nonnull 291 public GlAccount getGlAccountForUpdate() { 292 return getGlAccount(EntityPermission.READ_WRITE); 293 } 294 295 public void setGlAccountPK(@Nonnull GlAccountPK glAccountPK) 296 throws PersistenceNotNullException, PersistenceReadOnlyException { 297 checkReadWrite(); 298 _value.setGlAccountPK(glAccountPK); 299 } 300 301 public void setGlAccount(@Nonnull GlAccount entity) { 302 setGlAccountPK(entity == null ? null : entity.getPrimaryKey()); 303 } 304 305 public boolean getGlAccountPKHasBeenModified() { 306 return _value.getGlAccountPKHasBeenModified(); 307 } 308 309 @Nonnull 310 public TermPK getTermPK() { 311 return _value.getTermPK(); 312 } 313 314 @Nonnull 315 public Term getTerm(EntityPermission entityPermission) { 316 return TermFactory.getInstance().getEntityFromPK(entityPermission, getTermPK()); 317 } 318 319 @Nonnull 320 public Term getTerm() { 321 return getTerm(EntityPermission.READ_ONLY); 322 } 323 324 @Nonnull 325 public Term getTermForUpdate() { 326 return getTerm(EntityPermission.READ_WRITE); 327 } 328 329 public void setTermPK(@Nonnull TermPK termPK) 330 throws PersistenceNotNullException, PersistenceReadOnlyException { 331 checkReadWrite(); 332 _value.setTermPK(termPK); 333 } 334 335 public void setTerm(@Nonnull Term entity) { 336 setTermPK(entity == null ? null : entity.getPrimaryKey()); 337 } 338 339 public boolean getTermPKHasBeenModified() { 340 return _value.getTermPKHasBeenModified(); 341 } 342 343 @Nullable 344 public FreeOnBoardPK getFreeOnBoardPK() { 345 return _value.getFreeOnBoardPK(); 346 } 347 348 @Nullable 349 public FreeOnBoard getFreeOnBoard(EntityPermission entityPermission) { 350 FreeOnBoardPK pk = getFreeOnBoardPK(); 351 FreeOnBoard entity = pk == null? null: FreeOnBoardFactory.getInstance().getEntityFromPK(entityPermission, pk); 352 353 return entity; 354 } 355 356 @Nullable 357 public FreeOnBoard getFreeOnBoard() { 358 return getFreeOnBoard(EntityPermission.READ_ONLY); 359 } 360 361 @Nullable 362 public FreeOnBoard getFreeOnBoardForUpdate() { 363 return getFreeOnBoard(EntityPermission.READ_WRITE); 364 } 365 366 public void setFreeOnBoardPK(@Nullable FreeOnBoardPK freeOnBoardPK) 367 throws PersistenceNotNullException, PersistenceReadOnlyException { 368 checkReadWrite(); 369 _value.setFreeOnBoardPK(freeOnBoardPK); 370 } 371 372 public void setFreeOnBoard(@Nullable FreeOnBoard entity) { 373 setFreeOnBoardPK(entity == null ? null : entity.getPrimaryKey()); 374 } 375 376 public boolean getFreeOnBoardPKHasBeenModified() { 377 return _value.getFreeOnBoardPKHasBeenModified(); 378 } 379 380 @Nullable 381 public String getReference() { 382 return _value.getReference(); 383 } 384 385 public void setReference(@Nullable String reference) 386 throws PersistenceNotNullException, PersistenceReadOnlyException { 387 checkReadWrite(); 388 _value.setReference(reference); 389 } 390 391 public boolean getReferenceHasBeenModified() { 392 return _value.getReferenceHasBeenModified(); 393 } 394 395 @Nullable 396 public String getDescription() { 397 return _value.getDescription(); 398 } 399 400 public void setDescription(@Nullable String description) 401 throws PersistenceNotNullException, PersistenceReadOnlyException { 402 checkReadWrite(); 403 _value.setDescription(description); 404 } 405 406 public boolean getDescriptionHasBeenModified() { 407 return _value.getDescriptionHasBeenModified(); 408 } 409 410 @Nonnull 411 public Long getFromTime() { 412 return _value.getFromTime(); 413 } 414 415 public void setFromTime(@Nonnull Long fromTime) 416 throws PersistenceNotNullException, PersistenceReadOnlyException { 417 checkReadWrite(); 418 _value.setFromTime(fromTime); 419 } 420 421 public boolean getFromTimeHasBeenModified() { 422 return _value.getFromTimeHasBeenModified(); 423 } 424 425 @Nonnull 426 public Long getThruTime() { 427 return _value.getThruTime(); 428 } 429 430 public void setThruTime(@Nonnull Long thruTime) 431 throws PersistenceNotNullException, PersistenceReadOnlyException { 432 checkReadWrite(); 433 _value.setThruTime(thruTime); 434 } 435 436 public boolean getThruTimeHasBeenModified() { 437 return _value.getThruTimeHasBeenModified(); 438 } 439 440}