/** * Performs a patch operation on a document based on the result of @{link #isPatchAllowed(PatchRequest)} * * @param retrieveLatestDao DAO to retrieve the item to be patched * @param request The patch request. * @param timestamp Optionally a timestamp to set. If not specified then current time is used. * @return The patched document * @throws OriginalNotFoundException If no original document is found to patch. * @throws IOException If an error occurs performing the patch. */ @Override public Document patch(RetrieveLatestDao retrieveLatestDao, PatchRequest request, Optional<Long> timestamp) throws OriginalNotFoundException, IOException { if (isPatchAllowed(request)) { return updateDao.patch(retrieveLatestDao, request, timestamp); } else { throw new IllegalArgumentException( "Meta alert patches are not allowed for /alert or /status paths. " + "Please use the add/remove alert or update status functions instead."); } }