DocumentRef parentRef = session.getParentDocumentRef(localConfiguration.getDocumentRef()); if (parentRef == null) { DocumentModel parentDoc = session.getParentDocument(localConfiguration.getDocumentRef());
@Override public Set<DocumentRef> undeleteDocuments(List<DocumentModel> docs) { Set<DocumentRef> undeleted = new HashSet<>(); if (docs.isEmpty()) { return undeleted; } CoreSession session = docs.get(0).getCoreSession(); Set<DocumentRef> docRefs = undeleteDocumentList(session, docs); undeleted.addAll(docRefs); // undeleted ancestors for (DocumentRef docRef : docRefs) { undeleteAncestors(session, docRef, undeleted); } session.save(); // find parents of undeleted docs (for notification); Set<DocumentRef> parentRefs = new HashSet<>(); for (DocumentRef docRef : undeleted) { parentRefs.add(session.getParentDocumentRef(docRef)); } // launch async action on folderish to undelete all children recursively for (DocumentModel doc : docs) { if (doc.isFolder()) { notifyEvent(session, LifeCycleConstants.DOCUMENT_UNDELETED, doc, true); } } return parentRefs; }
public boolean getCanUnpublish(DocumentModel document) throws NuxeoException { boolean status = false; try { if (null != document) { DocumentRef parentRef = documentManager.getParentDocumentRef(document.getRef()); if (null != parentRef) { DocumentModelList proxies = documentManager.getProxies(document.getRef(), parentRef); if ((proxies != null) && (!proxies.isEmpty())) { DocumentModel proxy = proxies.get(0); status = canUnpublishProxy(proxy); } } } } catch (Exception e) { log.error("Failed to check the permission to unpublish the document '" + document.getTitle() + "', error: " + e.getMessage()); } return status; }
@Override public void run() { // get the parent container and set on it the id of the doc // to be run next DocumentModel condFolder = session.getDocument(session.getParentDocumentRef(new IdRef(stepDocId))); if (!condFolder.hasFacet(DocumentRoutingConstants.CONDITIONAL_STEP_FACET)) { return; } condFolder.setPropertyValue(DocumentRoutingConstants.STEP_TO_BE_EXECUTED_NEXT_PROPERTY_NAME, nextStepPos); session.saveDocument(condFolder); } }.runUnrestricted();