@EventListener public void beforeProjectRemove(BeforeProjectRemovedEvent aEvent) throws IOException { for (SourceDocument document : service.listSourceDocuments(aEvent.getProject())) { service.removeSourceDocument(document); } } }
@EventListener public void beforeProjectRemove(BeforeProjectRemovedEvent aEvent) throws IOException { for (SourceDocument document : service.listSourceDocuments(aEvent.getProject())) { service.removeSourceDocument(document); } } }
@ApiOperation(value = "Delete a document from a project") @RequestMapping( value = "/" + PROJECTS + "/{" + PARAM_PROJECT_ID + "}/" + DOCUMENTS + "/{" + PARAM_DOCUMENT_ID + "}", method = RequestMethod.DELETE, produces = APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<RResponse<Void>> documentDelete( @PathVariable(PARAM_PROJECT_ID) long aProjectId, @PathVariable(PARAM_DOCUMENT_ID) long aDocumentId) throws Exception { // Get project (this also ensures that it exists and that the current user can access it Project project = getProject(aProjectId); SourceDocument doc = getDocument(project, aDocumentId); documentService.removeSourceDocument(doc); return ResponseEntity.ok(new RResponse<>(INFO, "Document [" + aDocumentId + "] deleted from project [" + aProjectId + "].")); }
@ApiOperation(value = "Delete a document from a project") @RequestMapping( value = "/" + PROJECTS + "/{" + PARAM_PROJECT_ID + "}/" + DOCUMENTS + "/{" + PARAM_DOCUMENT_ID + "}", method = RequestMethod.DELETE, produces = APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<RResponse<Void>> documentDelete( @PathVariable(PARAM_PROJECT_ID) long aProjectId, @PathVariable(PARAM_DOCUMENT_ID) long aDocumentId) throws Exception { // Get project (this also ensures that it exists and that the current user can access it Project project = getProject(aProjectId); SourceDocument doc = getDocument(project, aDocumentId); documentService.removeSourceDocument(doc); return ResponseEntity.ok(new RResponse<>(INFO, "Document [" + aDocumentId + "] deleted from project [" + aProjectId + "].")); }
documentRepository.removeSourceDocument(srcDocument);
documentRepository.removeSourceDocument(srcDocument);
private void actionDelete(AjaxRequestTarget aTarget, Form<Void> aForm) { if (selectedDocuments.getObject() == null || selectedDocuments.getObject().isEmpty()) { error("No documents selected"); aTarget.addChildren(getPage(), IFeedback.class); return; } confirmationDialog.setContentModel(new StringResourceModel("DeleteDialog.text", this) .setParameters(selectedDocuments.getObject().size())); confirmationDialog.show(aTarget); confirmationDialog.setConfirmAction((_target) -> { for (SourceDocument sourceDocument : selectedDocuments.getObject()) { try { documentService.removeSourceDocument(sourceDocument); } catch (IOException e) { LOG.error("Unable to delete document", e); error("Unable to delete document: " + e.getMessage()); _target.addChildren(getPage(), IFeedback.class); } } selectedDocuments.getObject().clear(); _target.add(getPage()); }); } }
private void actionDelete(AjaxRequestTarget aTarget, Form<Void> aForm) { if (selectedDocuments.getObject() == null || selectedDocuments.getObject().isEmpty()) { error("No documents selected"); aTarget.addChildren(getPage(), IFeedback.class); return; } confirmationDialog.setContentModel(new StringResourceModel("DeleteDialog.text", this) .setParameters(selectedDocuments.getObject().size())); confirmationDialog.show(aTarget); confirmationDialog.setConfirmAction((_target) -> { for (SourceDocument sourceDocument : selectedDocuments.getObject()) { try { documentService.removeSourceDocument(sourceDocument); } catch (IOException e) { LOG.error("Unable to delete document", e); error("Unable to delete document: " + e.getMessage()); _target.addChildren(getPage(), IFeedback.class); } } selectedDocuments.getObject().clear(); _target.add(getPage()); }); } }