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;
42 @IdClass(OperationalEnvServiceModelStatusId.class)
44 @Table(name = "activate_operational_env_service_model_distribution_status")
45 public class OperationalEnvServiceModelStatus implements Serializable {
50 private static final long serialVersionUID = 8197084996598869656L;
53 @Column(name = "REQUEST_ID", length=45)
54 private String requestId;
56 @Column(name = "OPERATIONAL_ENV_ID", length=45)
57 private String operationalEnvId;
59 @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
60 private String serviceModelVersionId;
61 @Column(name = "SERVICE_MOD_VER_FINAL_DISTR_STATUS", length=45)
62 private String serviceModelVersionDistrStatus;
63 @Column(name = "RECOVERY_ACTION", length=30)
64 private String recoveryAction;
65 @Column(name = "RETRY_COUNT_LEFT")
66 private Integer retryCount;
67 @Column(name = "WORKLOAD_CONTEXT", length=80)
68 private String workloadContext;
69 @Column(name = "CREATE_TIME", updatable=false)
70 @Temporal(TemporalType.TIMESTAMP)
71 private Date createTime;
72 @Column(name = "MODIFY_TIME")
73 @Temporal(TemporalType.TIMESTAMP)
74 private Date modifyTime;
76 public OperationalEnvServiceModelStatus() {
80 public OperationalEnvServiceModelStatus(String requestId, String operationalEnvId, String serviceModelVersionId) {
81 this.requestId = requestId;
82 this.operationalEnvId = operationalEnvId;
83 this.serviceModelVersionId = serviceModelVersionId;
85 public String getRequestId() {
89 public void setRequestId(String requestId) {
90 this.requestId = requestId;
93 public String getOperationalEnvId() {
94 return operationalEnvId;
97 public void setOperationalEnvId(String operationalEnvId) {
98 this.operationalEnvId = operationalEnvId;
101 public String getServiceModelVersionId() {
102 return serviceModelVersionId;
105 public void setServiceModelVersionId(String serviceModelVersionId) {
106 this.serviceModelVersionId = serviceModelVersionId;
109 public String getServiceModelVersionDistrStatus() {
110 return serviceModelVersionDistrStatus;
113 public void setServiceModelVersionDistrStatus(String serviceModelVersionDistrStatus) {
114 this.serviceModelVersionDistrStatus = serviceModelVersionDistrStatus;
117 public String getRecoveryAction() {
118 return recoveryAction;
121 public void setRecoveryAction(String recoveryAction) {
122 this.recoveryAction = recoveryAction;
125 public Integer getRetryCount() {
129 public void setRetryCount(Integer retryCount) {
130 this.retryCount = retryCount;
133 public String getWorkloadContext() {
134 return workloadContext;
137 public void setWorkloadContext(String workloadContext) {
138 this.workloadContext = workloadContext;
141 public Date getCreateTime() {
146 public Date getModifyTime() {
151 protected void onCreate() {
152 this.createTime = this.modifyTime = new Date();
156 protected void onUpdate() {
157 this.modifyTime = new Date();
161 public boolean equals(final Object other) {
165 if (!(other instanceof OperationalEnvServiceModelStatus)) {
168 OperationalEnvServiceModelStatus castOther = (OperationalEnvServiceModelStatus) other;
169 return Objects.equals(getRequestId(), castOther.getRequestId())
170 && Objects.equals(getOperationalEnvId(), castOther.getOperationalEnvId());
174 public int hashCode() {
175 return Objects.hash(getRequestId(), getOperationalEnvId());
179 public String toString() {
180 return new ToStringBuilder(this).append("requestId", getRequestId())
181 .append("operationalEnvId", getOperationalEnvId())
182 .append("serviceModelVersionId", getServiceModelVersionId())
183 .append("serviceModelVersionDistrStatus", getServiceModelVersionDistrStatus())
184 .append("recoveryAction", getRecoveryAction()).append("retryCount", getRetryCount())
185 .append("workloadContext", getWorkloadContext()).append("createTime", getCreateTime())
186 .append("modifyTime", getModifyTime()).toString();