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


Java Node.getNodes方法代码示例

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


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

示例1: copyNode

import javax.jcr.Node; //导入方法依赖的package包/类
/**
 * Copies nodes.
 *
 * @param node              Node to copy
 * @param destinationParent Destination parent node
 * @throws RepositoryException if problem with jcr repository occurred
 */
public void copyNode(Node node, Node destinationParent) throws RepositoryException {
  LOG.debug("Copying node '{}' into '{}'", node.getPath(), destinationParent.getPath());
  Node newNode = destinationParent.addNode(node.getName(), node.getPrimaryNodeType().getName());
  PropertyIterator it = node.getProperties();
  while (it.hasNext()) {
    Property property = it.nextProperty();
    if (!property.getDefinition().isProtected()) {
      newNode
          .setProperty(property.getName(), property.getValue().getString(), property.getType());
    }
  }
  NodeIterator nodeIterator = node.getNodes();
  while (nodeIterator.hasNext()) {
    copyNode(nodeIterator.nextNode(), newNode);
  }
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:24,代码来源:JcrHelper.java

示例2: buildPath

import javax.jcr.Node; //导入方法依赖的package包/类
private void buildPath(List<String> list, Node parentNode) throws RepositoryException {
	NodeIterator nodeIterator=parentNode.getNodes();
	while(nodeIterator.hasNext()){
		Node node=nodeIterator.nextNode();
		String nodePath=node.getPath();
		if(nodePath.endsWith(FileType.Ruleset.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.UL.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.DecisionTable.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.ScriptDecisionTable.toString())){
			list.add(nodePath);
		}else if(nodePath.endsWith(FileType.DecisionTree.toString())){
			list.add(nodePath);					
		}else if(nodePath.endsWith(FileType.RuleFlow.toString())){
			list.add(nodePath);					
		}
		buildPath(list,node);
	}
}
 
开发者ID:youseries,项目名称:urule,代码行数:22,代码来源:RepositoryServiceImpl.java

示例3: buildDirectories

import javax.jcr.Node; //导入方法依赖的package包/类
private void buildDirectories(Node node, List<RepositoryFile> fileList, String projectPath) throws Exception {
	NodeIterator nodeIterator = node.getNodes();
	while (nodeIterator.hasNext()) {
		Node dirNode = nodeIterator.nextNode();
		if (!dirNode.hasProperty(FILE)) {
			continue;
		}
		if (!dirNode.hasProperty(DIR_TAG)) {
			continue;
		}
		RepositoryFile file = new RepositoryFile();
		file.setName(dirNode.getPath().substring(projectPath.length()));
		file.setFullPath(dirNode.getPath());
		buildDirectories(dirNode, fileList, projectPath);
		fileList.add(file);
	}
}
 
开发者ID:youseries,项目名称:urule,代码行数:18,代码来源:RepositoryServiceImpl.java

示例4: unlockAllChildNodes

import javax.jcr.Node; //导入方法依赖的package包/类
private void unlockAllChildNodes(Node node,User user,List<Node> nodeList,String rootPath) throws Exception{
	NodeIterator iter=node.getNodes();
	while(iter.hasNext()){
		Node nextNode=iter.nextNode();
		String absPath=nextNode.getPath();
		if(!lockManager.isLocked(absPath)){
			continue;
		}
		Lock lock=lockManager.getLock(absPath);
		String owner=lock.getLockOwner();
		if(!user.getUsername().equals(owner)){
			throw new NodeLockException("当前目录下有子目录被其它人锁定,您不能执行锁定"+rootPath+"目录");
		}
		nodeList.add(nextNode);
		unlockAllChildNodes(nextNode, user, nodeList, rootPath);
	}
}
 
开发者ID:youseries,项目名称:urule,代码行数:18,代码来源:RepositoryServiceImpl.java

示例5: loadProjects

import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public List<RepositoryFile> loadProjects(String companyId) throws Exception{
	List<RepositoryFile> projects=new ArrayList<RepositoryFile>();
	Node rootNode=getRootNode();
	NodeIterator nodeIterator = rootNode.getNodes();
	while (nodeIterator.hasNext()) {
		Node projectNode = nodeIterator.nextNode();
		if (!projectNode.hasProperty(FILE)) {
			continue;
		}
		if(StringUtils.isNotEmpty(companyId)){
			if(projectNode.hasProperty(COMPANY_ID)){
				String id=projectNode.getProperty(COMPANY_ID).getString();
				if(!companyId.equals(id)){
					continue;
				}
			}
		}
		if(projectNode.getName().indexOf(RESOURCE_SECURITY_CONFIG_FILE)>-1){
			continue;
		}
		RepositoryFile projectFile = new RepositoryFile();
		projectFile.setType(Type.project);
		projectFile.setName(projectNode.getName());
		projectFile.setFullPath("/" + projectNode.getName());
		projects.add(projectFile);
	}
	return projects;
}
 
开发者ID:youseries,项目名称:urule,代码行数:30,代码来源:BaseRepositoryService.java

示例6: getDirectories

import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public List<RepositoryFile> getDirectories(String project) throws Exception {
	Node rootNode=getRootNode();
	NodeIterator nodeIterator = rootNode.getNodes();
	Node targetProjectNode = null;
	while (nodeIterator.hasNext()) {
		Node projectNode = nodeIterator.nextNode();
		if (!projectNode.hasProperty(FILE)) {
			continue;
		}
		String projectName = projectNode.getName();
		if (project != null && !project.equals(projectName)) {
			continue;
		}
		targetProjectNode = projectNode;
		break;
	}
	if (targetProjectNode == null) {
		throw new RuleException("Project [" + project + "] not exist.");
	}
	List<RepositoryFile> fileList = new ArrayList<RepositoryFile>();
	RepositoryFile root = new RepositoryFile();
	root.setName("根目录");
	String projectPath = targetProjectNode.getPath();
	root.setFullPath(projectPath);
	fileList.add(root);
	NodeIterator projectNodeIterator = targetProjectNode.getNodes();
	while (projectNodeIterator.hasNext()) {
		Node dirNode = projectNodeIterator.nextNode();
		if (!dirNode.hasProperty(DIR_TAG)) {
			continue;
		}
		RepositoryFile file = new RepositoryFile();
		file.setName(dirNode.getPath().substring(projectPath.length()));
		file.setFullPath(dirNode.getPath());
		fileList.add(file);
		buildDirectories(dirNode, fileList, projectPath);
	}
	return fileList;
}
 
开发者ID:youseries,项目名称:urule,代码行数:41,代码来源:RepositoryServiceImpl.java

示例7: findPublicationInFolder

import javax.jcr.Node; //导入方法依赖的package包/类
private Node findPublicationInFolder(Node node) throws RepositoryException {
    for (NodeIterator i = node.getNodes(); i.hasNext(); ) {
        Node object = i.nextNode();
        if (isParentPublication(object)) {
            return object;
        }
    }

    if (RPS_ROOT_FOLDER.equals(node.getPath())) {
        return null;
    }

    return findPublicationInFolder(node.getParent());
}
 
开发者ID:NHS-digital-website,项目名称:hippo,代码行数:15,代码来源:DatasetProcessor.java

示例8: getRepositories

import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public Collection<String> getRepositories()
    throws MetadataRepositoryException
{
    List<String> repositories;

    try
    {
        Node root = getJcrSession().getRootNode();
        if ( root.hasNode( "repositories" ) )
        {
            Node node = root.getNode( "repositories" );

            repositories = new ArrayList<>();
            NodeIterator i = node.getNodes();
            while ( i.hasNext() )
            {
                Node n = i.nextNode();
                repositories.add( n.getName() );
            }
        }
        else
        {
            repositories = Collections.emptyList();
        }
    }
    catch ( RepositoryException e )
    {
        throw new MetadataRepositoryException( e.getMessage(), e );
    }
    return repositories;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:33,代码来源:JcrMetadataRepository.java

示例9: getNodesStringArrayThrowsException

import javax.jcr.Node; //导入方法依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void getNodesStringArrayThrowsException() throws Exception {
	aNode("/content/ko/zip");
	aNode("/content/ko/zap");
	aNode("/content/ko/zup");
	Node testObj = aNode("/content/ko");
	
	testObj.getNodes(new String[] { "zip", "zap", "zup" });
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:10,代码来源:MockNodeTest.java

示例10: getNodesWithExistingChildsReturnsNonEmptyIterator

import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void getNodesWithExistingChildsReturnsNonEmptyIterator() throws Exception {
	resources.aResource("/content/ko");
	Node testObj = aNode("/content");
	
	NodeIterator actual = testObj.getNodes();
	
	assertTrue(actual.hasNext());
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:10,代码来源:NodeTestDriver.java

示例11: getNodesWithNoChildrenReturnsEmptyIterator

import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void getNodesWithNoChildrenReturnsEmptyIterator() throws Exception {
	Node testObj = aNode();
	
	NodeIterator actual = testObj.getNodes();
	
	assertFalse(actual.hasNext());
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:9,代码来源:NodeTestDriver.java

示例12: getNodesStringWithMatchingChildReturnsChildNode

import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void getNodesStringWithMatchingChildReturnsChildNode() throws Exception {
	resources.aResource("/content/ko");
	Node testObj = aNode("/content");
	
	NodeIterator actual = testObj.getNodes("ko");
	
	assertThat(actual.nextNode(), nodeExistsAt("/content/ko"));
	assertFalse(actual.hasNext());
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:11,代码来源:NodeTestDriver.java

示例13: getNodesStringWithNoExistentChildrenReturnsEmptyIterator

import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void getNodesStringWithNoExistentChildrenReturnsEmptyIterator() throws Exception {
	Node testObj = aNode();
	
	NodeIterator actual = testObj.getNodes("\\*");
	
	assertFalse(actual.hasNext());
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:9,代码来源:NodeTestDriver.java

示例14: getNodesStringWithCombinedStringReturnsAllMatchingDirectChildren

import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void getNodesStringWithCombinedStringReturnsAllMatchingDirectChildren() throws Exception {
	aNode("/content/ko/zip");
	aNode("/content/ko/zap");
	aNode("/content/ko/zup");
	Node testObj = aNode("/content/ko");
	
	NodeIterator actual = testObj.getNodes("zip|zap|zup");
	
	assertThat(actual.nextNode(), nodeExistsAt("/content/ko/zip"));
	assertThat(actual.nextNode(), nodeExistsAt("/content/ko/zap"));
	assertThat(actual.nextNode(), nodeExistsAt("/content/ko/zup"));
	assertFalse(actual.hasNext());
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:15,代码来源:NodeTestDriver.java

示例15: crawl

import javax.jcr.Node; //导入方法依赖的package包/类
private List<String> crawl(final Node node) throws RepositoryException {
	List<String> paths = new ArrayList<>();
	paths.add(node.getPath());
	for (NodeIterator iter = node.getNodes(); iter.hasNext(); ) {
		paths.addAll(crawl(iter.nextNode()));
	}
	return paths;
}
 
开发者ID:Cognifide,项目名称:APM,代码行数:9,代码来源:CheckPermissions.java


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