@Override public void deleteUploadRequestEntry( String uploadRequestUrlUuid, String password, String entryUuid) throws BusinessException { UploadRequestUrl requestUrl = find(uploadRequestUrlUuid, password); deleteBusinessCheck(requestUrl); Set<UploadRequestEntry> entries = requestUrl.getUploadRequest().getUploadRequestEntries(); UploadRequestEntry found = null; for (UploadRequestEntry entry : entries) { if (entry.getUuid().equals(entryUuid)) { found = entry; break; } } if (found != null) { String documentEntryUuid = null; if (found.getDocumentEntry() != null) { documentEntryUuid = found.getDocumentEntry().getUuid(); } found.setDocumentEntry(null); found = uploadRequestEntryBusinessService.update(found); if (documentEntryUuid != null) { // TODO: HOOK : Extract owner for upload request URL // Actor should be used instead of owner Account owner = requestUrl.getUploadRequest().getOwner(); // Store the file into the owner account. DocumentEntry documentEntry = documentEntryService.findById(owner, documentEntryUuid); documentEntryService.deleteDocumentEntry(owner, documentEntry); } uploadRequestEntryBusinessService.delete(found); } else { throw new BusinessException( BusinessErrorCode.FORBIDDEN, "You do not have the right to delete a file into upload request : " + uploadRequestUrlUuid); } }