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