001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 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 StringBuilder stringValue = new StringBuilder("{"); 146 147 stringValue.append("entityId=").append(getEntityId()); 148 149 stringValue.append(", messagePK=").append(getMessagePK()); 150 stringValue.append(", languagePK=").append(getLanguagePK()); 151 stringValue.append(", mimeTypePK=").append(getMimeTypePK()); 152 stringValue.append(", clob=").append(getClob()); 153 stringValue.append(", fromTime=").append(getFromTime()); 154 stringValue.append(", thruTime=").append(getThruTime()); 155 156 stringValue.append('}'); 157 158 _stringValue = stringValue.toString(); 159 } 160 return _stringValue; 161 } 162 163 @Override 164 public boolean equals(Object other) { 165 if(this == other) 166 return true; 167 168 if(!hasIdentity()) 169 return false; 170 171 if(other instanceof MessageClobValue) { 172 MessageClobValue that = (MessageClobValue)other; 173 174 if(!that.hasIdentity()) 175 return false; 176 177 Long thisEntityId = getEntityId(); 178 Long thatEntityId = that.getEntityId(); 179 180 boolean objectsEqual = thisEntityId.equals(thatEntityId); 181 if(objectsEqual) 182 objectsEqual = objectsEqual && isIdentical(that); 183 184 return objectsEqual; 185 } else { 186 return false; 187 } 188 } 189 190 public boolean isIdentical(Object other) { 191 if(other instanceof MessageClobValue) { 192 MessageClobValue that = (MessageClobValue)other; 193 boolean objectsEqual = true; 194 195 196 if(objectsEqual) { 197 MessagePK thisMessagePK = getMessagePK(); 198 MessagePK thatMessagePK = that.getMessagePK(); 199 200 if(thisMessagePK == null) { 201 objectsEqual = objectsEqual && (thatMessagePK == null); 202 } else { 203 objectsEqual = objectsEqual && thisMessagePK.equals(thatMessagePK); 204 } 205 } 206 207 if(objectsEqual) { 208 LanguagePK thisLanguagePK = getLanguagePK(); 209 LanguagePK thatLanguagePK = that.getLanguagePK(); 210 211 if(thisLanguagePK == null) { 212 objectsEqual = objectsEqual && (thatLanguagePK == null); 213 } else { 214 objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK); 215 } 216 } 217 218 if(objectsEqual) { 219 MimeTypePK thisMimeTypePK = getMimeTypePK(); 220 MimeTypePK thatMimeTypePK = that.getMimeTypePK(); 221 222 if(thisMimeTypePK == null) { 223 objectsEqual = objectsEqual && (thatMimeTypePK == null); 224 } else { 225 objectsEqual = objectsEqual && thisMimeTypePK.equals(thatMimeTypePK); 226 } 227 } 228 229 if(objectsEqual) { 230 String thisClob = getClob(); 231 String thatClob = that.getClob(); 232 233 if(thisClob == null) { 234 objectsEqual = objectsEqual && (thatClob == null); 235 } else { 236 objectsEqual = objectsEqual && thisClob.equals(thatClob); 237 } 238 } 239 240 if(objectsEqual) { 241 Long thisFromTime = getFromTime(); 242 Long thatFromTime = that.getFromTime(); 243 244 if(thisFromTime == null) { 245 objectsEqual = objectsEqual && (thatFromTime == null); 246 } else { 247 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 248 } 249 } 250 251 if(objectsEqual) { 252 Long thisThruTime = getThruTime(); 253 Long thatThruTime = that.getThruTime(); 254 255 if(thisThruTime == null) { 256 objectsEqual = objectsEqual && (thatThruTime == null); 257 } else { 258 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 259 } 260 } 261 262 return objectsEqual; 263 } else { 264 return false; 265 } 266 } 267 268 @Override 269 public boolean hasBeenModified() { 270 return messagePKHasBeenModified || languagePKHasBeenModified || mimeTypePKHasBeenModified || clobHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 271 } 272 273 @Override 274 public void clearHasBeenModified() { 275 messagePKHasBeenModified = false; 276 languagePKHasBeenModified = false; 277 mimeTypePKHasBeenModified = false; 278 clobHasBeenModified = false; 279 fromTimeHasBeenModified = false; 280 thruTimeHasBeenModified = false; 281 } 282 283 public MessagePK getMessagePK() { 284 return messagePK; 285 } 286 287 public void setMessagePK(MessagePK messagePK) 288 throws PersistenceNotNullException { 289 checkForNull(messagePK); 290 291 boolean update = true; 292 293 if(this.messagePK != null) { 294 if(this.messagePK.equals(messagePK)) { 295 update = false; 296 } 297 } else if(messagePK == null) { 298 update = false; 299 } 300 301 if(update) { 302 this.messagePK = messagePK; 303 messagePKHasBeenModified = true; 304 clearHashAndString(); 305 } 306 } 307 308 public boolean getMessagePKHasBeenModified() { 309 return messagePKHasBeenModified; 310 } 311 312 public LanguagePK getLanguagePK() { 313 return languagePK; 314 } 315 316 public void setLanguagePK(LanguagePK languagePK) 317 throws PersistenceNotNullException { 318 checkForNull(languagePK); 319 320 boolean update = true; 321 322 if(this.languagePK != null) { 323 if(this.languagePK.equals(languagePK)) { 324 update = false; 325 } 326 } else if(languagePK == null) { 327 update = false; 328 } 329 330 if(update) { 331 this.languagePK = languagePK; 332 languagePKHasBeenModified = true; 333 clearHashAndString(); 334 } 335 } 336 337 public boolean getLanguagePKHasBeenModified() { 338 return languagePKHasBeenModified; 339 } 340 341 public MimeTypePK getMimeTypePK() { 342 return mimeTypePK; 343 } 344 345 public void setMimeTypePK(MimeTypePK mimeTypePK) { 346 boolean update = true; 347 348 if(this.mimeTypePK != null) { 349 if(this.mimeTypePK.equals(mimeTypePK)) { 350 update = false; 351 } 352 } else if(mimeTypePK == null) { 353 update = false; 354 } 355 356 if(update) { 357 this.mimeTypePK = mimeTypePK; 358 mimeTypePKHasBeenModified = true; 359 clearHashAndString(); 360 } 361 } 362 363 public boolean getMimeTypePKHasBeenModified() { 364 return mimeTypePKHasBeenModified; 365 } 366 367 public String getClob() { 368 return clob; 369 } 370 371 public void setClob(String clob) 372 throws PersistenceNotNullException { 373 checkForNull(clob); 374 375 boolean update = true; 376 377 if(this.clob != null) { 378 if(this.clob.equals(clob)) { 379 update = false; 380 } 381 } else if(clob == null) { 382 update = false; 383 } 384 385 if(update) { 386 this.clob = clob; 387 clobHasBeenModified = true; 388 clearHashAndString(); 389 } 390 } 391 392 public boolean getClobHasBeenModified() { 393 return clobHasBeenModified; 394 } 395 396 public Long getFromTime() { 397 return fromTime; 398 } 399 400 public void setFromTime(Long fromTime) 401 throws PersistenceNotNullException { 402 checkForNull(fromTime); 403 404 boolean update = true; 405 406 if(this.fromTime != null) { 407 if(this.fromTime.equals(fromTime)) { 408 update = false; 409 } 410 } else if(fromTime == null) { 411 update = false; 412 } 413 414 if(update) { 415 this.fromTime = fromTime; 416 fromTimeHasBeenModified = true; 417 clearHashAndString(); 418 } 419 } 420 421 public boolean getFromTimeHasBeenModified() { 422 return fromTimeHasBeenModified; 423 } 424 425 public Long getThruTime() { 426 return thruTime; 427 } 428 429 public void setThruTime(Long thruTime) 430 throws PersistenceNotNullException { 431 checkForNull(thruTime); 432 433 boolean update = true; 434 435 if(this.thruTime != null) { 436 if(this.thruTime.equals(thruTime)) { 437 update = false; 438 } 439 } else if(thruTime == null) { 440 update = false; 441 } 442 443 if(update) { 444 this.thruTime = thruTime; 445 thruTimeHasBeenModified = true; 446 clearHashAndString(); 447 } 448 } 449 450 public boolean getThruTimeHasBeenModified() { 451 return thruTimeHasBeenModified; 452 } 453 454}