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


Java AssociationRef.getId方法代码示例

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


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

示例1: getName

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public AssociationRef getName(AssociationRef assocRef)
{
    if (assocRef == null)
    {
        return null;
    }

    return new AssociationRef(assocRef.getId(),
            getName(assocRef.getSourceRef()),
            assocRef.getTypeQName(),
            getName(assocRef.getTargetRef()));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:MultiTServiceImpl.java

示例2: getBaseName

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public AssociationRef getBaseName(AssociationRef assocRef)
{
    if (assocRef == null)
    {
        return null;
    }

    return new AssociationRef(assocRef.getId(),
            getBaseName(assocRef.getSourceRef()),
            assocRef.getTypeQName(),
            getBaseName(assocRef.getTargetRef()));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:MultiTServiceImpl.java

示例3: testCreateAndRemoveAssociation

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
public void testCreateAndRemoveAssociation() throws Exception
{
    AssociationRef assocRef = createAssociation();
    NodeRef sourceRef = assocRef.getSourceRef();
    
    // create another
    Map<QName, Serializable> properties = new HashMap<QName, Serializable>(5);
    fillProperties(TYPE_QNAME_TEST_CONTENT, properties);
    fillProperties(ASPECT_QNAME_TEST_TITLED, properties);
    ChildAssociationRef childAssocRef = nodeService.createNode(
            rootNodeRef,
            ASSOC_TYPE_QNAME_TEST_CHILDREN,
            QName.createQName(null, "N3"),
            TYPE_QNAME_TEST_CONTENT,
            properties);
    NodeRef anotherTargetRef = childAssocRef.getChildRef();
    AssociationRef anotherAssocRef = nodeService.createAssociation(
            sourceRef,
            anotherTargetRef,
            ASSOC_TYPE_QNAME_TEST_NEXT);
    Long anotherAssocId = anotherAssocRef.getId();
    assertNotNull("Created association does not have an ID", anotherAssocId);
    AssociationRef anotherAssocRefCheck = nodeService.getAssoc(anotherAssocId);
    assertEquals("Assoc fetched by ID is incorrect.", anotherAssocRef, anotherAssocRefCheck);
    
    // remove assocs
    List<AssociationRef> assocs = nodeService.getTargetAssocs(sourceRef, ASSOC_TYPE_QNAME_TEST_NEXT);
    for (AssociationRef assoc : assocs)
    {
        nodeService.removeAssociation(
                assoc.getSourceRef(),
                assoc.getTargetRef(),
                assoc.getTypeQName());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:BaseNodeServiceTest.java

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

示例5: getSourceAssocs

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

    if (reference != null)
    {

        List<AssociationRef> materialAssocs = new ArrayList<AssociationRef>();

        if (smartStore.canMaterialize(reference))
        {
            List<AssociationRef> sourceAssocs = theTrait.getSourceAssocs(smartStore.materialize(reference),
                                                                         qnamePattern);
            for (AssociationRef associationRef : sourceAssocs)
            {
                NodeRef sourceRef = associationRef.getSourceRef();
                Reference sourceReference = NodeProtocol.newReference(sourceRef,
                                                                      reference
                                                                                  .execute(new GetParentReferenceMethod()));
                AssociationRef virtualAssocRef = new AssociationRef(associationRef.getId(),
                                                                    sourceReference.toNodeRef(),
                                                                    associationRef.getTypeQName(),
                                                                    targetRef);
                materialAssocs.add(virtualAssocRef);
            }
        }

        // Download sources are deliberately not virtualized due to
        // performance and complexity issues.
        // However they could be detected using
        // if (qnamePattern.isMatch(DownloadModel.ASSOC_REQUESTED_NODES))

        return materialAssocs;
    }
    else
    {
        return theTrait.getSourceAssocs(targetRef,
                                        qnamePattern);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:VirtualNodeServiceExtension.java

示例6: createRelationship

import org.alfresco.service.cmr.repository.AssociationRef; //导入方法依赖的package包/类
@Override
public String createRelationship(
        String repositoryId, Properties properties, List<String> policies, Acl addAces,
        Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get type
    String objectTypeId = connector.getObjectTypeIdProperty(properties);
    final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_RELATIONSHIP);

    // get source object
    String sourceId = connector.getSourceIdProperty(properties);
    CMISNodeInfo sourceInfo = getOrCreateNodeInfo(sourceId, "Source");

    if (!sourceInfo.isVariant(CMISObjectVariant.CURRENT_VERSION) && !sourceInfo.isVariant(CMISObjectVariant.FOLDER) && !sourceInfo.isVariant(CMISObjectVariant.ITEM))
    {
        throw new CmisInvalidArgumentException("Source is not the latest version of a document, a folder or an item object!");
    }

    final NodeRef sourceNodeRef = sourceInfo.getNodeRef();

    // get target object
    String targetId = connector.getTargetIdProperty(properties);
    CMISNodeInfo targetInfo = getOrCreateNodeInfo(targetId, "Target");

    if (!targetInfo.isVariant(CMISObjectVariant.CURRENT_VERSION) && !targetInfo.isVariant(CMISObjectVariant.FOLDER) && !targetInfo.isVariant(CMISObjectVariant.ITEM))
    {
        throw new CmisInvalidArgumentException(
                "Target is not the latest version of a document, a folder or an item object!!");
    }

    final NodeRef targetNodeRef = targetInfo.getNodeRef();

    // check policies and ACLs
    if ((policies != null) && (!policies.isEmpty()))
    {
        throw new CmisConstraintException("Relationships are not policy controllable!");
    }

    if ((addAces != null) && (addAces.getAces() != null) && (!addAces.getAces().isEmpty()))
    {
        throw new CmisConstraintException("Relationships are not ACL controllable!");
    }

    if ((removeAces != null) && (removeAces.getAces() != null) && (!removeAces.getAces().isEmpty()))
    {
        throw new CmisConstraintException("Relationships are not ACL controllable!");
    }

    // create relationship
    // ALF-10085 : disable auditing behaviour for this use case
    boolean wasEnabled = connector.disableBehaviour(ContentModel.ASPECT_AUDITABLE, sourceNodeRef);        // Lasts for txn
    try
    {
        AssociationRef assocRef = connector.getNodeService().createAssociation(
                sourceNodeRef, targetNodeRef, type.getAlfrescoClass());

        return CMISConnector.ASSOC_ID_PREFIX + assocRef.getId();
    }
    finally
    {
        if(wasEnabled)
        {
            connector.enableBehaviour(ContentModel.ASPECT_AUDITABLE, sourceNodeRef);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:69,代码来源:AlfrescoCmisServiceImpl.java


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