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 * 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() 120 throws PersistenceDatabaseException { 121 getBaseFactoryInstance().store(this); 122 } 123 124 @Override 125 public void remove() 126 throws PersistenceDatabaseException { 127 getBaseFactoryInstance().remove(this); 128 } 129 130 public LetterDetailValue getLetterDetailValue() { 131 return _value; 132 } 133 134 public void setLetterDetailValue(LetterDetailValue value) 135 throws PersistenceReadOnlyException { 136 checkReadWrite(); 137 _value = value; 138 } 139 140 @Override 141 public LetterDetailPK getPrimaryKey() { 142 return _pk; 143 } 144 145 public LetterPK getLetterPK() { 146 return _value.getLetterPK(); 147 } 148 149 public Letter getLetter(EntityPermission entityPermission) { 150 return LetterFactory.getInstance().getEntityFromPK(entityPermission, getLetterPK()); 151 } 152 153 public Letter getLetter() { 154 return getLetter(EntityPermission.READ_ONLY); 155 } 156 157 public Letter getLetterForUpdate() { 158 return getLetter(EntityPermission.READ_WRITE); 159 } 160 161 public void setLetterPK(LetterPK letterPK) 162 throws PersistenceNotNullException, PersistenceReadOnlyException { 163 checkReadWrite(); 164 _value.setLetterPK(letterPK); 165 } 166 167 public void setLetter(Letter entity) { 168 setLetterPK(entity == null? null: entity.getPrimaryKey()); 169 } 170 171 public boolean getLetterPKHasBeenModified() { 172 return _value.getLetterPKHasBeenModified(); 173 } 174 175 public ChainTypePK getChainTypePK() { 176 return _value.getChainTypePK(); 177 } 178 179 public ChainType getChainType(EntityPermission entityPermission) { 180 return ChainTypeFactory.getInstance().getEntityFromPK(entityPermission, getChainTypePK()); 181 } 182 183 public ChainType getChainType() { 184 return getChainType(EntityPermission.READ_ONLY); 185 } 186 187 public ChainType getChainTypeForUpdate() { 188 return getChainType(EntityPermission.READ_WRITE); 189 } 190 191 public void setChainTypePK(ChainTypePK chainTypePK) 192 throws PersistenceNotNullException, PersistenceReadOnlyException { 193 checkReadWrite(); 194 _value.setChainTypePK(chainTypePK); 195 } 196 197 public void setChainType(ChainType entity) { 198 setChainTypePK(entity == null? null: entity.getPrimaryKey()); 199 } 200 201 public boolean getChainTypePKHasBeenModified() { 202 return _value.getChainTypePKHasBeenModified(); 203 } 204 205 public String getLetterName() { 206 return _value.getLetterName(); 207 } 208 209 public void setLetterName(String letterName) 210 throws PersistenceNotNullException, PersistenceReadOnlyException { 211 checkReadWrite(); 212 _value.setLetterName(letterName); 213 } 214 215 public boolean getLetterNameHasBeenModified() { 216 return _value.getLetterNameHasBeenModified(); 217 } 218 219 public LetterSourcePK getLetterSourcePK() { 220 return _value.getLetterSourcePK(); 221 } 222 223 public LetterSource getLetterSource(EntityPermission entityPermission) { 224 return LetterSourceFactory.getInstance().getEntityFromPK(entityPermission, getLetterSourcePK()); 225 } 226 227 public LetterSource getLetterSource() { 228 return getLetterSource(EntityPermission.READ_ONLY); 229 } 230 231 public LetterSource getLetterSourceForUpdate() { 232 return getLetterSource(EntityPermission.READ_WRITE); 233 } 234 235 public void setLetterSourcePK(LetterSourcePK letterSourcePK) 236 throws PersistenceNotNullException, PersistenceReadOnlyException { 237 checkReadWrite(); 238 _value.setLetterSourcePK(letterSourcePK); 239 } 240 241 public void setLetterSource(LetterSource entity) { 242 setLetterSourcePK(entity == null? null: entity.getPrimaryKey()); 243 } 244 245 public boolean getLetterSourcePKHasBeenModified() { 246 return _value.getLetterSourcePKHasBeenModified(); 247 } 248 249 public ContactListPK getContactListPK() { 250 return _value.getContactListPK(); 251 } 252 253 public ContactList getContactList(EntityPermission entityPermission) { 254 ContactListPK pk = getContactListPK(); 255 ContactList entity = pk == null? null: ContactListFactory.getInstance().getEntityFromPK(entityPermission, pk); 256 257 return entity; 258 } 259 260 public ContactList getContactList() { 261 return getContactList(EntityPermission.READ_ONLY); 262 } 263 264 public ContactList getContactListForUpdate() { 265 return getContactList(EntityPermission.READ_WRITE); 266 } 267 268 public void setContactListPK(ContactListPK contactListPK) 269 throws PersistenceNotNullException, PersistenceReadOnlyException { 270 checkReadWrite(); 271 _value.setContactListPK(contactListPK); 272 } 273 274 public void setContactList(ContactList entity) { 275 setContactListPK(entity == null? null: entity.getPrimaryKey()); 276 } 277 278 public boolean getContactListPKHasBeenModified() { 279 return _value.getContactListPKHasBeenModified(); 280 } 281 282 public Boolean getIsDefault() { 283 return _value.getIsDefault(); 284 } 285 286 public void setIsDefault(Boolean isDefault) 287 throws PersistenceNotNullException, PersistenceReadOnlyException { 288 checkReadWrite(); 289 _value.setIsDefault(isDefault); 290 } 291 292 public boolean getIsDefaultHasBeenModified() { 293 return _value.getIsDefaultHasBeenModified(); 294 } 295 296 public Integer getSortOrder() { 297 return _value.getSortOrder(); 298 } 299 300 public void setSortOrder(Integer sortOrder) 301 throws PersistenceNotNullException, PersistenceReadOnlyException { 302 checkReadWrite(); 303 _value.setSortOrder(sortOrder); 304 } 305 306 public boolean getSortOrderHasBeenModified() { 307 return _value.getSortOrderHasBeenModified(); 308 } 309 310 public Long getFromTime() { 311 return _value.getFromTime(); 312 } 313 314 public void setFromTime(Long fromTime) 315 throws PersistenceNotNullException, PersistenceReadOnlyException { 316 checkReadWrite(); 317 _value.setFromTime(fromTime); 318 } 319 320 public boolean getFromTimeHasBeenModified() { 321 return _value.getFromTimeHasBeenModified(); 322 } 323 324 public Long getThruTime() { 325 return _value.getThruTime(); 326 } 327 328 public void setThruTime(Long thruTime) 329 throws PersistenceNotNullException, PersistenceReadOnlyException { 330 checkReadWrite(); 331 _value.setThruTime(thruTime); 332 } 333 334 public boolean getThruTimeHasBeenModified() { 335 return _value.getThruTimeHasBeenModified(); 336 } 337 338}