当前位置: 首页>>代码示例>>Java>>正文


Java ChildAssociationRef.isPrimary方法代码示例

本文整理汇总了Java中org.alfresco.service.cmr.repository.ChildAssociationRef.isPrimary方法的典型用法代码示例。如果您正苦于以下问题:Java ChildAssociationRef.isPrimary方法的具体用法?Java ChildAssociationRef.isPrimary怎么用?Java ChildAssociationRef.isPrimary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.service.cmr.repository.ChildAssociationRef的用法示例。


在下文中一共展示了ChildAssociationRef.isPrimary方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeParentAssoc

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:XMLTransferManifestWriter.java

示例2: writeParentAssoc

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
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); 
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:XMLTransferReportWriter.java

示例3: countTags

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:RefreshTagScopeActionExecuter.java

示例4: getLinkedToRuleNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
@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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:RuleServiceImpl.java

示例5: getLinkedFromRuleNodes

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
@Override
public List<NodeRef> getLinkedFromRuleNodes(NodeRef nodeRef)
{
    List<NodeRef> result = new ArrayList<NodeRef>();
    
    if (nodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true)
    {
        ChildAssociationRef assoc = getSavedRuleFolderAssoc(nodeRef);
        if (assoc.isPrimary() == true)
        {
            List<ChildAssociationRef> linkedAssocs = nodeService.getParentAssocs(assoc.getChildRef());
            for (ChildAssociationRef linkAssoc : linkedAssocs)
            {
                if (linkAssoc.isPrimary() == false)
                {
                    result.add(linkAssoc.getParentRef());
                }
            }
        }
    }
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:RuleServiceImpl.java

示例6: getName

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
@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());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:MultiTServiceImpl.java

示例7: getBaseName

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
@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());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:MultiTServiceImpl.java

示例8: moveNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * move transfer node to new parent.
 * @param childNode
 * @param newParent
 */
private void moveNode(TransferManifestNormalNode childNode, TransferManifestNormalNode newParent)
{
    List<ChildAssociationRef> currentParents = childNode.getParentAssocs();
    List<ChildAssociationRef> newParents = new ArrayList<ChildAssociationRef>();

    for (ChildAssociationRef parent : currentParents)
    {
        if (!parent.isPrimary())
        {
            newParents.add(parent);
        }
        else
        {
            ChildAssociationRef newPrimaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, newParent
                    .getNodeRef(), parent.getQName(), parent.getChildRef(), true, -1);
            newParents.add(newPrimaryAssoc);
            childNode.setPrimaryParentAssoc(newPrimaryAssoc);
            Path newParentPath = new Path();
            newParentPath.append(newParent.getParentPath());
            newParentPath.append(new Path.ChildAssocElement(newParent.getPrimaryParentAssoc()));
            childNode.setParentPath(newParentPath);
        }
    }
    childNode.setParentAssocs(newParents);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:RepoTransferReceiverImplTest.java

示例9: getChildAssocs

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Child Assocs translation for version store
 */
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) throws InvalidNodeRefException
{
    // Get the child assoc references from the version store
    List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs(
            VersionUtil.convertNodeRef(nodeRef),
            typeQNamePattern, qnamePattern);
    
    List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>(childAssocRefs.size());
    
    for (ChildAssociationRef childAssocRef : childAssocRefs)
    {
        if (! childAssocRef.getTypeQName().equals(Version2Model.CHILD_QNAME_VERSIONED_ASSOCS))
        {
            // Get the child reference
            NodeRef childRef = childAssocRef.getChildRef();
            NodeRef referencedNode = (NodeRef)this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE);
            
            if (this.dbNodeService.exists(referencedNode))
            {
                // Build a child assoc ref to add to the returned list
                ChildAssociationRef newChildAssocRef = new ChildAssociationRef(
                        childAssocRef.getTypeQName(),
                        childAssocRef.getParentRef(),
                        childAssocRef.getQName(),
                        referencedNode,
                        childAssocRef.isPrimary(),
                        childAssocRef.getNthSibling());
                
                result.add(newChildAssocRef);
            }
        }
    }
    
    // sort the results so that the order appears to be exactly as it was originally
    Collections.sort(result);
    
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:Node2ServiceImpl.java

示例10: getPrimaryParentAssoc

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
* 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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:TransferManifestNodeHelper.java

示例11: onMoveNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
{
    NodeRef oldRef = oldChildAssocRef.getChildRef();
    NodeRef oldParent = oldChildAssocRef.getParentRef();
    NodeRef newRef = newChildAssocRef.getChildRef();
    NodeRef newParent = newChildAssocRef.getParentRef();
    
    // Do nothing if it's a "rename" not a move
    if (oldParent.equals(newParent))
    {
        return;
    }
    
    // It has moved somewhere
    // Remove the tags from the old location
    if (this.nodeService.hasAspect(oldRef, ContentModel.ASPECT_TAGGABLE))
    {
        // Use the parent we were passed in, rather than re-fetching
        // via the node, as we need to reference the old scope!
        ChildAssociationRef scopeParent;
        if (oldChildAssocRef.isPrimary())
        {
            scopeParent = oldChildAssocRef;
        }
        else
        {
            scopeParent = this.nodeService.getPrimaryParent(oldParent);
        }
        if (scopeParent != null)
        {
            updateAllScopeTags(oldRef, scopeParent.getParentRef(), Boolean.FALSE);
        }
    }
    // Add the tags at its new location
    if (this.nodeService.hasAspect(newRef, ContentModel.ASPECT_TAGGABLE))
    {
        updateAllScopeTags(newRef, Boolean.TRUE);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:40,代码来源:TaggingServiceImpl.java

示例12: beforeRemoveAspect

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * The rule folder & below will be deleted automatically in the normal way, so we don't need to worry about them.
 * But we need additional handling for any other folders which have rules linked to this folder's rules. See
 * ALF-11923, ALF-15262.
 * 
 * @see org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy#beforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
 */
@Override
public void beforeRemoveAspect(NodeRef nodeRef, QName aspectTypeQName)
{
    if (!aspectTypeQName.equals(RuleModel.ASPECT_RULES))
    {
        return;
    }

    this.ruleService.disableRules(nodeRef);
    try
    {
        for (ChildAssociationRef childAssocRef : nodeService.getChildAssocs(nodeRef, RuleModel.ASSOC_RULE_FOLDER,
                RuleModel.ASSOC_RULE_FOLDER, false))
        {
            // We are only interested in the deletion of primary associations to a rule folder, which usually
            // happens when all rules in a folder are deleted and the ASPECT_RULES aspect is removed
            if (!childAssocRef.isPrimary())
            {
                continue;
            }
            NodeRef savedRuleFolderRef = childAssocRef.getChildRef();
            // Cascade the removal to all secondary (linked) parents
            List<ChildAssociationRef> linkedAssocs = nodeService.getParentAssocs(savedRuleFolderRef);
            for (ChildAssociationRef linkAssoc : linkedAssocs)
            {
                if (!linkAssoc.isPrimary())
                {
                    // Remove the aspect from linked parents; this will also delete the linking secondary
                    // association
                    nodeService.removeAspect(linkAssoc.getParentRef(), RuleModel.ASPECT_RULES);
                }
            }
        }
    }
    finally
    {
        this.ruleService.enableRules(nodeRef);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:47,代码来源:RulesAspect.java

示例13: execute

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
@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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:GetChildAssocsMethod.java

示例14: getChildAssociationCopyAction

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Respects the <code>copyChildren</code> flag.  Child nodes are copied fully if the association
 * is primary otherwise secondary associations are duplicated.
 */
@Override
public ChildAssocCopyAction getChildAssociationCopyAction(
        QName classQName,
        CopyDetails copyDetails,
        CopyChildAssociationDetails childAssocCopyDetails)
{
    ChildAssociationRef childAssocRef = childAssocCopyDetails.getChildAssocRef();
    boolean copyChildren = childAssocCopyDetails.isCopyChildren();
    if (childAssocRef.getTypeQName().equals(ContentModel.ASSOC_CONTAINS))
    {
        if (!copyChildren)
        {
            return ChildAssocCopyAction.IGNORE;
        }
        if (childAssocRef.isPrimary())
        {
            return ChildAssocCopyAction.COPY_CHILD;
        }
        else
        {
            return ChildAssocCopyAction.COPY_ASSOC;
        }
    }
    else
    {
        throw new IllegalStateException(
                "Behaviour should have been invoked: \n" +
                "   Aspect: " + this.getClass().getName() + "\n" +
                "   Assoc:  " + childAssocRef + "\n" +
                "   " + copyDetails);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:CopyServiceImpl.java

示例15: listNodeChildAssocs

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
protected CollectionWithPagingInfo<Node> listNodeChildAssocs(List<ChildAssociationRef> childAssocRefs, Parameters parameters, Boolean isPrimary, boolean returnChild)
{
    Map<QName, String> qnameMap = new HashMap<>(3);

    Map<String, UserInfo> mapUserInfo = new HashMap<>(10);

    List<String> includeParam = parameters.getInclude();

    List<Node> collection = new ArrayList<Node>(childAssocRefs.size());
    for (ChildAssociationRef childAssocRef : childAssocRefs)
    {
        if (isPrimary == null || (isPrimary == childAssocRef.isPrimary()))
        {
            // minimal info by default (unless "include"d otherwise)
            NodeRef nodeRef = (returnChild ? childAssocRef.getChildRef() : childAssocRef.getParentRef());

            Node node = nodes.getFolderOrDocument(nodeRef, null, null, includeParam, mapUserInfo);

            QName assocTypeQName = childAssocRef.getTypeQName();

            if (!EXCLUDED_NS.contains(assocTypeQName.getNamespaceURI()))
            {
                String assocType = qnameMap.get(assocTypeQName);
                if (assocType == null)
                {
                    assocType = assocTypeQName.toPrefixString(namespaceService);
                    qnameMap.put(assocTypeQName, assocType);
                }

                node.setAssociation(new AssocChild(assocType, childAssocRef.isPrimary()));
                
                collection.add(node);
            }
        }
    }
    
    return listPage(collection, parameters.getPaging());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:39,代码来源:AbstractNodeRelation.java


注:本文中的org.alfresco.service.cmr.repository.ChildAssociationRef.isPrimary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。