aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java19
2 files changed, 35 insertions, 10 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index e14b01792a..b4a3128de8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -94,8 +94,8 @@ public class OrchestrationRequests {
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@PathParam("requestId") String requestId,
- @PathParam("version") String version, @QueryParam("includeCloudRequest") boolean includeCloudRequest)
- throws ApiException {
+ @PathParam("version") String version, @QueryParam("includeCloudRequest") boolean includeCloudRequest,
+ @QueryParam("extSystemErrorSource") boolean extSystemErrorSource) throws ApiException {
String apiVersion = version.substring(1);
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
@@ -142,7 +142,8 @@ public class OrchestrationRequests {
throw validateException;
}
- Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest);
+ Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, extSystemErrorSource);
+
if (!requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
}
@@ -158,7 +159,8 @@ public class OrchestrationRequests {
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version,
- @QueryParam("includeCloudRequest") boolean includeCloudRequest) throws ApiException {
+ @QueryParam("includeCloudRequest") boolean includeCloudRequest,
+ @QueryParam("extSystemErrorSource") boolean extSystemErrorSource) throws ApiException {
long startTime = System.currentTimeMillis();
@@ -195,7 +197,8 @@ public class OrchestrationRequests {
List<RequestProcessingData> requestProcessingData =
requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
RequestList requestList = new RequestList();
- Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest);
+ Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, extSystemErrorSource);
+
if (!requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
}
@@ -290,8 +293,8 @@ public class OrchestrationRequests {
return Response.status(HttpStatus.SC_NO_CONTENT).entity("").build();
}
- protected Request mapInfraActiveRequestToRequest(InfraActiveRequests iar, boolean includeCloudRequest)
- throws ApiException {
+ protected Request mapInfraActiveRequestToRequest(InfraActiveRequests iar, boolean includeCloudRequest,
+ boolean extSystemErrorSource) throws ApiException {
String requestBody = iar.getRequestBody();
Request request = new Request();
@@ -427,10 +430,19 @@ public class OrchestrationRequests {
});
}
+ mapExtSystemErrorSourceToRequest(iar, status, extSystemErrorSource);
+
request.setRequestStatus(status);
return request;
}
+ protected void mapExtSystemErrorSourceToRequest(InfraActiveRequests iar, RequestStatus status,
+ boolean extSystemErrorSource) {
+ if (extSystemErrorSource) {
+ status.setExtSystemErrorSource(iar.getExtSystemErrorSource());
+ }
+ }
+
public List<org.onap.so.serviceinstancebeans.RequestProcessingData> mapRequestProcessingData(
List<org.onap.so.db.request.beans.RequestProcessingData> processingData) {
List<org.onap.so.serviceinstancebeans.RequestProcessingData> addedRequestProcessingData = new ArrayList<>();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index c46e27b844..86e2f5ce93 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -626,7 +626,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
protected InfraActiveRequests createNewRecordCopyFromInfraActiveRequest(InfraActiveRequests infraActiveRequest,
String requestId, Timestamp startTimeStamp, String source, String requestUri, String requestorId,
- String originalRequestId) {
+ String originalRequestId) throws ApiException {
InfraActiveRequests request = new InfraActiveRequests();
request.setRequestId(requestId);
request.setStartTime(startTimeStamp);
@@ -649,11 +649,24 @@ public class RequestHandlerUtils extends AbstractRestHandler {
}
protected void setInstanceIdAndName(InfraActiveRequests infraActiveRequest,
- InfraActiveRequests currentActiveRequest) {
+ InfraActiveRequests currentActiveRequest) throws ApiException {
String requestScope = infraActiveRequest.getRequestScope();
try {
ModelType type = ModelType.valueOf(requestScope);
- type.setName(currentActiveRequest, type.getName(infraActiveRequest));
+ String instanceName = type.getName(infraActiveRequest);
+ if (instanceName == null && type.equals(ModelType.vfModule)) {
+ logger.error("vfModule for requestId: {} being resumed does not have an instanceName.",
+ infraActiveRequest.getRequestId());
+ ValidateException validateException = new ValidateException.Builder(
+ "vfModule for requestId: " + infraActiveRequest.getRequestId()
+ + " being resumed does not have an instanceName.",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage());
+ throw validateException;
+ }
+ if (instanceName != null) {
+ type.setName(currentActiveRequest, instanceName);
+ }
type.setId(currentActiveRequest, type.getId(infraActiveRequest));
} catch (IllegalArgumentException e) {
logger.error(