protected DocumentModelList guardedDocumentChildren(CoreSession session, DocumentRef reference) { return session.getChildren(reference); }
@OperationMethod(collector = DocumentModelListCollector.class) public DocumentModelList run(DocumentRef doc) { return session.getChildren(doc); }
@Override protected Collection<DocumentModel> getChildren(DocumentModel obj) { return session.getChildren(obj.getRef()); }
@Override public Collection<ComponentInfo> getComponents() { List<ComponentInfo> components = new ArrayList<>(); List<DocumentModel> children = getCoreSession().getChildren(doc.getRef()); for (DocumentModel child : children) { ComponentInfo comp = child.getAdapter(ComponentInfo.class); if (comp != null) { components.add(comp); } } return components; }
protected List<DocumentRouteElement> getChildrenElement(CoreSession session, DocumentRouteElement element) { DocumentModelList children = session.getChildren(element.getDocument().getRef()); List<DocumentRouteElement> elements = new ArrayList<DocumentRouteElement>(); for (DocumentModel model : children) { elements.add(model.getAdapter(DocumentRouteElement.class)); } return elements; }
public List<Object> getChildren() { List<DocumentModel> children = doc.getCoreSession().getChildren(doc.getRef()); List<Object> docs = new ArrayList<Object>(); for (DocumentModel child : children) { docs.add(nuxeoWrapper.wrap(child)); } return docs; }
public Object getValue(DocumentModel doc) { CoreSession session = doc.getCoreSession(); return session.getChildren(doc.getRef()); } };
@OperationMethod(collector = DocumentModelListCollector.class) public DocumentModelList run(DocumentModel doc) { return session.getChildren(doc.getRef()); }
protected boolean isTargetEmpty(DocumentModel eventDoc) { // If we already have children : exit !!! return session.getChildren(eventDoc.getRef()).isEmpty(); }
private boolean isEmptyFolder(DocumentModel doc, CoreSession documentManager) { List<DocumentModel> docList = documentManager.getChildren(doc.getRef()); for (DocumentModel docChild : docList) { // If there is a blob or a folder, it is not empty. if (docChild.getAdapter(BlobHolder.class) != null || docChild.isFolder()) { return false; } } return true; }
@Override public boolean hasChildrenWithType(String type) throws NuxeoException { final DocumentModelList docLst = documentManager.getChildren(navigationContext.getCurrentDocument().getRef(), type); return docLst != null && !docLst.isEmpty(); }
@Override public void write(JsonGenerator jg, DocumentModel document) throws IOException { DocumentModelList children = null; try (SessionWrapper wrapper = ctx.getSession(document)) { children = wrapper.getSession().getChildren(document.getRef()); } jg.writeFieldName(NAME); writeEntity(children, jg); }
public Object[] getChildren(Object obj) { if (obj instanceof DocumentModel) { DocumentModelList list = session.getChildren(((DocumentModel) obj).getRef()); return list.toArray(new DocumentModel[list.size()]); } return null; }
@Override @WebMethod public DocumentDescriptor[] getChildren(@WebParam(name = "sessionId") String sessionId, @WebParam(name = "uuid") String uuid) { logDeprecation(); WSRemotingSession rs = initSession(sessionId); DocumentModelList docList = rs.getDocumentManager().getChildren(new IdRef(uuid)); DocumentDescriptor[] docs = new DocumentDescriptor[docList.size()]; int i = 0; for (DocumentModel doc : docList) { docs[i++] = new DocumentDescriptor(doc); } return docs; }
public void stackCommand(DocumentEventContext docCtx, String eventId) { DocumentModel doc = docCtx.getSourceDocument(); if (doc == null) { return; } if ("/".equals(doc.getPathAsString())) { if (log.isDebugEnabled()) { log.debug("Skip indexing command for root document"); } if (eventId.equals(DOCUMENT_SECURITY_UPDATED)) { if (log.isDebugEnabled()) { log.debug("Indexing root document children to update their permissions"); } DocumentModelList children = doc.getCoreSession().getChildren(doc.getRef()); children.forEach(child -> stackCommand(child, docCtx, eventId)); } } else { stackCommand(doc, docCtx, eventId); } }
@Override public List<DocumentModel> getChildren(DocumentRef ref) { List<DocumentModel> result = new ArrayList<DocumentModel>(); List<DocumentModel> children = getSession(true).getChildren(ref); for (DocumentModel child : children) { if (child.hasFacet(FacetNames.HIDDEN_IN_NAVIGATION)) { continue; } if (child.isTrashed()) { continue; } if (!child.hasSchema("dublincore")) { continue; } if (child.hasFacet(FacetNames.FOLDERISH) || child.getAdapter(BlobHolder.class) != null) { result.add(child); } } return result; }
@OperationMethod public DocumentModelList run() throws Exception { DocumentModelList children = session.getChildren(parent.getRef()); DocumentModelList allowedChildren = new DocumentModelListImpl(); if(CollectionUtils.isNotEmpty(children)){ for(DocumentModel child : children){ if(!child.isProxy()){ if(this.session.hasPermission(child.getRef(), SecurityConstants.ADD_CHILDREN)){ allowedChildren.add(child); } } } } return allowedChildren; }
@Override public void followTransition(ElementLifeCycleTransistion transition, CoreSession session, boolean recursive) { if (document.followTransition(transition.name())) { if (Framework.isTestModeSet()) { session.save(); } document = session.getDocument(document.getRef()); } if (recursive) { DocumentModelList children = session.getChildren(document.getRef()); for (DocumentModel child : children) { DocumentRouteElement element = child.getAdapter(DocumentRouteElement.class); element.followTransition(transition, session, recursive); } } }
private void recurse(DocumentModel doc) { fetchInfoFromDoc(session, doc); if (doc.isFolder()) { long children = 0; for (DocumentModel child : session.getChildren(doc.getRef())) { children += 1; if (child.isFolder()) { StatsTask newTask = hostTask.getNextTask(child); if (newTask != null) { hostTask.exec(newTask); } else { recurse(child); } } else { fetchInfoFromDoc(session, child); } } hostTask.getInfo().childrenCount(children, doc.getPath()); } }
@Override public void validateImportedSnapshot(CoreSession session, String name, String version, String pathSegment, String title) { DocumentModel container = persister.getDistributionRoot(session); DocumentRef tmpRef = new PathRef(container.getPathAsString(), IMPORT_TMP); DocumentModel tmp; if (session.exists(tmpRef)) { tmp = session.getChild(container.getRef(), IMPORT_TMP); DocumentModel snapDoc = session.getChildren(tmp.getRef()).get(0); snapDoc.setPropertyValue("nxdistribution:name", name); snapDoc.setPropertyValue("nxdistribution:version", version); snapDoc.setPropertyValue("nxdistribution:key", name + "-" + version); snapDoc.setPropertyValue("dc:title", title); snapDoc = session.saveDocument(snapDoc); DocumentModel targetContainer = session.getParentDocument(tmp.getRef()); session.move(snapDoc.getRef(), targetContainer.getRef(), pathSegment); session.removeDocument(tmp.getRef()); } }