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 / OperationalEnvServiceModelStatus.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 /**
38  * @author PB6115
39  *
40  */
41 @IdClass(OperationalEnvServiceModelStatusId.class)
42 @Entity
43 @Table(name = "activate_operational_env_service_model_distribution_status")
44 public class OperationalEnvServiceModelStatus implements Serializable {
45
46     /**
47      * Serialization id.
48      */
49     private static final long serialVersionUID = 8197084996598869656L;
50
51     @Id
52     @Column(name = "REQUEST_ID", length = 45)
53     private String requestId;
54     @Id
55     @Column(name = "OPERATIONAL_ENV_ID", length = 45)
56     private String operationalEnvId;
57     @Id
58     @Column(name = "SERVICE_MODEL_VERSION_ID", length = 45)
59     private String serviceModelVersionId;
60     @Column(name = "SERVICE_MOD_VER_FINAL_DISTR_STATUS", length = 45)
61     private String serviceModelVersionDistrStatus;
62     @Column(name = "RECOVERY_ACTION", length = 30)
63     private String recoveryAction;
64     @Column(name = "RETRY_COUNT_LEFT")
65     private Integer retryCount;
66     @Column(name = "WORKLOAD_CONTEXT", length = 80)
67     private String workloadContext;
68     @Column(name = "CREATE_TIME", updatable = false)
69     @Temporal(TemporalType.TIMESTAMP)
70     private Date createTime;
71     @Column(name = "MODIFY_TIME")
72     @Temporal(TemporalType.TIMESTAMP)
73     private Date modifyTime;
74     @Column(name = "VNF_OPERATIONAL_ENV_ID", length = 45)
75     private String vnfOperationalEnvId;
76
77     public OperationalEnvServiceModelStatus() {
78
79     }
80
81     public OperationalEnvServiceModelStatus(String requestId, String operationalEnvId, String serviceModelVersionId) {
82         this.requestId = requestId;
83         this.operationalEnvId = operationalEnvId;
84         this.serviceModelVersionId = serviceModelVersionId;
85     }
86
87     public String getRequestId() {
88         return requestId;
89     }
90
91     public void setRequestId(String requestId) {
92         this.requestId = requestId;
93     }
94
95     public String getOperationalEnvId() {
96         return operationalEnvId;
97     }
98
99     public void setOperationalEnvId(String operationalEnvId) {
100         this.operationalEnvId = operationalEnvId;
101     }
102
103     public String getServiceModelVersionId() {
104         return serviceModelVersionId;
105     }
106
107     public void setServiceModelVersionId(String serviceModelVersionId) {
108         this.serviceModelVersionId = serviceModelVersionId;
109     }
110
111     public String getServiceModelVersionDistrStatus() {
112         return serviceModelVersionDistrStatus;
113     }
114
115     public void setServiceModelVersionDistrStatus(String serviceModelVersionDistrStatus) {
116         this.serviceModelVersionDistrStatus = serviceModelVersionDistrStatus;
117     }
118
119     public String getRecoveryAction() {
120         return recoveryAction;
121     }
122
123     public void setRecoveryAction(String recoveryAction) {
124         this.recoveryAction = recoveryAction;
125     }
126
127     public Integer getRetryCount() {
128         return retryCount;
129     }
130
131     public void setRetryCount(Integer retryCount) {
132         this.retryCount = retryCount;
133     }
134
135     public String getWorkloadContext() {
136         return workloadContext;
137     }
138
139     public void setWorkloadContext(String workloadContext) {
140         this.workloadContext = workloadContext;
141     }
142
143     public Date getCreateTime() {
144         return createTime;
145     }
146
147
148     public Date getModifyTime() {
149         return modifyTime;
150     }
151
152     public String getVnfOperationalEnvId() {
153         return vnfOperationalEnvId;
154     }
155
156     public void setVnfOperationalEnvId(String vnfOperationalEnvId) {
157         this.vnfOperationalEnvId = vnfOperationalEnvId;
158     }
159
160     @PrePersist
161     protected void onCreate() {
162         this.createTime = this.modifyTime = new Date();
163     }
164
165     @PreUpdate
166     protected void onUpdate() {
167         this.modifyTime = new Date();
168     }
169
170     @Override
171     public boolean equals(final Object other) {
172         if (this == other) {
173             return true;
174         }
175         if (!(other instanceof OperationalEnvServiceModelStatus)) {
176             return false;
177         }
178         OperationalEnvServiceModelStatus castOther = (OperationalEnvServiceModelStatus) other;
179         return Objects.equals(getRequestId(), castOther.getRequestId())
180                 && Objects.equals(getOperationalEnvId(), castOther.getOperationalEnvId());
181     }
182
183     @Override
184     public int hashCode() {
185         return Objects.hash(getRequestId(), getOperationalEnvId());
186     }
187
188     @Override
189     public String toString() {
190         return new ToStringBuilder(this).append("requestId", getRequestId())
191                 .append("operationalEnvId", getOperationalEnvId())
192                 .append("serviceModelVersionId", getServiceModelVersionId())
193                 .append("serviceModelVersionDistrStatus", getServiceModelVersionDistrStatus())
194                 .append("recoveryAction", getRecoveryAction()).append("retryCount", getRetryCount())
195                 .append("workloadContext", getWorkloadContext()).append("createTime", getCreateTime())
196                 .append("modifyTime", getModifyTime()).append("vnfOperationalEnvId", getVnfOperationalEnvId())
197                 .toString();
198     }
199
200
201 }