2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 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;
24 import java.sql.Timestamp;
25 import java.util.ArrayList;
26 import java.util.Date;
27 import java.util.List;
28 import java.util.Objects;
29 import javax.persistence.CascadeType;
30 import javax.persistence.Column;
31 import javax.persistence.FetchType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.MappedSuperclass;
35 import javax.persistence.OneToMany;
36 import javax.persistence.PrePersist;
37 import javax.persistence.PreUpdate;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
41 import org.apache.commons.lang3.builder.ToStringBuilder;
42 import org.onap.so.requestsdb.TimestampXMLAdapter;
43 import uk.co.blackpepper.bowman.annotation.LinkedResource;
44 import uk.co.blackpepper.bowman.annotation.ResourceId;
47 public abstract class InfraRequests implements java.io.Serializable {
49 private static final long serialVersionUID = -5497583682393936143L;
50 private static final String UNKNOWN = "unknown";
54 @Column(name = "REQUEST_ID", length = 45)
55 private String requestId;
56 @Column(name = "CLIENT_REQUEST_ID", length = 45, unique = true)
57 private String clientRequestId;
58 @Column(name = "ACTION", length = 45)
59 private String action;
60 @Column(name = "REQUEST_STATUS", length = 20)
61 private String requestStatus;
62 @Column(name = "STATUS_MESSAGE", length = 2000)
63 private String statusMessage;
64 @Column(name = "ROLLBACK_STATUS_MESSAGE", length = 2000)
65 private String rollbackStatusMessage;
66 @Column(name = "FLOW_STATUS", length = 2000)
67 private String flowStatus;
68 @Column(name = "RETRY_STATUS_MESSAGE", length = 2000)
69 private String retryStatusMessage;
70 @Column(name = "PROGRESS", precision = 11)
71 private Long progress;
73 @Column(name = "START_TIME")
74 private Timestamp startTime;
75 @Column(name = "END_TIME")
76 private Timestamp endTime;
77 @Column(name = "SOURCE", length = 45)
78 private String source;
79 @Column(name = "VNF_ID", length = 45)
81 @Column(name = "VNF_NAME", length = 80)
82 private String vnfName;
83 @Column(name = "VNF_TYPE", length = 200)
84 private String vnfType;
85 @Column(name = "SERVICE_TYPE", length = 45)
86 private String serviceType;
87 @Column(name = "AIC_NODE_CLLI", length = 11)
88 private String aicNodeClli;
89 @Column(name = "TENANT_ID", length = 45)
90 private String tenantId;
91 @Column(name = "PROV_STATUS", length = 20)
92 private String provStatus;
93 @Column(name = "VNF_PARAMS")
94 private String vnfParams;
95 @Column(name = "VNF_OUTPUTS")
96 private String vnfOutputs;
97 @Column(name = "REQUEST_BODY")
98 private String requestBody;
99 @Column(name = "RESPONSE_BODY")
100 private String responseBody;
101 @Column(name = "LAST_MODIFIED_BY", length = 50)
102 private String lastModifiedBy;
103 @Column(name = "MODIFY_TIME")
104 @Temporal(TemporalType.TIMESTAMP)
105 private Date modifyTime;
106 @Column(name = "REQUEST_TYPE", length = 20)
107 private String requestType;
108 @Column(name = "VOLUME_GROUP_ID", length = 45)
109 private String volumeGroupId;
110 @Column(name = "VOLUME_GROUP_NAME", length = 45)
111 private String volumeGroupName;
112 @Column(name = "VF_MODULE_ID", length = 45)
113 private String vfModuleId;
114 @Column(name = "VF_MODULE_NAME", length = 200)
115 private String vfModuleName;
116 @Column(name = "VF_MODULE_MODEL_NAME", length = 200)
117 private String vfModuleModelName;
118 @Column(name = "AAI_SERVICE_ID", length = 50)
119 private String aaiServiceId;
120 @Column(name = "AIC_CLOUD_REGION", length = 11)
121 private String aicCloudRegion;
122 @Column(name = "CALLBACK_URL", length = 200)
123 private String callBackUrl;
124 @Column(name = "CORRELATOR", length = 80)
125 private String correlator;
126 @Column(name = "SERVICE_INSTANCE_ID", length = 45)
127 private String serviceInstanceId;
128 @Column(name = "SERVICE_INSTANCE_NAME", length = 80)
129 private String serviceInstanceName;
130 @Column(name = "REQUEST_SCOPE", length = 45)
131 private String requestScope;
132 @Column(name = "REQUEST_ACTION", length = 45)
133 private String requestAction;
134 @Column(name = "NETWORK_ID", length = 45)
135 private String networkId;
136 @Column(name = "NETWORK_NAME", length = 80)
137 private String networkName;
138 @Column(name = "NETWORK_TYPE", length = 80)
139 private String networkType;
140 @Column(name = "REQUESTOR_ID", length = 80)
141 private String requestorId;
142 @Column(name = "CONFIGURATION_ID", length = 45)
143 private String configurationId;
144 @Column(name = "CONFIGURATION_NAME", length = 200)
145 private String configurationName;
146 @Column(name = "OPERATIONAL_ENV_ID", length = 45)
147 private String operationalEnvId;
148 @Column(name = "OPERATIONAL_ENV_NAME", length = 200)
149 private String operationalEnvName;
150 @Column(name = "INSTANCE_GROUP_ID", length = 45)
151 private String instanceGroupId;
152 @Column(name = "INSTANCE_GROUP_NAME", length = 200)
153 private String instanceGroupName;
154 @Column(name = "REQUEST_URL", length = 500)
155 private String requestUrl;
156 @Column(name = "ORIGINAL_REQUEST_ID", length = 45)
157 private String originalRequestId;
158 @Column(name = "EXT_SYSTEM_ERROR_SOURCE", length = 80)
159 private String extSystemErrorSource;
161 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
162 @JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID")
163 private List<CloudApiRequests> cloudApiRequests = new ArrayList<>();
166 public URI getRequestURI() {
167 return URI.create(this.requestId);
170 public String getRequestId() {
171 return this.requestId;
174 public void setRequestId(String requestId) {
175 this.requestId = requestId;
178 public String getClientRequestId() {
179 return clientRequestId;
182 public void setClientRequestId(String clientRequestId) {
183 this.clientRequestId = clientRequestId;
186 public String getAction() {
190 public void setAction(String action) {
191 this.action = action;
194 public String getRequestStatus() {
195 return this.requestStatus;
198 public void setRequestStatus(String requestStatus) {
199 this.requestStatus = requestStatus;
202 public String getStatusMessage() {
203 return this.statusMessage;
206 public void setStatusMessage(String statusMessage) {
207 this.statusMessage = statusMessage;
210 public String getRollbackStatusMessage() {
211 return this.rollbackStatusMessage;
214 public void setRollbackStatusMessage(String rollbackStatusMessage) {
215 this.rollbackStatusMessage = rollbackStatusMessage;
218 public String getFlowStatus() {
219 return this.flowStatus;
222 public void setFlowStatus(String flowStatus) {
223 this.flowStatus = flowStatus;
226 public String getRetryStatusMessage() {
227 return this.retryStatusMessage;
230 public void setRetryStatusMessage(String retryStatusMessage) {
231 this.retryStatusMessage = retryStatusMessage;
234 public Long getProgress() {
235 return this.progress;
238 public void setProgress(Long progress) {
239 this.progress = progress;
242 @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
243 public Timestamp getStartTime() {
244 return this.startTime;
247 public void setStartTime(Timestamp startTime) {
248 this.startTime = startTime;
251 @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
252 public Timestamp getEndTime() {
256 public void setEndTime(Timestamp endTime) {
257 this.endTime = endTime;
260 public String getSource() {
264 public void setSource(String source) {
265 this.source = source;
268 public String getVnfId() {
272 public void setVnfId(String vnfId) {
276 public String getVnfName() {
280 public void setVnfName(String vnfName) {
281 this.vnfName = vnfName;
284 public String getVnfType() {
288 public void setVnfType(String vnfType) {
289 this.vnfType = vnfType;
292 public String getServiceType() {
293 return this.serviceType;
296 public void setServiceType(String serviceType) {
297 this.serviceType = serviceType;
300 public String getAicNodeClli() {
301 return this.aicNodeClli;
304 public void setAicNodeClli(String aicNodeClli) {
305 this.aicNodeClli = aicNodeClli;
308 public String getTenantId() {
309 return this.tenantId;
312 public void setTenantId(String tenantId) {
313 this.tenantId = tenantId;
316 public String getProvStatus() {
317 return this.provStatus;
320 public void setProvStatus(String provStatus) {
321 this.provStatus = provStatus;
324 public String getVnfParams() {
325 return this.vnfParams;
328 public void setVnfParams(String vnfParams) {
329 this.vnfParams = vnfParams;
332 public String getVnfOutputs() {
333 return this.vnfOutputs;
336 public void setVnfOutputs(String vnfOutputs) {
337 this.vnfOutputs = vnfOutputs;
340 public String getRequestBody() {
341 return this.requestBody;
344 public void setRequestBody(String requestBody) {
345 this.requestBody = requestBody;
348 public String getResponseBody() {
349 return this.responseBody;
352 public void setResponseBody(String responseBody) {
353 this.responseBody = responseBody;
356 public String getLastModifiedBy() {
357 return this.lastModifiedBy;
360 public void setLastModifiedBy(String lastModifiedBy) {
361 this.lastModifiedBy = lastModifiedBy;
364 public Date getModifyTime() {
365 return this.modifyTime;
368 public String getRequestType() {
369 return this.requestType;
372 public void setRequestType(String requestType) {
373 this.requestType = requestType;
376 public String getVolumeGroupId() {
377 return this.volumeGroupId;
380 public void setVolumeGroupId(String volumeGroupId) {
381 this.volumeGroupId = volumeGroupId;
384 public String getVolumeGroupName() {
385 return this.volumeGroupName;
388 public void setVolumeGroupName(String volumeGroupName) {
389 this.volumeGroupName = volumeGroupName;
392 public String getVfModuleId() {
393 return this.vfModuleId;
396 public void setVfModuleId(String vfModuleId) {
397 this.vfModuleId = vfModuleId;
400 public String getVfModuleName() {
401 return this.vfModuleName;
404 public void setVfModuleName(String vfModuleName) {
405 this.vfModuleName = vfModuleName;
408 public String getVfModuleModelName() {
409 return this.vfModuleModelName;
412 public void setVfModuleModelName(String vfModuleModelName) {
413 this.vfModuleModelName = vfModuleModelName;
416 public String getAaiServiceId() {
417 return this.aaiServiceId;
420 public void setAaiServiceId(String aaiServiceId) {
421 this.aaiServiceId = aaiServiceId;
424 public String getAicCloudRegion() {
425 return this.aicCloudRegion;
428 public void setAicCloudRegion(String aicCloudRegion) {
429 this.aicCloudRegion = aicCloudRegion;
432 public String getCallBackUrl() {
436 public void setCallBackUrl(String callBackUrl) {
437 this.callBackUrl = callBackUrl;
440 public String getCorrelator() {
444 public void setCorrelator(String correlator) {
445 this.correlator = correlator;
448 public String getServiceInstanceId() {
449 return serviceInstanceId;
452 public void setServiceInstanceId(String serviceInstanceId) {
453 this.serviceInstanceId = serviceInstanceId;
456 public String getServiceInstanceName() {
457 return serviceInstanceName;
460 public void setServiceInstanceName(String serviceInstanceName) {
461 this.serviceInstanceName = serviceInstanceName;
464 public String getRequestScope() {
468 public void setRequestScope(String requestScope) {
469 this.requestScope = requestScope;
472 public String getRequestAction() {
473 return requestAction;
477 public List<CloudApiRequests> getCloudApiRequests() {
478 return cloudApiRequests;
481 public void setCloudApiRequests(List<CloudApiRequests> cloudApiRequests) {
482 this.cloudApiRequests = cloudApiRequests;
485 public void setRequestAction(String requestAction) {
486 this.requestAction = requestAction;
489 public String getNetworkId() {
493 public void setNetworkId(String networkId) {
494 this.networkId = networkId;
497 public String getNetworkName() {
501 public void setNetworkName(String networkName) {
502 this.networkName = networkName;
505 public String getNetworkType() {
509 public void setNetworkType(String networkType) {
510 this.networkType = networkType;
513 public String getRequestorId() {
517 public void setRequestorId(String requestorId) {
518 this.requestorId = requestorId;
521 public String getConfigurationId() {
522 return configurationId;
525 public void setConfigurationId(String configurationId) {
526 this.configurationId = configurationId;
529 public String getConfigurationName() {
530 return configurationName;
533 public void setConfigurationName(String configurationName) {
534 this.configurationName = configurationName;
537 public String getOperationalEnvId() {
538 return operationalEnvId;
541 public void setOperationalEnvId(String operationalEnvId) {
542 this.operationalEnvId = operationalEnvId;
545 public String getOperationalEnvName() {
546 return operationalEnvName;
549 public void setOperationalEnvName(String operationalEnvName) {
550 this.operationalEnvName = operationalEnvName;
553 public String getInstanceGroupId() {
554 return instanceGroupId;
557 public void setInstanceGroupId(String instanceGroupId) {
558 this.instanceGroupId = instanceGroupId;
561 public String getInstanceGroupName() {
562 return instanceGroupName;
565 public void setInstanceGroupName(String instanceGroupName) {
566 this.instanceGroupName = instanceGroupName;
569 public String getRequestUrl() {
570 return this.requestUrl;
573 public void setRequestUrl(String requestUrl) {
574 this.requestUrl = requestUrl;
577 public String getOriginalRequestId() {
578 return this.originalRequestId;
581 public void setOriginalRequestId(String originalRequestId) {
582 this.originalRequestId = originalRequestId;
585 public String getExtSystemErrorSource() {
586 return this.extSystemErrorSource;
589 public void setExtSystemErrorSource(String extSystemErrorSource) {
590 this.extSystemErrorSource = extSystemErrorSource;
594 protected void onCreate() {
595 if (requestScope == null)
596 requestScope = UNKNOWN;
597 if (requestAction == null)
598 requestAction = UNKNOWN;
599 this.modifyTime = new Date();
603 protected void onUpdate() {
604 if (requestScope == null)
605 requestScope = UNKNOWN;
606 if (requestAction == null)
607 requestAction = UNKNOWN;
608 this.modifyTime = new Date();
612 public boolean equals(final Object other) {
616 if (!(other instanceof InfraRequests)) {
619 InfraRequests castOther = (InfraRequests) other;
620 return Objects.equals(getRequestId(), castOther.getRequestId());
624 public int hashCode() {
625 return Objects.hash(getRequestId());
629 public String toString() {
630 return new ToStringBuilder(this).append("requestId", getRequestId())
631 .append("clientRequestId", getClientRequestId()).append("action", getAction())
632 .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
633 .append("rollbackStatusMessage", getRollbackStatusMessage()).append("flowStatus", getFlowStatus())
634 .append("retryStatusMessage", getRetryStatusMessage()).append("progress", getProgress())
635 .append("startTime", getStartTime()).append("endTime", getEndTime()).append("source", getSource())
636 .append("vnfId", getVnfId()).append("vnfName", getVnfName()).append("vnfType", getVnfType())
637 .append("serviceType", getServiceType()).append("aicNodeClli", getAicNodeClli())
638 .append("tenantId", getTenantId()).append("provStatus", getProvStatus())
639 .append("vnfParams", getVnfParams()).append("vnfOutputs", getVnfOutputs())
640 .append("requestBody", getRequestBody()).append("responseBody", getResponseBody())
641 .append("lastModifiedBy", getLastModifiedBy()).append("modifyTime", getModifyTime())
642 .append("requestType", getRequestType()).append("volumeGroupId", getVolumeGroupId())
643 .append("volumeGroupName", getVolumeGroupName()).append("vfModuleId", getVfModuleId())
644 .append("vfModuleName", getVfModuleName()).append("vfModuleModelName", getVfModuleModelName())
645 .append("aaiServiceId", getAaiServiceId()).append("aicCloudRegion", getAicCloudRegion())
646 .append("callBackUrl", getCallBackUrl()).append("correlator", getCorrelator())
647 .append("serviceInstanceId", getServiceInstanceId())
648 .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
649 .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
650 .append("networkName", getNetworkName()).append("networkType", getNetworkType())
651 .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
652 .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
653 .append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId())
654 .append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl())
655 .append("originalRequestId", originalRequestId).append("extSystemErrorSource", extSystemErrorSource)