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