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 * InvoiceRole.java 021 */ 022 023package com.echothree.model.data.invoice.server.entity; 024 025import com.echothree.model.data.invoice.common.pk.InvoiceRolePK; 026 027import com.echothree.model.data.invoice.common.pk.InvoicePK; 028import com.echothree.model.data.party.common.pk.PartyPK; 029import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK; 030import com.echothree.model.data.invoice.common.pk.InvoiceRoleTypePK; 031 032import com.echothree.model.data.invoice.server.entity.Invoice; 033import com.echothree.model.data.party.server.entity.Party; 034import com.echothree.model.data.contact.server.entity.PartyContactMechanism; 035import com.echothree.model.data.invoice.server.entity.InvoiceRoleType; 036 037import com.echothree.model.data.invoice.server.factory.InvoiceFactory; 038import com.echothree.model.data.party.server.factory.PartyFactory; 039import com.echothree.model.data.contact.server.factory.PartyContactMechanismFactory; 040import com.echothree.model.data.invoice.server.factory.InvoiceRoleTypeFactory; 041 042import com.echothree.model.data.invoice.common.pk.InvoiceRolePK; 043 044import com.echothree.model.data.invoice.server.value.InvoiceRoleValue; 045 046import com.echothree.model.data.invoice.server.factory.InvoiceRoleFactory; 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 InvoiceRole 065 extends BaseEntity 066 implements Serializable { 067 068 private InvoiceRolePK _pk; 069 private InvoiceRoleValue _value; 070 071 /** Creates a new instance of InvoiceRole */ 072 public InvoiceRole() 073 throws PersistenceException { 074 super(); 075 } 076 077 /** Creates a new instance of InvoiceRole */ 078 public InvoiceRole(InvoiceRoleValue value, EntityPermission entityPermission) { 079 super(entityPermission); 080 081 _value = value; 082 _pk = value.getPrimaryKey(); 083 } 084 085 @Override 086 public InvoiceRoleFactory getBaseFactoryInstance() { 087 return InvoiceRoleFactory.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 InvoiceRole) { 111 InvoiceRole that = (InvoiceRole)other; 112 113 InvoiceRoleValue thatValue = that.getInvoiceRoleValue(); 114 return _value.equals(thatValue); 115 } else { 116 return false; 117 } 118 } 119 120 @Override 121 public void store(Session session) 122 throws PersistenceDatabaseException { 123 getBaseFactoryInstance().store(session, this); 124 } 125 126 @Override 127 public void remove(Session session) 128 throws PersistenceDatabaseException { 129 getBaseFactoryInstance().remove(session, this); 130 } 131 132 @Override 133 public void remove() 134 throws PersistenceDatabaseException { 135 getBaseFactoryInstance().remove(ThreadSession.currentSession(), this); 136 } 137 138 public InvoiceRoleValue getInvoiceRoleValue() { 139 return _value; 140 } 141 142 public void setInvoiceRoleValue(InvoiceRoleValue value) 143 throws PersistenceReadOnlyException { 144 checkReadWrite(); 145 _value = value; 146 } 147 148 @Override 149 public InvoiceRolePK getPrimaryKey() { 150 return _pk; 151 } 152 153 public InvoicePK getInvoicePK() { 154 return _value.getInvoicePK(); 155 } 156 157 public Invoice getInvoice(Session session, EntityPermission entityPermission) { 158 return InvoiceFactory.getInstance().getEntityFromPK(session, entityPermission, getInvoicePK()); 159 } 160 161 public Invoice getInvoice(EntityPermission entityPermission) { 162 return getInvoice(ThreadSession.currentSession(), entityPermission); 163 } 164 165 public Invoice getInvoice(Session session) { 166 return getInvoice(session, EntityPermission.READ_ONLY); 167 } 168 169 public Invoice getInvoice() { 170 return getInvoice(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 171 } 172 173 public Invoice getInvoiceForUpdate(Session session) { 174 return getInvoice(session, EntityPermission.READ_WRITE); 175 } 176 177 public Invoice getInvoiceForUpdate() { 178 return getInvoice(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 179 } 180 181 public void setInvoicePK(InvoicePK invoicePK) 182 throws PersistenceNotNullException, PersistenceReadOnlyException { 183 checkReadWrite(); 184 _value.setInvoicePK(invoicePK); 185 } 186 187 public void setInvoice(Invoice entity) { 188 setInvoicePK(entity == null? null: entity.getPrimaryKey()); 189 } 190 191 public boolean getInvoicePKHasBeenModified() { 192 return _value.getInvoicePKHasBeenModified(); 193 } 194 195 public PartyPK getPartyPK() { 196 return _value.getPartyPK(); 197 } 198 199 public Party getParty(Session session, EntityPermission entityPermission) { 200 return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyPK()); 201 } 202 203 public Party getParty(EntityPermission entityPermission) { 204 return getParty(ThreadSession.currentSession(), entityPermission); 205 } 206 207 public Party getParty(Session session) { 208 return getParty(session, EntityPermission.READ_ONLY); 209 } 210 211 public Party getParty() { 212 return getParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 213 } 214 215 public Party getPartyForUpdate(Session session) { 216 return getParty(session, EntityPermission.READ_WRITE); 217 } 218 219 public Party getPartyForUpdate() { 220 return getParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 221 } 222 223 public void setPartyPK(PartyPK partyPK) 224 throws PersistenceNotNullException, PersistenceReadOnlyException { 225 checkReadWrite(); 226 _value.setPartyPK(partyPK); 227 } 228 229 public void setParty(Party entity) { 230 setPartyPK(entity == null? null: entity.getPrimaryKey()); 231 } 232 233 public boolean getPartyPKHasBeenModified() { 234 return _value.getPartyPKHasBeenModified(); 235 } 236 237 public PartyContactMechanismPK getPartyContactMechanismPK() { 238 return _value.getPartyContactMechanismPK(); 239 } 240 241 public PartyContactMechanism getPartyContactMechanism(Session session, EntityPermission entityPermission) { 242 return PartyContactMechanismFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyContactMechanismPK()); 243 } 244 245 public PartyContactMechanism getPartyContactMechanism(EntityPermission entityPermission) { 246 return getPartyContactMechanism(ThreadSession.currentSession(), entityPermission); 247 } 248 249 public PartyContactMechanism getPartyContactMechanism(Session session) { 250 return getPartyContactMechanism(session, EntityPermission.READ_ONLY); 251 } 252 253 public PartyContactMechanism getPartyContactMechanism() { 254 return getPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 255 } 256 257 public PartyContactMechanism getPartyContactMechanismForUpdate(Session session) { 258 return getPartyContactMechanism(session, EntityPermission.READ_WRITE); 259 } 260 261 public PartyContactMechanism getPartyContactMechanismForUpdate() { 262 return getPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 263 } 264 265 public void setPartyContactMechanismPK(PartyContactMechanismPK partyContactMechanismPK) 266 throws PersistenceNotNullException, PersistenceReadOnlyException { 267 checkReadWrite(); 268 _value.setPartyContactMechanismPK(partyContactMechanismPK); 269 } 270 271 public void setPartyContactMechanism(PartyContactMechanism entity) { 272 setPartyContactMechanismPK(entity == null? null: entity.getPrimaryKey()); 273 } 274 275 public boolean getPartyContactMechanismPKHasBeenModified() { 276 return _value.getPartyContactMechanismPKHasBeenModified(); 277 } 278 279 public InvoiceRoleTypePK getInvoiceRoleTypePK() { 280 return _value.getInvoiceRoleTypePK(); 281 } 282 283 public InvoiceRoleType getInvoiceRoleType(Session session, EntityPermission entityPermission) { 284 return InvoiceRoleTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getInvoiceRoleTypePK()); 285 } 286 287 public InvoiceRoleType getInvoiceRoleType(EntityPermission entityPermission) { 288 return getInvoiceRoleType(ThreadSession.currentSession(), entityPermission); 289 } 290 291 public InvoiceRoleType getInvoiceRoleType(Session session) { 292 return getInvoiceRoleType(session, EntityPermission.READ_ONLY); 293 } 294 295 public InvoiceRoleType getInvoiceRoleType() { 296 return getInvoiceRoleType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 297 } 298 299 public InvoiceRoleType getInvoiceRoleTypeForUpdate(Session session) { 300 return getInvoiceRoleType(session, EntityPermission.READ_WRITE); 301 } 302 303 public InvoiceRoleType getInvoiceRoleTypeForUpdate() { 304 return getInvoiceRoleType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 305 } 306 307 public void setInvoiceRoleTypePK(InvoiceRoleTypePK invoiceRoleTypePK) 308 throws PersistenceNotNullException, PersistenceReadOnlyException { 309 checkReadWrite(); 310 _value.setInvoiceRoleTypePK(invoiceRoleTypePK); 311 } 312 313 public void setInvoiceRoleType(InvoiceRoleType entity) { 314 setInvoiceRoleTypePK(entity == null? null: entity.getPrimaryKey()); 315 } 316 317 public boolean getInvoiceRoleTypePKHasBeenModified() { 318 return _value.getInvoiceRoleTypePKHasBeenModified(); 319 } 320 321 public Long getFromTime() { 322 return _value.getFromTime(); 323 } 324 325 public void setFromTime(Long fromTime) 326 throws PersistenceNotNullException, PersistenceReadOnlyException { 327 checkReadWrite(); 328 _value.setFromTime(fromTime); 329 } 330 331 public boolean getFromTimeHasBeenModified() { 332 return _value.getFromTimeHasBeenModified(); 333 } 334 335 public Long getThruTime() { 336 return _value.getThruTime(); 337 } 338 339 public void setThruTime(Long thruTime) 340 throws PersistenceNotNullException, PersistenceReadOnlyException { 341 checkReadWrite(); 342 _value.setThruTime(thruTime); 343 } 344 345 public boolean getThruTimeHasBeenModified() { 346 return _value.getThruTimeHasBeenModified(); 347 } 348 349}