Search in sources :

Example 1 with GetE2EServiceInstanceResponse

use of org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse in project so by onap.

the class E2EServiceInstances method getE2EServiceInstance.

private Response getE2EServiceInstance(String serviceId, String operationId, String version) {
    GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
    String apiVersion = version.substring(1);
    OperationStatus operationStatus;
    try {
        operationStatus = requestsDbClient.getOneByServiceIdAndOperationId(serviceId, operationId);
    } catch (Exception e) {
        logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Request DB - Infra Request Lookup", e);
        Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
        logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
        return response;
    }
    if (operationStatus == 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, version);
        logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from RequestDB when searching by serviceId");
        logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
        return resp;
    }
    e2eServiceResponse.setOperation(operationStatus);
    return builder.buildResponse(HttpStatus.SC_OK, null, e2eServiceResponse, apiVersion);
}
Also used : CamundaResponse(org.onap.so.apihandler.camundabeans.CamundaResponse) GetE2EServiceInstanceResponse(org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse) Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) OperationStatus(org.onap.so.db.request.beans.OperationStatus) GetE2EServiceInstanceResponse(org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse) ApiException(org.onap.so.apihandlerinfra.exceptions.ApiException) BPMNFailureException(org.onap.so.apihandlerinfra.exceptions.BPMNFailureException) ValidateException(org.onap.so.apihandlerinfra.exceptions.ValidateException) IOException(java.io.IOException)

Aggregations

ApiResponse (io.swagger.v3.oas.annotations.responses.ApiResponse)1 IOException (java.io.IOException)1 Response (javax.ws.rs.core.Response)1 CamundaResponse (org.onap.so.apihandler.camundabeans.CamundaResponse)1 GetE2EServiceInstanceResponse (org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse)1 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)1 BPMNFailureException (org.onap.so.apihandlerinfra.exceptions.BPMNFailureException)1 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)1 OperationStatus (org.onap.so.db.request.beans.OperationStatus)1