class SoMonitoringController {

    @GET
    @Path("/process-definition/{processDefinitionId}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response getProcessDefinitionXml(final @PathParam("processDefinitionId") String processDefinitionId) {
        if (processDefinitionId == null || processDefinitionId.isEmpty()) {
            return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " + processDefinitionId)
                    .build();
        }
        try {
            final Optional<ProcessDefinitionDetail> response =
                    camundaProcessDataServiceProvider.getProcessDefinition(processDefinitionId);
            if (response.isPresent()) {
                final ProcessDefinitionDetail definitionDetail = response.get();
                return Response.status(Status.OK).entity(definitionDetail).build();
            }
            LOGGER.error("Unable to find process definition xml for processDefinitionId: {}", processDefinitionId);
            return Response.status(Status.NO_CONTENT).build();

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

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

}