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 * PeriodDetail.java 021 */ 022 023package com.echothree.model.data.period.server.entity; 024 025import com.echothree.model.data.period.common.pk.PeriodDetailPK; 026 027import com.echothree.model.data.period.common.pk.PeriodPK; 028import com.echothree.model.data.period.common.pk.PeriodKindPK; 029import com.echothree.model.data.period.common.pk.PeriodTypePK; 030 031import com.echothree.model.data.period.server.entity.Period; 032import com.echothree.model.data.period.server.entity.PeriodKind; 033import com.echothree.model.data.period.server.entity.PeriodType; 034 035import com.echothree.model.data.period.server.factory.PeriodFactory; 036import com.echothree.model.data.period.server.factory.PeriodKindFactory; 037import com.echothree.model.data.period.server.factory.PeriodTypeFactory; 038 039import com.echothree.model.data.period.common.pk.PeriodDetailPK; 040 041import com.echothree.model.data.period.server.value.PeriodDetailValue; 042 043import com.echothree.model.data.period.server.factory.PeriodDetailFactory; 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 061public class PeriodDetail 062 extends BaseEntity 063 implements Serializable { 064 065 private PeriodDetailPK _pk; 066 private PeriodDetailValue _value; 067 068 /** Creates a new instance of PeriodDetail */ 069 public PeriodDetail() 070 throws PersistenceException { 071 super(); 072 } 073 074 /** Creates a new instance of PeriodDetail */ 075 public PeriodDetail(PeriodDetailValue value, EntityPermission entityPermission) { 076 super(entityPermission); 077 078 _value = value; 079 _pk = value.getPrimaryKey(); 080 } 081 082 @Override 083 public PeriodDetailFactory getBaseFactoryInstance() { 084 return PeriodDetailFactory.getInstance(); 085 } 086 087 @Override 088 public boolean hasBeenModified() { 089 return _value.hasBeenModified(); 090 } 091 092 @Override 093 public int hashCode() { 094 return _pk.hashCode(); 095 } 096 097 @Override 098 public String toString() { 099 return _pk.toString(); 100 } 101 102 @Override 103 public boolean equals(Object other) { 104 if(this == other) 105 return true; 106 107 if(other instanceof PeriodDetail that) { 108 PeriodDetailValue thatValue = that.getPeriodDetailValue(); 109 return _value.equals(thatValue); 110 } else { 111 return false; 112 } 113 } 114 115 @Override 116 public void store(Session session) 117 throws PersistenceDatabaseException { 118 getBaseFactoryInstance().store(session, this); 119 } 120 121 @Override 122 public void remove(Session session) 123 throws PersistenceDatabaseException { 124 getBaseFactoryInstance().remove(session, this); 125 } 126 127 @Override 128 public void remove() 129 throws PersistenceDatabaseException { 130 getBaseFactoryInstance().remove(ThreadSession.currentSession(), this); 131 } 132 133 public PeriodDetailValue getPeriodDetailValue() { 134 return _value; 135 } 136 137 public void setPeriodDetailValue(PeriodDetailValue value) 138 throws PersistenceReadOnlyException { 139 checkReadWrite(); 140 _value = value; 141 } 142 143 @Override 144 public PeriodDetailPK getPrimaryKey() { 145 return _pk; 146 } 147 148 public PeriodPK getPeriodPK() { 149 return _value.getPeriodPK(); 150 } 151 152 public Period getPeriod(Session session, EntityPermission entityPermission) { 153 return PeriodFactory.getInstance().getEntityFromPK(session, entityPermission, getPeriodPK()); 154 } 155 156 public Period getPeriod(EntityPermission entityPermission) { 157 return getPeriod(ThreadSession.currentSession(), entityPermission); 158 } 159 160 public Period getPeriod(Session session) { 161 return getPeriod(session, EntityPermission.READ_ONLY); 162 } 163 164 public Period getPeriod() { 165 return getPeriod(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 166 } 167 168 public Period getPeriodForUpdate(Session session) { 169 return getPeriod(session, EntityPermission.READ_WRITE); 170 } 171 172 public Period getPeriodForUpdate() { 173 return getPeriod(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 174 } 175 176 public void setPeriodPK(PeriodPK periodPK) 177 throws PersistenceNotNullException, PersistenceReadOnlyException { 178 checkReadWrite(); 179 _value.setPeriodPK(periodPK); 180 } 181 182 public void setPeriod(Period entity) { 183 setPeriodPK(entity == null? null: entity.getPrimaryKey()); 184 } 185 186 public boolean getPeriodPKHasBeenModified() { 187 return _value.getPeriodPKHasBeenModified(); 188 } 189 190 public PeriodKindPK getPeriodKindPK() { 191 return _value.getPeriodKindPK(); 192 } 193 194 public PeriodKind getPeriodKind(Session session, EntityPermission entityPermission) { 195 return PeriodKindFactory.getInstance().getEntityFromPK(session, entityPermission, getPeriodKindPK()); 196 } 197 198 public PeriodKind getPeriodKind(EntityPermission entityPermission) { 199 return getPeriodKind(ThreadSession.currentSession(), entityPermission); 200 } 201 202 public PeriodKind getPeriodKind(Session session) { 203 return getPeriodKind(session, EntityPermission.READ_ONLY); 204 } 205 206 public PeriodKind getPeriodKind() { 207 return getPeriodKind(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 208 } 209 210 public PeriodKind getPeriodKindForUpdate(Session session) { 211 return getPeriodKind(session, EntityPermission.READ_WRITE); 212 } 213 214 public PeriodKind getPeriodKindForUpdate() { 215 return getPeriodKind(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 216 } 217 218 public void setPeriodKindPK(PeriodKindPK periodKindPK) 219 throws PersistenceNotNullException, PersistenceReadOnlyException { 220 checkReadWrite(); 221 _value.setPeriodKindPK(periodKindPK); 222 } 223 224 public void setPeriodKind(PeriodKind entity) { 225 setPeriodKindPK(entity == null? null: entity.getPrimaryKey()); 226 } 227 228 public boolean getPeriodKindPKHasBeenModified() { 229 return _value.getPeriodKindPKHasBeenModified(); 230 } 231 232 public String getPeriodName() { 233 return _value.getPeriodName(); 234 } 235 236 public void setPeriodName(String periodName) 237 throws PersistenceNotNullException, PersistenceReadOnlyException { 238 checkReadWrite(); 239 _value.setPeriodName(periodName); 240 } 241 242 public boolean getPeriodNameHasBeenModified() { 243 return _value.getPeriodNameHasBeenModified(); 244 } 245 246 public PeriodPK getParentPeriodPK() { 247 return _value.getParentPeriodPK(); 248 } 249 250 public Period getParentPeriod(Session session, EntityPermission entityPermission) { 251 PeriodPK pk = getParentPeriodPK(); 252 Period entity = pk == null? null: PeriodFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 253 254 return entity; 255 } 256 257 public Period getParentPeriod(EntityPermission entityPermission) { 258 return getParentPeriod(ThreadSession.currentSession(), entityPermission); 259 } 260 261 public Period getParentPeriod(Session session) { 262 return getParentPeriod(session, EntityPermission.READ_ONLY); 263 } 264 265 public Period getParentPeriod() { 266 return getParentPeriod(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 267 } 268 269 public Period getParentPeriodForUpdate(Session session) { 270 return getParentPeriod(session, EntityPermission.READ_WRITE); 271 } 272 273 public Period getParentPeriodForUpdate() { 274 return getParentPeriod(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 275 } 276 277 public void setParentPeriodPK(PeriodPK parentPeriodPK) 278 throws PersistenceNotNullException, PersistenceReadOnlyException { 279 checkReadWrite(); 280 _value.setParentPeriodPK(parentPeriodPK); 281 } 282 283 public void setParentPeriod(Period entity) { 284 setParentPeriodPK(entity == null? null: entity.getPrimaryKey()); 285 } 286 287 public boolean getParentPeriodPKHasBeenModified() { 288 return _value.getParentPeriodPKHasBeenModified(); 289 } 290 291 public PeriodTypePK getPeriodTypePK() { 292 return _value.getPeriodTypePK(); 293 } 294 295 public PeriodType getPeriodType(Session session, EntityPermission entityPermission) { 296 PeriodTypePK pk = getPeriodTypePK(); 297 PeriodType entity = pk == null? null: PeriodTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk); 298 299 return entity; 300 } 301 302 public PeriodType getPeriodType(EntityPermission entityPermission) { 303 return getPeriodType(ThreadSession.currentSession(), entityPermission); 304 } 305 306 public PeriodType getPeriodType(Session session) { 307 return getPeriodType(session, EntityPermission.READ_ONLY); 308 } 309 310 public PeriodType getPeriodType() { 311 return getPeriodType(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 312 } 313 314 public PeriodType getPeriodTypeForUpdate(Session session) { 315 return getPeriodType(session, EntityPermission.READ_WRITE); 316 } 317 318 public PeriodType getPeriodTypeForUpdate() { 319 return getPeriodType(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 320 } 321 322 public void setPeriodTypePK(PeriodTypePK periodTypePK) 323 throws PersistenceNotNullException, PersistenceReadOnlyException { 324 checkReadWrite(); 325 _value.setPeriodTypePK(periodTypePK); 326 } 327 328 public void setPeriodType(PeriodType entity) { 329 setPeriodTypePK(entity == null? null: entity.getPrimaryKey()); 330 } 331 332 public boolean getPeriodTypePKHasBeenModified() { 333 return _value.getPeriodTypePKHasBeenModified(); 334 } 335 336 public Long getStartTime() { 337 return _value.getStartTime(); 338 } 339 340 public void setStartTime(Long startTime) 341 throws PersistenceNotNullException, PersistenceReadOnlyException { 342 checkReadWrite(); 343 _value.setStartTime(startTime); 344 } 345 346 public boolean getStartTimeHasBeenModified() { 347 return _value.getStartTimeHasBeenModified(); 348 } 349 350 public Long getEndTime() { 351 return _value.getEndTime(); 352 } 353 354 public void setEndTime(Long endTime) 355 throws PersistenceNotNullException, PersistenceReadOnlyException { 356 checkReadWrite(); 357 _value.setEndTime(endTime); 358 } 359 360 public boolean getEndTimeHasBeenModified() { 361 return _value.getEndTimeHasBeenModified(); 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}