@Override public void run() { session.removeDocument(docRef); } };
protected void batchRemoveDocuments(List<DocumentRef> ids) { List<DocumentRef> deferredIds = new ArrayList<>(); for (DocumentRef id : ids) { if (!session.exists(id)) { continue; } if (session.canRemoveDocument(id)) { session.removeDocument(id); } else { deferredIds.add(id); } } session.removeDocuments(deferredIds.toArray(new DocumentRef[0])); }
@Override public void run() throws NuxeoException { this.session.removeDocument(this.docRef); }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentRef doc) { // if (soft) { // //TODO impl safe delete // throw new UnsupportedOperationException("Safe delete not yet // implemented"); // } session.removeDocument(doc); // TODO ctx.pop return null; }
protected void removeDocument(CoreSession session, String docId) { try { session.removeDocument(new IdRef(docId)); } catch (DocumentNotFoundException e) { // ignore document that was already removed, or whose type is unknown return; } }
@Override public void run() { session.removeDocument(document.getRef()); session.save(); }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel doc) { // if (soft) { // //TODO impl safe delete // throw new UnsupportedOperationException("Safe delete not yet // implemented"); // } session.removeDocument(doc.getRef()); // TODO ctx.pop return null; }
@Override public void deleteSavedSearch(CoreSession session, SavedSearch search) { session.removeDocument(new IdRef(search.getId())); } }
@Override public void run() { PartialList<Map<String, Serializable>> workflows = session.queryProjection(WORKFLOWS_QUERY, limit, 0); numberOfCleanedUpWorkflows = workflows.size(); for (Map<String, Serializable> workflow : workflows) { String routeDocId = workflow.get(ECM_UUID).toString(); final String associatedTaskQuery = String.format(TASKS_QUERY, routeDocId); session.queryProjection(associatedTaskQuery, 0, 0) .stream() .map(task -> new IdRef(task.get(ECM_UUID).toString())) .forEach(session::removeDocument); session.removeDocument(new IdRef(routeDocId)); } }
@DELETE public Response doDelete() { CoreSession session = getContext().getCoreSession(); for (DocumentModel doc : docs) { session.removeDocument(doc.getRef()); } session.save(); return Response.ok().build(); }
@Override public void deleteAnnotation(CoreSession session, String annotationId) throws IllegalArgumentException { CoreInstance.doPrivileged(session, s -> { DocumentModel annotationModel = getAnnotationModel(s, annotationId); if (annotationModel == null) { throw new IllegalArgumentException("The annotation " + annotationId + " does not exist."); } s.removeDocument(annotationModel.getRef()); }); }
@Override public void invoke(TrashService service, TrashInfo info) throws Exception { if (info.forbidden > 0) { throw new Exception("Can not put in trash!!"); } else { // #3411 delete the local proxy if there DocumentModel proxy = ToutaticeDocumentHelper.getProxy(this.session, this.document, null, true); if (proxy != null) { this.session.removeDocument(proxy.getRef()); } service.trashDocuments(info.docs); } }
protected void remove(Statement statement) { String query = "SELECT " + NXQL.ECM_UUID + " FROM " + docType; query = whereBuilder(query, statement); if (query == null) { return; } try (IterableQueryResult it = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> map : it) { String id = (String) map.get(NXQL.ECM_UUID); session.removeDocument(new IdRef(id)); } } } }
@Override public void removeItem(DocumentRef ref) { DocumentModel doc = getSession().getDocument(ref); if (doc != null) { if (isTemporaryFile(doc)) { session.removeDocument(ref); } else { getTrashService().trashDocuments(Arrays.asList(doc)); } } else { log.warn("Can't move document " + ref.toString() + " to trash. Document did not found."); } }
@Override public void run() throws NuxeoException { DocumentModelList proxies = this.session.query("SELECT * FROM Document WHERE ecm:path STARTSWITH '" + this.folder.getPathAsString() + "' AND ecm:isProxy = 1"); for (DocumentModel proxy : proxies) { this.session.removeDocument(proxy.getRef()); } }
protected void deleteCommentChildren(CoreSession coreSession, CommentManager commentManager, DocumentModel documentModel) { commentManager.getComments(coreSession, documentModel.getId()) .forEach(comment -> coreSession.removeDocument(new IdRef(comment.getId()))); }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } if (save) { session.save(); } return input; }
@Override public void deleteRegistrationRequests(CoreSession session, List<DocumentModel> registrationDocs) { for (DocumentModel registration : registrationDocs) { UserRegistrationConfiguration configuration = getConfiguration(registration); if (!registration.hasSchema(configuration.getUserInfoSchemaName())) { throw new NuxeoException("Registration document do not contains needed schema"); } session.removeDocument(registration.getRef()); } }
@Override public void removeRouteElement(DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException { DocumentRoute parentRoute = routeElement.getDocumentRoute(session); if (!isLockedByCurrentUser(parentRoute, session)) { throw new DocumentRouteNotLockedException(); } session.removeDocument(routeElement.getDocument().getRef()); session.save();// the document will be queried later on }
protected void trashDocument(CoreSession session, DocumentModel doc) { if (doc.getParentRef() == null) { // handle placeless document session.removeDocument(doc.getRef()); } else { if (!TRUE.equals(doc.getContextData(DISABLE_TRASH_RENAMING))) { String name = mangleName(doc); session.move(doc.getRef(), doc.getParentRef(), name); } doc.putContextData(FROM_LIFE_CYCLE_TRASH_SERVICE, TRUE); session.followTransition(doc, LifeCycleConstants.DELETE_TRANSITION); } }