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


Java AssociationRef.getTargetRef方法代码示例

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


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

示例1: 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

示例2: 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

示例3: onDeleteAssociation

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
/**
 * @see AssocSourceMultiplicityIntegrityEvent
 * @see AssocTargetMultiplicityIntegrityEvent
 */
public void onDeleteAssociation(AssociationRef nodeAssocRef)
{
    if (! storesToIgnore.contains(tenantService.getBaseName(nodeAssocRef.getSourceRef().getStoreRef()).toString()))
    {
        IntegrityEvent event = null;
        // check source multiplicity
        event = new AssocSourceMultiplicityIntegrityEvent(
                nodeService,
                dictionaryService,
                nodeAssocRef.getTargetRef(),
                nodeAssocRef.getTypeQName(),
                true);
        save(event);
        // check target multiplicity
        event = new AssocTargetMultiplicityIntegrityEvent(
                nodeService,
                dictionaryService,
                nodeAssocRef.getSourceRef(),
                nodeAssocRef.getTypeQName(),
                true);
        save(event);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:IntegrityChecker.java

示例4: 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

示例5: testGetTargetAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
public void testGetTargetAssocs() throws Exception
{
    AssociationRef assocRef = createAssociation();
    NodeRef sourceRef = assocRef.getSourceRef();
    NodeRef targetRef = assocRef.getTargetRef();
    QName qname = assocRef.getTypeQName();
    // get the target assocs
    List<AssociationRef> targetAssocs = nodeService.getTargetAssocs(sourceRef, qname);
    assertEquals("Incorrect number of targets", 1, targetAssocs.size());
    assertTrue("Target not found", targetAssocs.contains(assocRef));
    
    // Check that IDs are present
    for (AssociationRef targetAssoc : targetAssocs)
    {
        assertNotNull("Association does not have ID", targetAssoc.getId());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:BaseNodeServiceTest.java

示例6: testGetSourceAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
public void testGetSourceAssocs() throws Exception
{
    AssociationRef assocRef = createAssociation();
    NodeRef sourceRef = assocRef.getSourceRef();
    NodeRef targetRef = assocRef.getTargetRef();
    QName qname = assocRef.getTypeQName();
    // get the source assocs
    List<AssociationRef> sourceAssocs = nodeService.getSourceAssocs(targetRef, qname);
    assertEquals("Incorrect number of source assocs", 1, sourceAssocs.size());
    assertTrue("Source not found", sourceAssocs.contains(assocRef));
    
    // Check that IDs are present
    for (AssociationRef sourceAssoc : sourceAssocs)
    {
        assertNotNull("Association does not have ID", sourceAssoc.getId());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:BaseNodeServiceTest.java

示例7: 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

示例8: AssociationRefKey

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
/**
 * 
 * @param ref AssociationRef
 */
public AssociationRefKey(AssociationRef ref)
{
    this.sourceRef = ref.getSourceRef();
    this.targetRef = ref.getTargetRef();
    this.assocTypeQName = ref.getTypeQName();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:RepoSecondaryManifestProcessorImpl.java

示例9: getSingleAssocNode

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
public static NodeRef getSingleAssocNode(Collection<AssociationRef> assocs, boolean getTarget)
{
    if(assocs != null && assocs.size()==1 )
    {
        AssociationRef association = assocs.iterator().next();
        return getTarget ? association.getTargetRef() : association.getSourceRef();
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:NodeUtils.java

示例10: onCreateAssociation

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
/**
 * @see AssocSourceTypeIntegrityEvent
 * @see AssocTargetTypeIntegrityEvent
 * @see AssocSourceMultiplicityIntegrityEvent
 * @see AssocTargetMultiplicityIntegrityEvent
 */
public void onCreateAssociation(AssociationRef nodeAssocRef)
{
    if (! storesToIgnore.contains(tenantService.getBaseName(nodeAssocRef.getSourceRef().getStoreRef()).toString()))
    {
        IntegrityEvent event = null;
        // check source type
        event = new AssocSourceTypeIntegrityEvent(
                nodeService,
                dictionaryService,
                nodeAssocRef.getSourceRef(),
                nodeAssocRef.getTypeQName());
        save(event);
        // check target type
        event = new AssocTargetTypeIntegrityEvent(
                nodeService,
                dictionaryService,
                nodeAssocRef.getTargetRef(),
                nodeAssocRef.getTypeQName());
        save(event);
        // check source multiplicity
        event = new AssocSourceMultiplicityIntegrityEvent(
                nodeService,
                dictionaryService,
                nodeAssocRef.getTargetRef(),
                nodeAssocRef.getTypeQName(),
                false);
        save(event);
        // check target multiplicity
        event = new AssocTargetMultiplicityIntegrityEvent(
                nodeService,
                dictionaryService,
                nodeAssocRef.getSourceRef(),
                nodeAssocRef.getTypeQName(),
                false);
        save(event);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:44,代码来源:IntegrityChecker.java

示例11: getNodesHierarchyMonitorRequest

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
public NodesHierarchyMonitorRequest getNodesHierarchyMonitorRequest(final NodeRef monitorNodeRef) {
	validateMonitorNode(monitorNodeRef,  MonitorModel.TYPE_MONITOR_NODES_HIERARCHY);

	NodeRef sourcePath = null;
	List<AssociationRef> requestedSourceNode = nodeService.getTargetAssocs(monitorNodeRef,MonitorModel.ASSOC_SOURCE_NODE_PATH);
	for (AssociationRef asoc : requestedSourceNode){ 
		sourcePath = asoc.getTargetRef();
		break;
       }
	
	return new NodesHierarchyMonitorRequest(sourcePath);
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:13,代码来源:MonitorStorage.java

示例12: getTargetAssocs

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
{
    NodeServiceTrait theTrait = getTrait();
    List<AssociationRef> targetAssocs = null;

    Reference reference = Reference.fromNodeRef(sourceRef);
    if (reference != null)
    {
        if (smartStore.canMaterialize(reference))
        {
            NodeRef materializedReferece = smartStore.materialize(reference);
            targetAssocs = theTrait.getTargetAssocs(materializedReferece,
                                                    qnamePattern);
        }
        else
        {
            targetAssocs = new LinkedList<>();
        }
    }
    else
    {
        targetAssocs = theTrait.getTargetAssocs(sourceRef,
                                                qnamePattern);
    }

    List<AssociationRef> virtualizedIfNeededTargetAssocs = null;

    Reference sourceReference = Reference.fromNodeRef(sourceRef);
    if (sourceReference != null)
    {
        virtualizedIfNeededTargetAssocs = new LinkedList<>();

        for (AssociationRef associationRef : targetAssocs)
        {
            NodeRef targetNodeRef = associationRef.getTargetRef();
            Reference targetReference = NodeProtocol.newReference(targetNodeRef,
                                                                  sourceReference
                                                                              .execute(new GetParentReferenceMethod()));
            AssociationRef virtualAssocRef = new AssociationRef(associationRef.getId(),
                                                                sourceRef,
                                                                associationRef.getTypeQName(),
                                                                targetReference.toNodeRef(targetNodeRef
                                                                            .getStoreRef()));
            virtualizedIfNeededTargetAssocs.add(virtualAssocRef);
        }

    }
    else
    {
        virtualizedIfNeededTargetAssocs = targetAssocs;

        if (DownloadModel.TYPE_DOWNLOAD.equals(environment.getType(sourceRef)))
        {
            if (qnamePattern.isMatch(DownloadModel.ASSOC_REQUESTED_NODES))
            {
                List<AssociationRef> virtualTargetAssocs = getDownloadTargetAssocs(sourceRef);
                virtualizedIfNeededTargetAssocs.addAll(virtualTargetAssocs);
            }
        }
    }

    return virtualizedIfNeededTargetAssocs;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:65,代码来源:VirtualNodeServiceExtension.java

示例13: copyPendingAssociations

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
/**
 * Copy any remaining associations that could not be copied or ignored during the copy process.
 * See <a href=http://issues.alfresco.com/jira/browse/ALF-958>ALF-958: Target associations aren't copied</a>.
 */
private void copyPendingAssociations(Map<NodeRef, NodeRef> copiedNodeRefs)
{
    // Prepare storage for post-copy association handling
    List<Pair<AssociationRef, AssocCopyTargetAction>> postCopyAssocs =
            TransactionalResourceHelper.getList(KEY_POST_COPY_ASSOCS);
    for (Pair<AssociationRef, AssocCopyTargetAction> pair : postCopyAssocs)
    {
        AssociationRef assocRef = pair.getFirst();
        AssocCopyTargetAction action = pair.getSecond();
        // Was the original target copied?
        NodeRef newSourceForAssoc = copiedNodeRefs.get(assocRef.getSourceRef());
        if (newSourceForAssoc == null)
        {
            // Developer #fail
            throw new IllegalStateException("Post-copy association has a source that was NOT copied.");
        }
        NodeRef oldTargetForAssoc = assocRef.getTargetRef();
        NodeRef newTargetForAssoc = copiedNodeRefs.get(oldTargetForAssoc);      // May be null
        QName assocTypeQName = assocRef.getTypeQName();
        switch (action)
        {
            case USE_ORIGINAL_TARGET:
                internalNodeService.createAssociation(newSourceForAssoc, oldTargetForAssoc, assocTypeQName);
                break;
            case USE_COPIED_TARGET:
                // Do nothing if the target was not copied
                if (newTargetForAssoc != null)
                {
                    internalNodeService.createAssociation(newSourceForAssoc, newTargetForAssoc, assocTypeQName);
                }
                break;
            case USE_COPIED_OTHERWISE_ORIGINAL_TARGET:
                if (newTargetForAssoc == null)
                {
                    internalNodeService.createAssociation(newSourceForAssoc, oldTargetForAssoc, assocTypeQName);
                }
                else
                {
                    internalNodeService.createAssociation(newSourceForAssoc, newTargetForAssoc, assocTypeQName);
                }
                break;
            default:
                throw new IllegalStateException("Unknown association action: " + action);
        }
    }
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:52,代码来源:CopyServiceImpl.java


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