From 5ecb6d93b05f1cecb95604b057a1894293a6b687 Mon Sep 17 00:00:00 2001 From: Kruthi Bhat Date: Thu, 29 Oct 2020 22:15:04 +0530 Subject: VID-913 : Addition of Instance IDs in Audit Info screen Change-Id: I7a440c6797f63588c68d490715272992e626424f Issue-ID: VID-913 Signed-off-by: Kruthi Bhat --- .../java/org/onap/vid/model/JobAuditStatus.java | 16 ++++++++++++-- .../org/onap/vid/mso/rest/AsyncRequestStatus.java | 3 +++ .../org/onap/vid/services/AuditServiceImpl.java | 25 +++++++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) (limited to 'vid-app-common/src/main/java') diff --git a/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java b/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java index 3f25b8012..097803304 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java @@ -169,7 +169,7 @@ public class JobAuditStatus extends VidBaseEntity { public JobAuditStatus(UUID requestId, String instanceName, String modelType, String instanceType, String startTime, - String finishTime, String jobStatus, String additionalInfo) { + String finishTime, String jobStatus, String instanceId, String additionalInfo) { this.requestId = requestId; this.instanceName = instanceName; this.modelType = modelType; @@ -177,7 +177,8 @@ public class JobAuditStatus extends VidBaseEntity { this.startTime = startTime; this.finishTime = finishTime; - + + this.instanceId = instanceId; this.jobStatus = jobStatus; this.additionalInfo = additionalInfo; this.created = dateStringToDate(finishTime); @@ -185,6 +186,17 @@ public class JobAuditStatus extends VidBaseEntity { private String modelType; private String startTime; private String finishTime; + + @Transient + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + private String instanceId; @Transient public String getModelType() { diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java index 09c571c29..475e18401 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java @@ -83,6 +83,9 @@ public class AsyncRequestStatus { public static class InstanceReferences { public String serviceInstanceId; + public String vnfInstanceId; + public String vfModuleInstanceId; + public String volumeGroupInstanceId; } @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java index 4f32eca85..796e9de4a 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java @@ -28,6 +28,7 @@ import org.onap.vid.job.Job; import org.onap.vid.model.JobAuditStatus; import org.onap.vid.mso.*; import org.onap.vid.mso.rest.AsyncRequestStatus; +import org.onap.vid.mso.rest.AsyncRequestStatus.Request; import org.onap.vid.mso.rest.AsyncRequestStatusList; import org.springframework.stereotype.Service; import java.text.MessageFormat; @@ -172,6 +173,7 @@ public class AuditServiceImpl implements AuditService{ String instanceType = null; String modelType = ""; String startTime = null; + String instanceId = ""; AsyncRequestStatus.Request request = status.request; if (request != null) { if (request.requestId != null) { @@ -182,6 +184,9 @@ public class AuditServiceImpl implements AuditService{ if (request.requestDetails != null && request.requestDetails.modelInfo != null) { modelType = request.requestDetails.modelInfo.modelType; } + + instanceId = extractInstanceId(modelType,request); + startTime = request.startTime; if (request.requestStatus != null) { @@ -197,8 +202,26 @@ public class AuditServiceImpl implements AuditService{ } } return new JobAuditStatus(requestId, instanceName, modelType, instanceType, startTime, finishTime, - jobStatus, additionalInfo); + jobStatus, instanceId, additionalInfo); } + + private String extractInstanceId(String modelType, Request request) { + if(null != request.instanceReferences) { + if("service".equalsIgnoreCase(modelType)) { + return request.instanceReferences.serviceInstanceId; + } else if("vfModule".equalsIgnoreCase(modelType)){ + return request.instanceReferences.vfModuleInstanceId; + } else if("vnf".equalsIgnoreCase(modelType)) { + return request.instanceReferences.vnfInstanceId; + } else if("volumeGroup".equalsIgnoreCase(modelType)){ + return request.instanceReferences.volumeGroupInstanceId; + } else { + return ""; + } + } + return ""; + } + private String buildAdditionalInfo(AsyncRequestStatus.Request request) { String source = ""; String statusMessage = ""; -- cgit 1.2.3-korg