public boolean isPrimary() { return this.childAssocRef.isPrimary(); }
public boolean isPrimary() { return this.childAssocRef.isPrimary(); }
@Override public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) { if (!childAssocRef.isPrimary()) { eventsService.secondaryAssociationDeleted(childAssocRef); } }
@Override public void onCreateChildAssociation(ChildAssociationRef newChildAssocRef, boolean isNewNode) { if (!newChildAssocRef.isPrimary()) { eventsService.secondaryAssociationCreated(newChildAssocRef); } }
@Override public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) { if (!childAssocRef.isPrimary()) { eventsService.secondaryAssociationDeleted(childAssocRef); } }
@Override public void onCreateChildAssociation(ChildAssociationRef newChildAssocRef, boolean isNewNode) { if (!newChildAssocRef.isPrimary()) { eventsService.secondaryAssociationCreated(newChildAssocRef); } }
/** * Gets the primary parent association * @param node the node to process * @return the primary parent association or null if this is a root node */ public static ChildAssociationRef getPrimaryParentAssoc(TransferManifestNormalNode node) { List<ChildAssociationRef> assocs = node.getParentAssocs(); for(ChildAssociationRef assoc : assocs) { if(assoc.isPrimary()) { return assoc; } } return null; }
/** * Gets the primary parent association * @param node the node to process * @return the primary parent association or null if this is a root node */ public static ChildAssociationRef getPrimaryParentAssoc(TransferManifestNormalNode node) { List<ChildAssociationRef> assocs = node.getParentAssocs(); for(ChildAssociationRef assoc : assocs) { if(assoc.isPrimary()) { return assoc; } } return null; }
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); } }
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); } }
@Override public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair, Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair) { bindFixAssocAndCollectLostAndFound(childNodePair, "childNodeWithDeletedParent", childAssocPair.getFirst(), childAssocPair.getSecond().isPrimary() && exists(childAssocPair.getFirst())); return true; }
@Override public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair, Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair) { bindFixAssocAndCollectLostAndFound(childNodePair, "childNodeWithDeletedParent", childAssocPair.getFirst(), childAssocPair.getSecond().isPrimary() && exists(childAssocPair.getFirst())); return true; }
@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; }
@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 void countTags(NodeRef nodeRef, List<TagDetails> tagDetailsList) { // Add the tags of passed node List<String> tags = this.taggingService.getTags(nodeRef); for (String tag : tags) { addDetails(tag, tagDetailsList); } // Iterate over the children of the node List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef assoc : assocs) { if (assoc.isPrimary() == true) { countTags(assoc.getChildRef(), tagDetailsList); } } }
@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()); }
@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 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 Void execute() throws Throwable { NodeRef file2NodeRef = getNodeForPath(testConnection, FILE_PATH2); //assertEquals("node ref has changed on a rename", file1NodeRef, file2NodeRef); assertEquals(nodeService.getProperty(file2NodeRef, ContentModel.PROP_LASTNAME), LAST_NAME); ChildAssociationRef parentRef = nodeService.getPrimaryParent(file2NodeRef); assertTrue("file has wrong assoc local name", parentRef.getQName().getLocalName().equals(FILE_NAME2)); assertTrue("not primary assoc", parentRef.isPrimary()); return null; } };