if (maxLevel == -1 || currentLevel < maxLevel) { currentLevel++; PropertyIterator propIter = node.getProperties(); while (propIter.hasNext()) { propIter.nextProperty().accept(this); PropertyIterator propIter = node.getProperties(); while (propIter.hasNext()) { nextQueue.addLast(propIter.nextProperty());
private boolean hasI18NKeys(Node node, String[] properties) { try { return node.getProperties(properties).hasNext(); } catch (RepositoryException re) { log.warn("Got exception by checking if '{}' has i18n properties", NodeUtil.getName(node), re); return false; } }
/** * Sets up the fixture for this test. */ protected void setUp() throws Exception { isReadOnly = true; super.setUp(); session = getHelper().getReadOnlySession(); testRootNode = session.getRootNode().getNode(testPath); PropertyIterator properties = testRootNode.getProperties(); try { property = properties.nextProperty(); } catch (NoSuchElementException e) { fail("Any node must have at least one property set: jcr:primaryType"); } }
@Override public Set<String> keySet() { Set<String> keys = new HashSet<String>(); try { PropertyIterator props = content.getProperties(); while (props.hasNext()) { keys.add(props.nextProperty().getName()); } } catch (RepositoryException e) { // ignore - has no access } for (String name : specialProperties.keySet()) { keys.add(name); } return keys; }
/** * @see AbstractCollectionConverterImpl#doIsNull(Session, Node, CollectionDescriptor, Class) */ protected boolean doIsNull(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass) throws RepositoryException { String jcrName = getCollectionJcrName(collectionDescriptor); return (parentNode == null || !parentNode.getProperties(jcrName).hasNext()); }
/** * Returns a sorted map of the properties of the given node. * * @param node JCR node * @return sorted map (keyed by name) of properties * @throws RepositoryException if a repository error occurs */ private SortedMap getProperties(Node node) throws RepositoryException { SortedMap properties = new TreeMap(); PropertyIterator iterator = node.getProperties(); while (iterator.hasNext()) { Property property = iterator.nextProperty(); properties.put(property.getName(), property); } return properties; }
/** * @see AbstractCollectionConverterImpl#doIsNull(Session, Node, CollectionDescriptor, Class) */ protected boolean doIsNull(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass) throws RepositoryException { String jcrName = getCollectionJcrName(collectionDescriptor); return (parentNode == null || !parentNode.getProperties(jcrName).hasNext()); }
/** * Returns a sorted map of the properties of the given node. * * @param node JCR node * @return sorted map (keyed by name) of properties * @throws RepositoryException if a repository error occurs */ private SortedMap getProperties(Node node) throws RepositoryException { SortedMap properties = new TreeMap(); PropertyIterator iterator = node.getProperties(); while (iterator.hasNext()) { Property property = iterator.nextProperty(); properties.put(property.getName(), property); } return properties; }
/** * Gets all properties from node and returns them as {@link java.util.List}. * Also filters out "extends" property. */ private static List<Property> getPropertiesAsList(Node node, String namePattern) throws RepositoryException { List<Property> properties = new ArrayList<Property>(); PropertyIterator it = node.getProperties(namePattern); while (it.hasNext()) { Property prop = (Property) it.next(); if (!prop.getName().equals(EXTENDING_NODE_PROPERTY)) { properties.add(prop); } } return properties; }
/** * Returns a sorted map of the properties of the given node. * * @param node JCR node * @return sorted map (keyed by name) of properties * @throws RepositoryException if a repository error occurs */ private SortedMap getProperties(Node node) throws RepositoryException { SortedMap properties = new TreeMap(); PropertyIterator iterator = node.getProperties(); while (iterator.hasNext()) { Property property = iterator.nextProperty(); properties.put(property.getName(), property); } return properties; }
private List<String> listOfPermTypes(Node userNode) throws RepositoryException { List<String> permTypes = new ArrayList<String>(); Node permsNode = getNode(userNode, "permissions", "nt:file"); Node content = getNode(permsNode, "jcr:content", "nt:unstructured"); PropertyIterator perms = content.getProperties(); while (perms.hasNext()) { Property p = (Property) perms.next(); String name = p.getName(); if (!name.startsWith("jcr")) { permTypes.add(name); } } return permTypes; }
/** * Read all properties. * @throws IllegalArgumentException if a repository exception occurs */ void readFully() { if (!fullyRead) { try { final PropertyIterator pi = node.getProperties(); while (pi.hasNext()) { final Property prop = pi.nextProperty(); this.cacheProperty(prop); } fullyRead = true; } catch (final RepositoryException re) { throw new IllegalArgumentException(re); } } }
private List<String> listOfPermTypes(Node userNode) throws RepositoryException { List<String> permTypes = new ArrayList<String>(); Node permsNode = getNode(userNode, "permissions", "nt:file"); Node content = getNode(permsNode, "jcr:content", "nt:unstructured"); PropertyIterator perms = content.getProperties(); while (perms.hasNext()) { Property p = (Property) perms.next(); String name = p.getName(); if (!name.startsWith("jcr")) { permTypes.add(name); } } return permTypes; }
/** * Read all properties. * @throws IllegalArgumentException if a repository exception occurs */ void readFully() { if (!fullyRead) { try { final PropertyIterator pi = node.getProperties(); while (pi.hasNext()) { final Property prop = pi.nextProperty(); this.cacheProperty(prop); } fullyRead = true; } catch (final RepositoryException re) { throw new IllegalArgumentException(re); } } }
protected Collection<NodeData> getPrimitiveNodeDatas(String namePattern) throws RepositoryException { final Collection<NodeData> nodeDatas = new ArrayList<NodeData>(); final PropertyIterator propertyIterator; if (namePattern == null) { propertyIterator = this.node.getProperties(); } else { propertyIterator = this.node.getProperties(namePattern); } while (propertyIterator.hasNext()) { Property property = (Property) propertyIterator.next(); try { if (!property.getName().startsWith("jcr:") && !property.getName().startsWith("mgnl:")) { nodeDatas.add(getNodeData(property.getName())); } } catch (PathNotFoundException e) { log.error("Exception caught", e); } catch (AccessDeniedException e) { // ignore, simply wont add content in a list } } return nodeDatas; }
/** * Gets all of the custom s-ramp property names currently stored on the given * JCR node. * @param jcrNode * @throws RepositoryException */ private static Set<String> getNodePropertyNames(Node jcrNode) throws RepositoryException { String srampPropsPrefix = JCRConstants.SRAMP_PROPERTIES + ":"; //$NON-NLS-1$ int srampPropsPrefixLen = srampPropsPrefix.length(); Set<String> rval = new HashSet<String>(); PropertyIterator properties = jcrNode.getProperties(); while (properties.hasNext()) { Property prop = properties.nextProperty(); String propName = prop.getName(); if (propName.startsWith(srampPropsPrefix)) { propName = propName.substring(srampPropsPrefixLen); rval.add(propName); } } return rval; }
/** * Test if all returned items are of type node. */ public void testGetProperties() throws RepositoryException { PropertyIterator properties = testRootNode.getProperties(); while (properties.hasNext()) { Item item = (Item) properties.next(); assertFalse("Item is not a property", item.isNode()); } }
private static Map<String, String> getLocalizedStringMap( final Session session, final PentahoJcrConstants pentahoJcrConstants, final Node localizedStringNode ) throws RepositoryException { Assert.isTrue( isLocalizedString( session, pentahoJcrConstants, localizedStringNode ) ); String prefix = session.getNamespacePrefix( PentahoJcrConstants.PHO_NS ); Assert.hasText( prefix ); Map<String, String> localizedStringMap = new HashMap<String, String>(); PropertyIterator propertyIter = localizedStringNode.getProperties(); // Loop through properties and append the appropriate values in the map while ( propertyIter.hasNext() ) { Property property = propertyIter.nextProperty(); String propertyKey = property.getName().substring( prefix.length() + 1 ); localizedStringMap.put( propertyKey, property.getString() ); } return localizedStringMap; }
@Override public Void call() throws Exception { for (int k = 0; k < 100000; k++) { session.refresh(false); PropertyIterator properties = testRoot.getProperties(); properties.hasNext(); } return null; } }));
private void handleNode(Node node, String[] properties) throws RepositoryException { PropertyIterator propertyIterator = node.getProperties(properties); while (propertyIterator.hasNext()) { Property property = propertyIterator.nextProperty(); if (DEPRECATED_I18N_PROPERTIES.contains(property.getName())) { log.info("SiteMap i18n property removed: '{}' ", property.getPath()); property.remove(); } } }