class PreparationAPI extends APIService {

    @RequestMapping(value = "/api/preparations/{id}/details", method = RequestMethod.GET,
            produces = APPLICATION_JSON_VALUE)
    @ApiOperation(value = "Get a preparation by id and details.", notes = "Returns the preparation details.")
    @Timed
    public PreparationDetailsDTO getPreparation(
            @PathVariable(value = "id") @ApiParam(name = "id", value = "Preparation id.") String preparationId, //
            @RequestParam(value = "stepId", defaultValue = "head") @ApiParam(name = "stepId",
                    value = "optional step id", defaultValue = "head") String stepId) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Retrieving preparation details (pool: {} )...", getConnectionStats());
        }

        try {
            return getCommand(PreparationDetailsGet.class, preparationId, stepId).execute();
        } catch (Exception e) {
            LOG.error("Unable to get preparation {}", preparationId, e);
            throw new TDPException(APIErrorCodes.UNABLE_TO_GET_PREPARATION_DETAILS, e);
        } finally {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Retrieved preparation details (pool: {} )...", getConnectionStats());
            }
            LOG.info("Preparation {} retrieved", preparationId);
        }
    }

}