2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.db.request.beans;
23 import java.io.Serializable;
24 import java.util.Date;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.Id;
29 import javax.persistence.PrePersist;
30 import javax.persistence.PreUpdate;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34 import javax.persistence.Version;
36 import java.util.Objects;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
40 @Table(name = "watchdog_distributionid_status")
41 public class WatchdogDistributionStatus implements Serializable {
46 private static final long serialVersionUID = -4449711060885719079L;
49 @Column(name = "DISTRIBUTION_ID", length=45)
50 private String distributionId;
51 @Column(name = "DISTRIBUTION_ID_STATUS", length=45)
52 private String distributionIdStatus;
53 @Column(name = "CREATE_TIME", updatable=false)
54 @Temporal(TemporalType.TIMESTAMP)
55 private Date createTime;
56 @Column(name = "MODIFY_TIME")
57 @Temporal(TemporalType.TIMESTAMP)
58 private Date modifyTime;
60 @Column(name = "LOCK_VERSION")
63 public WatchdogDistributionStatus() {
67 public WatchdogDistributionStatus(String distributionId) {
68 this.distributionId = distributionId;
71 public String getDistributionId() {
72 return distributionId;
75 public void setDistributionId(String distributionId) {
76 this.distributionId = distributionId;
79 public String getDistributionIdStatus() {
80 return distributionIdStatus;
83 public void setDistributionIdStatus(String distributionIdStatus) {
84 this.distributionIdStatus = distributionIdStatus;
87 public int getVersion() {
91 public void setVersion(int version) {
92 this.version = version;
95 public Date getCreateTime() {
99 public Date getModifyTime() {
104 protected void onCreate() {
105 this.createTime = this.modifyTime = new Date();
109 protected void onUpdate() {
110 this.modifyTime = new Date();
114 public boolean equals(final Object other) {
118 if (!(other instanceof WatchdogDistributionStatus)) {
121 WatchdogDistributionStatus castOther = (WatchdogDistributionStatus) other;
122 return Objects.equals(getDistributionId(), castOther.getDistributionId());
126 public int hashCode() {
127 return Objects.hash(getDistributionId());
131 public String toString() {
132 return new ToStringBuilder(this).append("distributionId", getDistributionId())
133 .append("distributionIdStatus", getDistributionIdStatus()).append("createTime", getCreateTime())
134 .append("modifyTime", getModifyTime()).toString();