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 * EntityBlobAttribute.java 021 */ 022 023package com.echothree.model.data.core.server.entity; 024 025import com.echothree.model.data.core.common.pk.EntityBlobAttributePK; 026 027import com.echothree.model.data.core.common.pk.EntityAttributePK; 028import com.echothree.model.data.core.common.pk.EntityInstancePK; 029import com.echothree.model.data.party.common.pk.LanguagePK; 030import com.echothree.model.data.core.common.pk.MimeTypePK; 031 032import com.echothree.model.data.core.server.entity.EntityAttribute; 033import com.echothree.model.data.core.server.entity.EntityInstance; 034import com.echothree.model.data.party.server.entity.Language; 035import com.echothree.model.data.core.server.entity.MimeType; 036 037import com.echothree.model.data.core.server.factory.EntityAttributeFactory; 038import com.echothree.model.data.core.server.factory.EntityInstanceFactory; 039import com.echothree.model.data.party.server.factory.LanguageFactory; 040import com.echothree.model.data.core.server.factory.MimeTypeFactory; 041 042import com.echothree.model.data.core.common.pk.EntityBlobAttributePK; 043 044import com.echothree.model.data.core.server.value.EntityBlobAttributeValue; 045 046import com.echothree.model.data.core.server.factory.EntityBlobAttributeFactory; 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 EntityBlobAttribute 065 extends BaseEntity 066 implements Serializable { 067 068 private EntityBlobAttributePK _pk; 069 private EntityBlobAttributeValue _value; 070 071 /** Creates a new instance of EntityBlobAttribute */ 072 public EntityBlobAttribute() 073 throws PersistenceException { 074 super(); 075 } 076 077 /** Creates a new instance of EntityBlobAttribute */ 078 public EntityBlobAttribute(EntityBlobAttributeValue value, EntityPermission entityPermission) { 079 super(entityPermission); 080 081 _value = value; 082 _pk = value.getPrimaryKey(); 083 } 084 085 @Override 086 public EntityBlobAttributeFactory getBaseFactoryInstance() { 087 return EntityBlobAttributeFactory.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 EntityBlobAttribute) { 111 EntityBlobAttribute that = (EntityBlobAttribute)other; 112 113 EntityBlobAttributeValue thatValue = that.getEntityBlobAttributeValue(); 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 EntityBlobAttributeValue getEntityBlobAttributeValue() { 139 return _value; 140 } 141 142 public void setEntityBlobAttributeValue(EntityBlobAttributeValue value) 143 throws PersistenceReadOnlyException { 144 checkReadWrite(); 145 _value = value; 146 } 147 148 @Override 149 public EntityBlobAttributePK getPrimaryKey() { 150 return _pk; 151 } 152 153 public EntityAttributePK getEntityAttributePK() { 154 return _value.getEntityAttributePK(); 155 } 156 157 public EntityAttribute getEntityAttribute(Session session, EntityPermission entityPermission) { 158 return EntityAttributeFactory.getInstance().getEntityFromPK(session, entityPermission, getEntityAttributePK()); 159 } 160 161 public EntityAttribute getEntityAttribute(EntityPermission entityPermission) { 162 return getEntityAttribute(ThreadSession.currentSession(), entityPermission); 163 } 164 165 public EntityAttribute getEntityAttribute(Session session) { 166 return getEntityAttribute(session, EntityPermission.READ_ONLY); 167 } 168 169 public EntityAttribute getEntityAttribute() { 170 return getEntityAttribute(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 171 } 172 173 public EntityAttribute getEntityAttributeForUpdate(Session session) { 174 return getEntityAttribute(session, EntityPermission.READ_WRITE); 175 } 176 177 public EntityAttribute getEntityAttributeForUpdate() { 178 return getEntityAttribute(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 179 } 180 181 public void setEntityAttributePK(EntityAttributePK entityAttributePK) 182 throws PersistenceNotNullException, PersistenceReadOnlyException { 183 checkReadWrite(); 184 _value.setEntityAttributePK(entityAttributePK); 185 } 186 187 public void setEntityAttribute(EntityAttribute entity) { 188 setEntityAttributePK(entity == null? null: entity.getPrimaryKey()); 189 } 190 191 public boolean getEntityAttributePKHasBeenModified() { 192 return _value.getEntityAttributePKHasBeenModified(); 193 } 194 195 public EntityInstancePK getEntityInstancePK() { 196 return _value.getEntityInstancePK(); 197 } 198 199 public EntityInstance getEntityInstance(Session session, EntityPermission entityPermission) { 200 return EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, getEntityInstancePK()); 201 } 202 203 public EntityInstance getEntityInstance(EntityPermission entityPermission) { 204 return getEntityInstance(ThreadSession.currentSession(), entityPermission); 205 } 206 207 public EntityInstance getEntityInstance(Session session) { 208 return getEntityInstance(session, EntityPermission.READ_ONLY); 209 } 210 211 public EntityInstance getEntityInstance() { 212 return getEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 213 } 214 215 public EntityInstance getEntityInstanceForUpdate(Session session) { 216 return getEntityInstance(session, EntityPermission.READ_WRITE); 217 } 218 219 public EntityInstance getEntityInstanceForUpdate() { 220 return getEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 221 } 222 223 public void setEntityInstancePK(EntityInstancePK entityInstancePK) 224 throws PersistenceNotNullException, PersistenceReadOnlyException { 225 checkReadWrite(); 226 _value.setEntityInstancePK(entityInstancePK); 227 } 228 229 public void setEntityInstance(EntityInstance entity) { 230 setEntityInstancePK(entity == null? null: entity.getPrimaryKey()); 231 } 232 233 public boolean getEntityInstancePKHasBeenModified() { 234 return _value.getEntityInstancePKHasBeenModified(); 235 } 236 237 public LanguagePK getLanguagePK() { 238 return _value.getLanguagePK(); 239 } 240 241 public Language getLanguage(Session session, EntityPermission entityPermission) { 242 return LanguageFactory.getInstance().getEntityFromPK(session, entityPermission, getLanguagePK()); 243 } 244 245 public Language getLanguage(EntityPermission entityPermission) { 246 return getLanguage(ThreadSession.currentSession(), entityPermission); 247 } 248 249 public Language getLanguage(Session session) { 250 return getLanguage(session, EntityPermission.READ_ONLY); 251 } 252 253 public Language getLanguage() { 254 return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 255 } 256 257 public Language getLanguageForUpdate(Session session) { 258 return getLanguage(session, EntityPermission.READ_WRITE); 259 } 260 261 public Language getLanguageForUpdate() { 262 return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 263 } 264 265 public void setLanguagePK(LanguagePK languagePK) 266 throws PersistenceNotNullException, PersistenceReadOnlyException { 267 checkReadWrite(); 268 _value.setLanguagePK(languagePK); 269 } 270 271 public void setLanguage(Language entity) { 272 setLanguagePK(entity == null? null: entity.getPrimaryKey()); 273 } 274 275 public boolean getLanguagePKHasBeenModified() { 276 return _value.getLanguagePKHasBeenModified(); 277 } 278 279 public ByteArray getBlobAttribute() { 280 return _value.getBlobAttribute(); 281 } 282 283 public void setBlobAttribute(ByteArray blobAttribute) 284 throws PersistenceNotNullException, PersistenceReadOnlyException { 285 checkReadWrite(); 286 _value.setBlobAttribute(blobAttribute); 287 } 288 289 public boolean getBlobAttributeHasBeenModified() { 290 return _value.getBlobAttributeHasBeenModified(); 291 } 292 293 public MimeTypePK getMimeTypePK() { 294 return _value.getMimeTypePK(); 295 } 296 297 public MimeType getMimeType(Session session, EntityPermission entityPermission) { 298 return MimeTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getMimeTypePK()); 299 } 300 301 public MimeType getMimeType(EntityPermission entityPermission) { 302 return getMimeType(ThreadSession.currentSession(), entityPermission); 303 } 304 305 public MimeType getMimeType(Session session) { 306 return getMimeType(session, EntityPermission.READ_ONLY); 307 } 308 309 public MimeType getMimeType() { 310 return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 311 } 312 313 public MimeType getMimeTypeForUpdate(Session session) { 314 return getMimeType(session, EntityPermission.READ_WRITE); 315 } 316 317 public MimeType getMimeTypeForUpdate() { 318 return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 319 } 320 321 public void setMimeTypePK(MimeTypePK mimeTypePK) 322 throws PersistenceNotNullException, PersistenceReadOnlyException { 323 checkReadWrite(); 324 _value.setMimeTypePK(mimeTypePK); 325 } 326 327 public void setMimeType(MimeType entity) { 328 setMimeTypePK(entity == null? null: entity.getPrimaryKey()); 329 } 330 331 public boolean getMimeTypePKHasBeenModified() { 332 return _value.getMimeTypePKHasBeenModified(); 333 } 334 335 public Long getFromTime() { 336 return _value.getFromTime(); 337 } 338 339 public void setFromTime(Long fromTime) 340 throws PersistenceNotNullException, PersistenceReadOnlyException { 341 checkReadWrite(); 342 _value.setFromTime(fromTime); 343 } 344 345 public boolean getFromTimeHasBeenModified() { 346 return _value.getFromTimeHasBeenModified(); 347 } 348 349 public Long getThruTime() { 350 return _value.getThruTime(); 351 } 352 353 public void setThruTime(Long thruTime) 354 throws PersistenceNotNullException, PersistenceReadOnlyException { 355 checkReadWrite(); 356 _value.setThruTime(thruTime); 357 } 358 359 public boolean getThruTimeHasBeenModified() { 360 return _value.getThruTimeHasBeenModified(); 361 } 362 363}