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


Java AssociationRef类代码示例

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


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

示例1: getAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
/**
 * Gets the current node associations
 * 
 * @return associations
 */
public List<PeerAssociation> getAssocs(NodeRef nodeRef)
{
    List<AssociationRef> refs = null;
    try
    {
        refs = getNodeService().getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL);
    }
    catch (UnsupportedOperationException err)
    {
       // some stores do not support associations
       // but we doesn't want NPE in code below
       refs = new ArrayList<AssociationRef>();
    }
    List<PeerAssociation> assocs = new ArrayList<PeerAssociation>(refs.size());
    for (AssociationRef ref : refs)
    {
        assocs.add(new PeerAssociation(ref.getTypeQName(), ref.getSourceRef(), ref.getTargetRef()));
    }
    return assocs;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:NodeBrowserPost.java

示例2: updateAssociations

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
@Override
protected void updateAssociations(NodeService nodeService)
{
    List<AssociationRef> existingAssocs = nodeService.getTargetAssocs(sourceNodeRef, assocQName);
    for (AssociationRef assoc : existingAssocs)
    {
        if (assoc.getTargetRef().equals(targetNodeRef))
        {
            if (logger.isWarnEnabled())
            {
                logger.warn("Attempt to add existing association prevented. " + assoc);
            }
            return;
        }
    }
    nodeService.createAssociation(sourceNodeRef, targetNodeRef, assocQName);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:ContentModelFormProcessor.java

示例3: freezeAssociations

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
/**
 * Freeze associations
 *
 * @param versionNodeRef   the version node reference
 * @param associations     the list of associations
 * 
 * @since 3.3 (Ent)
 */
private void freezeAssociations(NodeRef versionNodeRef, List<AssociationRef> associations)
{
    for (AssociationRef targetAssocRef : associations)
    {
        HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
        
        QName sourceTypeRef = nodeService.getType(targetAssocRef.getSourceRef());
        
        NodeRef targetRef = targetAssocRef.getTargetRef();
        
        // Set the reference property to point to the target node
        properties.put(ContentModel.PROP_REFERENCE, targetRef);
        properties.put(Version2Model.PROP_QNAME_ASSOC_DBID, targetAssocRef.getId());
        
        // Create peer version reference
        dbNodeService.createNode(
                versionNodeRef,
                Version2Model.CHILD_QNAME_VERSIONED_ASSOCS,
                targetAssocRef.getTypeQName(),
                sourceTypeRef,
                properties);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:Version2ServiceImpl.java

示例4: testGetNull

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
@Test
public void testGetNull()
{
    assertNull(tenantService.getName((NodeRef)null));
    assertNull(tenantService.getName((String)null));
    assertNull(tenantService.getName((StoreRef) null));
    assertNull(tenantService.getName("", (StoreRef) null));
    assertNull(tenantService.getName((ChildAssociationRef) null));
    assertNull(tenantService.getName((AssociationRef) null));
    assertNull(tenantService.getName((NodeRef)null,(NodeRef)null));
    assertNull(tenantService.getBaseName((StoreRef) null));
    assertNull(tenantService.getBaseName((AssociationRef) null));
    assertNull(tenantService.getBaseName((ChildAssociationRef) null, false));
    assertNull(tenantService.getBaseName((String)null, false));
    tenantService.checkDomain((String)null);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:MultiTServiceImplTest.java

示例5: listNodePeerAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
protected CollectionWithPagingInfo<Node> listNodePeerAssocs(List<AssociationRef> assocRefs, Parameters parameters, boolean returnTarget)
{
    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>(assocRefs.size());
    for (AssociationRef assocRef : assocRefs)
    {
        // minimal info by default (unless "include"d otherwise)
        NodeRef nodeRef = (returnTarget ? assocRef.getTargetRef() : assocRef.getSourceRef());

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

        QName assocTypeQName = assocRef.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 Assoc(assocType));

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

示例6: testDuplicateAssociationDetection

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
public void testDuplicateAssociationDetection() throws Exception
{
    AssociationRef assocRef = createAssociation();
    NodeRef sourceRef = assocRef.getSourceRef();
    NodeRef targetRef = assocRef.getTargetRef();
    QName qname = assocRef.getTypeQName();
    try
    {
        // attempt repeat
        nodeService.createAssociation(sourceRef, targetRef, qname);
        fail("Duplicate assocation not detected");
    }
    catch (AssociationExistsException e)
    {
        // expected
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:BaseNodeServiceTest.java

示例7: processExcludedSet

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
/**
 * @param thisNode NodeRef
 * @return Set<NodeRef>
 */
private Set<NodeRef> processExcludedSet(NodeRef thisNode)
{
    Set<NodeRef> results = new HashSet<NodeRef>(89);
    NodeService nodeService = serviceRegistry.getNodeService();

    // Find any peer nodes (filtering as necessary)
    List<AssociationRef> targets = nodeService.getTargetAssocs(thisNode, RegexQNamePattern.MATCH_ALL);
    boolean filterPeers = !peerAssociationTypes.isEmpty();
    for (AssociationRef target : targets)
    {
        if (!filterPeers || !peerAssociationTypes.contains(target.getTypeQName()))
        {
            results.add(target.getTargetRef());
        }
    }
    return results;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:PeerAssociatedNodeFinder.java

示例8: getAssociations

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
/**
 * Get associations
 * 
 * @param classRef QName
 */
public List<AssociationRef> getAssociations(QName classRef) 
{
	List<AssociationRef> result = null;
	if (classRef.equals(this.classRef) == true)
	{
		result = getAssociations();
	}
	else
	{
		AspectDetails aspectDetails = this.aspectCopyDetails.get(classRef);
		if (aspectDetails != null)
		{
			result = aspectDetails.getAssociations();
		}
	}
	
	return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:PolicyScope.java

示例9: policyBehaviour

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
public void policyBehaviour(AssociationRef assocRef)
{
    final QName assocTypeQName = assocRef.getTypeQName();
    if ( !excludedAssocTypes.contains(assocTypeQName))
    {
        NodeRef nodeRef = assocRef.getSourceRef();
        
        if (nodeService.exists(nodeRef))
        {
            List<ChildAssociationRef> parentsAssocRefs = this.nodeService.getParentAssocs(nodeRef);
            for (ChildAssociationRef parentAssocRef : parentsAssocRefs)
            {
                triggerRules(parentAssocRef.getParentRef(), nodeRef);
                if (logger.isDebugEnabled() == true)
                {
                    logger.debug(
                            "OnUpdateAssoc rule triggered (parent); " +
                                    "nodeRef=" + parentAssocRef.getParentRef());
                }
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:SingleAssocRefPolicyRuleTrigger.java

示例10: getTargetAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
@Override
public NodeRef getTargetAssocs(NodeRef nodeRef, QName associationQName)
{
    List<AssociationRef> assocs = apiFacet.getNodeService().getTargetAssocs(nodeRef,
                                                                            associationQName);

    if (assocs != null && assocs.size() >= 1)
    {
        AssociationRef associationRef = assocs.get(0);
        NodeRef targetRef = associationRef.getTargetRef();
        return targetRef;
    }
    else
    {
        return null;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AlfrescoEnviroment.java

示例11: createAssociation

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
@Override
public AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
{
	Reference targetReference = Reference.fromNodeRef(targetRef);
    if (targetReference != null
                && getTrait().getType(materializeIfPossible(sourceRef)).equals(DownloadModel.TYPE_DOWNLOAD))
    {
        // NOTE : this is enables downloads of virtual structures
        createDownloadAssociation(sourceRef,
                                  targetRef);

        AssociationRef assocRef = new AssociationRef(sourceRef,
                                                     assocTypeQName,
                                                     targetRef);
        return assocRef;
    }
    else
    {
        return getTrait().createAssociation(materializeIfPossible(sourceRef),
                                            materializeIfPossible(targetRef),
                                            assocTypeQName);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:VirtualNodeServiceExtension.java

示例12: getWorkingCopy

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
@Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef getWorkingCopy(NodeRef nodeRef)
{
    NodeRef workingCopy = null;
    if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CHECKED_OUT))
    {
        List<AssociationRef> assocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK);
        // It is a 1:1 relationship
        if (assocs.size() == 0)
        {
            logger.warn("Found node with cm:checkedOut aspect but no association.  Current node state: " + nodeService.getNodeStatus(nodeRef));
        }
        else if (assocs.size() > 1)
        {
            logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association from node: " + nodeRef);
        }
        else
        {
            workingCopy = assocs.get(0).getTargetRef();
        }
    }
    
    return workingCopy;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:CheckOutCheckInServiceImpl.java

示例13: getCheckedOut

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
@Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef getCheckedOut(NodeRef nodeRef)
{
    NodeRef original = null;
    if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
    {
        List<AssociationRef> assocs = nodeService.getSourceAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK);
        // It is a 1:1 relationship
        if (assocs.size() == 0)
        {
            logger.warn("Found node with cm:workingcopy aspect but no association.  Current node state: " + nodeService.getNodeStatus(nodeRef));
        }
        else if (assocs.size() > 1)
        {
            logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association to node: " + nodeRef);
        }
        else
        {
            original = assocs.get(0).getSourceRef();
        }
    }
    
    return original;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:CheckOutCheckInServiceImpl.java

示例14: getAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
/**
 * @return Target associations for this Node. As a Map of assoc name to a List of TemplateNodes. 
 */
public Map<String, List<TemplateNode>> getAssocs()
{
    if (this.targetAssocs == null)
    {
        List<AssociationRef> refs = this.services.getNodeService().getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
        this.targetAssocs = new QNameMap<String, List<TemplateNode>>(this);
        for (AssociationRef ref : refs)
        {
            String qname = ref.getTypeQName().toString();
            List<TemplateNode> nodes = this.targetAssocs.get(qname);
            if (nodes == null)
            {
                // first access for the list for this qname
                nodes = new ArrayList<TemplateNode>(4);
                this.targetAssocs.put(ref.getTypeQName().toString(), nodes);
            }
            nodes.add( new TemplateNode(ref.getTargetRef(), this.services, this.imageResolver) );
        }
    }
    
    return this.targetAssocs;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:TemplateNode.java

示例15: getSourceAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入依赖的package包/类
/**
 * @return Source associations for this Node. As a Map of assoc name to a List of TemplateNodes. 
 */
public Map<String, List<TemplateNode>> getSourceAssocs()
{
    if (this.sourceAssocs == null)
    {
        List<AssociationRef> refs = this.services.getNodeService().getSourceAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
        this.sourceAssocs = new QNameMap<String, List<TemplateNode>>(this);
        for (AssociationRef ref : refs)
        {
            String qname = ref.getTypeQName().toString();
            List<TemplateNode> nodes = this.sourceAssocs.get(qname);
            if (nodes == null)
            {
                // first access for the list for this qname
                nodes = new ArrayList<TemplateNode>(4);
                this.sourceAssocs.put(ref.getTypeQName().toString(), nodes);
            }
            nodes.add( new TemplateNode(ref.getSourceRef(), this.services, this.imageResolver) );
        }
    }
    
    return this.sourceAssocs;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:TemplateNode.java


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