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 * CommentDetail.java 021 */ 022 023package com.echothree.model.data.comment.server.entity; 024 025import com.echothree.model.data.comment.common.pk.CommentDetailPK; 026 027import com.echothree.model.data.comment.common.pk.CommentPK; 028import com.echothree.model.data.comment.common.pk.CommentTypePK; 029import com.echothree.model.data.core.common.pk.EntityInstancePK; 030import com.echothree.model.data.party.common.pk.LanguagePK; 031import com.echothree.model.data.core.common.pk.MimeTypePK; 032 033import com.echothree.model.data.comment.server.entity.Comment; 034import com.echothree.model.data.comment.server.entity.CommentType; 035import com.echothree.model.data.core.server.entity.EntityInstance; 036import com.echothree.model.data.party.server.entity.Language; 037import com.echothree.model.data.core.server.entity.MimeType; 038 039import com.echothree.model.data.comment.server.factory.CommentFactory; 040import com.echothree.model.data.comment.server.factory.CommentTypeFactory; 041import com.echothree.model.data.core.server.factory.EntityInstanceFactory; 042import com.echothree.model.data.party.server.factory.LanguageFactory; 043import com.echothree.model.data.core.server.factory.MimeTypeFactory; 044 045import com.echothree.model.data.comment.common.pk.CommentDetailPK; 046 047import com.echothree.model.data.comment.server.value.CommentDetailValue; 048 049import com.echothree.model.data.comment.server.factory.CommentDetailFactory; 050 051import com.echothree.util.common.exception.PersistenceException; 052import com.echothree.util.common.exception.PersistenceDatabaseException; 053import com.echothree.util.common.exception.PersistenceNotNullException; 054import com.echothree.util.common.exception.PersistenceReadOnlyException; 055 056import com.echothree.util.common.persistence.BasePK; 057 058import com.echothree.util.common.persistence.type.ByteArray; 059 060import com.echothree.util.server.persistence.BaseEntity; 061import com.echothree.util.server.persistence.EntityPermission; 062import com.echothree.util.server.persistence.Session; 063import com.echothree.util.server.persistence.ThreadSession; 064 065import java.io.Serializable; 066 067public class CommentDetail 068 extends BaseEntity 069 implements Serializable { 070 071 private CommentDetailPK _pk; 072 private CommentDetailValue _value; 073 074 /** Creates a new instance of CommentDetail */ 075 public CommentDetail() 076 throws PersistenceException { 077 super(); 078 } 079 080 /** Creates a new instance of CommentDetail */ 081 public CommentDetail(CommentDetailValue value, EntityPermission entityPermission) { 082 super(entityPermission); 083 084 _value = value; 085 _pk = value.getPrimaryKey(); 086 } 087 088 @Override 089 public CommentDetailFactory getBaseFactoryInstance() { 090 return CommentDetailFactory.getInstance(); 091 } 092 093 @Override 094 public boolean hasBeenModified() { 095 return _value.hasBeenModified(); 096 } 097 098 @Override 099 public int hashCode() { 100 return _pk.hashCode(); 101 } 102 103 @Override 104 public String toString() { 105 return _pk.toString(); 106 } 107 108 @Override 109 public boolean equals(Object other) { 110 if(this == other) 111 return true; 112 113 if(other instanceof CommentDetail) { 114 CommentDetail that = (CommentDetail)other; 115 116 CommentDetailValue thatValue = that.getCommentDetailValue(); 117 return _value.equals(thatValue); 118 } else { 119 return false; 120 } 121 } 122 123 @Override 124 public void store(Session session) 125 throws PersistenceDatabaseException { 126 getBaseFactoryInstance().store(session, this); 127 } 128 129 @Override 130 public void remove(Session session) 131 throws PersistenceDatabaseException { 132 getBaseFactoryInstance().remove(session, this); 133 } 134 135 @Override 136 public void remove() 137 throws PersistenceDatabaseException { 138 getBaseFactoryInstance().remove(ThreadSession.currentSession(), this); 139 } 140 141 public CommentDetailValue getCommentDetailValue() { 142 return _value; 143 } 144 145 public void setCommentDetailValue(CommentDetailValue value) 146 throws PersistenceReadOnlyException { 147 checkReadWrite(); 148 _value = value; 149 } 150 151 @Override 152 public CommentDetailPK getPrimaryKey() { 153 return _pk; 154 } 155 156 public CommentPK getCommentPK() { 157 return _value.getCommentPK(); 158 } 159 160 public Comment getComment(Session session, EntityPermission entityPermission) { 161 return CommentFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentPK()); 162 } 163 164 public Comment getComment(EntityPermission entityPermission) { 165 return getComment(ThreadSession.currentSession(), entityPermission); 166 } 167 168 public Comment getComment(Session session) { 169 return getComment(session, EntityPermission.READ_ONLY); 170 } 171 172 public Comment getComment() { 173 return getComment(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 174 } 175 176 public Comment getCommentForUpdate(Session session) { 177 return getComment(session, EntityPermission.READ_WRITE); 178 } 179 180 public Comment getCommentForUpdate() { 181 return getComment(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 182 } 183 184 public void setCommentPK(CommentPK commentPK) 185 throws PersistenceNotNullException, PersistenceReadOnlyException { 186 checkReadWrite(); 187 _value.setCommentPK(commentPK); 188 } 189 190 public void setComment(Comment entity) { 191 setCommentPK(entity == null? null: entity.getPrimaryKey()); 192 } 193 194 public boolean getCommentPKHasBeenModified() { 195 return _value.getCommentPKHasBeenModified(); 196 } 197 198 public String getCommentName() { 199 return _value.getCommentName(); 200 } 201 202 public void setCommentName(String commentName) 203 throws PersistenceNotNullException, PersistenceReadOnlyException { 204 checkReadWrite(); 205 _value.setCommentName(commentName); 206 } 207 208 public boolean getCommentNameHasBeenModified() { 209 return _value.getCommentNameHasBeenModified(); 210 } 211 212 public CommentTypePK getCommentTypePK() { 213 return _value.getCommentTypePK(); 214 } 215 216 public CommentType getCommentType(Session session, EntityPermission entityPermission) { 217 return CommentTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentTypePK()); 218 } 219 220 public CommentType getCommentType(EntityPermission entityPermission) { 221 return getCommentType(ThreadSession.currentSession(), entityPermission); 222 } 223 224 public CommentType getCommentType(Session session) { 225 return getCommentType(session, EntityPermission.READ_ONLY); 226 } 227 228 public CommentType getCommentType() { 229 return getCommentType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 230 } 231 232 public CommentType getCommentTypeForUpdate(Session session) { 233 return getCommentType(session, EntityPermission.READ_WRITE); 234 } 235 236 public CommentType getCommentTypeForUpdate() { 237 return getCommentType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 238 } 239 240 public void setCommentTypePK(CommentTypePK commentTypePK) 241 throws PersistenceNotNullException, PersistenceReadOnlyException { 242 checkReadWrite(); 243 _value.setCommentTypePK(commentTypePK); 244 } 245 246 public void setCommentType(CommentType entity) { 247 setCommentTypePK(entity == null? null: entity.getPrimaryKey()); 248 } 249 250 public boolean getCommentTypePKHasBeenModified() { 251 return _value.getCommentTypePKHasBeenModified(); 252 } 253 254 public EntityInstancePK getCommentedEntityInstancePK() { 255 return _value.getCommentedEntityInstancePK(); 256 } 257 258 public EntityInstance getCommentedEntityInstance(Session session, EntityPermission entityPermission) { 259 return EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentedEntityInstancePK()); 260 } 261 262 public EntityInstance getCommentedEntityInstance(EntityPermission entityPermission) { 263 return getCommentedEntityInstance(ThreadSession.currentSession(), entityPermission); 264 } 265 266 public EntityInstance getCommentedEntityInstance(Session session) { 267 return getCommentedEntityInstance(session, EntityPermission.READ_ONLY); 268 } 269 270 public EntityInstance getCommentedEntityInstance() { 271 return getCommentedEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 272 } 273 274 public EntityInstance getCommentedEntityInstanceForUpdate(Session session) { 275 return getCommentedEntityInstance(session, EntityPermission.READ_WRITE); 276 } 277 278 public EntityInstance getCommentedEntityInstanceForUpdate() { 279 return getCommentedEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 280 } 281 282 public void setCommentedEntityInstancePK(EntityInstancePK commentedEntityInstancePK) 283 throws PersistenceNotNullException, PersistenceReadOnlyException { 284 checkReadWrite(); 285 _value.setCommentedEntityInstancePK(commentedEntityInstancePK); 286 } 287 288 public void setCommentedEntityInstance(EntityInstance entity) { 289 setCommentedEntityInstancePK(entity == null? null: entity.getPrimaryKey()); 290 } 291 292 public boolean getCommentedEntityInstancePKHasBeenModified() { 293 return _value.getCommentedEntityInstancePKHasBeenModified(); 294 } 295 296 public EntityInstancePK getCommentedByEntityInstancePK() { 297 return _value.getCommentedByEntityInstancePK(); 298 } 299 300 public EntityInstance getCommentedByEntityInstance(Session session, EntityPermission entityPermission) { 301 return EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentedByEntityInstancePK()); 302 } 303 304 public EntityInstance getCommentedByEntityInstance(EntityPermission entityPermission) { 305 return getCommentedByEntityInstance(ThreadSession.currentSession(), entityPermission); 306 } 307 308 public EntityInstance getCommentedByEntityInstance(Session session) { 309 return getCommentedByEntityInstance(session, EntityPermission.READ_ONLY); 310 } 311 312 public EntityInstance getCommentedByEntityInstance() { 313 return getCommentedByEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 314 } 315 316 public EntityInstance getCommentedByEntityInstanceForUpdate(Session session) { 317 return getCommentedByEntityInstance(session, EntityPermission.READ_WRITE); 318 } 319 320 public EntityInstance getCommentedByEntityInstanceForUpdate() { 321 return getCommentedByEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 322 } 323 324 public void setCommentedByEntityInstancePK(EntityInstancePK commentedByEntityInstancePK) 325 throws PersistenceNotNullException, PersistenceReadOnlyException { 326 checkReadWrite(); 327 _value.setCommentedByEntityInstancePK(commentedByEntityInstancePK); 328 } 329 330 public void setCommentedByEntityInstance(EntityInstance entity) { 331 setCommentedByEntityInstancePK(entity == null? null: entity.getPrimaryKey()); 332 } 333 334 public boolean getCommentedByEntityInstancePKHasBeenModified() { 335 return _value.getCommentedByEntityInstancePKHasBeenModified(); 336 } 337 338 public LanguagePK getLanguagePK() { 339 return _value.getLanguagePK(); 340 } 341 342 public Language getLanguage(Session session, EntityPermission entityPermission) { 343 return LanguageFactory.getInstance().getEntityFromPK(session, entityPermission, getLanguagePK()); 344 } 345 346 public Language getLanguage(EntityPermission entityPermission) { 347 return getLanguage(ThreadSession.currentSession(), entityPermission); 348 } 349 350 public Language getLanguage(Session session) { 351 return getLanguage(session, EntityPermission.READ_ONLY); 352 } 353 354 public Language getLanguage() { 355 return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 356 } 357 358 public Language getLanguageForUpdate(Session session) { 359 return getLanguage(session, EntityPermission.READ_WRITE); 360 } 361 362 public Language getLanguageForUpdate() { 363 return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 364 } 365 366 public void setLanguagePK(LanguagePK languagePK) 367 throws PersistenceNotNullException, PersistenceReadOnlyException { 368 checkReadWrite(); 369 _value.setLanguagePK(languagePK); 370 } 371 372 public void setLanguage(Language entity) { 373 setLanguagePK(entity == null? null: entity.getPrimaryKey()); 374 } 375 376 public boolean getLanguagePKHasBeenModified() { 377 return _value.getLanguagePKHasBeenModified(); 378 } 379 380 public String getDescription() { 381 return _value.getDescription(); 382 } 383 384 public void setDescription(String description) 385 throws PersistenceNotNullException, PersistenceReadOnlyException { 386 checkReadWrite(); 387 _value.setDescription(description); 388 } 389 390 public boolean getDescriptionHasBeenModified() { 391 return _value.getDescriptionHasBeenModified(); 392 } 393 394 public MimeTypePK getMimeTypePK() { 395 return _value.getMimeTypePK(); 396 } 397 398 public MimeType getMimeType(Session session, EntityPermission entityPermission) { 399 MimeTypePK pk = getMimeTypePK(); 400 MimeType entity = pk == null? null: MimeTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 401 402 return entity; 403 } 404 405 public MimeType getMimeType(EntityPermission entityPermission) { 406 return getMimeType(ThreadSession.currentSession(), entityPermission); 407 } 408 409 public MimeType getMimeType(Session session) { 410 return getMimeType(session, EntityPermission.READ_ONLY); 411 } 412 413 public MimeType getMimeType() { 414 return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 415 } 416 417 public MimeType getMimeTypeForUpdate(Session session) { 418 return getMimeType(session, EntityPermission.READ_WRITE); 419 } 420 421 public MimeType getMimeTypeForUpdate() { 422 return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 423 } 424 425 public void setMimeTypePK(MimeTypePK mimeTypePK) 426 throws PersistenceNotNullException, PersistenceReadOnlyException { 427 checkReadWrite(); 428 _value.setMimeTypePK(mimeTypePK); 429 } 430 431 public void setMimeType(MimeType entity) { 432 setMimeTypePK(entity == null? null: entity.getPrimaryKey()); 433 } 434 435 public boolean getMimeTypePKHasBeenModified() { 436 return _value.getMimeTypePKHasBeenModified(); 437 } 438 439 public Long getFromTime() { 440 return _value.getFromTime(); 441 } 442 443 public void setFromTime(Long fromTime) 444 throws PersistenceNotNullException, PersistenceReadOnlyException { 445 checkReadWrite(); 446 _value.setFromTime(fromTime); 447 } 448 449 public boolean getFromTimeHasBeenModified() { 450 return _value.getFromTimeHasBeenModified(); 451 } 452 453 public Long getThruTime() { 454 return _value.getThruTime(); 455 } 456 457 public void setThruTime(Long thruTime) 458 throws PersistenceNotNullException, PersistenceReadOnlyException { 459 checkReadWrite(); 460 _value.setThruTime(thruTime); 461 } 462 463 public boolean getThruTimeHasBeenModified() { 464 return _value.getThruTimeHasBeenModified(); 465 } 466 467}