public int getNthSibling() { return this.childAssocRef.getNthSibling(); } }
public int getNthSibling() { return this.childAssocRef.getNthSibling(); } }
/** * Freeze child associations * * @param versionNodeRef the version node reference * @param childAssociations the child associations */ private void freezeChildAssociations(NodeRef versionNodeRef, List<ChildAssociationRef> childAssociations) { for (ChildAssociationRef childAssocRef : childAssociations) { HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>(); // Set the qname, isPrimary and nthSibling properties properties.put(PROP_QNAME_ASSOC_QNAME, childAssocRef.getQName()); properties.put(PROP_QNAME_ASSOC_TYPE_QNAME, childAssocRef.getTypeQName()); properties.put(PROP_QNAME_IS_PRIMARY, Boolean.valueOf(childAssocRef.isPrimary())); properties.put(PROP_QNAME_NTH_SIBLING, Integer.valueOf(childAssocRef.getNthSibling())); // Set the reference property to point to the child node properties.put(ContentModel.PROP_REFERENCE, childAssocRef.getChildRef()); // Create child version reference this.dbNodeService.createNode( versionNodeRef, CHILD_QNAME_VERSIONED_CHILD_ASSOCS, CHILD_QNAME_VERSIONED_CHILD_ASSOCS, TYPE_QNAME_VERSIONED_CHILD_ASSOC, properties); } }
/** * Freeze child associations * * @param versionNodeRef the version node reference * @param childAssociations the child associations */ private void freezeChildAssociations(NodeRef versionNodeRef, List<ChildAssociationRef> childAssociations) { for (ChildAssociationRef childAssocRef : childAssociations) { HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>(); // Set the qname, isPrimary and nthSibling properties properties.put(PROP_QNAME_ASSOC_QNAME, childAssocRef.getQName()); properties.put(PROP_QNAME_ASSOC_TYPE_QNAME, childAssocRef.getTypeQName()); properties.put(PROP_QNAME_IS_PRIMARY, Boolean.valueOf(childAssocRef.isPrimary())); properties.put(PROP_QNAME_NTH_SIBLING, Integer.valueOf(childAssocRef.getNthSibling())); // Set the reference property to point to the child node properties.put(ContentModel.PROP_REFERENCE, childAssocRef.getChildRef()); // Create child version reference this.dbNodeService.createNode( versionNodeRef, CHILD_QNAME_VERSIONED_CHILD_ASSOCS, CHILD_QNAME_VERSIONED_CHILD_ASSOCS, TYPE_QNAME_VERSIONED_CHILD_ASSOC, properties); } }
referencedNode, childAssocRef.isPrimary(), childAssocRef.getNthSibling());
referencedNode, childAssocRef.isPrimary(), childAssocRef.getNthSibling());
@Override public List<ChildAssociationRef> execute(NodeProtocol protocol, Reference reference) throws ProtocolMethodException { NodeRef actualNodeRef = reference.execute(new GetActualNodeRefMethod(null)); NodeRef nodeRefReference = reference.toNodeRef(); List<ChildAssociationRef> referenceAssociations = new LinkedList<>(); if (!environment.isSubClass(environment.getType(nodeRefReference), ContentModel.TYPE_FOLDER)) { List<ChildAssociationRef> actualAssociations = environment.getChildAssocs(actualNodeRef, typeQNamePattern, qnamePattern, maxResults, preload); for (ChildAssociationRef actualAssoc : actualAssociations) { ChildAssociationRef referenceChildAssocRef = new ChildAssociationRef(actualAssoc.getTypeQName(), nodeRefReference, actualAssoc.getQName(), actualAssoc.getChildRef(), actualAssoc.isPrimary(), actualAssoc.getNthSibling()); referenceAssociations.add(referenceChildAssocRef); } } return referenceAssociations; } }
@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()); }
@Override public List<ChildAssociationRef> execute(NodeProtocol protocol, Reference reference) throws ProtocolMethodException { NodeRef actualNodeRef = reference.execute(new GetActualNodeRefMethod(null)); NodeRef nodeRefReference = reference.toNodeRef(); List<ChildAssociationRef> referenceAssociations = new LinkedList<>(); if (!environment.isSubClass(environment.getType(nodeRefReference), ContentModel.TYPE_FOLDER)) { List<ChildAssociationRef> actualAssociations = environment.getChildAssocs(actualNodeRef, typeQNamePattern, qnamePattern, maxResults, preload); for (ChildAssociationRef actualAssoc : actualAssociations) { ChildAssociationRef referenceChildAssocRef = new ChildAssociationRef(actualAssoc.getTypeQName(), nodeRefReference, actualAssoc.getQName(), actualAssoc.getChildRef(), actualAssoc.isPrimary(), actualAssoc.getNthSibling()); referenceAssociations.add(referenceChildAssocRef); } } return referenceAssociations; } }
@Override public ChildAssociationRef getBaseName(ChildAssociationRef childAssocRef, boolean forceForNonTenant) { if (childAssocRef == null) { return null; } return new ChildAssociationRef( childAssocRef.getTypeQName(), getBaseName(childAssocRef.getParentRef(), forceForNonTenant), childAssocRef.getQName(), getBaseName(childAssocRef.getChildRef(), forceForNonTenant), childAssocRef.isPrimary(), childAssocRef.getNthSibling()); }
@Override public ChildAssociationRef getBaseName(ChildAssociationRef childAssocRef, boolean forceForNonTenant) { if (childAssocRef == null) { return null; } return new ChildAssociationRef( childAssocRef.getTypeQName(), getBaseName(childAssocRef.getParentRef(), forceForNonTenant), childAssocRef.getQName(), getBaseName(childAssocRef.getChildRef(), forceForNonTenant), childAssocRef.isPrimary(), childAssocRef.getNthSibling()); }
@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()); }
versionedChildRef.isPrimary()); assertEquals( origChildAssocRef.getNthSibling(), versionedChildRef.getNthSibling());
new NodeRef(archiveStoreRef, node.nodeRef.getId()), true, primaryParentAssocRef.getNthSibling());
new NodeRef(archiveStoreRef, node.nodeRef.getId()), true, primaryParentAssocRef.getNthSibling());
for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs) System.out.println(" - Assoc index = " + ruleChildAssocRef.getNthSibling() + ", name = " + nodeService.getProperty(ruleChildAssocRef.getChildRef(), ContentModel.PROP_TITLE)); for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs) System.out.println(" - Assoc index = " + ruleChildAssocRef.getNthSibling() + ", name = " + nodeService.getProperty(ruleChildAssocRef.getChildRef(), ContentModel.PROP_TITLE)); for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs) System.out.println(" - Assoc index = " + ruleChildAssocRef.getNthSibling() + ", name = " + nodeService.getProperty(ruleChildAssocRef.getChildRef(), ContentModel.PROP_TITLE));
newNode.setPrimaryParentAssoc(new ChildAssociationRef(primaryParentAssoc.getTypeQName(), mappedParentNodeRef, primaryParentAssoc.getQName(), mappedNodeRef, primaryParentAssoc.isPrimary(), primaryParentAssoc.getNthSibling())); assoc.getQName(), mappedNodeRef, assoc.isPrimary(), assoc.getNthSibling()); mappedParentAssocs.add(replace); assoc.getQName(), mappedChildNodeRef, assoc.isPrimary(), assoc.getNthSibling()); mappedChildAssocs.add(replace);