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 * ContentPageLayoutAreaDescriptionValue.java 021 */ 022 023package com.echothree.model.data.content.server.value; 024 025import com.echothree.model.data.content.common.pk.ContentPageLayoutAreaDescriptionPK; 026 027import com.echothree.model.data.content.server.factory.ContentPageLayoutAreaDescriptionFactory; 028 029import com.echothree.model.data.content.common.pk.ContentPageLayoutAreaPK; 030import com.echothree.model.data.party.common.pk.LanguagePK; 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 ContentPageLayoutAreaDescriptionValue 040 extends BaseValue<ContentPageLayoutAreaDescriptionPK> 041 implements Cloneable, Serializable { 042 043 private ContentPageLayoutAreaPK contentPageLayoutAreaPK; 044 private boolean contentPageLayoutAreaPKHasBeenModified = false; 045 private LanguagePK languagePK; 046 private boolean languagePKHasBeenModified = false; 047 private String description; 048 private boolean descriptionHasBeenModified = false; 049 050 private transient Integer _hashCode = null; 051 private transient String _stringValue = null; 052 053 private void constructFields(ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, String description) 054 throws PersistenceNotNullException { 055 checkForNull(contentPageLayoutAreaPK); 056 this.contentPageLayoutAreaPK = contentPageLayoutAreaPK; 057 checkForNull(languagePK); 058 this.languagePK = languagePK; 059 checkForNull(description); 060 this.description = description; 061 } 062 063 /** Creates a new instance of ContentPageLayoutAreaDescriptionValue */ 064 public ContentPageLayoutAreaDescriptionValue(ContentPageLayoutAreaDescriptionPK contentPageLayoutAreaDescriptionPK, ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, String description) 065 throws PersistenceNotNullException { 066 super(contentPageLayoutAreaDescriptionPK); 067 constructFields(contentPageLayoutAreaPK, languagePK, description); 068 } 069 070 /** Creates a new instance of ContentPageLayoutAreaDescriptionValue */ 071 public ContentPageLayoutAreaDescriptionValue(ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, String description) 072 throws PersistenceNotNullException { 073 super(); 074 constructFields(contentPageLayoutAreaPK, languagePK, description); 075 } 076 077 @Override 078 public ContentPageLayoutAreaDescriptionFactory getBaseFactoryInstance() { 079 return ContentPageLayoutAreaDescriptionFactory.getInstance(); 080 } 081 082 @Override 083 public ContentPageLayoutAreaDescriptionValue clone() { 084 Object result; 085 086 try { 087 result = super.clone(); 088 } catch (CloneNotSupportedException cnse) { 089 // This shouldn't happen, fail when it does. 090 throw new PersistenceCloneException(cnse); 091 } 092 093 return (ContentPageLayoutAreaDescriptionValue)result; 094 } 095 096 @Override 097 public ContentPageLayoutAreaDescriptionPK getPrimaryKey() { 098 if(_primaryKey == null) { 099 _primaryKey = new ContentPageLayoutAreaDescriptionPK(entityId); 100 } 101 102 return _primaryKey; 103 } 104 105 private void clearHashAndString() { 106 _hashCode = null; 107 _stringValue = null; 108 } 109 110 @Override 111 public int hashCode() { 112 if(_hashCode == null) { 113 int hashCode = 17; 114 115 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 116 117 hashCode = 37 * hashCode + ((contentPageLayoutAreaPK != null) ? contentPageLayoutAreaPK.hashCode() : 0); 118 hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0); 119 hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0); 120 121 _hashCode = hashCode; 122 } 123 124 return _hashCode; 125 } 126 127 @Override 128 public String toString() { 129 if(_stringValue == null) { 130 _stringValue = "{" + 131 "entityId=" + getEntityId() + 132 ", contentPageLayoutAreaPK=" + getContentPageLayoutAreaPK() + 133 ", languagePK=" + getLanguagePK() + 134 ", description=" + getDescription() + 135 "}"; 136 } 137 return _stringValue; 138 } 139 140 @Override 141 public boolean equals(Object other) { 142 if(this == other) 143 return true; 144 145 if(!hasIdentity()) 146 return false; 147 148 if(other instanceof ContentPageLayoutAreaDescriptionValue that) { 149 if(!that.hasIdentity()) 150 return false; 151 152 Long thisEntityId = getEntityId(); 153 Long thatEntityId = that.getEntityId(); 154 155 boolean objectsEqual = thisEntityId.equals(thatEntityId); 156 if(objectsEqual) 157 objectsEqual = isIdentical(that); 158 159 return objectsEqual; 160 } else { 161 return false; 162 } 163 } 164 165 public boolean isIdentical(Object other) { 166 if(other instanceof ContentPageLayoutAreaDescriptionValue that) { 167 boolean objectsEqual = true; 168 169 170 if(objectsEqual) { 171 ContentPageLayoutAreaPK thisContentPageLayoutAreaPK = getContentPageLayoutAreaPK(); 172 ContentPageLayoutAreaPK thatContentPageLayoutAreaPK = that.getContentPageLayoutAreaPK(); 173 174 if(thisContentPageLayoutAreaPK == null) { 175 objectsEqual = objectsEqual && (thatContentPageLayoutAreaPK == null); 176 } else { 177 objectsEqual = objectsEqual && thisContentPageLayoutAreaPK.equals(thatContentPageLayoutAreaPK); 178 } 179 } 180 181 if(objectsEqual) { 182 LanguagePK thisLanguagePK = getLanguagePK(); 183 LanguagePK thatLanguagePK = that.getLanguagePK(); 184 185 if(thisLanguagePK == null) { 186 objectsEqual = objectsEqual && (thatLanguagePK == null); 187 } else { 188 objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK); 189 } 190 } 191 192 if(objectsEqual) { 193 String thisDescription = getDescription(); 194 String thatDescription = that.getDescription(); 195 196 if(thisDescription == null) { 197 objectsEqual = objectsEqual && (thatDescription == null); 198 } else { 199 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 200 } 201 } 202 203 return objectsEqual; 204 } else { 205 return false; 206 } 207 } 208 209 @Override 210 public boolean hasBeenModified() { 211 return contentPageLayoutAreaPKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified; 212 } 213 214 @Override 215 public void clearHasBeenModified() { 216 contentPageLayoutAreaPKHasBeenModified = false; 217 languagePKHasBeenModified = false; 218 descriptionHasBeenModified = false; 219 } 220 221 public ContentPageLayoutAreaPK getContentPageLayoutAreaPK() { 222 return contentPageLayoutAreaPK; 223 } 224 225 public void setContentPageLayoutAreaPK(ContentPageLayoutAreaPK contentPageLayoutAreaPK) 226 throws PersistenceNotNullException { 227 checkForNull(contentPageLayoutAreaPK); 228 229 boolean update = true; 230 231 if(this.contentPageLayoutAreaPK != null) { 232 if(this.contentPageLayoutAreaPK.equals(contentPageLayoutAreaPK)) { 233 update = false; 234 } 235 } else if(contentPageLayoutAreaPK == null) { 236 update = false; 237 } 238 239 if(update) { 240 this.contentPageLayoutAreaPK = contentPageLayoutAreaPK; 241 contentPageLayoutAreaPKHasBeenModified = true; 242 clearHashAndString(); 243 } 244 } 245 246 public boolean getContentPageLayoutAreaPKHasBeenModified() { 247 return contentPageLayoutAreaPKHasBeenModified; 248 } 249 250 public LanguagePK getLanguagePK() { 251 return languagePK; 252 } 253 254 public void setLanguagePK(LanguagePK languagePK) 255 throws PersistenceNotNullException { 256 checkForNull(languagePK); 257 258 boolean update = true; 259 260 if(this.languagePK != null) { 261 if(this.languagePK.equals(languagePK)) { 262 update = false; 263 } 264 } else if(languagePK == null) { 265 update = false; 266 } 267 268 if(update) { 269 this.languagePK = languagePK; 270 languagePKHasBeenModified = true; 271 clearHashAndString(); 272 } 273 } 274 275 public boolean getLanguagePKHasBeenModified() { 276 return languagePKHasBeenModified; 277 } 278 279 public String getDescription() { 280 return description; 281 } 282 283 public void setDescription(String description) 284 throws PersistenceNotNullException { 285 checkForNull(description); 286 287 boolean update = true; 288 289 if(this.description != null) { 290 if(this.description.equals(description)) { 291 update = false; 292 } 293 } else if(description == null) { 294 update = false; 295 } 296 297 if(update) { 298 this.description = description; 299 descriptionHasBeenModified = true; 300 clearHashAndString(); 301 } 302 } 303 304 public boolean getDescriptionHasBeenModified() { 305 return descriptionHasBeenModified; 306 } 307 308}