Source:
private Response deletePersistenceItemData(String serviceName, String itemName, String timeBegin, String timeEnd) { if (serviceName == null || serviceName.length() == 0) { logger.warn("Persistence service must be specified for delete operations."); return JSONResponse.createErrorResponse(Status.CONFLICT, "Persistence service must be specified for delete operations."); } PersistenceService service = persistenceServices.get(serviceName); if (service == null) { logger.warn("Persistence service not found '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.CONFLICT, "Persistence service not found: " + serviceName); } if (!(service instanceof ModifiablePersistenceService)) { logger.warn("Persistence service not modifiable '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.CONFLICT, "Persistence service not modifiable: " + serviceName); } ModifiablePersistenceService mService = (ModifiablePersistenceService) service; if (timeBegin == null | timeEnd == null) { return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "The start and end time must be set"); } Date dateTimeBegin = convertTime(timeBegin); Date dateTimeEnd = convertTime(timeEnd); if (dateTimeEnd.before(dateTimeBegin)) { return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Start time must be earlier than end time"); } FilterCriteria filter; filter = new FilterCriteria(); filter.setBeginDate(dateTimeBegin); filter.setEndDate(dateTimeEnd); filter.setItemName(itemName); mService.remove(filter); return JSONResponse.createResponse(Status.OK, null, ""); }

Target:
private Response deletePersistenceItemData(String serviceName, String itemName, String timeBegin, String timeEnd) { if (serviceName == null || serviceName.length() == 0) { logger.debug("Persistence service must be specified for delete operations."); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Persistence service must be specified for delete operations."); } PersistenceService service = persistenceServices.get(serviceName); if (service == null) { logger.debug("Persistence service not found '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Persistence service not found: " + serviceName); } if (!(service instanceof ModifiablePersistenceService)) { logger.warn("Persistence service not modifiable '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Persistence service not modifiable: " + serviceName); } ModifiablePersistenceService mService = (ModifiablePersistenceService) service; if (timeBegin == null | timeEnd == null) { return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "The start and end time must be set"); } Date dateTimeBegin = convertTime(timeBegin); Date dateTimeEnd = convertTime(timeEnd); if (dateTimeEnd.before(dateTimeBegin)) { return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Start time must be earlier than end time"); } FilterCriteria filter; filter = new FilterCriteria(); filter.setBeginDate(dateTimeBegin); filter.setEndDate(dateTimeEnd); filter.setItemName(itemName); try { mService.remove(filter); } catch (IllegalArgumentException e) { return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Invalid filter parameters."); } return Response.status(Status.OK).build(); }