summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org
diff options
context:
space:
mode:
authorRachitha Ramappa <rachitha.ramappa@att.com>2020-09-23 12:42:19 +0530
committerIkram Ikramullah <ikram@research.att.com>2020-10-08 10:53:16 +0000
commit226ef715d7afe3758fbc88c05cf4d752c6bed51b (patch)
tree26915a243c02d977cd906937330234860cbed6dd /vid-app-common/src/main/java/org
parent30eb0655f49fd3565d737b91146baf9ce4e02f9d (diff)
New audit info screen changes7.0.0
Audit screen css changes and export mso status to external file Change-Id: I71d577121e18090eab7a388ed01707823e45ac82 Issue-ID: VID-901 Signed-off-by: rachitha.ramappa@att.com
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java48
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java54
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java39
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java130
5 files changed, 264 insertions, 8 deletions
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 012db5a31..3f25b8012 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
@@ -126,6 +126,7 @@ public class JobAuditStatus extends VidBaseEntity {
.append(source, that.source)
.append(requestId, that.requestId)
.append(additionalInfo, that.additionalInfo)
+ .append(modelType, that.modelType)
// ordinal is not part of equality (similarly to "created" field)
.isEquals();
}
@@ -138,6 +139,7 @@ public class JobAuditStatus extends VidBaseEntity {
.append(source)
.append(requestId)
.append(additionalInfo)
+
// ordinal is not part of equality (similarly to "created" field)
.toHashCode();
}
@@ -165,6 +167,52 @@ public class JobAuditStatus extends VidBaseEntity {
}
}
+ public JobAuditStatus(UUID requestId, String instanceName,
+ String modelType, String instanceType, String startTime,
+ String finishTime, String jobStatus, String additionalInfo) {
+ this.requestId = requestId;
+ this.instanceName = instanceName;
+ this.modelType = modelType;
+ this.instanceType = instanceType;
+
+ this.startTime = startTime;
+ this.finishTime = finishTime;
+
+ this.jobStatus = jobStatus;
+ this.additionalInfo = additionalInfo;
+ this.created = dateStringToDate(finishTime);
+ }
+ private String modelType;
+ private String startTime;
+ private String finishTime;
+
+ @Transient
+ public String getModelType() {
+ return modelType;
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ @Transient
+ public String getFinishTime() {
+ return finishTime;
+ }
+
+ public void setFinishTime(String finishTime) {
+ this.finishTime = finishTime;
+ }
+
+ @Transient
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
private UUID jobId;
private String instanceName;
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 61e0d3af6..09c571c29 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
@@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AsyncRequestStatus {
+
public Request request;
public AsyncRequestStatus(Request request) {
@@ -88,14 +89,61 @@ public class AsyncRequestStatus {
public static class RequestDetails {
public RequestInfo requestInfo;
+ public ModelInfo modelInfo;
+ public RequestParameters requestParameters;
+ public Project project;
+ public OwningEntity owningEntity;
+ public CloudConfiguration cloudConfiguration;
+ public LineOfBusiness lineOfBusiness;
+ public Platform platform;
+
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class LineOfBusiness {
+ public String lineOfBusinessName;
+ }
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class CloudConfiguration {
+ public String tenantId;
+ public String tenantName;
+ public String cloudOwner;
+ public String lcpCloudRegionId;
+ }
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class Platform {
+ public String platformName;
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static class RequestInfo {
public String instanceName;
+ public String source;
+ }
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class ModelInfo {
+ public String modelInvariantId;
+ public String modelType;
+ public String modelName;
+ public String modelVersion;
+ public String modelVersionId;
+ public String modelUuid;
+ public String modelInvariantUuid;
+ }
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class RequestParameters {
+ public String subscriptionServiceType;
+ public String aLaCarte;
+ public String testApi;
+ }
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class Project {
+ public String projectName;
+ }
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class OwningEntity {
+ public String owningEntityId;
+ public String owningEntityName;
}
-
-
-
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java
index 29356aa4d..c574e5ae5 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java
@@ -50,6 +50,21 @@ public class RequestStatus {
this.statusMessage = statusMessage;
this.timestamp = timestamp;
}
+ public RequestStatus(String requestState, String statusMessage, String timestamp, String flowStatus) {
+ this.requestState = requestState;
+ this.statusMessage = statusMessage;
+ this.timestamp = timestamp;
+ this.flowStatus = flowStatus;
+ }
+
+ /**
+ * short description of the flow status
+ * (Required)
+ *
+ */
+ @JsonProperty("flowStatus")
+ private String flowStatus;
+
/**
* percentage complete estimate from 0 to 100
@@ -215,6 +230,28 @@ public class RequestStatus {
this.additionalProperties.put(name, value);
}
+ /**
+ * additional descriptive information about the status
+ *
+ * @return
+ * The flowStatus
+ */
+ @JsonProperty("flowStatus")
+ public String getFlowStatus() {
+ return flowStatus;
+ }
+
+ /**
+ * additional descriptive information about the status
+ *
+ * @param flowStatus
+ * The flowStatus
+ */
+ @JsonProperty("flowStatus")
+ public void setFlowStatus(String flowStatus) {
+ this.flowStatus = flowStatus;
+ }
+
@Override
public int hashCode() {
return new HashCodeBuilder().append(percentProgress).append(requestState).append(statusMessage).append(timestamp).append(wasRolledBack).append(additionalProperties).toHashCode();
@@ -229,7 +266,7 @@ public class RequestStatus {
return false;
}
RequestStatus rhs = ((RequestStatus) other);
- return new EqualsBuilder().append(percentProgress, rhs.percentProgress).append(requestState, rhs.requestState).append(statusMessage, rhs.statusMessage).append(timestamp, rhs.timestamp).append(wasRolledBack, rhs.wasRolledBack).append(additionalProperties, rhs.additionalProperties).isEquals();
+ return new EqualsBuilder().append(percentProgress, rhs.percentProgress).append(requestState, rhs.requestState).append(statusMessage, rhs.statusMessage).append(timestamp, rhs.timestamp).append(wasRolledBack, rhs.wasRolledBack).append(flowStatus, rhs.flowStatus).append(additionalProperties, rhs.additionalProperties).isEquals();
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index 9d3faa062..6ff6157ff 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -103,6 +103,7 @@ public enum Features implements Feature {
FLAG_2008_PAUSE_INSTANTIATION_ON_VFMODULE_POPUP,
FLAG_2008_REMOVE_PAUSE_INSTANTIATION,
FLAG_2008_PAUSE_VFMODULE_INSTANTIATION_FAILURE,
+ FLAG_2011_EXPORT_MSO_STATUS,
;
public boolean isActive() {
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 287a771d3..4f32eca85 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
@@ -30,7 +30,8 @@ import org.onap.vid.mso.*;
import org.onap.vid.mso.rest.AsyncRequestStatus;
import org.onap.vid.mso.rest.AsyncRequestStatusList;
import org.springframework.stereotype.Service;
-
+import java.text.MessageFormat;
+import org.apache.commons.lang3.StringUtils;
import javax.inject.Inject;
import java.util.List;
import java.util.Objects;
@@ -59,13 +60,13 @@ public class AuditServiceImpl implements AuditService{
@Override
public List<JobAuditStatus> getAuditStatusFromMsoByRequestId(UUID jobId, UUID requestId) {
- String filter = "requestId:EQUALS:" + requestId;
+ String filter = "requestId:EQUALS:" + requestId + "&format=statusDetail";
return getAuditStatusFromMso(jobId, filter, null);
}
@Override
public List<JobAuditStatus> getAuditStatusFromMsoByInstanceId(JobAuditStatus.ResourceTypeFilter resourceTypeFilter, UUID instanceId, UUID jobId) {
- String filter = resourceTypeFilter.getFilterBy() + ":EQUALS:" + instanceId;
+ String filter = resourceTypeFilter.getFilterBy() + ":EQUALS:" + instanceId + "&format=statusDetail";
return getAuditStatusFromMso(jobId, filter, instanceId);
}
@@ -156,10 +157,131 @@ public class AuditServiceImpl implements AuditService{
protected List<JobAuditStatus> convertMsoResponseStatusToJobAuditStatus(List<AsyncRequestStatus> msoStatuses, String defaultName){
return msoStatuses.stream().map(status ->
- convertAsyncRequestStatusToJobAuditStatus(status, defaultName)
+ convertAsyncRequestStatusToJobAuditStatusAdditionalInfo(status, defaultName)
).collect(Collectors.toList());
}
+ private JobAuditStatus convertAsyncRequestStatusToJobAuditStatusAdditionalInfo(AsyncRequestStatus status, String defaultName) {
+ if (status == null) {
+ return null;
+ }
+ UUID requestId = null;
+ String instanceName = defaultName;
+ String jobStatus = null;
+ String additionalInfo = null;
+ String finishTime = null;
+ String instanceType = null;
+ String modelType = "";
+ String startTime = null;
+ AsyncRequestStatus.Request request = status.request;
+ if (request != null) {
+ if (request.requestId != null) {
+ requestId = UUID.fromString(request.requestId);
+ }
+ instanceName = extractInstanceName(instanceName, request);
+ instanceType = request.requestType;
+ if (request.requestDetails != null && request.requestDetails.modelInfo != null) {
+ modelType = request.requestDetails.modelInfo.modelType;
+ }
+ startTime = request.startTime;
+ if (request.requestStatus != null) {
+ jobStatus = request.requestStatus.getRequestState();
+ additionalInfo = buildAdditionalInfo(request);
+
+ if (!request.requestStatus.getAdditionalProperties().isEmpty() &&
+ request.requestStatus.getAdditionalProperties().get("finishTime") != null) {
+ finishTime = request.requestStatus.getAdditionalProperties().get("finishTime").toString();
+ } else {
+ finishTime = request.requestStatus.getTimestamp();
+ }
+ }
+ }
+ return new JobAuditStatus(requestId, instanceName, modelType, instanceType, startTime, finishTime,
+ jobStatus, additionalInfo);
+ }
+ private String buildAdditionalInfo(AsyncRequestStatus.Request request) {
+ String source = "";
+ String statusMessage = "";
+ String flowStatus = "";
+ String subscriptionServiceType = "";
+ String alacarte = "";
+ String testApi = "";
+ String projectName = "";
+ String owningEntityId = "";
+ String owningEntityName = "";
+ String requestScope = "";
+ String tenantId = "";
+ String tenantName = "";
+ String cloudOwner = "";
+ String platformName = "";
+ String lineOfBusiness = "";
+ MessageFormat mfBasedOnService = null;
+ String otherInfo = "";
+ MessageFormat mf = new MessageFormat("{0}" +
+ "{1}" +
+ "{2}" +
+ "{3}" +
+ "{4}" +
+ "{5}"+
+ "{6}");
+ requestScope = request.requestScope;
+ statusMessage = request.requestStatus != null ? "<b>StatusMessage:</b>"+request.requestStatus.getStatusMessage()+ "</br>": "";
+ if(request.requestDetails != null && request.requestDetails.requestInfo != null) {
+ source = "<b>Source:</b> "+request.requestDetails.requestInfo.source + "</br>";
+ }
+ if(request.requestStatus != null && request.requestStatus.getFlowStatus() != null) {
+ flowStatus = "<b>FlowStatus:</b> "+request.requestStatus.getFlowStatus()+ "</br>";
+ }
+ if(request.requestDetails != null && request.requestDetails.requestParameters != null &&
+ request.requestDetails.requestParameters.subscriptionServiceType != null) {
+ subscriptionServiceType = "<b>SubscriptionServiceType:</b> "+request.requestDetails.requestParameters.subscriptionServiceType+ "</br>";
+ }
+ if(request.requestDetails != null && request.requestDetails.requestParameters != null &&
+ request.requestDetails.requestParameters.aLaCarte != null) {
+ alacarte = "<b>Alacarte:</b> "+request.requestDetails.requestParameters.aLaCarte+ "</br>";
+ }
+ if(request.requestDetails != null && request.requestDetails.requestParameters != null &&
+ request.requestDetails.requestParameters.testApi != null) {
+ testApi = "<b>TestAPI:</b> "+request.requestDetails.requestParameters.testApi+ "</br>";
+ }
+
+ if(request.requestDetails != null) {
+ if("service".equals(requestScope)) {
+ mfBasedOnService = new MessageFormat("<b>ProjectName: {0}</br>" +
+ "<b>OwningEntityId:</b> {1}</br>" +
+ "<b>OwningEntityName:</b> {2}</br>");
+ projectName = request.requestDetails.project != null ? request.requestDetails.project.projectName : "";
+ owningEntityId = request.requestDetails.owningEntity != null ? request.requestDetails.owningEntity.owningEntityId : "";
+ owningEntityName = request.requestDetails.owningEntity != null ? request.requestDetails.owningEntity.owningEntityName : "";
+ Object[] arr1 = new Object[]{projectName, owningEntityId, owningEntityName};
+ otherInfo = mfBasedOnService.format(arr1);
+ } else if("vnf".equals(requestScope)) {
+ mfBasedOnService = new MessageFormat("<b>TenantId:</b> {0}</br>" +
+ "<b>TenantName:</b> {1}</br>" +
+ "<b>CloudOwner:</b> {2}</br>" +
+ "<b>PlatformName:</b> {3}</br>" +
+ "<b>LineOfBusiness:</b> {4}</br>");
+ tenantId = request.requestDetails.cloudConfiguration != null ? request.requestDetails.cloudConfiguration.tenantId : "";
+ tenantName= request.requestDetails.cloudConfiguration != null ? request.requestDetails.cloudConfiguration.tenantName : "";
+ cloudOwner= request.requestDetails.cloudConfiguration != null ? request.requestDetails.cloudConfiguration.cloudOwner : "";
+ platformName= request.requestDetails.platform != null ? request.requestDetails.platform.platformName : "";
+ lineOfBusiness= request.requestDetails.lineOfBusiness != null ? request.requestDetails.lineOfBusiness.lineOfBusinessName : "";
+ Object[] arr2 = new Object[]{tenantId, tenantName, cloudOwner,platformName,lineOfBusiness};
+ otherInfo = mfBasedOnService.format(arr2);
+ } else if("vfModule".equals(requestScope)) {
+ mfBasedOnService = new MessageFormat("<b>TenantId:</b> {0}</br>" +
+ "<b>TenantName:</b> {1}</br>" +
+ "<b>CloudOwner:</b> {2}</br>");
+ tenantId = request.requestDetails.cloudConfiguration != null ? request.requestDetails.cloudConfiguration.tenantId : "";
+ tenantName= request.requestDetails.cloudConfiguration != null ? request.requestDetails.cloudConfiguration.tenantName : "";
+ cloudOwner= request.requestDetails.cloudConfiguration != null ? request.requestDetails.cloudConfiguration.cloudOwner : "";
+ Object[] arr2 = new Object[]{tenantId, tenantName, cloudOwner};
+ otherInfo = mfBasedOnService.format(arr2);
+ }
+ }
+ Object[] objArray = {source, statusMessage, flowStatus, subscriptionServiceType, alacarte, testApi, otherInfo};
+ return StringUtils.chomp(mf.format(objArray));
+ }
private JobAuditStatus convertAsyncRequestStatusToJobAuditStatus(AsyncRequestStatus status, String defaultName){
if (status == null) {
return null;