public boolean isNew() { boolean isNew = false; try { if (resource != null) { isNew = !(resource instanceof Collection) || (((CollectionImpl) resource).getChildren() != null && ((CollectionImpl) resource).getChildren().length == 0); } } catch (Exception e) { isNew = true; } return isNew; }
@Override public String[] getChildren() throws RegistryException { Object content = getContent(); if (content == null) { return new String[0]; } else { return super.getChildren(); } }
@Override public String[] getChildren(int start, int pageLen) throws RegistryException { Object content = getContent(); if (content == null) { return new String[0]; } else { return super.getChildren(start, pageLen); } }
public static void unregisterNodeTypeFromRegistry(RegistrySession registrySession, RegistryNodeTypeManager registryNodeTypeManager, String nodeType) { try { String[] paths = ((CollectionImpl) registrySession.getUserRegistry().get( RegistryJCRSpecificStandardLoderUtil. getSystemConfigNodeTypePath(registrySession))).getChildren(); for (String path : paths) { String name = path.split("/")[path.split("/").length - 1]; if (name.equals(nodeType)) { registrySession.getUserRegistry().delete(path); } } } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
public NodeIterator getNodes(String s) throws RepositoryException { List<Node> nodes = new ArrayList<Node>(); try { CollectionImpl coll = (CollectionImpl) registrySession.getUserRegistry().get(nodePath); String[] childpaths = coll.getChildren(); for (int i = 0; i < childpaths.length; i++) { if(RegistryJCRItemOperationUtil.isSystemConfigNode(childpaths[i])){ continue; } Node node = new RegistryNode(childpaths[i], registrySession); nodes.add(node); } } catch (RegistryException e) { String msg = "failed to resolve the path of the given node or violation of repository syntax " + this; log.debug(msg); throw new RepositoryException(msg, e); } return new RegistryNodeIterator(nodes); }
public NodeIterator getNodes() throws RepositoryException { List<Node> nodes = new ArrayList<Node>(); CollectionImpl tempCollection = null; try { if (registrySession.getUserRegistry().get(nodePath) instanceof CollectionImpl) { tempCollection = (CollectionImpl) registrySession.getUserRegistry().get(nodePath); String[] children = tempCollection.getChildren(); for (int i = 0; i < children.length; i++) { if(isARegistryCollection(children[i])) { if(RegistryJCRItemOperationUtil.isSystemConfigNode(children[i])) { continue; } nodes.add(registrySession.getNode(children[i])); } } } } catch (RegistryException e) { String msg = "failed to resolve the path of the given node or violation of repository syntax " + this; log.debug(msg); throw new RepositoryException(msg, e); } RegistryNodeIterator nodeIterator = new RegistryNodeIterator(nodes); return (NodeIterator) nodeIterator; }
Arrays.asList(collection.getChildren())); pathsToDelete.removeAll(Arrays.asList(children)); for (String pathToDelete : pathsToDelete) {
public boolean hasNodes() throws RepositoryException { boolean hasNodes = true; CollectionImpl collec = null; try { if ((registrySession.getUserRegistry().resourceExists(nodePath)) && ((registrySession.getUserRegistry().get(nodePath) instanceof CollectionImpl))) { collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath); } if (collec != null) { String[] children = collec.getChildren(); if (children != null) { if (children.length == 0) hasNodes = false; } } } catch (RegistryException e) { e.printStackTrace(); } return hasNodes; }
String[] paths = ((CollectionImpl) registrySession.getUserRegistry().get( RegistryJCRSpecificStandardLoderUtil. getSystemConfigNodeTypePath(registrySession))).getChildren(); String[] childDefPaths = ((CollectionImpl) registrySession.getUserRegistry().get(childDefRootPath)).getChildren(); String[] propDefPaths = ((CollectionImpl) registrySession.getUserRegistry().get(propDefRootPath)).getChildren();