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.IdClass;
30 import javax.persistence.PrePersist;
31 import javax.persistence.PreUpdate;
32 import javax.persistence.Table;
33 import javax.persistence.Temporal;
34 import javax.persistence.TemporalType;
35 import java.util.Objects;
36 import org.apache.commons.lang3.builder.ToStringBuilder;
38 @IdClass(WatchdogComponentDistributionStatusId.class)
40 @Table(name = "watchdog_per_component_distribution_status")
41 public class WatchdogComponentDistributionStatus implements Serializable {
47 private static final long serialVersionUID = -4344508954204488669L;
49 @Column(name = "DISTRIBUTION_ID", length=45)
50 private String distributionId;
52 @Column(name = "COMPONENT_NAME", length=45)
53 private String componentName;
54 @Column(name = "COMPONENT_DISTRIBUTION_STATUS", length=45)
55 private String componentDistributionStatus;
56 @Column(name = "CREATE_TIME", updatable=false)
57 @Temporal(TemporalType.TIMESTAMP)
58 private Date createTime;
59 @Column(name = "MODIFY_TIME")
60 @Temporal(TemporalType.TIMESTAMP)
61 private Date modifyTime;
63 public WatchdogComponentDistributionStatus() {
67 public WatchdogComponentDistributionStatus(String distributionId, String componentName) {
68 this.distributionId = distributionId;
69 this.componentName = componentName;
72 public String getDistributionId() {
73 return distributionId;
76 public void setDistributionId(String distributionId) {
77 this.distributionId = distributionId;
80 public String getComponentName() {
84 public void setComponentName(String componentName) {
85 this.componentName = componentName;
88 public String getComponentDistributionStatus() {
89 return componentDistributionStatus;
92 public void setComponentDistributionStatus(String componentDistributionStatus) {
93 this.componentDistributionStatus = componentDistributionStatus;
96 public Date getCreateTime() {
100 public Date getModifyTime() {
105 protected void onCreate() {
106 this.createTime = this.modifyTime = new Date();
110 protected void onUpdate() {
111 this.modifyTime = new Date();
115 public boolean equals(final Object other) {
119 if (!(other instanceof WatchdogComponentDistributionStatus)) {
122 WatchdogComponentDistributionStatus castOther = (WatchdogComponentDistributionStatus) other;
123 return Objects.equals(getDistributionId(), castOther.getDistributionId())
124 && Objects.equals(getComponentName(), castOther.getComponentName());
128 public int hashCode() {
129 return Objects.hash(getDistributionId(), getComponentName());
133 public String toString() {
134 return new ToStringBuilder(this).append("distributionId", getDistributionId())
135 .append("componentName", getComponentName())
136 .append("componentDistributionStatus", getComponentDistributionStatus())
137 .append("createTime", getCreateTime()).append("modifyTime", getModifyTime()).toString();