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.Date;
26 import java.util.Objects;
28 import javax.persistence.Column;
29 import javax.persistence.Id;
30 import javax.persistence.MappedSuperclass;
31 import javax.persistence.PrePersist;
32 import javax.persistence.PreUpdate;
33 import javax.persistence.Temporal;
34 import javax.persistence.TemporalType;
35 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
38 import org.onap.so.requestsdb.adapter.TimestampXMLAdapter;
40 import uk.co.blackpepper.bowman.annotation.ResourceId;
43 public abstract class InfraRequests implements java.io.Serializable {
45 private static final long serialVersionUID = -5497583682393936143L;
46 private static final String UNKNOWN = "unknown";
50 @Column(name = "REQUEST_ID", length = 45)
51 private String requestId;
52 @Column(name = "CLIENT_REQUEST_ID", length = 45, unique = true)
53 private String clientRequestId;
54 @Column(name = "ACTION", length = 45)
55 private String action;
56 @Column(name = "REQUEST_STATUS", length = 20)
57 private String requestStatus;
58 @Column(name = "STATUS_MESSAGE", length = 2000)
59 private String statusMessage;
60 @Column(name = "PROGRESS", precision = 11)
61 private Long progress;
63 @Column(name = "START_TIME")
64 private Timestamp startTime;
65 @Column(name = "END_TIME")
66 private Timestamp endTime;
67 @Column(name = "SOURCE", length = 45)
68 private String source;
69 @Column(name = "VNF_ID", length = 45)
71 @Column(name = "VNF_NAME", length = 80)
72 private String vnfName;
73 @Column(name = "VNF_TYPE", length = 200)
74 private String vnfType;
75 @Column(name = "SERVICE_TYPE", length = 45)
76 private String serviceType;
77 @Column(name = "AIC_NODE_CLLI", length = 11)
78 private String aicNodeClli;
79 @Column(name = "TENANT_ID", length = 45)
80 private String tenantId;
81 @Column(name = "PROV_STATUS", length = 20)
82 private String provStatus;
83 @Column(name = "VNF_PARAMS")
84 private String vnfParams;
85 @Column(name = "VNF_OUTPUTS")
86 private String vnfOutputs;
87 @Column(name = "REQUEST_BODY")
88 private String requestBody;
89 @Column(name = "RESPONSE_BODY")
90 private String responseBody;
91 @Column(name = "LAST_MODIFIED_BY", length = 50)
92 private String lastModifiedBy;
93 @Column(name = "MODIFY_TIME")
94 @Temporal(TemporalType.TIMESTAMP)
95 private Date modifyTime;
96 @Column(name = "REQUEST_TYPE", length = 20)
97 private String requestType;
98 @Column(name = "VOLUME_GROUP_ID", length = 45)
99 private String volumeGroupId;
100 @Column(name = "VOLUME_GROUP_NAME", length = 45)
101 private String volumeGroupName;
102 @Column(name = "VF_MODULE_ID", length = 45)
103 private String vfModuleId;
104 @Column(name = "VF_MODULE_NAME", length = 200)
105 private String vfModuleName;
106 @Column(name = "VF_MODULE_MODEL_NAME", length = 200)
107 private String vfModuleModelName;
108 @Column(name = "AAI_SERVICE_ID", length = 50)
109 private String aaiServiceId;
110 @Column(name = "AIC_CLOUD_REGION", length = 11)
111 private String aicCloudRegion;
112 @Column(name = "CALLBACK_URL", length = 200)
113 private String callBackUrl;
114 @Column(name = "CORRELATOR", length = 80)
115 private String correlator;
116 @Column(name = "SERVICE_INSTANCE_ID", length = 45)
117 private String serviceInstanceId;
118 @Column(name = "SERVICE_INSTANCE_NAME", length = 80)
119 private String serviceInstanceName;
120 @Column(name = "REQUEST_SCOPE", length = 45)
121 private String requestScope;
122 @Column(name = "REQUEST_ACTION", length = 45)
123 private String requestAction;
124 @Column(name = "NETWORK_ID", length = 45)
125 private String networkId;
126 @Column(name = "NETWORK_NAME", length = 80)
127 private String networkName;
128 @Column(name = "NETWORK_TYPE", length = 80)
129 private String networkType;
130 @Column(name = "REQUESTOR_ID", length = 80)
131 private String requestorId;
132 @Column(name = "CONFIGURATION_ID", length = 45)
133 private String configurationId;
134 @Column(name = "CONFIGURATION_NAME", length = 200)
135 private String configurationName;
136 @Column(name = "OPERATIONAL_ENV_ID", length = 45)
137 private String operationalEnvId;
138 @Column(name = "OPERATIONAL_ENV_NAME", length = 200)
139 private String operationalEnvName;
142 public URI getRequestURI() {
143 return URI.create(this.requestId);
146 public String getRequestId() {
147 return this.requestId;
150 public void setRequestId(String requestId) {
151 this.requestId = requestId;
154 public String getClientRequestId() {
155 return clientRequestId;
158 public void setClientRequestId(String clientRequestId) {
159 this.clientRequestId = clientRequestId;
162 public String getAction() {
166 public void setAction(String action) {
167 this.action = action;
170 public String getRequestStatus() {
171 return this.requestStatus;
174 public void setRequestStatus(String requestStatus) {
175 this.requestStatus = requestStatus;
178 public String getStatusMessage() {
179 return this.statusMessage;
182 public void setStatusMessage(String statusMessage) {
183 this.statusMessage = statusMessage;
186 public Long getProgress() {
187 return this.progress;
190 public void setProgress(Long progress) {
191 this.progress = progress;
194 @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
195 public Timestamp getStartTime() {
196 return this.startTime;
199 public void setStartTime(Timestamp startTime) {
200 this.startTime = startTime;
203 @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
204 public Timestamp getEndTime() {
208 public void setEndTime(Timestamp endTime) {
209 this.endTime = endTime;
212 public String getSource() {
216 public void setSource(String source) {
217 this.source = source;
220 public String getVnfId() {
224 public void setVnfId(String vnfId) {
228 public String getVnfName() {
232 public void setVnfName(String vnfName) {
233 this.vnfName = vnfName;
236 public String getVnfType() {
240 public void setVnfType(String vnfType) {
241 this.vnfType = vnfType;
244 public String getServiceType() {
245 return this.serviceType;
248 public void setServiceType(String serviceType) {
249 this.serviceType = serviceType;
252 public String getAicNodeClli() {
253 return this.aicNodeClli;
256 public void setAicNodeClli(String aicNodeClli) {
257 this.aicNodeClli = aicNodeClli;
260 public String getTenantId() {
261 return this.tenantId;
264 public void setTenantId(String tenantId) {
265 this.tenantId = tenantId;
268 public String getProvStatus() {
269 return this.provStatus;
272 public void setProvStatus(String provStatus) {
273 this.provStatus = provStatus;
276 public String getVnfParams() {
277 return this.vnfParams;
280 public void setVnfParams(String vnfParams) {
281 this.vnfParams = vnfParams;
284 public String getVnfOutputs() {
285 return this.vnfOutputs;
288 public void setVnfOutputs(String vnfOutputs) {
289 this.vnfOutputs = vnfOutputs;
292 public String getRequestBody() {
293 return this.requestBody;
296 public void setRequestBody(String requestBody) {
297 this.requestBody = requestBody;
300 public String getResponseBody() {
301 return this.responseBody;
304 public void setResponseBody(String responseBody) {
305 this.responseBody = responseBody;
308 public String getLastModifiedBy() {
309 return this.lastModifiedBy;
312 public void setLastModifiedBy(String lastModifiedBy) {
313 this.lastModifiedBy = lastModifiedBy;
316 public Date getModifyTime() {
317 return this.modifyTime;
320 public String getRequestType() {
321 return this.requestType;
324 public void setRequestType(String requestType) {
325 this.requestType = requestType;
328 public String getVolumeGroupId() {
329 return this.volumeGroupId;
332 public void setVolumeGroupId(String volumeGroupId) {
333 this.volumeGroupId = volumeGroupId;
336 public String getVolumeGroupName() {
337 return this.volumeGroupName;
340 public void setVolumeGroupName(String volumeGroupName) {
341 this.volumeGroupName = volumeGroupName;
344 public String getVfModuleId() {
345 return this.vfModuleId;
348 public void setVfModuleId(String vfModuleId) {
349 this.vfModuleId = vfModuleId;
352 public String getVfModuleName() {
353 return this.vfModuleName;
356 public void setVfModuleName(String vfModuleName) {
357 this.vfModuleName = vfModuleName;
360 public String getVfModuleModelName() {
361 return this.vfModuleModelName;
364 public void setVfModuleModelName(String vfModuleModelName) {
365 this.vfModuleModelName = vfModuleModelName;
368 public String getAaiServiceId() {
369 return this.aaiServiceId;
372 public void setAaiServiceId(String aaiServiceId) {
373 this.aaiServiceId = aaiServiceId;
376 public String getAicCloudRegion() {
377 return this.aicCloudRegion;
380 public void setAicCloudRegion(String aicCloudRegion) {
381 this.aicCloudRegion = aicCloudRegion;
384 public String getCallBackUrl() {
388 public void setCallBackUrl(String callBackUrl) {
389 this.callBackUrl = callBackUrl;
392 public String getCorrelator() {
396 public void setCorrelator(String correlator) {
397 this.correlator = correlator;
400 public String getServiceInstanceId() {
401 return serviceInstanceId;
404 public void setServiceInstanceId(String serviceInstanceId) {
405 this.serviceInstanceId = serviceInstanceId;
408 public String getServiceInstanceName() {
409 return serviceInstanceName;
412 public void setServiceInstanceName(String serviceInstanceName) {
413 this.serviceInstanceName = serviceInstanceName;
416 public String getRequestScope() {
420 public void setRequestScope(String requestScope) {
421 this.requestScope = requestScope;
424 public String getRequestAction() {
425 return requestAction;
428 public void setRequestAction(String requestAction) {
429 this.requestAction = requestAction;
432 public String getNetworkId() {
436 public void setNetworkId(String networkId) {
437 this.networkId = networkId;
440 public String getNetworkName() {
444 public void setNetworkName(String networkName) {
445 this.networkName = networkName;
448 public String getNetworkType() {
452 public void setNetworkType(String networkType) {
453 this.networkType = networkType;
456 public String getRequestorId() {
460 public void setRequestorId(String requestorId) {
461 this.requestorId = requestorId;
464 public String getConfigurationId() {
465 return configurationId;
468 public void setConfigurationId(String configurationId) {
469 this.configurationId = configurationId;
472 public String getConfigurationName() {
473 return configurationName;
476 public void setConfigurationName(String configurationName) {
477 this.configurationName = configurationName;
480 public String getOperationalEnvId() {
481 return operationalEnvId;
484 public void setOperationalEnvId(String operationalEnvId) {
485 this.operationalEnvId = operationalEnvId;
488 public String getOperationalEnvName() {
489 return operationalEnvName;
492 public void setOperationalEnvName(String operationalEnvName) {
493 this.operationalEnvName = operationalEnvName;
497 protected void onCreate() {
498 if (requestScope == null)
499 requestScope = UNKNOWN;
500 if (requestAction == null)
501 requestAction = UNKNOWN;
502 this.modifyTime = new Date();
506 protected void onUpdate() {
507 if (requestScope == null)
508 requestScope = UNKNOWN;
509 if (requestAction == null)
510 requestAction = UNKNOWN;
511 this.modifyTime = new Date();
515 public boolean equals(final Object other) {
519 if (!(other instanceof InfraRequests)) {
522 InfraRequests castOther = (InfraRequests) other;
523 return Objects.equals(getRequestId(), castOther.getRequestId());
527 public int hashCode() {
528 return Objects.hash(getRequestId());
532 public String toString() {
533 return new ToStringBuilder(this).append("requestId", getRequestId())
534 .append("clientRequestId", getClientRequestId()).append("action", getAction())
535 .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
536 .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
537 .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
538 .append("vnfType", getVnfType()).append("serviceType", getServiceType())
539 .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
540 .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams())
541 .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
542 .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
543 .append("modifyTime", getModifyTime()).append("requestType", getRequestType())
544 .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
545 .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
546 .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId())
547 .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl())
548 .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
549 .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
550 .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
551 .append("networkName", getNetworkName()).append("networkType", getNetworkType())
552 .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
553 .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
554 .append("operationalEnvName", getOperationalEnvName()).toString();