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;
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;
41 @IdClass(OperationalEnvServiceModelStatusId.class)
43 @Table(name = "activate_operational_env_service_model_distribution_status")
44 public class OperationalEnvServiceModelStatus implements Serializable {
49 private static final long serialVersionUID = 8197084996598869656L;
52 @Column(name = "REQUEST_ID", length = 45)
53 private String requestId;
55 @Column(name = "OPERATIONAL_ENV_ID", length = 45)
56 private String operationalEnvId;
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;
77 public OperationalEnvServiceModelStatus() {
81 public OperationalEnvServiceModelStatus(String requestId, String operationalEnvId, String serviceModelVersionId) {
82 this.requestId = requestId;
83 this.operationalEnvId = operationalEnvId;
84 this.serviceModelVersionId = serviceModelVersionId;
87 public String getRequestId() {
91 public void setRequestId(String requestId) {
92 this.requestId = requestId;
95 public String getOperationalEnvId() {
96 return operationalEnvId;
99 public void setOperationalEnvId(String operationalEnvId) {
100 this.operationalEnvId = operationalEnvId;
103 public String getServiceModelVersionId() {
104 return serviceModelVersionId;
107 public void setServiceModelVersionId(String serviceModelVersionId) {
108 this.serviceModelVersionId = serviceModelVersionId;
111 public String getServiceModelVersionDistrStatus() {
112 return serviceModelVersionDistrStatus;
115 public void setServiceModelVersionDistrStatus(String serviceModelVersionDistrStatus) {
116 this.serviceModelVersionDistrStatus = serviceModelVersionDistrStatus;
119 public String getRecoveryAction() {
120 return recoveryAction;
123 public void setRecoveryAction(String recoveryAction) {
124 this.recoveryAction = recoveryAction;
127 public Integer getRetryCount() {
131 public void setRetryCount(Integer retryCount) {
132 this.retryCount = retryCount;
135 public String getWorkloadContext() {
136 return workloadContext;
139 public void setWorkloadContext(String workloadContext) {
140 this.workloadContext = workloadContext;
143 public Date getCreateTime() {
148 public Date getModifyTime() {
152 public String getVnfOperationalEnvId() {
153 return vnfOperationalEnvId;
156 public void setVnfOperationalEnvId(String vnfOperationalEnvId) {
157 this.vnfOperationalEnvId = vnfOperationalEnvId;
161 protected void onCreate() {
162 this.createTime = this.modifyTime = new Date();
166 protected void onUpdate() {
167 this.modifyTime = new Date();
171 public boolean equals(final Object other) {
175 if (!(other instanceof OperationalEnvServiceModelStatus)) {
178 OperationalEnvServiceModelStatus castOther = (OperationalEnvServiceModelStatus) other;
179 return Objects.equals(getRequestId(), castOther.getRequestId())
180 && Objects.equals(getOperationalEnvId(), castOther.getOperationalEnvId());
184 public int hashCode() {
185 return Objects.hash(getRequestId(), getOperationalEnvId());
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())