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