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 * MessageClobValue.java 021 */ 022 023package com.echothree.model.data.message.server.value; 024 025import com.echothree.model.data.message.common.pk.MessageClobPK; 026 027import com.echothree.model.data.message.server.factory.MessageClobFactory; 028 029import com.echothree.model.data.message.common.pk.MessagePK; 030import com.echothree.model.data.party.common.pk.LanguagePK; 031import com.echothree.model.data.core.common.pk.MimeTypePK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040public class MessageClobValue 041 extends BaseValue<MessageClobPK> 042 implements Cloneable, Serializable { 043 044 private MessagePK messagePK; 045 private boolean messagePKHasBeenModified = false; 046 private LanguagePK languagePK; 047 private boolean languagePKHasBeenModified = false; 048 private MimeTypePK mimeTypePK; 049 private boolean mimeTypePKHasBeenModified = false; 050 private String clob; 051 private boolean clobHasBeenModified = false; 052 private Long fromTime; 053 private boolean fromTimeHasBeenModified = false; 054 private Long thruTime; 055 private boolean thruTimeHasBeenModified = false; 056 057 private transient Integer _hashCode = null; 058 private transient String _stringValue = null; 059 060 private void constructFields(MessagePK messagePK, LanguagePK languagePK, MimeTypePK mimeTypePK, String clob, Long fromTime, Long thruTime) 061 throws PersistenceNotNullException { 062 checkForNull(messagePK); 063 this.messagePK = messagePK; 064 checkForNull(languagePK); 065 this.languagePK = languagePK; 066 this.mimeTypePK = mimeTypePK; 067 checkForNull(clob); 068 this.clob = clob; 069 checkForNull(fromTime); 070 this.fromTime = fromTime; 071 checkForNull(thruTime); 072 this.thruTime = thruTime; 073 } 074 075 /** Creates a new instance of MessageClobValue */ 076 public MessageClobValue(MessageClobPK messageClobPK, MessagePK messagePK, LanguagePK languagePK, MimeTypePK mimeTypePK, String clob, Long fromTime, Long thruTime) 077 throws PersistenceNotNullException { 078 super(messageClobPK); 079 constructFields(messagePK, languagePK, mimeTypePK, clob, fromTime, thruTime); 080 } 081 082 /** Creates a new instance of MessageClobValue */ 083 public MessageClobValue(MessagePK messagePK, LanguagePK languagePK, MimeTypePK mimeTypePK, String clob, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(); 086 constructFields(messagePK, languagePK, mimeTypePK, clob, fromTime, thruTime); 087 } 088 089 @Override 090 public MessageClobFactory getBaseFactoryInstance() { 091 return MessageClobFactory.getInstance(); 092 } 093 094 @Override 095 public MessageClobValue clone() { 096 Object result; 097 098 try { 099 result = super.clone(); 100 } catch (CloneNotSupportedException cnse) { 101 // This shouldn't happen, fail when it does. 102 throw new PersistenceCloneException(cnse); 103 } 104 105 return (MessageClobValue)result; 106 } 107 108 @Override 109 public MessageClobPK getPrimaryKey() { 110 if(_primaryKey == null) { 111 _primaryKey = new MessageClobPK(entityId); 112 } 113 114 return _primaryKey; 115 } 116 117 private void clearHashAndString() { 118 _hashCode = null; 119 _stringValue = null; 120 } 121 122 @Override 123 public int hashCode() { 124 if(_hashCode == null) { 125 int hashCode = 17; 126 127 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 128 129 hashCode = 37 * hashCode + ((messagePK != null) ? messagePK.hashCode() : 0); 130 hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0); 131 hashCode = 37 * hashCode + ((mimeTypePK != null) ? mimeTypePK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((clob != null) ? clob.hashCode() : 0); 133 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 134 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 135 136 _hashCode = hashCode; 137 } 138 139 return _hashCode; 140 } 141 142 @Override 143 public String toString() { 144 if(_stringValue == null) { 145 _stringValue = "{" + 146 "entityId=" + getEntityId() + 147 ", messagePK=" + getMessagePK() + 148 ", languagePK=" + getLanguagePK() + 149 ", mimeTypePK=" + getMimeTypePK() + 150 ", clob=" + getClob() + 151 ", fromTime=" + getFromTime() + 152 ", thruTime=" + getThruTime() + 153 "}"; 154 } 155 return _stringValue; 156 } 157 158 @Override 159 public boolean equals(Object other) { 160 if(this == other) 161 return true; 162 163 if(!hasIdentity()) 164 return false; 165 166 if(other instanceof MessageClobValue that) { 167 if(!that.hasIdentity()) 168 return false; 169 170 Long thisEntityId = getEntityId(); 171 Long thatEntityId = that.getEntityId(); 172 173 boolean objectsEqual = thisEntityId.equals(thatEntityId); 174 if(objectsEqual) 175 objectsEqual = isIdentical(that); 176 177 return objectsEqual; 178 } else { 179 return false; 180 } 181 } 182 183 public boolean isIdentical(Object other) { 184 if(other instanceof MessageClobValue that) { 185 boolean objectsEqual = true; 186 187 188 if(objectsEqual) { 189 MessagePK thisMessagePK = getMessagePK(); 190 MessagePK thatMessagePK = that.getMessagePK(); 191 192 if(thisMessagePK == null) { 193 objectsEqual = objectsEqual && (thatMessagePK == null); 194 } else { 195 objectsEqual = objectsEqual && thisMessagePK.equals(thatMessagePK); 196 } 197 } 198 199 if(objectsEqual) { 200 LanguagePK thisLanguagePK = getLanguagePK(); 201 LanguagePK thatLanguagePK = that.getLanguagePK(); 202 203 if(thisLanguagePK == null) { 204 objectsEqual = objectsEqual && (thatLanguagePK == null); 205 } else { 206 objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK); 207 } 208 } 209 210 if(objectsEqual) { 211 MimeTypePK thisMimeTypePK = getMimeTypePK(); 212 MimeTypePK thatMimeTypePK = that.getMimeTypePK(); 213 214 if(thisMimeTypePK == null) { 215 objectsEqual = objectsEqual && (thatMimeTypePK == null); 216 } else { 217 objectsEqual = objectsEqual && thisMimeTypePK.equals(thatMimeTypePK); 218 } 219 } 220 221 if(objectsEqual) { 222 String thisClob = getClob(); 223 String thatClob = that.getClob(); 224 225 if(thisClob == null) { 226 objectsEqual = objectsEqual && (thatClob == null); 227 } else { 228 objectsEqual = objectsEqual && thisClob.equals(thatClob); 229 } 230 } 231 232 if(objectsEqual) { 233 Long thisFromTime = getFromTime(); 234 Long thatFromTime = that.getFromTime(); 235 236 if(thisFromTime == null) { 237 objectsEqual = objectsEqual && (thatFromTime == null); 238 } else { 239 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 240 } 241 } 242 243 if(objectsEqual) { 244 Long thisThruTime = getThruTime(); 245 Long thatThruTime = that.getThruTime(); 246 247 if(thisThruTime == null) { 248 objectsEqual = objectsEqual && (thatThruTime == null); 249 } else { 250 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 251 } 252 } 253 254 return objectsEqual; 255 } else { 256 return false; 257 } 258 } 259 260 @Override 261 public boolean hasBeenModified() { 262 return messagePKHasBeenModified || languagePKHasBeenModified || mimeTypePKHasBeenModified || clobHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 263 } 264 265 @Override 266 public void clearHasBeenModified() { 267 messagePKHasBeenModified = false; 268 languagePKHasBeenModified = false; 269 mimeTypePKHasBeenModified = false; 270 clobHasBeenModified = false; 271 fromTimeHasBeenModified = false; 272 thruTimeHasBeenModified = false; 273 } 274 275 public MessagePK getMessagePK() { 276 return messagePK; 277 } 278 279 public void setMessagePK(MessagePK messagePK) 280 throws PersistenceNotNullException { 281 checkForNull(messagePK); 282 283 boolean update = true; 284 285 if(this.messagePK != null) { 286 if(this.messagePK.equals(messagePK)) { 287 update = false; 288 } 289 } else if(messagePK == null) { 290 update = false; 291 } 292 293 if(update) { 294 this.messagePK = messagePK; 295 messagePKHasBeenModified = true; 296 clearHashAndString(); 297 } 298 } 299 300 public boolean getMessagePKHasBeenModified() { 301 return messagePKHasBeenModified; 302 } 303 304 public LanguagePK getLanguagePK() { 305 return languagePK; 306 } 307 308 public void setLanguagePK(LanguagePK languagePK) 309 throws PersistenceNotNullException { 310 checkForNull(languagePK); 311 312 boolean update = true; 313 314 if(this.languagePK != null) { 315 if(this.languagePK.equals(languagePK)) { 316 update = false; 317 } 318 } else if(languagePK == null) { 319 update = false; 320 } 321 322 if(update) { 323 this.languagePK = languagePK; 324 languagePKHasBeenModified = true; 325 clearHashAndString(); 326 } 327 } 328 329 public boolean getLanguagePKHasBeenModified() { 330 return languagePKHasBeenModified; 331 } 332 333 public MimeTypePK getMimeTypePK() { 334 return mimeTypePK; 335 } 336 337 public void setMimeTypePK(MimeTypePK mimeTypePK) { 338 boolean update = true; 339 340 if(this.mimeTypePK != null) { 341 if(this.mimeTypePK.equals(mimeTypePK)) { 342 update = false; 343 } 344 } else if(mimeTypePK == null) { 345 update = false; 346 } 347 348 if(update) { 349 this.mimeTypePK = mimeTypePK; 350 mimeTypePKHasBeenModified = true; 351 clearHashAndString(); 352 } 353 } 354 355 public boolean getMimeTypePKHasBeenModified() { 356 return mimeTypePKHasBeenModified; 357 } 358 359 public String getClob() { 360 return clob; 361 } 362 363 public void setClob(String clob) 364 throws PersistenceNotNullException { 365 checkForNull(clob); 366 367 boolean update = true; 368 369 if(this.clob != null) { 370 if(this.clob.equals(clob)) { 371 update = false; 372 } 373 } else if(clob == null) { 374 update = false; 375 } 376 377 if(update) { 378 this.clob = clob; 379 clobHasBeenModified = true; 380 clearHashAndString(); 381 } 382 } 383 384 public boolean getClobHasBeenModified() { 385 return clobHasBeenModified; 386 } 387 388 public Long getFromTime() { 389 return fromTime; 390 } 391 392 public void setFromTime(Long fromTime) 393 throws PersistenceNotNullException { 394 checkForNull(fromTime); 395 396 boolean update = true; 397 398 if(this.fromTime != null) { 399 if(this.fromTime.equals(fromTime)) { 400 update = false; 401 } 402 } else if(fromTime == null) { 403 update = false; 404 } 405 406 if(update) { 407 this.fromTime = fromTime; 408 fromTimeHasBeenModified = true; 409 clearHashAndString(); 410 } 411 } 412 413 public boolean getFromTimeHasBeenModified() { 414 return fromTimeHasBeenModified; 415 } 416 417 public Long getThruTime() { 418 return thruTime; 419 } 420 421 public void setThruTime(Long thruTime) 422 throws PersistenceNotNullException { 423 checkForNull(thruTime); 424 425 boolean update = true; 426 427 if(this.thruTime != null) { 428 if(this.thruTime.equals(thruTime)) { 429 update = false; 430 } 431 } else if(thruTime == null) { 432 update = false; 433 } 434 435 if(update) { 436 this.thruTime = thruTime; 437 thruTimeHasBeenModified = true; 438 clearHashAndString(); 439 } 440 } 441 442 public boolean getThruTimeHasBeenModified() { 443 return thruTimeHasBeenModified; 444 } 445 446}