class SoMonitoringController {

    @GET
    @Path("/activity-instance/{processInstanceId}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response getActivityInstanceDetail(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 List<ActivityInstanceDetail> activityInstanceDetails =
                    camundaProcessDataServiceProvider.getActivityInstance(processInstanceId);
            return Response.status(Status.OK).entity(activityInstanceDetails).build();
        } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
            final String message = "Unable to find activity instance for processInstanceId: " + processInstanceId;
            LOGGER.error(message);
            return Response.status(Status.BAD_REQUEST).entity(message).build();
        } catch (final RestProcessingException restProcessingException) {
            final String message = "Unable to get activity instance detail 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);

}