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 * ContentSectionDetailValue.java 021 */ 022 023package com.echothree.model.data.content.server.value; 024 025import com.echothree.model.data.content.common.pk.ContentSectionDetailPK; 026 027import com.echothree.model.data.content.server.factory.ContentSectionDetailFactory; 028 029import com.echothree.model.data.content.common.pk.ContentSectionPK; 030import com.echothree.model.data.content.common.pk.ContentCollectionPK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039import javax.annotation.Nonnull; 040import javax.annotation.Nullable; 041 042public class ContentSectionDetailValue 043 extends BaseValue<ContentSectionDetailPK> 044 implements Cloneable, Serializable { 045 046 private ContentSectionPK contentSectionPK; 047 private boolean contentSectionPKHasBeenModified = false; 048 private ContentCollectionPK contentCollectionPK; 049 private boolean contentCollectionPKHasBeenModified = false; 050 private String contentSectionName; 051 private boolean contentSectionNameHasBeenModified = false; 052 private ContentSectionPK parentContentSectionPK; 053 private boolean parentContentSectionPKHasBeenModified = false; 054 private Boolean isDefault; 055 private boolean isDefaultHasBeenModified = false; 056 private Integer sortOrder; 057 private boolean sortOrderHasBeenModified = false; 058 private Long fromTime; 059 private boolean fromTimeHasBeenModified = false; 060 private Long thruTime; 061 private boolean thruTimeHasBeenModified = false; 062 063 private transient Integer _hashCode = null; 064 private transient String _stringValue = null; 065 066 private void constructFields(ContentSectionPK contentSectionPK, ContentCollectionPK contentCollectionPK, String contentSectionName, ContentSectionPK parentContentSectionPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 067 throws PersistenceNotNullException { 068 checkForNull(contentSectionPK); 069 this.contentSectionPK = contentSectionPK; 070 checkForNull(contentCollectionPK); 071 this.contentCollectionPK = contentCollectionPK; 072 checkForNull(contentSectionName); 073 this.contentSectionName = contentSectionName; 074 this.parentContentSectionPK = parentContentSectionPK; 075 checkForNull(isDefault); 076 this.isDefault = isDefault; 077 checkForNull(sortOrder); 078 this.sortOrder = sortOrder; 079 checkForNull(fromTime); 080 this.fromTime = fromTime; 081 checkForNull(thruTime); 082 this.thruTime = thruTime; 083 } 084 085 /** Creates a new instance of ContentSectionDetailValue */ 086 public ContentSectionDetailValue(ContentSectionDetailPK contentSectionDetailPK, ContentSectionPK contentSectionPK, ContentCollectionPK contentCollectionPK, String contentSectionName, ContentSectionPK parentContentSectionPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 087 throws PersistenceNotNullException { 088 super(contentSectionDetailPK); 089 constructFields(contentSectionPK, contentCollectionPK, contentSectionName, parentContentSectionPK, isDefault, sortOrder, fromTime, thruTime); 090 } 091 092 /** Creates a new instance of ContentSectionDetailValue */ 093 public ContentSectionDetailValue(ContentSectionPK contentSectionPK, ContentCollectionPK contentCollectionPK, String contentSectionName, ContentSectionPK parentContentSectionPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 094 throws PersistenceNotNullException { 095 super(); 096 constructFields(contentSectionPK, contentCollectionPK, contentSectionName, parentContentSectionPK, isDefault, sortOrder, fromTime, thruTime); 097 } 098 099 @Override 100 @Nonnull 101 public ContentSectionDetailFactory getBaseFactoryInstance() { 102 return ContentSectionDetailFactory.getInstance(); 103 } 104 105 @Override 106 @Nonnull 107 public ContentSectionDetailValue clone() { 108 Object result; 109 110 try { 111 result = super.clone(); 112 } catch (CloneNotSupportedException cnse) { 113 // This shouldn't happen, fail when it does. 114 throw new PersistenceCloneException(cnse); 115 } 116 117 return (ContentSectionDetailValue)result; 118 } 119 120 @Override 121 @Nonnull 122 public ContentSectionDetailPK getPrimaryKey() { 123 if(_primaryKey == null) { 124 _primaryKey = new ContentSectionDetailPK(entityId); 125 } 126 127 return _primaryKey; 128 } 129 130 private void clearHashAndString() { 131 _hashCode = null; 132 _stringValue = null; 133 } 134 135 @Override 136 public int hashCode() { 137 if(_hashCode == null) { 138 int hashCode = 17; 139 140 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 141 142 hashCode = 37 * hashCode + ((contentSectionPK != null) ? contentSectionPK.hashCode() : 0); 143 hashCode = 37 * hashCode + ((contentCollectionPK != null) ? contentCollectionPK.hashCode() : 0); 144 hashCode = 37 * hashCode + ((contentSectionName != null) ? contentSectionName.hashCode() : 0); 145 hashCode = 37 * hashCode + ((parentContentSectionPK != null) ? parentContentSectionPK.hashCode() : 0); 146 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 147 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 148 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 149 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 150 151 _hashCode = hashCode; 152 } 153 154 return _hashCode; 155 } 156 157 @Override 158 @Nonnull 159 public String toString() { 160 if(_stringValue == null) { 161 _stringValue = "{" + 162 "entityId=" + getEntityId() + 163 ", contentSectionPK=" + getContentSectionPK() + 164 ", contentCollectionPK=" + getContentCollectionPK() + 165 ", contentSectionName=" + getContentSectionName() + 166 ", parentContentSectionPK=" + getParentContentSectionPK() + 167 ", isDefault=" + getIsDefault() + 168 ", sortOrder=" + getSortOrder() + 169 ", fromTime=" + getFromTime() + 170 ", thruTime=" + getThruTime() + 171 "}"; 172 } 173 return _stringValue; 174 } 175 176 @Override 177 public boolean equals(Object other) { 178 if(this == other) 179 return true; 180 181 if(!hasIdentity()) 182 return false; 183 184 if(other instanceof ContentSectionDetailValue that) { 185 if(!that.hasIdentity()) 186 return false; 187 188 Long thisEntityId = getEntityId(); 189 Long thatEntityId = that.getEntityId(); 190 191 boolean objectsEqual = thisEntityId.equals(thatEntityId); 192 if(objectsEqual) 193 objectsEqual = isIdentical(that); 194 195 return objectsEqual; 196 } else { 197 return false; 198 } 199 } 200 201 public boolean isIdentical(Object other) { 202 if(other instanceof ContentSectionDetailValue that) { 203 boolean objectsEqual = true; 204 205 206 if(objectsEqual) { 207 ContentSectionPK thisContentSectionPK = getContentSectionPK(); 208 ContentSectionPK thatContentSectionPK = that.getContentSectionPK(); 209 210 if(thisContentSectionPK == null) { 211 objectsEqual = objectsEqual && (thatContentSectionPK == null); 212 } else { 213 objectsEqual = objectsEqual && thisContentSectionPK.equals(thatContentSectionPK); 214 } 215 } 216 217 if(objectsEqual) { 218 ContentCollectionPK thisContentCollectionPK = getContentCollectionPK(); 219 ContentCollectionPK thatContentCollectionPK = that.getContentCollectionPK(); 220 221 if(thisContentCollectionPK == null) { 222 objectsEqual = objectsEqual && (thatContentCollectionPK == null); 223 } else { 224 objectsEqual = objectsEqual && thisContentCollectionPK.equals(thatContentCollectionPK); 225 } 226 } 227 228 if(objectsEqual) { 229 String thisContentSectionName = getContentSectionName(); 230 String thatContentSectionName = that.getContentSectionName(); 231 232 if(thisContentSectionName == null) { 233 objectsEqual = objectsEqual && (thatContentSectionName == null); 234 } else { 235 objectsEqual = objectsEqual && thisContentSectionName.equals(thatContentSectionName); 236 } 237 } 238 239 if(objectsEqual) { 240 ContentSectionPK thisParentContentSectionPK = getParentContentSectionPK(); 241 ContentSectionPK thatParentContentSectionPK = that.getParentContentSectionPK(); 242 243 if(thisParentContentSectionPK == null) { 244 objectsEqual = objectsEqual && (thatParentContentSectionPK == null); 245 } else { 246 objectsEqual = objectsEqual && thisParentContentSectionPK.equals(thatParentContentSectionPK); 247 } 248 } 249 250 if(objectsEqual) { 251 Boolean thisIsDefault = getIsDefault(); 252 Boolean thatIsDefault = that.getIsDefault(); 253 254 if(thisIsDefault == null) { 255 objectsEqual = objectsEqual && (thatIsDefault == null); 256 } else { 257 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 258 } 259 } 260 261 if(objectsEqual) { 262 Integer thisSortOrder = getSortOrder(); 263 Integer thatSortOrder = that.getSortOrder(); 264 265 if(thisSortOrder == null) { 266 objectsEqual = objectsEqual && (thatSortOrder == null); 267 } else { 268 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 269 } 270 } 271 272 if(objectsEqual) { 273 Long thisFromTime = getFromTime(); 274 Long thatFromTime = that.getFromTime(); 275 276 if(thisFromTime == null) { 277 objectsEqual = objectsEqual && (thatFromTime == null); 278 } else { 279 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 280 } 281 } 282 283 if(objectsEqual) { 284 Long thisThruTime = getThruTime(); 285 Long thatThruTime = that.getThruTime(); 286 287 if(thisThruTime == null) { 288 objectsEqual = objectsEqual && (thatThruTime == null); 289 } else { 290 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 291 } 292 } 293 294 return objectsEqual; 295 } else { 296 return false; 297 } 298 } 299 300 @Override 301 public boolean hasBeenModified() { 302 return contentSectionPKHasBeenModified || contentCollectionPKHasBeenModified || contentSectionNameHasBeenModified || parentContentSectionPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 303 } 304 305 @Override 306 public void clearHasBeenModified() { 307 contentSectionPKHasBeenModified = false; 308 contentCollectionPKHasBeenModified = false; 309 contentSectionNameHasBeenModified = false; 310 parentContentSectionPKHasBeenModified = false; 311 isDefaultHasBeenModified = false; 312 sortOrderHasBeenModified = false; 313 fromTimeHasBeenModified = false; 314 thruTimeHasBeenModified = false; 315 } 316 317 @Nonnull 318 public ContentSectionPK getContentSectionPK() { 319 return contentSectionPK; 320 } 321 322 public void setContentSectionPK(@Nonnull ContentSectionPK contentSectionPK) 323 throws PersistenceNotNullException { 324 checkForNull(contentSectionPK); 325 326 boolean update = true; 327 328 if(this.contentSectionPK != null) { 329 if(this.contentSectionPK.equals(contentSectionPK)) { 330 update = false; 331 } 332 } else if(contentSectionPK == null) { 333 update = false; 334 } 335 336 if(update) { 337 this.contentSectionPK = contentSectionPK; 338 contentSectionPKHasBeenModified = true; 339 clearHashAndString(); 340 } 341 } 342 343 public boolean getContentSectionPKHasBeenModified() { 344 return contentSectionPKHasBeenModified; 345 } 346 347 @Nonnull 348 public ContentCollectionPK getContentCollectionPK() { 349 return contentCollectionPK; 350 } 351 352 public void setContentCollectionPK(@Nonnull ContentCollectionPK contentCollectionPK) 353 throws PersistenceNotNullException { 354 checkForNull(contentCollectionPK); 355 356 boolean update = true; 357 358 if(this.contentCollectionPK != null) { 359 if(this.contentCollectionPK.equals(contentCollectionPK)) { 360 update = false; 361 } 362 } else if(contentCollectionPK == null) { 363 update = false; 364 } 365 366 if(update) { 367 this.contentCollectionPK = contentCollectionPK; 368 contentCollectionPKHasBeenModified = true; 369 clearHashAndString(); 370 } 371 } 372 373 public boolean getContentCollectionPKHasBeenModified() { 374 return contentCollectionPKHasBeenModified; 375 } 376 377 @Nonnull 378 public String getContentSectionName() { 379 return contentSectionName; 380 } 381 382 public void setContentSectionName(@Nonnull String contentSectionName) 383 throws PersistenceNotNullException { 384 checkForNull(contentSectionName); 385 386 boolean update = true; 387 388 if(this.contentSectionName != null) { 389 if(this.contentSectionName.equals(contentSectionName)) { 390 update = false; 391 } 392 } else if(contentSectionName == null) { 393 update = false; 394 } 395 396 if(update) { 397 this.contentSectionName = contentSectionName; 398 contentSectionNameHasBeenModified = true; 399 clearHashAndString(); 400 } 401 } 402 403 public boolean getContentSectionNameHasBeenModified() { 404 return contentSectionNameHasBeenModified; 405 } 406 407 @Nullable 408 public ContentSectionPK getParentContentSectionPK() { 409 return parentContentSectionPK; 410 } 411 412 public void setParentContentSectionPK(@Nullable ContentSectionPK parentContentSectionPK) { 413 boolean update = true; 414 415 if(this.parentContentSectionPK != null) { 416 if(this.parentContentSectionPK.equals(parentContentSectionPK)) { 417 update = false; 418 } 419 } else if(parentContentSectionPK == null) { 420 update = false; 421 } 422 423 if(update) { 424 this.parentContentSectionPK = parentContentSectionPK; 425 parentContentSectionPKHasBeenModified = true; 426 clearHashAndString(); 427 } 428 } 429 430 public boolean getParentContentSectionPKHasBeenModified() { 431 return parentContentSectionPKHasBeenModified; 432 } 433 434 @Nonnull 435 public Boolean getIsDefault() { 436 return isDefault; 437 } 438 439 public void setIsDefault(@Nonnull Boolean isDefault) 440 throws PersistenceNotNullException { 441 checkForNull(isDefault); 442 443 boolean update = true; 444 445 if(this.isDefault != null) { 446 if(this.isDefault.equals(isDefault)) { 447 update = false; 448 } 449 } else if(isDefault == null) { 450 update = false; 451 } 452 453 if(update) { 454 this.isDefault = isDefault; 455 isDefaultHasBeenModified = true; 456 clearHashAndString(); 457 } 458 } 459 460 public boolean getIsDefaultHasBeenModified() { 461 return isDefaultHasBeenModified; 462 } 463 464 @Nonnull 465 public Integer getSortOrder() { 466 return sortOrder; 467 } 468 469 public void setSortOrder(@Nonnull Integer sortOrder) 470 throws PersistenceNotNullException { 471 checkForNull(sortOrder); 472 473 boolean update = true; 474 475 if(this.sortOrder != null) { 476 if(this.sortOrder.equals(sortOrder)) { 477 update = false; 478 } 479 } else if(sortOrder == null) { 480 update = false; 481 } 482 483 if(update) { 484 this.sortOrder = sortOrder; 485 sortOrderHasBeenModified = true; 486 clearHashAndString(); 487 } 488 } 489 490 public boolean getSortOrderHasBeenModified() { 491 return sortOrderHasBeenModified; 492 } 493 494 @Nonnull 495 public Long getFromTime() { 496 return fromTime; 497 } 498 499 public void setFromTime(@Nonnull Long fromTime) 500 throws PersistenceNotNullException { 501 checkForNull(fromTime); 502 503 boolean update = true; 504 505 if(this.fromTime != null) { 506 if(this.fromTime.equals(fromTime)) { 507 update = false; 508 } 509 } else if(fromTime == null) { 510 update = false; 511 } 512 513 if(update) { 514 this.fromTime = fromTime; 515 fromTimeHasBeenModified = true; 516 clearHashAndString(); 517 } 518 } 519 520 public boolean getFromTimeHasBeenModified() { 521 return fromTimeHasBeenModified; 522 } 523 524 @Nonnull 525 public Long getThruTime() { 526 return thruTime; 527 } 528 529 public void setThruTime(@Nonnull Long thruTime) 530 throws PersistenceNotNullException { 531 checkForNull(thruTime); 532 533 boolean update = true; 534 535 if(this.thruTime != null) { 536 if(this.thruTime.equals(thruTime)) { 537 update = false; 538 } 539 } else if(thruTime == null) { 540 update = false; 541 } 542 543 if(update) { 544 this.thruTime = thruTime; 545 thruTimeHasBeenModified = true; 546 clearHashAndString(); 547 } 548 } 549 550 public boolean getThruTimeHasBeenModified() { 551 return thruTimeHasBeenModified; 552 } 553 554}