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;
160 @Column(name = "ROLLBACK_EXT_SYSTEM_ERROR_SOURCE", length = 80)
161 private String rollbackExtSystemErrorSource;
163 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
164 @JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID")
165 private List<CloudApiRequests> cloudApiRequests = new ArrayList<>();
168 public URI getRequestURI() {
169 return URI.create(this.requestId);
172 public String getRequestId() {
173 return this.requestId;
176 public void setRequestId(String requestId) {
177 this.requestId = requestId;
180 public String getClientRequestId() {
181 return clientRequestId;
184 public void setClientRequestId(String clientRequestId) {
185 this.clientRequestId = clientRequestId;
188 public String getAction() {
192 public void setAction(String action) {
193 this.action = action;
196 public String getRequestStatus() {
197 return this.requestStatus;
200 public void setRequestStatus(String requestStatus) {
201 this.requestStatus = requestStatus;
204 public String getStatusMessage() {
205 return this.statusMessage;
208 public void setStatusMessage(String statusMessage) {
209 this.statusMessage = statusMessage;
212 public String getRollbackStatusMessage() {
213 return this.rollbackStatusMessage;
216 public void setRollbackStatusMessage(String rollbackStatusMessage) {
217 this.rollbackStatusMessage = rollbackStatusMessage;
220 public String getFlowStatus() {
221 return this.flowStatus;
224 public void setFlowStatus(String flowStatus) {
225 this.flowStatus = flowStatus;
228 public String getRetryStatusMessage() {
229 return this.retryStatusMessage;
232 public void setRetryStatusMessage(String retryStatusMessage) {
233 this.retryStatusMessage = retryStatusMessage;
236 public Long getProgress() {
237 return this.progress;
240 public void setProgress(Long progress) {
241 this.progress = progress;
244 @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
245 public Timestamp getStartTime() {
246 return this.startTime;
249 public void setStartTime(Timestamp startTime) {
250 this.startTime = startTime;
253 @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
254 public Timestamp getEndTime() {
258 public void setEndTime(Timestamp endTime) {
259 this.endTime = endTime;
262 public String getSource() {
266 public void setSource(String source) {
267 this.source = source;
270 public String getVnfId() {
274 public void setVnfId(String vnfId) {
278 public String getVnfName() {
282 public void setVnfName(String vnfName) {
283 this.vnfName = vnfName;
286 public String getVnfType() {
290 public void setVnfType(String vnfType) {
291 this.vnfType = vnfType;
294 public String getServiceType() {
295 return this.serviceType;
298 public void setServiceType(String serviceType) {
299 this.serviceType = serviceType;
302 public String getAicNodeClli() {
303 return this.aicNodeClli;
306 public void setAicNodeClli(String aicNodeClli) {
307 this.aicNodeClli = aicNodeClli;
310 public String getTenantId() {
311 return this.tenantId;
314 public void setTenantId(String tenantId) {
315 this.tenantId = tenantId;
318 public String getProvStatus() {
319 return this.provStatus;
322 public void setProvStatus(String provStatus) {
323 this.provStatus = provStatus;
326 public String getVnfParams() {
327 return this.vnfParams;
330 public void setVnfParams(String vnfParams) {
331 this.vnfParams = vnfParams;
334 public String getVnfOutputs() {
335 return this.vnfOutputs;
338 public void setVnfOutputs(String vnfOutputs) {
339 this.vnfOutputs = vnfOutputs;
342 public String getRequestBody() {
343 return this.requestBody;
346 public void setRequestBody(String requestBody) {
347 this.requestBody = requestBody;
350 public String getResponseBody() {
351 return this.responseBody;
354 public void setResponseBody(String responseBody) {
355 this.responseBody = responseBody;
358 public String getLastModifiedBy() {
359 return this.lastModifiedBy;
362 public void setLastModifiedBy(String lastModifiedBy) {
363 this.lastModifiedBy = lastModifiedBy;
366 public Date getModifyTime() {
367 return this.modifyTime;
370 public String getRequestType() {
371 return this.requestType;
374 public void setRequestType(String requestType) {
375 this.requestType = requestType;
378 public String getVolumeGroupId() {
379 return this.volumeGroupId;
382 public void setVolumeGroupId(String volumeGroupId) {
383 this.volumeGroupId = volumeGroupId;
386 public String getVolumeGroupName() {
387 return this.volumeGroupName;
390 public void setVolumeGroupName(String volumeGroupName) {
391 this.volumeGroupName = volumeGroupName;
394 public String getVfModuleId() {
395 return this.vfModuleId;
398 public void setVfModuleId(String vfModuleId) {
399 this.vfModuleId = vfModuleId;
402 public String getVfModuleName() {
403 return this.vfModuleName;
406 public void setVfModuleName(String vfModuleName) {
407 this.vfModuleName = vfModuleName;
410 public String getVfModuleModelName() {
411 return this.vfModuleModelName;
414 public void setVfModuleModelName(String vfModuleModelName) {
415 this.vfModuleModelName = vfModuleModelName;
418 public String getAaiServiceId() {
419 return this.aaiServiceId;
422 public void setAaiServiceId(String aaiServiceId) {
423 this.aaiServiceId = aaiServiceId;
426 public String getAicCloudRegion() {
427 return this.aicCloudRegion;
430 public void setAicCloudRegion(String aicCloudRegion) {
431 this.aicCloudRegion = aicCloudRegion;
434 public String getCallBackUrl() {
438 public void setCallBackUrl(String callBackUrl) {
439 this.callBackUrl = callBackUrl;
442 public String getCorrelator() {
446 public void setCorrelator(String correlator) {
447 this.correlator = correlator;
450 public String getServiceInstanceId() {
451 return serviceInstanceId;
454 public void setServiceInstanceId(String serviceInstanceId) {
455 this.serviceInstanceId = serviceInstanceId;
458 public String getServiceInstanceName() {
459 return serviceInstanceName;
462 public void setServiceInstanceName(String serviceInstanceName) {
463 this.serviceInstanceName = serviceInstanceName;
466 public String getRequestScope() {
470 public void setRequestScope(String requestScope) {
471 this.requestScope = requestScope;
474 public String getRequestAction() {
475 return requestAction;
479 public List<CloudApiRequests> getCloudApiRequests() {
480 return cloudApiRequests;
483 public void setCloudApiRequests(List<CloudApiRequests> cloudApiRequests) {
484 this.cloudApiRequests = cloudApiRequests;
487 public void setRequestAction(String requestAction) {
488 this.requestAction = requestAction;
491 public String getNetworkId() {
495 public void setNetworkId(String networkId) {
496 this.networkId = networkId;
499 public String getNetworkName() {
503 public void setNetworkName(String networkName) {
504 this.networkName = networkName;
507 public String getNetworkType() {
511 public void setNetworkType(String networkType) {
512 this.networkType = networkType;
515 public String getRequestorId() {
519 public void setRequestorId(String requestorId) {
520 this.requestorId = requestorId;
523 public String getConfigurationId() {
524 return configurationId;
527 public void setConfigurationId(String configurationId) {
528 this.configurationId = configurationId;
531 public String getConfigurationName() {
532 return configurationName;
535 public void setConfigurationName(String configurationName) {
536 this.configurationName = configurationName;
539 public String getOperationalEnvId() {
540 return operationalEnvId;
543 public void setOperationalEnvId(String operationalEnvId) {
544 this.operationalEnvId = operationalEnvId;
547 public String getOperationalEnvName() {
548 return operationalEnvName;
551 public void setOperationalEnvName(String operationalEnvName) {
552 this.operationalEnvName = operationalEnvName;
555 public String getInstanceGroupId() {
556 return instanceGroupId;
559 public void setInstanceGroupId(String instanceGroupId) {
560 this.instanceGroupId = instanceGroupId;
563 public String getInstanceGroupName() {
564 return instanceGroupName;
567 public void setInstanceGroupName(String instanceGroupName) {
568 this.instanceGroupName = instanceGroupName;
571 public String getRequestUrl() {
572 return this.requestUrl;
575 public void setRequestUrl(String requestUrl) {
576 this.requestUrl = requestUrl;
579 public String getOriginalRequestId() {
580 return this.originalRequestId;
583 public void setOriginalRequestId(String originalRequestId) {
584 this.originalRequestId = originalRequestId;
587 public String getExtSystemErrorSource() {
588 return this.extSystemErrorSource;
591 public void setExtSystemErrorSource(String extSystemErrorSource) {
592 this.extSystemErrorSource = extSystemErrorSource;
595 public String getRollbackExtSystemErrorSource() {
596 return this.rollbackExtSystemErrorSource;
599 public void setRollbackExtSystemErrorSource(String rollbackExtSystemErrorSource) {
600 this.rollbackExtSystemErrorSource = rollbackExtSystemErrorSource;
604 protected void onCreate() {
605 if (requestScope == null)
606 requestScope = UNKNOWN;
607 if (requestAction == null)
608 requestAction = UNKNOWN;
609 this.modifyTime = new Date();
613 protected void onUpdate() {
614 if (requestScope == null)
615 requestScope = UNKNOWN;
616 if (requestAction == null)
617 requestAction = UNKNOWN;
618 this.modifyTime = new Date();
622 public boolean equals(final Object other) {
626 if (!(other instanceof InfraRequests)) {
629 InfraRequests castOther = (InfraRequests) other;
630 return Objects.equals(getRequestId(), castOther.getRequestId());
634 public int hashCode() {
635 return Objects.hash(getRequestId());
639 public String toString() {
640 return new ToStringBuilder(this).append("requestId", getRequestId())
641 .append("clientRequestId", getClientRequestId()).append("action", getAction())
642 .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
643 .append("rollbackStatusMessage", getRollbackStatusMessage()).append("flowStatus", getFlowStatus())
644 .append("retryStatusMessage", getRetryStatusMessage()).append("progress", getProgress())
645 .append("startTime", getStartTime()).append("endTime", getEndTime()).append("source", getSource())
646 .append("vnfId", getVnfId()).append("vnfName", getVnfName()).append("vnfType", getVnfType())
647 .append("serviceType", getServiceType()).append("aicNodeClli", getAicNodeClli())
648 .append("tenantId", getTenantId()).append("provStatus", getProvStatus())
649 .append("vnfParams", getVnfParams()).append("vnfOutputs", getVnfOutputs())
650 .append("requestBody", getRequestBody()).append("responseBody", getResponseBody())
651 .append("lastModifiedBy", getLastModifiedBy()).append("modifyTime", getModifyTime())
652 .append("requestType", getRequestType()).append("volumeGroupId", getVolumeGroupId())
653 .append("volumeGroupName", getVolumeGroupName()).append("vfModuleId", getVfModuleId())
654 .append("vfModuleName", getVfModuleName()).append("vfModuleModelName", getVfModuleModelName())
655 .append("aaiServiceId", getAaiServiceId()).append("aicCloudRegion", getAicCloudRegion())
656 .append("callBackUrl", getCallBackUrl()).append("correlator", getCorrelator())
657 .append("serviceInstanceId", getServiceInstanceId())
658 .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
659 .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
660 .append("networkName", getNetworkName()).append("networkType", getNetworkType())
661 .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
662 .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
663 .append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId())
664 .append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl())
665 .append("originalRequestId", originalRequestId).append("extSystemErrorSource", extSystemErrorSource)
666 .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).toString();