當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeRef.equals方法代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.repository.NodeRef.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeRef.equals方法的具體用法?Java NodeRef.equals怎麽用?Java NodeRef.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.alfresco.service.cmr.repository.NodeRef的用法示例。


在下文中一共展示了NodeRef.equals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: allNodeRefsEqual

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
private boolean allNodeRefsEqual(Map<String, NodeRef> selected)
{
    NodeRef last = null;
    for (NodeRef current : selected.values())
    {
        if (last == null)
        {
            last = current;
        } else
        {
            if (!last.equals(current))
            {
                return false;
            }
        }
    }
    return true;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:19,代碼來源:CMISResultSetRow.java

示例2: alreadyCreated

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private boolean alreadyCreated(NodeRef nodeRef)
{
    Set<NodeRef> createdNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_CREATED_NODES);
    if (createdNodes != null)
    {
        for (NodeRef createdNodeRef : createdNodes)
        {
            if (createdNodeRef.equals(nodeRef))
            {
                if (logger.isDebugEnabled()) logger.debug("alreadyCreated: nodeRef="+nodeRef);
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ContentUsageImpl.java

示例3: alreadyDeleted

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private boolean alreadyDeleted(NodeRef nodeRef)
{
    Set<NodeRef> deletedNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_DELETED_NODES);
    if (deletedNodes != null)
    {
        for (NodeRef deletedNodeRef : deletedNodes)
        {
            if (deletedNodeRef.equals(nodeRef))
            {
                if (logger.isDebugEnabled()) logger.debug("alreadyDeleted: nodeRef="+nodeRef);
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ContentUsageImpl.java

示例4: importImportableItemMetadata

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
protected final void importImportableItemMetadata(NodeRef nodeRef, Path parentFile, MetadataLoader.Metadata metadata)
{
    // Attach aspects
    if (metadata.getAspects() != null)
    {
        for (final QName aspect : metadata.getAspects())
        {
            if (logger.isDebugEnabled()) logger.debug("Attaching aspect '" + aspect.toString() + "' to node '" + nodeRef.toString() + "'.");

            nodeService.addAspect(nodeRef, aspect, null);  // Note: we set the aspect's properties separately, hence null for the third parameter
        }
    }

    // Set property values for both the type and any aspect(s)
    if (metadata.getProperties() != null)
    {
        if (logger.isDebugEnabled()) logger.debug("Adding properties to node '" + nodeRef.toString() + "':\n" + mapToString(metadata.getProperties()));

        try
        {
            nodeService.addProperties(nodeRef, metadata.getProperties());
        }
        catch (final InvalidNodeRefException inre)
        {
            if (!nodeRef.equals(inre.getNodeRef()))
            {
                // Caused by an invalid NodeRef in the metadata (e.g. in an association)
                throw new IllegalStateException("Invalid nodeRef found in metadata for '" + getFileName(parentFile) + "'.  " +
                        "Probable cause: an association is being populated via metadata, but the " +
                        "NodeRef for the target of that association ('" + inre.getNodeRef() + "') is invalid.  " +
                        "Please double check your metadata file and try again.", inre);
            }
            else
            {
                // Logic bug in the BFSIT.  :-(
                throw inre;
            }
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:41,代碼來源:AbstractNodeImporter.java

示例5: setRulePosition

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public void setRulePosition(NodeRef nodeRef, NodeRef ruleNodeRef, int index)
{
    NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef);
    if (ruleFolder != null)
    {
        List<ChildAssociationRef> assocs = this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES_REGEX);
        List<ChildAssociationRef> orderedAssocs = new ArrayList<ChildAssociationRef>(assocs.size());
        ChildAssociationRef movedAssoc = null;
        for (ChildAssociationRef assoc : assocs)
        {
            NodeRef childNodeRef = assoc.getChildRef();
            if (childNodeRef.equals(ruleNodeRef) == true)
            {
                movedAssoc = assoc;
            }
            else
            {
                orderedAssocs.add(assoc);
            }
        }          
        if (movedAssoc != null)
        {
            orderedAssocs.add(index, movedAssoc);
        }
        
        index = 0;
        for (ChildAssociationRef orderedAssoc : orderedAssocs)
        {
            nodeService.setChildAssociationIndex(orderedAssoc, index);
            index++;
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:35,代碼來源:RuleServiceImpl.java

示例6: outputFileNodes

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Output the matching file paths a node contains based on a pattern search.
 * 
 * @param out Writer for output - relative paths separated by newline characters
 * @param surfConfigRef Surf-Config folder
 * @param fileInfo The FileInfo node to use as the parent
 * @param pattern Optional pattern to match filenames against ("*" is match all)
 * @param recurse True to recurse sub-directories
 * @throws IOException
 */
private void outputFileNodes(Writer out, FileInfo fileInfo, NodeRef surfConfigRef, String pattern, boolean recurse) throws IOException
{
    if (surfConfigRef != null)
    {
        final boolean debug = logger.isDebugEnabled();
        PagingResults<FileInfo> files = getFileNodes(fileInfo, pattern, recurse);
        
        final Map<NodeRef, String> nameCache = new HashMap<NodeRef, String>();
        for (final FileInfo file : files.getPage())
        {
            // walking up the parent tree manually until the "surf-config" parent is hit
            // and manually appending the rest of the cm:name path down to the node.
            final StringBuilder displayPath = new StringBuilder(64);
            NodeRef ref = unprotNodeService.getPrimaryParent(file.getNodeRef()).getParentRef();
            while (!ref.equals(surfConfigRef))
            {
                String name = nameCache.get(ref);
                if (name == null)
                {
                    name = (String) unprotNodeService.getProperty(ref, ContentModel.PROP_NAME);
                    nameCache.put(ref, name);
                }
                displayPath.insert(0, '/');
                displayPath.insert(0, name);
                ref = unprotNodeService.getPrimaryParent(ref).getParentRef();
            }
            
            out.write("/alfresco/site-data/");
            out.write(URLDecoder.decode(displayPath.toString()));
            out.write(URLDecoder.decode(file.getName()));
            out.write('\n');
            if (debug) logger.debug("   /alfresco/site-data/" + displayPath.toString() + file.getName());
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:46,代碼來源:ADMRemoteStore.java

示例7: removeEmptyParentFolders

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Removes the parent folder if it is empty and its parents up to but not
 * including the root.
 */
private void removeEmptyParentFolders(NodeRef parent, NodeRef root)
{
    // Parent folders we have created don't have an owner, were as
    // home folders do, hence the 3rd test (just in case) as we really
    // don't want to delete empty home folders.
    if (root != null &&
        !keepEmptyParents() &&
        nodeService.getProperty(parent, ContentModel.PROP_OWNER) == null)
    {   
        // Do nothing if root is not an ancestor of parent.
        NodeRef nodeRef = parent;
        while (!root.equals(nodeRef))
        {
            if (nodeRef == null)
            {
                return;
            }
            nodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
        }
       
        // Remove any empty nodes.
        while (!root.equals(parent))
        {
            nodeRef = parent;
            parent = nodeService.getPrimaryParent(parent).getParentRef();

            if (!nodeService.getChildAssocs(nodeRef).isEmpty())
            {
                return;
            }
            if (logger.isInfoEnabled())
            {
                logger.info("       rm "+toPath(root, nodeRef));
            }
            nodeService.deleteNode(nodeRef);
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:43,代碼來源:HomeFolderProviderSynchronizer.java

示例8: validateRenditionAssociation

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
private void validateRenditionAssociation(ChildAssociationRef chAssRef, QName renderingActionQName)
{
    assertEquals("The assoc type name was wrong", RenditionModel.ASSOC_RENDITION, chAssRef.getTypeQName());
    assertEquals("The assoc name was wrong", renderingActionQName, chAssRef.getQName());

    assertTrue("The source node should have the rn:renditioned aspect applied", nodeService.hasAspect(chAssRef
                .getParentRef(), RenditionModel.ASPECT_RENDITIONED));

    final NodeRef newRenditionNodeRef = chAssRef.getChildRef();
    assertTrue("The new rendition node was not a rendition.", renditionService.isRendition(newRenditionNodeRef));

    // If the source node for the rendition equals the primary parent
    NodeRef renditionSource = renditionService.getSourceNode(newRenditionNodeRef).getParentRef();
    NodeRef renditionPrimaryParent = nodeService.getPrimaryParent(newRenditionNodeRef).getParentRef();
    if (renditionSource.equals(renditionPrimaryParent))
    {
        assertTrue("Rendition node was missing the hiddenRendition aspect", nodeService.hasAspect(
                    newRenditionNodeRef, RenditionModel.ASPECT_HIDDEN_RENDITION));
    }
    else
    {
        assertTrue("Rendition node was missing the visibleRendition aspect", nodeService.hasAspect(
                    newRenditionNodeRef, RenditionModel.ASPECT_VISIBLE_RENDITION));
    }

    assertEquals(ContentModel.PROP_CONTENT, nodeService.getProperty(newRenditionNodeRef,
                ContentModel.PROP_CONTENT_PROPERTY_NAME));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:29,代碼來源:RenditionServiceIntegrationTest.java

示例9: startReference

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
public void startReference(NodeRef nodeRef, QName childName)
{
    try
    {
        // determine format of reference e.g. node or path based
        ReferenceType referenceFormat = referenceType;
        if (nodeRef.equals(nodeService.getRootNode(nodeRef.getStoreRef())))
        {
            referenceFormat = ReferenceType.PATHREF;
        }

        // output reference
        AttributesImpl attrs = new AttributesImpl(); 
        if (referenceFormat.equals(ReferenceType.PATHREF))
        {
            Path path = createPath(context.getExportParent(), context.getExportParent(), nodeRef);            
            attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, PATHREF_LOCALNAME, PATHREF_QNAME.toPrefixString(), null, path.toPrefixString(namespaceService));
        }
        else
        {
            attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, NODEREF_LOCALNAME, NODEREF_QNAME.toPrefixString(), null, nodeRef.toString());
        }
        if (childName != null)
        {
            attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, CHILDNAME_LOCALNAME, CHILDNAME_QNAME.toPrefixString(), null, childName.toPrefixString(namespaceService));
        }
        contentHandler.startElement(REFERENCE_QNAME.getNamespaceURI(), REFERENCE_LOCALNAME, toPrefixString(REFERENCE_QNAME), attrs);
    }
    catch (SAXException e)
    {
        throw new ExporterException("Failed to process start reference", e);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:34,代碼來源:ViewXMLExporter.java

示例10: createIndexedPath

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Helper to convert a path into an indexed path which uniquely identifies a node
 * 
 * @param nodeRef NodeRef
 * @param path Path
 * @return Path
 */
private Path createIndexedPath(NodeRef nodeRef, Path path)
{
    // Add indexes for same name siblings
    // TODO: Look at more efficient approach
    for (int i = path.size() - 1; i >= 0; i--)
    {
        Path.Element pathElement = path.get(i);
        if (i > 0 && pathElement instanceof Path.ChildAssocElement)
        {
            int index = 1;  // for xpath index compatibility
            String searchPath = path.subPath(i).toPrefixString(namespaceService);
            List<NodeRef> siblings = searchService.selectNodes(nodeRef, searchPath, null, namespaceService, false);
            if (siblings.size() > 1)
            {
                ChildAssociationRef childAssoc = ((Path.ChildAssocElement)pathElement).getRef();
                NodeRef childRef = childAssoc.getChildRef();
                for (NodeRef sibling : siblings)
                {
                    if (sibling.equals(childRef))
                    {
                        childAssoc.setNthSibling(index);
                        break;
                    }
                    index++;
                }
            }
        }
    }
    
    return path;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:39,代碼來源:ViewXMLExporter.java

示例11: manageRenditionAspects

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的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

示例12: createNode

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public void createNode(ChildAssociationRef relationshipRef) throws LuceneIndexException
{
    NodeRef childRef = relationshipRef.getChildRef();
    // If we have the root node we delete all other root nodes first
    if ((relationshipRef.getParentRef() == null) && childRef.equals(nodeService.getRootNode(childRef.getStoreRef())))
    {
        // do the root node only
        super.createNode(relationshipRef);
    }
    else
    {
        // Nothing
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:16,代碼來源:ADMLuceneNoActionIndexerImpl.java

示例13: updateNode

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
@Override
public void updateNode(NodeRef nodeRef) throws LuceneIndexException
{
    if((nodeService.hasAspect(nodeRef, ContentModel.ASPECT_ROOT) && nodeRef.equals(nodeService.getRootNode(nodeRef.getStoreRef()))))
    {
        super.updateNode(nodeRef);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:9,代碼來源:ADMLuceneNoActionIndexerImpl.java

示例14: getTranslatedNodeRef

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Converts the node referenice where an alternative translation should be used.
 * 
 * @param nodeRef       the basic nodeRef
 * @return              Returns the replacement if required
 */
private NodeRef getTranslatedNodeRef(NodeRef nodeRef)
{
    // Ignore null
    if (nodeRef == null)
    {
        return nodeRef;
    }
    // Ignore everything without the correct aspect
    if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
    {
        return nodeRef;
    }
    Locale filterLocale = I18NUtil.getContentLocaleOrNull();
    if (filterLocale == null)
    {
        // We aren't doing any filtering
        return nodeRef;
    }
    // Find the best translation.  This won't return null.
    NodeRef translatedNodeRef = multilingualContentService.getTranslationForLocale(nodeRef, filterLocale);
    // Done
    if (logger.isDebugEnabled())
    {
        if (nodeRef.equals(translatedNodeRef))
        {
            logger.debug("NodeRef substitution: " + nodeRef + " --> " + translatedNodeRef);
        }
        else
        {
            logger.debug("NodeRef substitution: " + nodeRef + " (no change)");
        }
    }
    return translatedNodeRef;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:41,代碼來源:MLTranslationInterceptor.java

示例15: getAssociationCopyInfo

import org.alfresco.service.cmr.repository.NodeRef; //導入方法依賴的package包/類
/**
 * Calculates {@link QName} type of target association, which will be created after copying
 * 
 * @param sourceNodeRef             the node that will be copied (never <tt>null</tt>)
 * @param sourceParentRef           the parent of the node being copied (may be <tt>null</tt>)
 * @param newName                   the planned new name of the node
 * @param nameChanged               <tt>true</tt> if the name of the node is being changed
 * @return                          Returns the path part for a new association and the effective
 *                                  primary parent association that was used
 */
protected AssociationCopyInfo getAssociationCopyInfo(
        NodeService nodeService,
        NodeRef sourceNodeRef,
        NodeRef sourceParentRef,
        String newName, boolean nameChanged)
{
    // we need the current association type
    ChildAssociationRef primaryAssocRef = nodeService.getPrimaryParent(sourceNodeRef);

    // Attempt to find a template association reference for the new association
    ChildAssociationRef sourceParentAssocRef = primaryAssocRef;
    if (sourceParentRef != null)
    {
        // We have been given a source parent node
        boolean copyingFromPrimaryParent = sourceParentRef.equals(primaryAssocRef.getParentRef());
        if (!copyingFromPrimaryParent)
        {
            // We are not copying from the primary parent.
            // Find a random association to the source parent to use as a template
            List<ChildAssociationRef> assocList = nodeService.getParentAssocs(sourceNodeRef);
            for (ChildAssociationRef assocListEntry : assocList)
            {
                if (sourceParentRef.equals(assocListEntry.getParentRef()))
                {
                    sourceParentAssocRef = assocListEntry;
                    break;
                }
            }
        }
    }

    QName targetAssocQName = null;
    QName existingQName = sourceParentAssocRef.getQName();
    if (nameChanged && !systemNamespaces.contains(existingQName.getNamespaceURI()))
    {
        // Change the localname to match the new name
        targetAssocQName = QName.createQName(sourceParentAssocRef.getQName().getNamespaceURI(), QName.createValidLocalName(newName));
    }
    else
    {
        // Keep the localname
        targetAssocQName = existingQName;
    }

    return new AssociationCopyInfo(targetAssocQName, sourceParentAssocRef);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:57,代碼來源:AbstractBaseCopyService.java


注:本文中的org.alfresco.service.cmr.repository.NodeRef.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。