class SoMonitoringController {

    @GET
    @Path("/process-instance/{processInstanceId}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response getSingleProcessInstance(final @PathParam("processInstanceId") String processInstanceId) {
        if (processInstanceId == null || processInstanceId.isEmpty()) {
            return Response.status(Status.BAD_REQUEST)
                    .entity(INVALID_PROCESS_INSTANCE_ERROR_MESSAGE + processInstanceId).build();
        }
        try {
            final Optional<ProcessInstanceDetail> processInstanceDetail =
                    camundaProcessDataServiceProvider.getSingleProcessInstanceDetail(processInstanceId);
            if (processInstanceDetail.isPresent()) {
                return Response.status(Status.OK).entity(processInstanceDetail.get()).build();
            }

            LOGGER.error("Unable to find process instance id for : {}", processInstanceId);
            return Response.status(Status.NO_CONTENT).build();

        } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
            final String message = "Unable to find process instance id for : " + processInstanceId;
            LOGGER.error(message);
            return Response.status(Status.BAD_REQUEST).entity(message).build();
        } catch (final RestProcessingException restProcessingException) {
            final String message = "Unable to process request for id: " + processInstanceId;
            LOGGER.error(message);
            return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
        }
    }

    @Autowired public  SoMonitoringController(final DatabaseServiceProvider databaseServiceProvider,
            final CamundaProcessDataServiceProvider camundaProcessDataServiceProvider);

}