001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 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 * LetterDetail.java 021 */ 022 023package com.echothree.model.data.letter.server.entity; 024 025import com.echothree.model.data.letter.common.pk.LetterDetailPK; 026 027import com.echothree.model.data.letter.common.pk.LetterPK; 028import com.echothree.model.data.chain.common.pk.ChainTypePK; 029import com.echothree.model.data.letter.common.pk.LetterSourcePK; 030import com.echothree.model.data.contactlist.common.pk.ContactListPK; 031 032import com.echothree.model.data.letter.server.entity.Letter; 033import com.echothree.model.data.chain.server.entity.ChainType; 034import com.echothree.model.data.letter.server.entity.LetterSource; 035import com.echothree.model.data.contactlist.server.entity.ContactList; 036 037import com.echothree.model.data.letter.server.factory.LetterFactory; 038import com.echothree.model.data.chain.server.factory.ChainTypeFactory; 039import com.echothree.model.data.letter.server.factory.LetterSourceFactory; 040import com.echothree.model.data.contactlist.server.factory.ContactListFactory; 041 042import com.echothree.model.data.letter.common.pk.LetterDetailPK; 043 044import com.echothree.model.data.letter.server.value.LetterDetailValue; 045 046import com.echothree.model.data.letter.server.factory.LetterDetailFactory; 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 LetterDetail 065 extends BaseEntity 066 implements Serializable { 067 068 private LetterDetailPK _pk; 069 private LetterDetailValue _value; 070 071 /** Creates a new instance of LetterDetail */ 072 public LetterDetail() 073 throws PersistenceException { 074 super(); 075 } 076 077 /** Creates a new instance of LetterDetail */ 078 public LetterDetail(LetterDetailValue value, EntityPermission entityPermission) { 079 super(entityPermission); 080 081 _value = value; 082 _pk = value.getPrimaryKey(); 083 } 084 085 @Override 086 public LetterDetailFactory getBaseFactoryInstance() { 087 return LetterDetailFactory.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 LetterDetail that) { 111 LetterDetailValue thatValue = that.getLetterDetailValue(); 112 return _value.equals(thatValue); 113 } else { 114 return false; 115 } 116 } 117 118 @Override 119 public void store(Session session) 120 throws PersistenceDatabaseException { 121 getBaseFactoryInstance().store(session, this); 122 } 123 124 @Override 125 public void remove(Session session) 126 throws PersistenceDatabaseException { 127 getBaseFactoryInstance().remove(session, this); 128 } 129 130 @Override 131 public void remove() 132 throws PersistenceDatabaseException { 133 getBaseFactoryInstance().remove(ThreadSession.currentSession(), this); 134 } 135 136 public LetterDetailValue getLetterDetailValue() { 137 return _value; 138 } 139 140 public void setLetterDetailValue(LetterDetailValue value) 141 throws PersistenceReadOnlyException { 142 checkReadWrite(); 143 _value = value; 144 } 145 146 @Override 147 public LetterDetailPK getPrimaryKey() { 148 return _pk; 149 } 150 151 public LetterPK getLetterPK() { 152 return _value.getLetterPK(); 153 } 154 155 public Letter getLetter(Session session, EntityPermission entityPermission) { 156 return LetterFactory.getInstance().getEntityFromPK(session, entityPermission, getLetterPK()); 157 } 158 159 public Letter getLetter(EntityPermission entityPermission) { 160 return getLetter(ThreadSession.currentSession(), entityPermission); 161 } 162 163 public Letter getLetter(Session session) { 164 return getLetter(session, EntityPermission.READ_ONLY); 165 } 166 167 public Letter getLetter() { 168 return getLetter(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 169 } 170 171 public Letter getLetterForUpdate(Session session) { 172 return getLetter(session, EntityPermission.READ_WRITE); 173 } 174 175 public Letter getLetterForUpdate() { 176 return getLetter(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 177 } 178 179 public void setLetterPK(LetterPK letterPK) 180 throws PersistenceNotNullException, PersistenceReadOnlyException { 181 checkReadWrite(); 182 _value.setLetterPK(letterPK); 183 } 184 185 public void setLetter(Letter entity) { 186 setLetterPK(entity == null? null: entity.getPrimaryKey()); 187 } 188 189 public boolean getLetterPKHasBeenModified() { 190 return _value.getLetterPKHasBeenModified(); 191 } 192 193 public ChainTypePK getChainTypePK() { 194 return _value.getChainTypePK(); 195 } 196 197 public ChainType getChainType(Session session, EntityPermission entityPermission) { 198 return ChainTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getChainTypePK()); 199 } 200 201 public ChainType getChainType(EntityPermission entityPermission) { 202 return getChainType(ThreadSession.currentSession(), entityPermission); 203 } 204 205 public ChainType getChainType(Session session) { 206 return getChainType(session, EntityPermission.READ_ONLY); 207 } 208 209 public ChainType getChainType() { 210 return getChainType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 211 } 212 213 public ChainType getChainTypeForUpdate(Session session) { 214 return getChainType(session, EntityPermission.READ_WRITE); 215 } 216 217 public ChainType getChainTypeForUpdate() { 218 return getChainType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 219 } 220 221 public void setChainTypePK(ChainTypePK chainTypePK) 222 throws PersistenceNotNullException, PersistenceReadOnlyException { 223 checkReadWrite(); 224 _value.setChainTypePK(chainTypePK); 225 } 226 227 public void setChainType(ChainType entity) { 228 setChainTypePK(entity == null? null: entity.getPrimaryKey()); 229 } 230 231 public boolean getChainTypePKHasBeenModified() { 232 return _value.getChainTypePKHasBeenModified(); 233 } 234 235 public String getLetterName() { 236 return _value.getLetterName(); 237 } 238 239 public void setLetterName(String letterName) 240 throws PersistenceNotNullException, PersistenceReadOnlyException { 241 checkReadWrite(); 242 _value.setLetterName(letterName); 243 } 244 245 public boolean getLetterNameHasBeenModified() { 246 return _value.getLetterNameHasBeenModified(); 247 } 248 249 public LetterSourcePK getLetterSourcePK() { 250 return _value.getLetterSourcePK(); 251 } 252 253 public LetterSource getLetterSource(Session session, EntityPermission entityPermission) { 254 return LetterSourceFactory.getInstance().getEntityFromPK(session, entityPermission, getLetterSourcePK()); 255 } 256 257 public LetterSource getLetterSource(EntityPermission entityPermission) { 258 return getLetterSource(ThreadSession.currentSession(), entityPermission); 259 } 260 261 public LetterSource getLetterSource(Session session) { 262 return getLetterSource(session, EntityPermission.READ_ONLY); 263 } 264 265 public LetterSource getLetterSource() { 266 return getLetterSource(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 267 } 268 269 public LetterSource getLetterSourceForUpdate(Session session) { 270 return getLetterSource(session, EntityPermission.READ_WRITE); 271 } 272 273 public LetterSource getLetterSourceForUpdate() { 274 return getLetterSource(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 275 } 276 277 public void setLetterSourcePK(LetterSourcePK letterSourcePK) 278 throws PersistenceNotNullException, PersistenceReadOnlyException { 279 checkReadWrite(); 280 _value.setLetterSourcePK(letterSourcePK); 281 } 282 283 public void setLetterSource(LetterSource entity) { 284 setLetterSourcePK(entity == null? null: entity.getPrimaryKey()); 285 } 286 287 public boolean getLetterSourcePKHasBeenModified() { 288 return _value.getLetterSourcePKHasBeenModified(); 289 } 290 291 public ContactListPK getContactListPK() { 292 return _value.getContactListPK(); 293 } 294 295 public ContactList getContactList(Session session, EntityPermission entityPermission) { 296 ContactListPK pk = getContactListPK(); 297 ContactList entity = pk == null? null: ContactListFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 298 299 return entity; 300 } 301 302 public ContactList getContactList(EntityPermission entityPermission) { 303 return getContactList(ThreadSession.currentSession(), entityPermission); 304 } 305 306 public ContactList getContactList(Session session) { 307 return getContactList(session, EntityPermission.READ_ONLY); 308 } 309 310 public ContactList getContactList() { 311 return getContactList(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 312 } 313 314 public ContactList getContactListForUpdate(Session session) { 315 return getContactList(session, EntityPermission.READ_WRITE); 316 } 317 318 public ContactList getContactListForUpdate() { 319 return getContactList(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 320 } 321 322 public void setContactListPK(ContactListPK contactListPK) 323 throws PersistenceNotNullException, PersistenceReadOnlyException { 324 checkReadWrite(); 325 _value.setContactListPK(contactListPK); 326 } 327 328 public void setContactList(ContactList entity) { 329 setContactListPK(entity == null? null: entity.getPrimaryKey()); 330 } 331 332 public boolean getContactListPKHasBeenModified() { 333 return _value.getContactListPKHasBeenModified(); 334 } 335 336 public Boolean getIsDefault() { 337 return _value.getIsDefault(); 338 } 339 340 public void setIsDefault(Boolean isDefault) 341 throws PersistenceNotNullException, PersistenceReadOnlyException { 342 checkReadWrite(); 343 _value.setIsDefault(isDefault); 344 } 345 346 public boolean getIsDefaultHasBeenModified() { 347 return _value.getIsDefaultHasBeenModified(); 348 } 349 350 public Integer getSortOrder() { 351 return _value.getSortOrder(); 352 } 353 354 public void setSortOrder(Integer sortOrder) 355 throws PersistenceNotNullException, PersistenceReadOnlyException { 356 checkReadWrite(); 357 _value.setSortOrder(sortOrder); 358 } 359 360 public boolean getSortOrderHasBeenModified() { 361 return _value.getSortOrderHasBeenModified(); 362 } 363 364 public Long getFromTime() { 365 return _value.getFromTime(); 366 } 367 368 public void setFromTime(Long fromTime) 369 throws PersistenceNotNullException, PersistenceReadOnlyException { 370 checkReadWrite(); 371 _value.setFromTime(fromTime); 372 } 373 374 public boolean getFromTimeHasBeenModified() { 375 return _value.getFromTimeHasBeenModified(); 376 } 377 378 public Long getThruTime() { 379 return _value.getThruTime(); 380 } 381 382 public void setThruTime(Long thruTime) 383 throws PersistenceNotNullException, PersistenceReadOnlyException { 384 checkReadWrite(); 385 _value.setThruTime(thruTime); 386 } 387 388 public boolean getThruTimeHasBeenModified() { 389 return _value.getThruTimeHasBeenModified(); 390 } 391 392}