From 5368783be5ae005c59bb67541e5f84dae9a090c8 Mon Sep 17 00:00:00 2001 From: seshukm Date: Wed, 25 Oct 2017 17:49:27 +0530 Subject: fix Get E2E service IssueId: SO-263 Change-Id: I965a34906c9b22345452000bf26dcfe5d5773429 Signed-off-by: seshukm --- .../mso/apihandlerinfra/E2EServiceInstances.java | 2 +- .../mso/apihandlerinfra/OrchestrationRequests.java | 80 +--------------------- 2 files changed, 3 insertions(+), 79 deletions(-) (limited to 'mso-api-handlers') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index 83755ca253..dc6889802e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -562,7 +562,7 @@ public class E2EServiceInstances { msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody); // currently only for delete case we update the status here - if(action.name().equals("DELETE")){ + if(action == Action.deleteInstance){ ObjectMapper mapper = new ObjectMapper(); try{ DelE2ESvcResp jo = mapper.readValue(camundaJSONResponseBody, DelE2ESvcResp.class); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java index 92a45a71dd..2f32e80dc1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java @@ -134,58 +134,7 @@ public class OrchestrationRequests { return Response.status(200).entity(orchestrationResponse).build(); } - @GET - @Path("e2eServiceInstances/{version:[vV][3-5]}/{serviceId}/operations/{operationId}") - @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class) - @Produces(MediaType.APPLICATION_JSON) - public Response getE2EServiceInstances(@PathParam("serviceId") String serviceId, - @PathParam("version") String version, @PathParam("operationId") String operationId) { - - GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse(); - - MsoRequest msoRequest = new MsoRequest(serviceId); - - long startTime = System.currentTimeMillis(); - - OperationStatus requestDB = null; - - try { - requestDB = requestsDB.getOperationStatus(serviceId, operationId); - - } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); - alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with Request DB"); - msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); - return response; - - } - - if (requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT, - MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Null response from RequestDB when searching by serviceId"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, - "Null response from RequestDB when searching by serviceId"); - msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); - return resp; - - } - - e2eServiceResponse.setE2eRequest(requestDB); - - return Response.status(200).entity(e2eServiceResponse).build(); - } + @GET @Path("orchestrationRequests/{version:[vV][2-5]}") @@ -242,7 +191,7 @@ public class OrchestrationRequests { } @POST - @Path("/{version: [vV][3-5]}/{requestId}/unlock") + @Path("orchestrationRequests/{version: [vV][3-5]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class) @@ -437,29 +386,4 @@ public class OrchestrationRequests { return request; } - private E2ERequest mapInfraActiveRequestToE2ERequest(InfraActiveRequests requestDB) { - - E2ERequest e2erequest = new E2ERequest(); - - e2erequest.setOperationId(requestDB.getRequestId()); - // e2erequest.setRequestScope(requestDB.getRequestScope()); - e2erequest.setOperation(requestDB.getRequestAction()); - e2erequest.setResult(requestDB.getRequestStatus()); - e2erequest.setReason(requestDB.getStatusMessage()); - e2erequest.setUserId(requestDB.getRequestorId()); - e2erequest.setOperationContent(requestDB.getStatusMessage()); - e2erequest.setProgress(requestDB.getProgress()); - - String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) - + " GMT"; - e2erequest.setOperateAt(startTimeStamp); - - if (requestDB.getEndTime() != null) { - String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) - + " GMT"; - e2erequest.setFinishedAt(endTimeStamp); - } - - return e2erequest; - } } \ No newline at end of file -- cgit 1.2.3-korg