Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-api-handlers / mso-requests-db / src / main / java / org / onap / so / db / request / beans / WatchdogComponentDistributionStatus.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.db.request.beans;
22
23 import java.io.Serializable;
24 import java.util.Date;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.Id;
28 import javax.persistence.IdClass;
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 java.util.Objects;
35 import org.apache.commons.lang3.builder.ToStringBuilder;
36
37 @IdClass(WatchdogComponentDistributionStatusId.class)
38 @Entity
39 @Table(name = "watchdog_per_component_distribution_status")
40 public class WatchdogComponentDistributionStatus implements Serializable {
41
42
43     /**
44      * Serialization id.
45      */
46     private static final long serialVersionUID = -4344508954204488669L;
47     @Id
48     @Column(name = "DISTRIBUTION_ID", length = 45)
49     private String distributionId;
50     @Id
51     @Column(name = "COMPONENT_NAME", length = 45)
52     private String componentName;
53     @Column(name = "COMPONENT_DISTRIBUTION_STATUS", length = 45)
54     private String componentDistributionStatus;
55     @Column(name = "CREATE_TIME", updatable = false)
56     @Temporal(TemporalType.TIMESTAMP)
57     private Date createTime;
58     @Column(name = "MODIFY_TIME")
59     @Temporal(TemporalType.TIMESTAMP)
60     private Date modifyTime;
61
62     public WatchdogComponentDistributionStatus() {
63
64     }
65
66     public WatchdogComponentDistributionStatus(String distributionId, String componentName) {
67         this.distributionId = distributionId;
68         this.componentName = componentName;
69     }
70
71     public String getDistributionId() {
72         return distributionId;
73     }
74
75     public void setDistributionId(String distributionId) {
76         this.distributionId = distributionId;
77     }
78
79     public String getComponentName() {
80         return componentName;
81     }
82
83     public void setComponentName(String componentName) {
84         this.componentName = componentName;
85     }
86
87     public String getComponentDistributionStatus() {
88         return componentDistributionStatus;
89     }
90
91     public void setComponentDistributionStatus(String componentDistributionStatus) {
92         this.componentDistributionStatus = componentDistributionStatus;
93     }
94
95     public Date getCreateTime() {
96         return createTime;
97     }
98
99     public Date getModifyTime() {
100         return modifyTime;
101     }
102
103     @PrePersist
104     protected void onCreate() {
105         this.createTime = this.modifyTime = new Date();
106     }
107
108     @PreUpdate
109     protected void onUpdate() {
110         this.modifyTime = new Date();
111     }
112
113     @Override
114     public boolean equals(final Object other) {
115         if (this == other) {
116             return true;
117         }
118         if (!(other instanceof WatchdogComponentDistributionStatus)) {
119             return false;
120         }
121         WatchdogComponentDistributionStatus castOther = (WatchdogComponentDistributionStatus) other;
122         return Objects.equals(getDistributionId(), castOther.getDistributionId())
123                 && Objects.equals(getComponentName(), castOther.getComponentName());
124     }
125
126     @Override
127     public int hashCode() {
128         return Objects.hash(getDistributionId(), getComponentName());
129     }
130
131     @Override
132     public String toString() {
133         return new ToStringBuilder(this).append("distributionId", getDistributionId())
134                 .append("componentName", getComponentName())
135                 .append("componentDistributionStatus", getComponentDistributionStatus())
136                 .append("createTime", getCreateTime()).append("modifyTime", getModifyTime()).toString();
137     }
138
139 }