Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-api-handlers / mso-requests-db / src / main / java / org / onap / so / db / request / beans / InfraRequests.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.db.request.beans;
22
23 import java.net.URI;
24 import java.sql.Timestamp;
25 import java.util.Date;
26 import java.util.Objects;
27 import javax.persistence.Column;
28 import javax.persistence.Id;
29 import javax.persistence.MappedSuperclass;
30 import javax.persistence.PrePersist;
31 import javax.persistence.PreUpdate;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
35 import org.apache.commons.lang3.builder.ToStringBuilder;
36 import org.onap.so.requestsdb.TimestampXMLAdapter;
37 import uk.co.blackpepper.bowman.annotation.ResourceId;
38
39 @MappedSuperclass
40 public abstract class InfraRequests implements java.io.Serializable {
41
42     private static final long serialVersionUID = -5497583682393936143L;
43     private static final String UNKNOWN = "unknown";
44
45
46     @Id
47     @Column(name = "REQUEST_ID", length = 45)
48     private String requestId;
49     @Column(name = "CLIENT_REQUEST_ID", length = 45, unique = true)
50     private String clientRequestId;
51     @Column(name = "ACTION", length = 45)
52     private String action;
53     @Column(name = "REQUEST_STATUS", length = 20)
54     private String requestStatus;
55     @Column(name = "STATUS_MESSAGE", length = 2000)
56     private String statusMessage;
57     @Column(name = "ROLLBACK_STATUS_MESSAGE", length = 2000)
58     private String rollbackStatusMessage;
59     @Column(name = "FLOW_STATUS", length = 2000)
60     private String flowStatus;
61     @Column(name = "RETRY_STATUS_MESSAGE", length = 2000)
62     private String retryStatusMessage;
63     @Column(name = "PROGRESS", precision = 11)
64     private Long progress;
65
66     @Column(name = "START_TIME")
67     private Timestamp startTime;
68     @Column(name = "END_TIME")
69     private Timestamp endTime;
70     @Column(name = "SOURCE", length = 45)
71     private String source;
72     @Column(name = "VNF_ID", length = 45)
73     private String vnfId;
74     @Column(name = "VNF_NAME", length = 80)
75     private String vnfName;
76     @Column(name = "VNF_TYPE", length = 200)
77     private String vnfType;
78     @Column(name = "SERVICE_TYPE", length = 45)
79     private String serviceType;
80     @Column(name = "AIC_NODE_CLLI", length = 11)
81     private String aicNodeClli;
82     @Column(name = "TENANT_ID", length = 45)
83     private String tenantId;
84     @Column(name = "PROV_STATUS", length = 20)
85     private String provStatus;
86     @Column(name = "VNF_PARAMS")
87     private String vnfParams;
88     @Column(name = "VNF_OUTPUTS")
89     private String vnfOutputs;
90     @Column(name = "REQUEST_BODY")
91     private String requestBody;
92     @Column(name = "RESPONSE_BODY")
93     private String responseBody;
94     @Column(name = "LAST_MODIFIED_BY", length = 50)
95     private String lastModifiedBy;
96     @Column(name = "MODIFY_TIME")
97     @Temporal(TemporalType.TIMESTAMP)
98     private Date modifyTime;
99     @Column(name = "REQUEST_TYPE", length = 20)
100     private String requestType;
101     @Column(name = "VOLUME_GROUP_ID", length = 45)
102     private String volumeGroupId;
103     @Column(name = "VOLUME_GROUP_NAME", length = 45)
104     private String volumeGroupName;
105     @Column(name = "VF_MODULE_ID", length = 45)
106     private String vfModuleId;
107     @Column(name = "VF_MODULE_NAME", length = 200)
108     private String vfModuleName;
109     @Column(name = "VF_MODULE_MODEL_NAME", length = 200)
110     private String vfModuleModelName;
111     @Column(name = "AAI_SERVICE_ID", length = 50)
112     private String aaiServiceId;
113     @Column(name = "AIC_CLOUD_REGION", length = 11)
114     private String aicCloudRegion;
115     @Column(name = "CALLBACK_URL", length = 200)
116     private String callBackUrl;
117     @Column(name = "CORRELATOR", length = 80)
118     private String correlator;
119     @Column(name = "SERVICE_INSTANCE_ID", length = 45)
120     private String serviceInstanceId;
121     @Column(name = "SERVICE_INSTANCE_NAME", length = 80)
122     private String serviceInstanceName;
123     @Column(name = "REQUEST_SCOPE", length = 45)
124     private String requestScope;
125     @Column(name = "REQUEST_ACTION", length = 45)
126     private String requestAction;
127     @Column(name = "NETWORK_ID", length = 45)
128     private String networkId;
129     @Column(name = "NETWORK_NAME", length = 80)
130     private String networkName;
131     @Column(name = "NETWORK_TYPE", length = 80)
132     private String networkType;
133     @Column(name = "REQUESTOR_ID", length = 80)
134     private String requestorId;
135     @Column(name = "CONFIGURATION_ID", length = 45)
136     private String configurationId;
137     @Column(name = "CONFIGURATION_NAME", length = 200)
138     private String configurationName;
139     @Column(name = "OPERATIONAL_ENV_ID", length = 45)
140     private String operationalEnvId;
141     @Column(name = "OPERATIONAL_ENV_NAME", length = 200)
142     private String operationalEnvName;
143     @Column(name = "INSTANCE_GROUP_ID", length = 45)
144     private String instanceGroupId;
145     @Column(name = "INSTANCE_GROUP_NAME", length = 200)
146     private String instanceGroupName;
147     @Column(name = "REQUEST_URL", length = 500)
148     private String requestUrl;
149
150     @ResourceId
151     public URI getRequestURI() {
152         return URI.create(this.requestId);
153     }
154
155     public String getRequestId() {
156         return this.requestId;
157     }
158
159     public void setRequestId(String requestId) {
160         this.requestId = requestId;
161     }
162
163     public String getClientRequestId() {
164         return clientRequestId;
165     }
166
167     public void setClientRequestId(String clientRequestId) {
168         this.clientRequestId = clientRequestId;
169     }
170
171     public String getAction() {
172         return this.action;
173     }
174
175     public void setAction(String action) {
176         this.action = action;
177     }
178
179     public String getRequestStatus() {
180         return this.requestStatus;
181     }
182
183     public void setRequestStatus(String requestStatus) {
184         this.requestStatus = requestStatus;
185     }
186
187     public String getStatusMessage() {
188         return this.statusMessage;
189     }
190
191     public void setStatusMessage(String statusMessage) {
192         this.statusMessage = statusMessage;
193     }
194
195     public String getRollbackStatusMessage() {
196         return this.rollbackStatusMessage;
197     }
198
199     public void setRollbackStatusMessage(String rollbackStatusMessage) {
200         this.rollbackStatusMessage = rollbackStatusMessage;
201     }
202
203     public String getFlowStatus() {
204         return this.flowStatus;
205     }
206
207     public void setFlowStatus(String flowStatus) {
208         this.flowStatus = flowStatus;
209     }
210
211     public String getRetryStatusMessage() {
212         return this.retryStatusMessage;
213     }
214
215     public void setRetryStatusMessage(String retryStatusMessage) {
216         this.retryStatusMessage = retryStatusMessage;
217     }
218
219     public Long getProgress() {
220         return this.progress;
221     }
222
223     public void setProgress(Long progress) {
224         this.progress = progress;
225     }
226
227     @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
228     public Timestamp getStartTime() {
229         return this.startTime;
230     }
231
232     public void setStartTime(Timestamp startTime) {
233         this.startTime = startTime;
234     }
235
236     @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
237     public Timestamp getEndTime() {
238         return this.endTime;
239     }
240
241     public void setEndTime(Timestamp endTime) {
242         this.endTime = endTime;
243     }
244
245     public String getSource() {
246         return this.source;
247     }
248
249     public void setSource(String source) {
250         this.source = source;
251     }
252
253     public String getVnfId() {
254         return this.vnfId;
255     }
256
257     public void setVnfId(String vnfId) {
258         this.vnfId = vnfId;
259     }
260
261     public String getVnfName() {
262         return this.vnfName;
263     }
264
265     public void setVnfName(String vnfName) {
266         this.vnfName = vnfName;
267     }
268
269     public String getVnfType() {
270         return this.vnfType;
271     }
272
273     public void setVnfType(String vnfType) {
274         this.vnfType = vnfType;
275     }
276
277     public String getServiceType() {
278         return this.serviceType;
279     }
280
281     public void setServiceType(String serviceType) {
282         this.serviceType = serviceType;
283     }
284
285     public String getAicNodeClli() {
286         return this.aicNodeClli;
287     }
288
289     public void setAicNodeClli(String aicNodeClli) {
290         this.aicNodeClli = aicNodeClli;
291     }
292
293     public String getTenantId() {
294         return this.tenantId;
295     }
296
297     public void setTenantId(String tenantId) {
298         this.tenantId = tenantId;
299     }
300
301     public String getProvStatus() {
302         return this.provStatus;
303     }
304
305     public void setProvStatus(String provStatus) {
306         this.provStatus = provStatus;
307     }
308
309     public String getVnfParams() {
310         return this.vnfParams;
311     }
312
313     public void setVnfParams(String vnfParams) {
314         this.vnfParams = vnfParams;
315     }
316
317     public String getVnfOutputs() {
318         return this.vnfOutputs;
319     }
320
321     public void setVnfOutputs(String vnfOutputs) {
322         this.vnfOutputs = vnfOutputs;
323     }
324
325     public String getRequestBody() {
326         return this.requestBody;
327     }
328
329     public void setRequestBody(String requestBody) {
330         this.requestBody = requestBody;
331     }
332
333     public String getResponseBody() {
334         return this.responseBody;
335     }
336
337     public void setResponseBody(String responseBody) {
338         this.responseBody = responseBody;
339     }
340
341     public String getLastModifiedBy() {
342         return this.lastModifiedBy;
343     }
344
345     public void setLastModifiedBy(String lastModifiedBy) {
346         this.lastModifiedBy = lastModifiedBy;
347     }
348
349     public Date getModifyTime() {
350         return this.modifyTime;
351     }
352
353     public String getRequestType() {
354         return this.requestType;
355     }
356
357     public void setRequestType(String requestType) {
358         this.requestType = requestType;
359     }
360
361     public String getVolumeGroupId() {
362         return this.volumeGroupId;
363     }
364
365     public void setVolumeGroupId(String volumeGroupId) {
366         this.volumeGroupId = volumeGroupId;
367     }
368
369     public String getVolumeGroupName() {
370         return this.volumeGroupName;
371     }
372
373     public void setVolumeGroupName(String volumeGroupName) {
374         this.volumeGroupName = volumeGroupName;
375     }
376
377     public String getVfModuleId() {
378         return this.vfModuleId;
379     }
380
381     public void setVfModuleId(String vfModuleId) {
382         this.vfModuleId = vfModuleId;
383     }
384
385     public String getVfModuleName() {
386         return this.vfModuleName;
387     }
388
389     public void setVfModuleName(String vfModuleName) {
390         this.vfModuleName = vfModuleName;
391     }
392
393     public String getVfModuleModelName() {
394         return this.vfModuleModelName;
395     }
396
397     public void setVfModuleModelName(String vfModuleModelName) {
398         this.vfModuleModelName = vfModuleModelName;
399     }
400
401     public String getAaiServiceId() {
402         return this.aaiServiceId;
403     }
404
405     public void setAaiServiceId(String aaiServiceId) {
406         this.aaiServiceId = aaiServiceId;
407     }
408
409     public String getAicCloudRegion() {
410         return this.aicCloudRegion;
411     }
412
413     public void setAicCloudRegion(String aicCloudRegion) {
414         this.aicCloudRegion = aicCloudRegion;
415     }
416
417     public String getCallBackUrl() {
418         return callBackUrl;
419     }
420
421     public void setCallBackUrl(String callBackUrl) {
422         this.callBackUrl = callBackUrl;
423     }
424
425     public String getCorrelator() {
426         return correlator;
427     }
428
429     public void setCorrelator(String correlator) {
430         this.correlator = correlator;
431     }
432
433     public String getServiceInstanceId() {
434         return serviceInstanceId;
435     }
436
437     public void setServiceInstanceId(String serviceInstanceId) {
438         this.serviceInstanceId = serviceInstanceId;
439     }
440
441     public String getServiceInstanceName() {
442         return serviceInstanceName;
443     }
444
445     public void setServiceInstanceName(String serviceInstanceName) {
446         this.serviceInstanceName = serviceInstanceName;
447     }
448
449     public String getRequestScope() {
450         return requestScope;
451     }
452
453     public void setRequestScope(String requestScope) {
454         this.requestScope = requestScope;
455     }
456
457     public String getRequestAction() {
458         return requestAction;
459     }
460
461     public void setRequestAction(String requestAction) {
462         this.requestAction = requestAction;
463     }
464
465     public String getNetworkId() {
466         return networkId;
467     }
468
469     public void setNetworkId(String networkId) {
470         this.networkId = networkId;
471     }
472
473     public String getNetworkName() {
474         return networkName;
475     }
476
477     public void setNetworkName(String networkName) {
478         this.networkName = networkName;
479     }
480
481     public String getNetworkType() {
482         return networkType;
483     }
484
485     public void setNetworkType(String networkType) {
486         this.networkType = networkType;
487     }
488
489     public String getRequestorId() {
490         return requestorId;
491     }
492
493     public void setRequestorId(String requestorId) {
494         this.requestorId = requestorId;
495     }
496
497     public String getConfigurationId() {
498         return configurationId;
499     }
500
501     public void setConfigurationId(String configurationId) {
502         this.configurationId = configurationId;
503     }
504
505     public String getConfigurationName() {
506         return configurationName;
507     }
508
509     public void setConfigurationName(String configurationName) {
510         this.configurationName = configurationName;
511     }
512
513     public String getOperationalEnvId() {
514         return operationalEnvId;
515     }
516
517     public void setOperationalEnvId(String operationalEnvId) {
518         this.operationalEnvId = operationalEnvId;
519     }
520
521     public String getOperationalEnvName() {
522         return operationalEnvName;
523     }
524
525     public void setOperationalEnvName(String operationalEnvName) {
526         this.operationalEnvName = operationalEnvName;
527     }
528
529     public String getInstanceGroupId() {
530         return instanceGroupId;
531     }
532
533     public void setInstanceGroupId(String instanceGroupId) {
534         this.instanceGroupId = instanceGroupId;
535     }
536
537     public String getInstanceGroupName() {
538         return instanceGroupName;
539     }
540
541     public void setInstanceGroupName(String instanceGroupName) {
542         this.instanceGroupName = instanceGroupName;
543     }
544
545     public String getRequestUrl() {
546         return this.requestUrl;
547     }
548
549     public void setRequestUrl(String requestUrl) {
550         this.requestUrl = requestUrl;
551     }
552
553     @PrePersist
554     protected void onCreate() {
555         if (requestScope == null)
556             requestScope = UNKNOWN;
557         if (requestAction == null)
558             requestAction = UNKNOWN;
559         this.modifyTime = new Date();
560     }
561
562     @PreUpdate
563     protected void onUpdate() {
564         if (requestScope == null)
565             requestScope = UNKNOWN;
566         if (requestAction == null)
567             requestAction = UNKNOWN;
568         this.modifyTime = new Date();
569     }
570
571     @Override
572     public boolean equals(final Object other) {
573         if (this == other) {
574             return true;
575         }
576         if (!(other instanceof InfraRequests)) {
577             return false;
578         }
579         InfraRequests castOther = (InfraRequests) other;
580         return Objects.equals(getRequestId(), castOther.getRequestId());
581     }
582
583     @Override
584     public int hashCode() {
585         return Objects.hash(getRequestId());
586     }
587
588     @Override
589     public String toString() {
590         return new ToStringBuilder(this).append("requestId", getRequestId())
591                 .append("clientRequestId", getClientRequestId()).append("action", getAction())
592                 .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
593                 .append("rollbackStatusMessage", getRollbackStatusMessage()).append("flowStatus", getFlowStatus())
594                 .append("retryStatusMessage", getRetryStatusMessage()).append("progress", getProgress())
595                 .append("startTime", getStartTime()).append("endTime", getEndTime()).append("source", getSource())
596                 .append("vnfId", getVnfId()).append("vnfName", getVnfName()).append("vnfType", getVnfType())
597                 .append("serviceType", getServiceType()).append("aicNodeClli", getAicNodeClli())
598                 .append("tenantId", getTenantId()).append("provStatus", getProvStatus())
599                 .append("vnfParams", getVnfParams()).append("vnfOutputs", getVnfOutputs())
600                 .append("requestBody", getRequestBody()).append("responseBody", getResponseBody())
601                 .append("lastModifiedBy", getLastModifiedBy()).append("modifyTime", getModifyTime())
602                 .append("requestType", getRequestType()).append("volumeGroupId", getVolumeGroupId())
603                 .append("volumeGroupName", getVolumeGroupName()).append("vfModuleId", getVfModuleId())
604                 .append("vfModuleName", getVfModuleName()).append("vfModuleModelName", getVfModuleModelName())
605                 .append("aaiServiceId", getAaiServiceId()).append("aicCloudRegion", getAicCloudRegion())
606                 .append("callBackUrl", getCallBackUrl()).append("correlator", getCorrelator())
607                 .append("serviceInstanceId", getServiceInstanceId())
608                 .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
609                 .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
610                 .append("networkName", getNetworkName()).append("networkType", getNetworkType())
611                 .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
612                 .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
613                 .append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId())
614                 .append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl()).toString();
615     }
616 }