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 * RatingDetail.java 021 */ 022 023package com.echothree.model.data.rating.server.entity; 024 025import com.echothree.model.data.rating.common.pk.RatingDetailPK; 026 027import com.echothree.model.data.rating.common.pk.RatingPK; 028import com.echothree.model.data.rating.common.pk.RatingTypeListItemPK; 029import com.echothree.model.data.core.common.pk.EntityInstancePK; 030 031import com.echothree.model.data.rating.server.entity.Rating; 032import com.echothree.model.data.rating.server.entity.RatingTypeListItem; 033import com.echothree.model.data.core.server.entity.EntityInstance; 034 035import com.echothree.model.data.rating.server.factory.RatingFactory; 036import com.echothree.model.data.rating.server.factory.RatingTypeListItemFactory; 037import com.echothree.model.data.core.server.factory.EntityInstanceFactory; 038 039import com.echothree.model.data.rating.common.pk.RatingDetailPK; 040 041import com.echothree.model.data.rating.server.value.RatingDetailValue; 042 043import com.echothree.model.data.rating.server.factory.RatingDetailFactory; 044 045import com.echothree.util.common.exception.PersistenceException; 046import com.echothree.util.common.exception.PersistenceDatabaseException; 047import com.echothree.util.common.exception.PersistenceNotNullException; 048import com.echothree.util.common.exception.PersistenceReadOnlyException; 049 050import com.echothree.util.common.persistence.BasePK; 051 052import com.echothree.util.common.persistence.type.ByteArray; 053 054import com.echothree.util.server.persistence.BaseEntity; 055import com.echothree.util.server.persistence.EntityPermission; 056import com.echothree.util.server.persistence.Session; 057import com.echothree.util.server.persistence.ThreadSession; 058 059import java.io.Serializable; 060 061import javax.annotation.Nonnull; 062import javax.annotation.Nullable; 063 064public class RatingDetail 065 extends BaseEntity 066 implements Serializable { 067 068 private RatingDetailPK _pk; 069 private RatingDetailValue _value; 070 071 /** Creates a new instance of RatingDetail */ 072 public RatingDetail() 073 throws PersistenceException { 074 super(); 075 } 076 077 /** Creates a new instance of RatingDetail */ 078 public RatingDetail(RatingDetailValue value, EntityPermission entityPermission) { 079 super(entityPermission); 080 081 _value = value; 082 _pk = value.getPrimaryKey(); 083 } 084 085 @Override 086 @Nonnull 087 public RatingDetailFactory getBaseFactoryInstance() { 088 return RatingDetailFactory.getInstance(); 089 } 090 091 @Override 092 public boolean hasBeenModified() { 093 return _value.hasBeenModified(); 094 } 095 096 @Override 097 public int hashCode() { 098 return _pk.hashCode(); 099 } 100 101 @Override 102 @Nonnull 103 public String toString() { 104 return _pk.toString(); 105 } 106 107 @Override 108 public boolean equals(Object other) { 109 if(this == other) 110 return true; 111 112 if(other instanceof RatingDetail that) { 113 RatingDetailValue thatValue = that.getRatingDetailValue(); 114 return _value.equals(thatValue); 115 } else { 116 return false; 117 } 118 } 119 120 @Override 121 public void store() 122 throws PersistenceDatabaseException { 123 getBaseFactoryInstance().store(this); 124 } 125 126 @Override 127 public void remove() 128 throws PersistenceDatabaseException { 129 getBaseFactoryInstance().remove(this); 130 } 131 132 @Nonnull 133 public RatingDetailValue getRatingDetailValue() { 134 return _value; 135 } 136 137 public void setRatingDetailValue(@Nonnull RatingDetailValue value) 138 throws PersistenceReadOnlyException { 139 checkReadWrite(); 140 _value = value; 141 } 142 143 @Override 144 @Nonnull 145 public RatingDetailPK getPrimaryKey() { 146 return _pk; 147 } 148 149 @Nonnull 150 public RatingPK getRatingPK() { 151 return _value.getRatingPK(); 152 } 153 154 @Nonnull 155 public Rating getRating(EntityPermission entityPermission) { 156 return RatingFactory.getInstance().getEntityFromPK(entityPermission, getRatingPK()); 157 } 158 159 @Nonnull 160 public Rating getRating() { 161 return getRating(EntityPermission.READ_ONLY); 162 } 163 164 @Nonnull 165 public Rating getRatingForUpdate() { 166 return getRating(EntityPermission.READ_WRITE); 167 } 168 169 public void setRatingPK(@Nonnull RatingPK ratingPK) 170 throws PersistenceNotNullException, PersistenceReadOnlyException { 171 checkReadWrite(); 172 _value.setRatingPK(ratingPK); 173 } 174 175 public void setRating(@Nonnull Rating entity) { 176 setRatingPK(entity == null ? null : entity.getPrimaryKey()); 177 } 178 179 public boolean getRatingPKHasBeenModified() { 180 return _value.getRatingPKHasBeenModified(); 181 } 182 183 @Nonnull 184 public String getRatingName() { 185 return _value.getRatingName(); 186 } 187 188 public void setRatingName(@Nonnull String ratingName) 189 throws PersistenceNotNullException, PersistenceReadOnlyException { 190 checkReadWrite(); 191 _value.setRatingName(ratingName); 192 } 193 194 public boolean getRatingNameHasBeenModified() { 195 return _value.getRatingNameHasBeenModified(); 196 } 197 198 @Nonnull 199 public RatingTypeListItemPK getRatingTypeListItemPK() { 200 return _value.getRatingTypeListItemPK(); 201 } 202 203 @Nonnull 204 public RatingTypeListItem getRatingTypeListItem(EntityPermission entityPermission) { 205 return RatingTypeListItemFactory.getInstance().getEntityFromPK(entityPermission, getRatingTypeListItemPK()); 206 } 207 208 @Nonnull 209 public RatingTypeListItem getRatingTypeListItem() { 210 return getRatingTypeListItem(EntityPermission.READ_ONLY); 211 } 212 213 @Nonnull 214 public RatingTypeListItem getRatingTypeListItemForUpdate() { 215 return getRatingTypeListItem(EntityPermission.READ_WRITE); 216 } 217 218 public void setRatingTypeListItemPK(@Nonnull RatingTypeListItemPK ratingTypeListItemPK) 219 throws PersistenceNotNullException, PersistenceReadOnlyException { 220 checkReadWrite(); 221 _value.setRatingTypeListItemPK(ratingTypeListItemPK); 222 } 223 224 public void setRatingTypeListItem(@Nonnull RatingTypeListItem entity) { 225 setRatingTypeListItemPK(entity == null ? null : entity.getPrimaryKey()); 226 } 227 228 public boolean getRatingTypeListItemPKHasBeenModified() { 229 return _value.getRatingTypeListItemPKHasBeenModified(); 230 } 231 232 @Nonnull 233 public EntityInstancePK getRatedEntityInstancePK() { 234 return _value.getRatedEntityInstancePK(); 235 } 236 237 @Nonnull 238 public EntityInstance getRatedEntityInstance(EntityPermission entityPermission) { 239 return EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, getRatedEntityInstancePK()); 240 } 241 242 @Nonnull 243 public EntityInstance getRatedEntityInstance() { 244 return getRatedEntityInstance(EntityPermission.READ_ONLY); 245 } 246 247 @Nonnull 248 public EntityInstance getRatedEntityInstanceForUpdate() { 249 return getRatedEntityInstance(EntityPermission.READ_WRITE); 250 } 251 252 public void setRatedEntityInstancePK(@Nonnull EntityInstancePK ratedEntityInstancePK) 253 throws PersistenceNotNullException, PersistenceReadOnlyException { 254 checkReadWrite(); 255 _value.setRatedEntityInstancePK(ratedEntityInstancePK); 256 } 257 258 public void setRatedEntityInstance(@Nonnull EntityInstance entity) { 259 setRatedEntityInstancePK(entity == null ? null : entity.getPrimaryKey()); 260 } 261 262 public boolean getRatedEntityInstancePKHasBeenModified() { 263 return _value.getRatedEntityInstancePKHasBeenModified(); 264 } 265 266 @Nonnull 267 public EntityInstancePK getRatedByEntityInstancePK() { 268 return _value.getRatedByEntityInstancePK(); 269 } 270 271 @Nonnull 272 public EntityInstance getRatedByEntityInstance(EntityPermission entityPermission) { 273 return EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, getRatedByEntityInstancePK()); 274 } 275 276 @Nonnull 277 public EntityInstance getRatedByEntityInstance() { 278 return getRatedByEntityInstance(EntityPermission.READ_ONLY); 279 } 280 281 @Nonnull 282 public EntityInstance getRatedByEntityInstanceForUpdate() { 283 return getRatedByEntityInstance(EntityPermission.READ_WRITE); 284 } 285 286 public void setRatedByEntityInstancePK(@Nonnull EntityInstancePK ratedByEntityInstancePK) 287 throws PersistenceNotNullException, PersistenceReadOnlyException { 288 checkReadWrite(); 289 _value.setRatedByEntityInstancePK(ratedByEntityInstancePK); 290 } 291 292 public void setRatedByEntityInstance(@Nonnull EntityInstance entity) { 293 setRatedByEntityInstancePK(entity == null ? null : entity.getPrimaryKey()); 294 } 295 296 public boolean getRatedByEntityInstancePKHasBeenModified() { 297 return _value.getRatedByEntityInstancePKHasBeenModified(); 298 } 299 300 @Nonnull 301 public Long getFromTime() { 302 return _value.getFromTime(); 303 } 304 305 public void setFromTime(@Nonnull Long fromTime) 306 throws PersistenceNotNullException, PersistenceReadOnlyException { 307 checkReadWrite(); 308 _value.setFromTime(fromTime); 309 } 310 311 public boolean getFromTimeHasBeenModified() { 312 return _value.getFromTimeHasBeenModified(); 313 } 314 315 @Nonnull 316 public Long getThruTime() { 317 return _value.getThruTime(); 318 } 319 320 public void setThruTime(@Nonnull Long thruTime) 321 throws PersistenceNotNullException, PersistenceReadOnlyException { 322 checkReadWrite(); 323 _value.setThruTime(thruTime); 324 } 325 326 public boolean getThruTimeHasBeenModified() { 327 return _value.getThruTimeHasBeenModified(); 328 } 329 330}