本文整理了Java中javax.jcr.Node.getProperties()
方法的一些代码示例,展示了Node.getProperties()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getProperties()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:getProperties
[英]Returns all properties of this node accessible through the current Session
. Does not include child nodes of this node. The same reacquisition semantics apply as with #getNode(String)
. If this node has no accessible properties, then an empty iterator is returned.
[中]返回可通过当前Session
访问的此节点的所有属性。不包括此节点的子节点。与#getNode(String)
相同的重新获取语义也适用。如果此节点没有可访问的属性,则返回一个空迭代器。
代码示例来源:origin: javax.jcr/jcr
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());
代码示例来源:origin: info.magnolia/magnolia-i18n
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;
}
}
代码示例来源:origin: apache/jackrabbit
/**
* 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");
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@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;
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-ocm
/**
* @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());
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons
/**
* 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;
}
代码示例来源:origin: org.apache/jackrabbit-ocm
/**
* @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());
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
/**
* 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;
}
代码示例来源:origin: info.magnolia/magnolia-core
/**
* 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;
}
代码示例来源:origin: apache/jackrabbit
/**
* 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;
}
代码示例来源:origin: org.chtijbug.drools/guvnor-repository
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;
}
代码示例来源:origin: org.apache.sling/org.apache.sling.jcr.resource
/**
* 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);
}
}
}
代码示例来源:origin: org.drools/guvnor-repository
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;
}
代码示例来源:origin: org.apache.sling/org.apache.sling.jcr.resource
/**
* 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);
}
}
}
代码示例来源:origin: info.magnolia/magnolia-core
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;
}
代码示例来源:origin: org.overlord.sramp/s-ramp-repository-jcr
/**
* 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;
}
代码示例来源:origin: apache/jackrabbit
/**
* 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());
}
}
代码示例来源:origin: pentaho/pentaho-platform
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;
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public Void call() throws Exception {
for (int k = 0; k < 100000; k++) {
session.refresh(false);
PropertyIterator properties = testRoot.getProperties();
properties.hasNext();
}
return null;
}
}));
代码示例来源:origin: info.magnolia/magnolia-i18n
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();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!