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


Java ChildAssociationRef.getParentRef方法代码示例

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


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

示例1: removeParentsFromChildAuthorityCache

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Remove entries for the parents of the given node.
 * 
 * @param lock          <tt>true</tt> if the cache modifications need to be locked
 *                      i.e. if the caller is handling a <b>beforeXYZ</b> callback.
 */
private void removeParentsFromChildAuthorityCache(NodeRef nodeRef, boolean lock)
{
    // Get the transactional version of the cache if we need locking
    TransactionalCache<NodeRef, Pair<Map<NodeRef,String>, List<NodeRef>>> childAuthorityCacheTxn = null;
    if (lock && childAuthorityCache instanceof TransactionalCache)
    {
        childAuthorityCacheTxn = (TransactionalCache<NodeRef, Pair<Map<NodeRef,String>, List<NodeRef>>>) childAuthorityCache;
    }
    
    // Iterate over all relevant parents of the given node
    for (ChildAssociationRef car: nodeService.getParentAssocs(nodeRef))
    {
        NodeRef parentRef = car.getParentRef();
        if (dictionaryService.isSubClass(nodeService.getType(parentRef), ContentModel.TYPE_AUTHORITY_CONTAINER))
        {
            TransactionalResourceHelper.getSet(PARENTS_OF_DELETING_CHILDREN_SET_RESOURCE).add(parentRef);
            childAuthorityCache.remove(parentRef);
            if (childAuthorityCacheTxn != null)
            {
                childAuthorityCacheTxn.lockValue(parentRef);
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:AuthorityDAOImpl.java

示例2: removeAuthorityFromZones

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
public void removeAuthorityFromZones(String authorityName, Set<String> zones)
{
    if ((zones != null) && (zones.size() > 0))
    {
        NodeRef authRef = getAuthorityOrNull(authorityName);
        List<ChildAssociationRef> results = nodeService.getParentAssocs(authRef, ContentModel.ASSOC_IN_ZONE, RegexQNamePattern.MATCH_ALL);
        for (ChildAssociationRef current : results)
        {
            NodeRef zoneRef = current.getParentRef();
            Serializable value = nodeService.getProperty(zoneRef, ContentModel.PROP_NAME);
            if (value == null)
            {
                continue;
            }
            else
            {
                String testZone = DefaultTypeConverter.INSTANCE.convert(String.class, value);
                if (zones.contains(testZone))
                {
                    nodeService.removeChildAssociation(current);
                }
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AuthorityDAOImpl.java

示例3: invokeBeforeDeleteChildAssociation

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * @see NodeServicePolicies.BeforeDeleteChildAssociationPolicy#beforeDeleteChildAssociation(ChildAssociationRef)
 */
protected void invokeBeforeDeleteChildAssociation(ChildAssociationRef childAssocRef)
{
    NodeRef parentNodeRef = childAssocRef.getParentRef();
    
    if (ignorePolicy(parentNodeRef))
    {
        return;
    }
    
    QName assocTypeQName = childAssocRef.getTypeQName();
    // get qnames to invoke against
    Set<QName> qnames = getTypeAndAspectQNames(parentNodeRef);
    // execute policy for node type and aspects
    NodeServicePolicies.BeforeDeleteChildAssociationPolicy policy = beforeDeleteChildAssociationDelegate.get(parentNodeRef, qnames, assocTypeQName);
    policy.beforeDeleteChildAssociation(childAssocRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:AbstractNodeServiceImpl.java

示例4: onDeleteNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
{
    // add the child to the list
    deletedNodeRefs.add(childAssocRef.getChildRef());
    
    if(onDeleteCreateChild)
    {
        System.out.println("on delete node - add sibling.");
        // now perform some nasties on the node's parent, i.e. add a new child
        NodeRef parentRef = childAssocRef.getParentRef();
        NodeRef childRef = childAssocRef.getChildRef();
        ChildAssociationRef assocRef = nodeService.createNode(
            parentRef,
            ASSOC_TYPE_QNAME_TEST_CHILDREN,
            QName.createQName("post-delete new child"),
            ContentModel.TYPE_CONTAINER);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:BaseNodeServiceTest.java

示例5: deleteNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
public void deleteNode(ChildAssociationRef relationshipRef) throws LuceneIndexException
{
    if (s_logger.isDebugEnabled())
    {
        NodeRef parentRef = relationshipRef.getParentRef();
        Path path = parentRef == null ? new Path() : nodeService.getPath(parentRef);
        path.append(new ChildAssocElement(relationshipRef));
        s_logger.debug("Delete node " + path + " " + relationshipRef.getChildRef());
    }
    checkAbleToDoWork(IndexUpdateStatus.SYNCRONOUS);
    try
    {
        if (!relationshipRef.getChildRef().getStoreRef().equals(store))
        {
            throw new LuceneIndexException("Delete node failed - node is not in the required store");
        }
        delete(relationshipRef.getChildRef());
    }
    catch (LuceneIndexException e)
    {
        setRollbackOnly();
        throw new LuceneIndexException("Delete node failed", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ADMLuceneIndexerImpl.java

示例6: getParent

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Gets the parent node of the items to be exported
 * 
 * @param exportOf NodeRef
 * @param exportSelf boolean
 * @return NodeRef
 */
private NodeRef getParent(NodeRef exportOf, boolean exportSelf)
{
    NodeRef parent = null;
    
    if (exportSelf)
    {
        NodeRef rootNode = nodeService.getRootNode(exportOf.getStoreRef());
        if (rootNode.equals(exportOf))
        {
            parent = exportOf;
        }
        else
        {
            ChildAssociationRef parentRef = nodeService.getPrimaryParent(exportOf);
            parent = parentRef.getParentRef();
        }
    }
    else
    {
        parent = exportOf;
    }
    
    return parent;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:ExporterComponent.java

示例7: invokeOnDeleteChildAssociation

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * @see NodeServicePolicies.OnDeleteChildAssociationPolicy#onDeleteChildAssociation(ChildAssociationRef)
 */
protected void invokeOnDeleteChildAssociation(ChildAssociationRef childAssocRef)
{
    NodeRef parentNodeRef = childAssocRef.getParentRef();
    
    if (ignorePolicy(parentNodeRef))
    {
        return;
    }
    
    QName assocTypeQName = childAssocRef.getTypeQName();
    // get qnames to invoke against
    Set<QName> qnames = getTypeAndAspectQNames(parentNodeRef);
    // execute policy for node type and aspects
    NodeServicePolicies.OnDeleteChildAssociationPolicy policy = onDeleteChildAssociationDelegate.get(parentNodeRef, qnames, assocTypeQName);
    policy.onDeleteChildAssociation(childAssocRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:AbstractNodeServiceImpl.java

示例8: invokeOnCreateChildAssociation

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * @see NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(ChildAssociationRef, boolean)
 */
protected void invokeOnCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
{
    // Get the parent reference and the assoc type qName
    NodeRef parentNodeRef = childAssocRef.getParentRef();
    
    if (ignorePolicy(parentNodeRef))
    {
        return;
    }
    
    QName assocTypeQName = childAssocRef.getTypeQName();
    // get qnames to invoke against
    Set<QName> qnames = getTypeAndAspectQNames(parentNodeRef);
    // execute policy for node type and aspects
    NodeServicePolicies.OnCreateChildAssociationPolicy policy = onCreateChildAssociationDelegate.get(parentNodeRef, qnames, assocTypeQName);
    policy.onCreateChildAssociation(childAssocRef, isNewNode);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:AbstractNodeServiceImpl.java

示例9: getSingleChildAssocNode

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

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

示例11: testCreate_NodeProtocolParent

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
@Test
public void testCreate_NodeProtocolParent() throws Exception
{
    NodeRef assocNode2 = nodeService.getChildByName(virtualFolder1NodeRef,
                                                    ContentModel.ASSOC_CONTAINS,
                                                    "Node2");
    NodeRef assocNode2_1 = nodeService.getChildByName(assocNode2,
                                                      ContentModel.ASSOC_CONTAINS,
                                                      "Node2_1");
    ChildAssociationRef childAssocRef = createContent(assocNode2_1,
                                                      "Content");
    NodeRef node = childAssocRef.getChildRef();
    Reference reference = Reference.fromNodeRef(node);
    assertNotNull(reference);
    assertTrue(reference.getProtocol().equals(Protocols.NODE.protocol));
    
    QName nodeTypeQName = ContentModel.TYPE_THUMBNAIL;
    QName assocQName = QName.createQName("cm", "contentThumbnail", environment.getNamespacePrefixResolver());
    QName assocTypeQName = RenditionModel.ASSOC_RENDITION;
    ChildAssociationRef assoc = nodeService.createNode(node,
                                          assocTypeQName,
                                          assocQName,
                                          nodeTypeQName);
    NodeRef virtualRenditionNode = assoc.getChildRef();
    NodeRef virtualRenditionParent = assoc.getParentRef();        
    assertEquals(node, virtualRenditionParent);
    
    Reference child = Reference.fromNodeRef(virtualRenditionNode);
    Reference parent = Reference.fromNodeRef(virtualRenditionParent);
    NodeRef physicalRenditionNode = child.execute(new GetActualNodeRefMethod(environment));
    NodeRef physicalRenditionParent = parent.execute(new GetActualNodeRefMethod(environment));
    List<ChildAssociationRef> refs = nodeService.getChildAssocs(physicalRenditionParent);
    assertEquals(physicalRenditionNode, refs.get(0).getChildRef()); // the association exists for the physical nodes
    
    List<ChildAssociationRef> virtualRefs = nodeService.getChildAssocs(virtualRenditionParent);
    assertEquals(physicalRenditionNode, virtualRefs.get(0).getChildRef()); // the association exists for the virtual nodes
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:VirtualNodeServiceExtensionTest.java

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

示例13: manageRenditionAspects

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * This method manages the <code>rn:rendition</code> aspects on the rendition node. It applies the
 * correct rendition aspect based on the rendition node's location and removes any out-of-date rendition
 * aspect.
 */
private void manageRenditionAspects(NodeRef sourceNode, ChildAssociationRef renditionParentAssoc)
{
    NodeRef renditionNode = renditionParentAssoc.getChildRef();
    NodeRef primaryParent = renditionParentAssoc.getParentRef();

    // If the rendition is located directly underneath its own source node
    if (primaryParent.equals(sourceNode))
    {
        // It should be a 'hidden' rendition.
        // Ensure we do not update the 'modifier' due to rendition addition
        behaviourFilter.disableBehaviour(renditionNode, ContentModel.ASPECT_AUDITABLE);
        try
        {
            nodeService.addAspect(renditionNode, RenditionModel.ASPECT_HIDDEN_RENDITION, null);
            nodeService.removeAspect(renditionNode, RenditionModel.ASPECT_VISIBLE_RENDITION);
        }
        finally
        {
            behaviourFilter.enableBehaviour(renditionNode, ContentModel.ASPECT_AUDITABLE);
        }
        // We remove the other aspect to cover the potential case where a
        // rendition
        // has been updated in a different location.
    } else
    {
        // Renditions stored underneath any node other than their source are
        // 'visible'.
        behaviourFilter.disableBehaviour(renditionNode, ContentModel.ASPECT_AUDITABLE);
        try
        {
            nodeService.addAspect(renditionNode, RenditionModel.ASPECT_VISIBLE_RENDITION, null);
            nodeService.removeAspect(renditionNode, RenditionModel.ASPECT_HIDDEN_RENDITION);
        }
        finally
        {
            behaviourFilter.enableBehaviour(renditionNode, ContentModel.ASPECT_AUDITABLE);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:45,代码来源:AbstractRenderingEngine.java

示例14: getNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public NodeRef getNode(NodeRef source, Map<String, Serializable> params)
{
    QName type = getQNameParam(TYPE_KEY, params);
    QName aspect = getQNameParam(ASPECT_KEY, params);
    NodeRef child = source;
    while (true)
    {
        ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(child);
        if (parentAssoc == null)
        {
            break; // No matching ancestor found.
        }
        NodeRef parent = parentAssoc.getParentRef();
        if (parent == null)
        {
            break; // No matching ancestor found.
        }
        if (typeMatches(type, parent) && aspectMatches(aspect, parent))
        {
            return parent; // Matching ancestor was found.
        }
        child = parent;
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:AncestorNodeLocator.java

示例15: getParentAxisIterator

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
public Iterator getParentAxisIterator(Object o) throws UnsupportedAxisException
{
    ArrayList<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>(1);
    // Iterator of ??
    if (o instanceof ChildAssociationRef)
    {
        ChildAssociationRef contextRef = (ChildAssociationRef) o;
        if (contextRef.getParentRef() != null)
        {
            if (followAllParentLinks)
            {
                for (ChildAssociationRef car : nodeService.getParentAssocs(contextRef.getChildRef()))
                {
                    parents.add(nodeService.getPrimaryParent(car.getParentRef()));
                }
            }
            else
            {
                parents.add(nodeService.getPrimaryParent(contextRef.getParentRef()));
            }
        }
    }
    if (o instanceof Property)
    {
        Property p = (Property) o;
        parents.add(nodeService.getPrimaryParent(p.parent));
    }
    return parents.iterator();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:DocumentNavigator.java


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