@Override public ChildAssociationRef getName(ChildAssociationRef childAssocRef) { if (childAssocRef == null) { return null; } return new ChildAssociationRef( childAssocRef.getTypeQName(), getName(childAssocRef.getParentRef()), childAssocRef.getQName(), getName(childAssocRef.getChildRef()), childAssocRef.isPrimary(), childAssocRef.getNthSibling()); }
public boolean isDocument(Object o) { if (!(o instanceof ChildAssociationRef)) { return false; } ChildAssociationRef car = (ChildAssociationRef) o; return (car.getParentRef() == null) && (car.getQName() == null); }
/** * Helper to report node created progress * * @param childAssocRef ChildAssociationRef */ private void reportNodeCreated(ChildAssociationRef childAssocRef) { if (progress != null) { progress.nodeCreated(childAssocRef.getChildRef(), childAssocRef.getParentRef(), childAssocRef.getTypeQName(), childAssocRef.getQName()); } }
ChildAssociationRef assocRef = new ChildAssociationRef(null, null, null, currentRootNodePair.getSecond()); ChildAssociationRef updateAssocRef = new ChildAssociationRef( parentAssocInfo.isStoreRoot() ? ContentModel.ASSOC_CHILDREN : first.getRef().getTypeQName(), currentRootNodePair.getSecond(), first.getRef().getQName(), first.getRef().getChildRef()); Path.Element newFirst = new Path.ChildAssocElement(updateAssocRef); pathToSave.prepend(newFirst); ChildAssociationRef assocRef = assoc.getRef(qnameDAO); if (primaryOnly && !assocRef.isPrimary()) assocRef.setNthSibling(-1); assocRef.getParentRef());
private void writeParentAssoc(ChildAssociationRef assoc) throws SAXException { if(assoc != null) { AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "from", "from", "String", assoc.getParentRef().toString()); attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "type", "type", "String", formatQName(assoc.getTypeQName())); attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "type", "isPrimary", "Boolean", assoc.isPrimary()?"true":"false"); writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI, ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC, PREFIX + ":" + ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC, attributes); String name= formatQName(assoc.getQName()); writer.characters(name.toCharArray(), 0, name.length()); assoc.isPrimary(); writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI, ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC, PREFIX + ":" + ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC); } }
log.debug("Attempting to resolve corresponding node for noderef " + sourceNodeRef); log.debug("Supplied parent path: " + parentPath); log.debug("Supplied parent assoc: " + primaryAssoc.toString()); NodeRef parentNodeRef = primaryAssoc.getParentRef(); if (!nodeService.exists(parentNodeRef.getStoreRef())) parentNodeRef = resolveParentPath(primaryAssoc.getParentRef().getStoreRef(), parentPath); primaryAssoc.getQName()); if (!children.isEmpty()) result.resolvedChild = children.get(0).getChildRef();
@Override @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef checkout(NodeRef nodeRef) { // Find the primary parent in order to determine where to put the copy ChildAssociationRef childAssocRef = nodeService.getPrimaryParent(nodeRef); // Checkout the working copy to the same destination return checkout(nodeRef, childAssocRef.getParentRef(), childAssocRef.getTypeQName(), childAssocRef.getQName()); }
public static NodeRef getSingleChildAssocNode(Collection<ChildAssociationRef> assocs, boolean getChild) { if(assocs != null && assocs.size()==1 ) { ChildAssociationRef association = assocs.iterator().next(); return getChild ? association.getChildRef() : association.getParentRef(); } return null; }
public NodeInfo newNodeInfo(ChildAssociationRef childAssocRef) { // Build up the path from the parent and child name, as // the child may no longer be under the parent. String path = getPath(childAssocRef.getParentRef())+'/'+getName(childAssocRef.getQName()); String type = getType(childAssocRef.getChildRef()); return new NodeInfo(childAssocRef.getChildRef(), path, type); }
/** * {@inheritDoc} */ public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) { if (! storesToIgnore.contains(childAssocRef.getChildRef().getStoreRef().toString())) { saveAssoc(childAssocRef.getParentRef(), childAssocRef.getTypeQName()); } }
@Override public NodeRef getLinkedToRuleNode(NodeRef nodeRef) { NodeRef result = null; // Check whether the node reference has the rule aspect if (nodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true) { ChildAssociationRef assoc = getSavedRuleFolderAssoc(nodeRef); if (assoc.isPrimary() == false) { result = nodeService.getPrimaryParent(assoc.getChildRef()).getParentRef(); } } return result; }
private ChildAssociationRef makeAssoc(NodeRef parent, NodeRef child, QName assocName, boolean isRenditionAssoc) { QName assocType = isRenditionAssoc ? RenditionModel.ASSOC_RENDITION : ContentModel.ASSOC_CONTAINS; return new ChildAssociationRef(assocType, parent, assocName, child); } }
ServiceRegistry serviceRegistry = (ServiceRegistry) context.getBean("ServiceRegistry"); Node rootNode = session.getRootNode(); //obtaining root node company home Node companyHome = rootNode.getNode("app:company_home"); // getting noderef of company home node NodeRef companyHomeRef = JCRNodeRef.getNodeRef(companyHome); List<ChildAssociationRef> children = nodeService.getChildAssocs(companyHomeRef); for (ChildAssociationRef childAssoc : children) { NodeRef childNodeRef = childAssoc.getChildRef(); // Use childNodeRef here. }
public Object getDocumentNode(Object o) { ChildAssociationRef assocRef = (ChildAssociationRef) o; StoreRef storeRef = assocRef.getChildRef().getStoreRef(); return new ChildAssociationRef(null, null, null, nodeService.getRootNode(storeRef)); }
@Test public void testCreateNode() throws Exception { ChildAssociationRef assocRef = nodeService.createNode(rootNodeRef, ASSOC_TYPE_QNAME_TEST_CHILDREN, QName.createQName("pathA"), ContentModel.TYPE_CONTAINER); assertEquals("Assoc type qname not set", ASSOC_TYPE_QNAME_TEST_CHILDREN, assocRef.getTypeQName()); assertEquals("Assoc qname not set", QName.createQName("pathA"), assocRef.getQName()); NodeRef childRef = assocRef.getChildRef(); QName checkType = nodeService.getType(childRef); assertEquals("Child node type incorrect", ContentModel.TYPE_CONTAINER, checkType); }
@Override public NodeRef doWork() throws Exception { NodeRef result = null; ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); if (assoc != null) { result = assoc.getParentRef(); } return result; } }, AuthenticationUtil.getSystemUserName());
for (ChildAssociationRef ref : originalChildren) originalChildAssocRefs.put(ref.getChildRef().getId(), ref); ChildAssociationRef origChildAssocRef = originalChildAssocRefs.get(versionedChildRef.getChildRef().getId()); assertNotNull(origChildAssocRef); origChildAssocRef.getChildRef(), versionedChildRef.getChildRef()); assertEquals( origChildAssocRef.isPrimary(), versionedChildRef.isPrimary()); assertEquals( origChildAssocRef.getNthSibling(), versionedChildRef.getNthSibling());
public String getElementNamespaceUri(Object o) { QName qName = ((ChildAssociationRef) o).getQName(); if(qName == null) { return ""; } return (qName.getNamespaceURI()); }
public boolean isPrimary() { return this.childAssocRef.isPrimary(); }
NodeRef childRef = childAssoc.getChildRef(); for (NodeRef sibling : siblings) childAssoc.setNthSibling(index); break;