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


Java Path.ChildAssocElement方法代码示例

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


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

示例1: startNode

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
public void startNode(NodeRef nodeRef)
{
    try
    {
        AttributesImpl attrs = new AttributesImpl(); 

        Path path = nodeService.getPath(nodeRef);
        if (path.size() > 1)
        {
            // a child name does not exist for root
            Path.ChildAssocElement pathElement = (Path.ChildAssocElement)path.last();
            QName childQName = pathElement.getRef().getQName();
            attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, CHILDNAME_LOCALNAME, CHILDNAME_QNAME.toPrefixString(), null, toPrefixString(childQName));
        }
        
        QName type = nodeService.getType(nodeRef);
        contentHandler.startElement(type.getNamespaceURI(), type.getLocalName(), toPrefixString(type), attrs);
    }
    catch (SAXException e)
    {
        throw new ExporterException("Failed to process start node event - node ref " + nodeRef.toString(), e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:ViewXMLExporter.java

示例2: buildXPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
private String buildXPath(Path path)
{
    StringBuilder pathBuffer = new StringBuilder(64);
    for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
    {
        Path.Element element = elit.next();
        if (!(element instanceof Path.ChildAssocElement))
        {
            throw new IndexerException("Confused path: " + path);
        }
        Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
        if (cae.getRef().getParentRef() != null)
        {
            pathBuffer.append("/");
            pathBuffer.append(getPrefix(cae.getRef().getQName().getNamespaceURI()));
            pathBuffer.append(ISO9075.encode(cae.getRef().getQName().getLocalName()));
        }
    }
    return pathBuffer.toString();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:LuceneCategoryServiceImpl.java

示例3: getParents

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
private ArrayList<NodeRef> getParents(Path path)
{
    ArrayList<NodeRef> parentsInDepthOrderStartingWithSelf = new ArrayList<NodeRef>(8);
    for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
    {
        Path.Element element = elit.next();
        if (!(element instanceof Path.ChildAssocElement))
        {
            throw new IndexerException("Confused path: " + path);
        }
        Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
        parentsInDepthOrderStartingWithSelf.add(0, tenantService.getName(cae.getRef().getChildRef()));

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

示例4: isSystemPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
private boolean isSystemPath(NodeRef parentNodeRef, String filename)
{
    boolean ret = false;
    Path path = nodeService.getPath(parentNodeRef);

    Iterator<Element> it = path.iterator();
    while(it.hasNext())
    {
        Path.ChildAssocElement elem = (Path.ChildAssocElement)it.next();
        QName qname = elem.getRef().getQName();
        if(qname != null && systemPaths.isFiltered(qname.getLocalName()))
        {
            ret = true;
            break;
        }
    }

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

示例5: onHiddenPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * Checks whether the node is on a hidden path
 *
 * @param nodeRef NodeRef
 * @return the matching filter, or null if no match
 */
public HiddenFileInfo onHiddenPath(NodeRef nodeRef)
{
    HiddenFileInfo ret = null;
    // TODO would be nice to check each part of the path in turn, bailing out if a match is found
    Path path = nodeService.getPath(nodeRef);
    nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);

    Iterator<Element> it = path.iterator();
    while(it.hasNext())
    {
        Path.ChildAssocElement elem = (Path.ChildAssocElement)it.next();
        QName qname = elem.getRef().getQName();
        if(qname != null)
        {
            ret = isHidden(qname.getLocalName());
            if(ret != null)
            {
                break;
            }
        }
    }

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

示例6: getAncestors

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
private ArrayList<NodeRef> getAncestors(Path path)
{
    ArrayList<NodeRef> ancestors = new ArrayList<NodeRef>(8);
    for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
    {
        Path.Element element = elit.next();
        if (!(element instanceof Path.ChildAssocElement))
        {
            throw new IndexerException("Confused path: " + path);
        }
        Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
        NodeRef parentRef = cae.getRef().getParentRef();
        if(parentRef != null)
        {
            ancestors.add(0, parentRef);
        }

    }
    return ancestors;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:NodesMetaDataGet.java

示例7: createIndexedPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的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

示例8: createQNamePaths

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * @return an array containing the plain qname path at index 0 and the
 *         ISO9075 element-encoded qname path at index 1
 */
private String[] createQNamePaths()
{
    final NamespaceService ns = serviceRegistry.getNamespaceService();
    final Map<String, String> cache = new HashMap<String, String>();
    final StringBuilder bufPlain = new StringBuilder(128);
    final StringBuilder bufISO9075 = new StringBuilder(128);

    final Path path = serviceRegistry.getNodeService().getPath(context.getActualNodeRef());
    for (final Path.Element e : path)
    {
        if (e instanceof Path.ChildAssocElement)
        {
            final QName qname = ((Path.ChildAssocElement) e).getRef().getQName();
            if (qname != null)
            {
                String prefix = cache.get(qname.getNamespaceURI());
                if (prefix == null)
                {
                    // first request for this namespace prefix, get and
                    // cache result
                    Collection<String> prefixes = ns.getPrefixes(qname.getNamespaceURI());
                    prefix = prefixes.size() != 0 ? prefixes.iterator().next() : "";
                    cache.put(qname.getNamespaceURI(),
                              prefix);
                }
                bufISO9075.append('/').append(prefix).append(':').append(ISO9075.encode(qname.getLocalName()));
                bufPlain.append('/').append(prefix).append(':').append(qname.getLocalName());
            }
        }
        else
        {
            bufISO9075.append('/').append(e.toString());
            bufPlain.append('/').append(e.toString());
        }
    }
    String[] qnamePaths = new String[] { bufPlain.toString(), bufISO9075.toString() };

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

示例9: getDisplayPath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * Return the human readable form of the specified node Path. Fast version
 * of the method that simply converts QName localname components to Strings.
 * 
 * @param path Path to extract readable form from
 * @param showLeaf Whether to process the final leaf element of the path
 * 
 * @return human readable form of the Path
 */
public static String getDisplayPath(Path path, boolean showLeaf)
{
    // This method was moved here from org.alfresco.web.bean.repository.Repository
    StringBuilder buf = new StringBuilder(64);

    int count = path.size() - (showLeaf ? 0 : 1);
    for (int i = 0; i < count; i++)
    {
        String elementString = null;
        Path.Element element = path.get(i);
        if (element instanceof Path.ChildAssocElement)
        {
            ChildAssociationRef elementRef = ((Path.ChildAssocElement) element).getRef();
            if (elementRef.getParentRef() != null)
            {
                elementString = elementRef.getQName().getLocalName();
            }
        } else
        {
            elementString = element.getElementString();
        }

        if (elementString != null)
        {
            buf.append("/");
            buf.append(elementString);
        }
    }

    return buf.toString();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:PathUtil.java

示例10: getQnamePath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * @return QName path to this node. This can be used for Lucene PATH: style queries
 */
public String getQnamePath()
{
    if (this.qnamePath == null)
    {
        final NamespaceService ns = this.services.getNamespaceService();
        final Map<String, String> cache = new HashMap<String, String>();
        final StringBuilder buf = new StringBuilder(128);
        final Path path = this.services.getNodeService().getPath(getNodeRef());
        for (final Path.Element e : path)
        {
            if (e instanceof Path.ChildAssocElement)
            {
                final QName qname = ((Path.ChildAssocElement)e).getRef().getQName();
                if (qname != null)
                {
                    String prefix = cache.get(qname.getNamespaceURI());
                    if (prefix == null)
                    {
                        // first request for this namespace prefix, get and cache result
                        Collection<String> prefixes = ns.getPrefixes(qname.getNamespaceURI());
                        prefix = prefixes.size() != 0 ? prefixes.iterator().next() : "";
                        cache.put(qname.getNamespaceURI(), prefix);
                    }
                    buf.append('/').append(prefix).append(':').append(ISO9075.encode(qname.getLocalName()));
                }
            }
            else
            {
                buf.append('/').append(e.toString());
            }
        }
        this.qnamePath = buf.toString();
    }
    
    return this.qnamePath;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:40,代码来源:ScriptNode.java

示例11: getPathFromSpaceRef

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * Generate a search XPATH pointing to the specified node, optionally return an XPATH
 * that includes the child nodes.
 *  
 * @param ref         Of the node to generate path too
 * @param children   Whether to include children of the node
 * 
 * @return the path
 */
public static String getPathFromSpaceRef(NodeRef ref, boolean children)
{
   FacesContext context = FacesContext.getCurrentInstance();
   Path path = Repository.getServiceRegistry(context).getNodeService().getPath(ref);
   NamespaceService ns = Repository.getServiceRegistry(context).getNamespaceService();
   StringBuilder buf = new StringBuilder(64);
   for (int i=0; i<path.size(); i++)
   {
      String elementString = "";
      Path.Element element = path.get(i);
      if (element instanceof Path.ChildAssocElement)
      {
         ChildAssociationRef elementRef = ((Path.ChildAssocElement)element).getRef();
         if (elementRef.getParentRef() != null)
         {
            Collection<String> prefixes = ns.getPrefixes(elementRef.getQName().getNamespaceURI());
            if (prefixes.size() >0)
            {
               elementString = '/' + (String)prefixes.iterator().next() + ':' + ISO9075.encode(elementRef.getQName().getLocalName());
            }
         }
      }
      
      buf.append(elementString);
   }
   if (children == true)
   {
      // append syntax to get all children of the path
      buf.append("//*");
   }
   else
   {
      // append syntax to just represent the path, not the children
      buf.append("/*");
   }
   
   return buf.toString();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:48,代码来源:SearchContext.java

示例12: getRelativePath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * @return the relative 'path' (a list of folder names) of the {@code homeFolder}
 * from the {@code root} or {@code null} if the homeFolder is not under the root
 * or is the root. An empty list is returned if the homeFolder is the same as the
 * root or the root is below the homeFolder.
 */
private List<String> getRelativePath(NodeRef root, NodeRef homeFolder)
{
    if (root == null || homeFolder == null)
    {
        return null;
    }
    
    if (root.equals(homeFolder))
    {
        return Collections.emptyList();
    }
    
    Path rootPath = nodeService.getPath(root);
    Path homeFolderPath = nodeService.getPath(homeFolder);
    int rootSize = rootPath.size();
    int homeFolderSize = homeFolderPath.size();
    if (rootSize >= homeFolderSize)
    {
        return Collections.emptyList();
    }
    
    // Check homeFolder is under root
    for (int i=0; i < rootSize; i++)
    {
        if (!rootPath.get(i).equals(homeFolderPath.get(i)))
        {
            return null;
        }
    }
    
    // Build up path of sub folders
    List<String> path = new ArrayList<String>();
    for (int i = rootSize; i < homeFolderSize; i++)
    {
        Path.Element element = homeFolderPath.get(i);
        if (!(element instanceof Path.ChildAssocElement))
        {
            return null;
        }
        QName folderQName = ((Path.ChildAssocElement) element).getRef().getQName();
        path.add(folderQName.getLocalName());
    }
    return path;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:51,代码来源:HomeFolderProviderSynchronizer.java

示例13: isWithinExport

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * Determine if specified Node Reference is within the set of nodes to be exported
 * 
 * @param nodeRef  node reference to check
 * @return  true => node reference is within export set
 */
private boolean isWithinExport(NodeRef nodeRef, ExporterCrawlerParameters parameters)
{
    boolean isWithin = false;

    try
    {
        // Current strategy is to determine if node is a child of the root exported node
        for (NodeRef exportRoot : context.getExportList())
        {
            if (nodeRef.equals(exportRoot) && parameters.isCrawlSelf() == true)
            {
                // node to export is the root export node (and root is to be exported)
                isWithin = true;
            }
            else
            {
                // locate export root in primary parent path of node
                Path nodePath = nodeService.getPath(nodeRef);
                for (int i = nodePath.size() - 1; i >= 0; i--)
                {
                    Path.ChildAssocElement pathElement = (Path.ChildAssocElement) nodePath.get(i);
                    if (pathElement.getRef().getChildRef().equals(exportRoot))
                    {
                        isWithin = true;
                        break;
                    }
                }
            }
        }
    }
    catch (AccessDeniedException accessErr)
    {
        // use default if this occurs
    }
    catch (InvalidNodeRefException nodeErr)
    {
        // use default if this occurs
    }

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

示例14: findMatch

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
private HiddenFileInfo findMatch(NodeRef nodeRef)
{
    HiddenFileInfo ret = null;
    Path path = null;
    String name = null;

    OUTER: for(HiddenFileInfo filter : filters)
    {
        if (Client.cmis.equals(FileFilterMode.getClient()) && filter instanceof ConfigurableHiddenFileInfo)
        {
            if (((ConfigurableHiddenFileInfo) filter).isCmisDisableHideConfig())
            {
                continue;
            }
        }
    	if(filter.cascadeHiddenAspect() || filter.cascadeIndexControlAspect())
    	{
    		if(path == null)
    		{
    			path = nodeService.getPath(nodeRef);
    		}

            // TODO would be nice to check each part of the path in turn, bailing out if a match is found
            Iterator<Element> it = path.iterator();
            while(it.hasNext())
            {
                Path.ChildAssocElement elem = (Path.ChildAssocElement)it.next();
                QName qname = elem.getRef().getQName();
                if(qname != null)
                {
        			if(filter.isHidden(qname.getLocalName()))
        			{
        				ret = filter;
                        break OUTER;
                    }
                }
    		}
    	}
    	else
    	{
    		if(name == null)
    		{
    			name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
    		}

         if(filter.isHidden(name))
         {
         	ret = filter;
         	break;
         }
    	}
    }

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

示例15: getQnamePath

import org.alfresco.service.cmr.repository.Path; //导入方法依赖的package包/类
/**
 * @return QName path to this node. This can be used for Lucene PATH: style queries
 */
public String getQnamePath()
{
    if (this.qnamePath == null)
    {
        final NamespaceService ns = this.services.getNamespaceService();
        final Map<String, String> cache = new HashMap<String, String>();
        final StringBuilder buf = new StringBuilder(128);
        final Path path = this.services.getNodeService().getPath(getNodeRef());
        for (final Path.Element e : path)
        {
            if (e instanceof Path.ChildAssocElement)
            {
                final QName qname = ((Path.ChildAssocElement)e).getRef().getQName();
                if (qname != null)
                {
                    String prefix = cache.get(qname.getNamespaceURI());
                    if (prefix == null)
                    {
                        // first request for this namespace prefix, get and cache result
                        Collection<String> prefixes = ns.getPrefixes(qname.getNamespaceURI());
                        prefix = prefixes.size() != 0 ? prefixes.iterator().next() : "";
                        cache.put(qname.getNamespaceURI(), prefix);
                    }
                    buf.append('/');
                    if(prefix.length() > 0)
                    {
                    	  buf.append(prefix).append(':');
                    }
                    buf.append(ISO9075.encode(qname.getLocalName()));
                }
            }
            else
            {
                buf.append('/').append(e.toString());
            }
        }
        this.qnamePath = buf.toString();
    }
    
    return this.qnamePath;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:45,代码来源:ScriptNode.java


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