本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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" });
}
示例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());
}
示例11: getNodesWithNoChildrenReturnsEmptyIterator
import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void getNodesWithNoChildrenReturnsEmptyIterator() throws Exception {
Node testObj = aNode();
NodeIterator actual = testObj.getNodes();
assertFalse(actual.hasNext());
}
示例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());
}
示例13: getNodesStringWithNoExistentChildrenReturnsEmptyIterator
import javax.jcr.Node; //导入方法依赖的package包/类
@Test
public void getNodesStringWithNoExistentChildrenReturnsEmptyIterator() throws Exception {
Node testObj = aNode();
NodeIterator actual = testObj.getNodes("\\*");
assertFalse(actual.hasNext());
}
示例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());
}
示例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;
}