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


Java PropertyIterator类代码示例

本文整理汇总了Java中javax.jcr.PropertyIterator的典型用法代码示例。如果您正苦于以下问题:Java PropertyIterator类的具体用法?Java PropertyIterator怎么用?Java PropertyIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: copyNode

import javax.jcr.PropertyIterator; //导入依赖的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: getPropertiesWithDefaultValuesReturnsNonEmptyProperties

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

示例3: getFieldsForCard

import javax.jcr.PropertyIterator; //导入依赖的package包/类
public Map<String, Object> getFieldsForCard(Card card,
		ObjectContentManager ocm) throws RepositoryException {

	Map<String, Object> result = new HashMap<String, Object>();
	Node node = ocm.getSession().getNode(
			String.format(URI.FIELDS_URI, card.getBoard(), card.getPhase(),
					card.getId()));
	
	if(node==null){
		return result;
	}

	PropertyIterator properties = node.getProperties();
	while (properties.hasNext()) {
		Property property = properties.nextProperty();
		Object value = getRealValue(property);
		result.put(property.getName(), value);
	}
	return result;
}
 
开发者ID:cheetah100,项目名称:gravity,代码行数:21,代码来源:CardToolsImpl.java

示例4: mapPropertiesToMap

import javax.jcr.PropertyIterator; //导入依赖的package包/类
void mapPropertiesToMap(Object obj, Field field, Class<?> valueType, PropertyIterator propIterator, boolean ignoreReadOnlyProperties) throws RepositoryException, IOException, IllegalAccessException {
    Map<String, Object> map = new HashMap<String, Object>();
    while (propIterator.hasNext()) {
        Property p = propIterator.nextProperty();
        // we ignore the read-only properties added by the repository
        if (!ignoreReadOnlyProperties || (!p.getName().startsWith("jcr:") && !p.getName().startsWith(NamespaceRegistry.NAMESPACE_JCR) && !p.getName().startsWith("nt:") && !p.getName().startsWith(NamespaceRegistry.NAMESPACE_NT))) {
            if (valueType.isArray()) {
                if (p.getDefinition().isMultiple()) {
                    map.put(p.getName(), valuesToArray(valueType.getComponentType(), p.getValues()));
                } else {
                    Value[] values = new Value[1];
                    values[0] = p.getValue();
                    map.put(p.getName(), valuesToArray(valueType.getComponentType(), values));
                }
            } else {
                map.put(p.getName(), JcrUtils.getValue(valueType, p.getValue()));
            }
        }
    }
    setObject(field, obj, map);
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:22,代码来源:PropertyMapper.java

示例5: mapPropertyToField

import javax.jcr.PropertyIterator; //导入依赖的package包/类
void mapPropertyToField(Object obj, Field field, Node node, int depth, NodeFilter nodeFilter) throws RepositoryException, IllegalAccessException, IOException {
    String name = getPropertyName(field);

    if (nodeFilter == null || nodeFilter.isIncluded(NodeFilter.PROPERTY_PREFIX + field.getName(), node, depth)) {
        if (isMap(field)) {
            // map of properties
            Class<?> valueType = ReflectionUtils.getParameterizedClass(field, 1);
            try {
                Node childrenContainer = node.getNode(name);
                PropertyIterator propIterator = childrenContainer.getProperties();
                mapPropertiesToMap(obj, field, valueType, propIterator, true);
            } catch (PathNotFoundException pne) {
                // ignore here as the Field could have been added to the model
                // since the Node was created and not yet been populated.
            }
        } else {
            mapToField(name, field, obj, node);
        }
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:21,代码来源:PropertyMapper.java

示例6: mapProtectedPropertyToField

import javax.jcr.PropertyIterator; //导入依赖的package包/类
void mapProtectedPropertyToField(Object obj, Field field, Node node) throws RepositoryException, IllegalAccessException, IOException
{
    String name = getProtectedPropertyName(field);

    if (ReflectionUtils.implementsInterface(field.getType(), Map.class))
    {
        // map of properties
        Class<?> valueType = ReflectionUtils.getParameterizedClass(field, 1);
        Node childrenContainer = node.getNode(name);
        PropertyIterator propIterator = childrenContainer.getProperties();
        mapPropertiesToMap(obj, field, valueType, propIterator, false);
    }
    else
    {
        mapToField(name, field, obj, node);
    }
}
 
开发者ID:sbrinkmann,项目名称:jcrom-extended,代码行数:18,代码来源:PropertyMapper.java

示例7: getAttributes

import javax.jcr.PropertyIterator; //导入依赖的package包/类
/**
 * Writes the mail attributes from the <code>jamesattr:*</code> property.
 * 
 * @param node
 *            mail node
 * @param mail
 *            mail message
 * @throws RepositoryException
 *             if a repository error occurs
 * @throws IOException
 *             if an IO error occurs
 */
private void getAttributes(Node node, Mail mail) throws RepositoryException, IOException {
    PropertyIterator iterator = node.getProperties("jamesattr:*");
    while (iterator.hasNext()) {
        Property property = iterator.nextProperty();
        String name = Text.unescapeIllegalJcrChars(property.getName().substring("jamesattr:".length()));
        if (property.getType() == PropertyType.BINARY) {
            InputStream input = property.getStream();
            try {
                ObjectInputStream stream = new ObjectInputStream(input);
                mail.setAttribute(name, (Serializable) stream.readObject());
            } catch (ClassNotFoundException e) {
                throw new IOException(e.getMessage());
            } finally {
                input.close();
            }
        } else {
            mail.setAttribute(name, property.getString());
        }
    }
}
 
开发者ID:twachan,项目名称:James,代码行数:33,代码来源:JCRMailRepository.java

示例8: propertyNames

import javax.jcr.PropertyIterator; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.modelspace.ModelObject#propertyNames()
 */
@Override
public String[] propertyNames() throws ModelspaceException {
    return modelspace.run( new TaskWithResult< String[] >() {

        @Override
        public String[] run( final Session session ) throws Exception {
            final List< String > names = new ArrayList<>();
            for ( final PropertyIterator iter = session.getNode( path ).getProperties(); iter.hasNext(); ) {
                final String name = iter.nextProperty().getName();
                if ( !name.startsWith( JcrLexicon.Namespace.PREFIX ) && !name.startsWith( ModelspaceLexicon.NAMESPACE_PREFIX ) )
                    names.add( name );
            }
            return names.toArray( new String[ names.size() ] );
        }
    } );
}
 
开发者ID:Polyglotter,项目名称:chrysalix,代码行数:22,代码来源:ModelObjectImpl.java

示例9: createInventory

import javax.jcr.PropertyIterator; //导入依赖的package包/类
private void createInventory(Node webResourceGroup)
		throws RepositoryException, PathNotFoundException,
		ValueFormatException {
	if (webResourceGroup.hasNode(INVENTORY)) {
		Node inventoryNode = webResourceGroup.getNode(INVENTORY);
		PropertyIterator inventoryPropIt = inventoryNode.getProperties();
		while (inventoryPropIt.hasNext()) {
			Property currentInventoryProperty = inventoryPropIt
					.nextProperty();
			if (!currentInventoryProperty.getName().startsWith("jcr:")) {
				String inventoryType = currentInventoryProperty.getName();
				if (!inventory.containsKey(inventoryType)) {
					inventory.put(inventoryType, new ArrayList<String>());
				}
				List<String> inventoryTypeList = inventory
						.get(inventoryType);
				Value[] inventoryTypeValues = currentInventoryProperty
						.getValues();
				for (Value currentValue : inventoryTypeValues) {
					inventoryTypeList.add(currentValue.getString());
				}
			}
		}
	}
}
 
开发者ID:bobpaulin,项目名称:sling-web-resource,代码行数:26,代码来源:WebResourceGroup.java

示例10: getNodePropertySize

import javax.jcr.PropertyIterator; //导入依赖的package包/类
/**
 * Get the total size of a Node's properties
 * 
 * @param node the node
 * @return size in bytes
 * @throws RepositoryException if repository exception occurred
 */
public static Long getNodePropertySize(final Node node)
    throws RepositoryException {
    Long size = 0L;
    for (final PropertyIterator i = node.getProperties(); i.hasNext();) {
        final Property p = i.nextProperty();
        if (p.isMultiple()) {
            for (final Value v : p.getValues()) {
                size += v.getBinary().getSize();
            }
        } else {
            size += p.getBinary().getSize();
        }
    }
    return size;
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:23,代码来源:ServiceHelpers.java

示例11: getPropertyNames

import javax.jcr.PropertyIterator; //导入依赖的package包/类
/**
 * @see Entity#getPropertyNames(String)
 */
public Iterator<String> getPropertyNames(String relPath) throws RepositoryException {
    Node n = node.getNode(relPath);
    if (n.isSame(node)) {
        // same as #getPropertyNames()
        return getPropertyNames();
    } else if (Text.isDescendant(node.getPath(), n.getPath())) {
        List<String> l = new ArrayList<String>();
        for (PropertyIterator it = n.getProperties(); it.hasNext();) {
            Property prop = it.nextProperty();
            if (isEntityProperty(prop, false)) {
                l.add(prop.getName());
            }
        }
        return l.iterator();
    } else {
        throw new IllegalArgumentException("Relative path " + relPath + " refers to items outside of scope of authorizable " + getId());
    }
}
 
开发者ID:hlta,项目名称:playweb,代码行数:22,代码来源:EntityImpl.java

示例12: getProperties

import javax.jcr.PropertyIterator; //导入依赖的package包/类
public static Properties getProperties(BOContent a_content) throws Throwable{
	Properties properties = new Properties();
	Node node = a_content.getNode();
	PropertyIterator props = node.getProperties();
	while(props.hasNext()) {
		Property prop = props.nextProperty();
		properties.put(prop.getName(), prop.getString());
	}
	return properties;
}
 
开发者ID:adchowdhury,项目名称:jcrBrowser,代码行数:11,代码来源:JCRUtil.java

示例13: getProperties

import javax.jcr.PropertyIterator; //导入依赖的package包/类
@Override
public PropertyIterator getProperties() throws RepositoryException {
    List<Property> children = new ArrayList<>();
    for (Item item : session.getChildren(this))
        if (!item.isNode())
            children.add((Property)item);
    return new PropertyIteratorImpl(children);
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:9,代码来源:NodeImpl.java

示例14: mapProtectedPropertyToField

import javax.jcr.PropertyIterator; //导入依赖的package包/类
void mapProtectedPropertyToField(Object obj, Field field, Node node) throws RepositoryException, IllegalAccessException, IOException {
    String name = getProtectedPropertyName(field);

    if (isMap(field)) {
        // map of properties
        Class<?> valueType = ReflectionUtils.getParameterizedClass(field, 1);
        Node childrenContainer = node.getNode(name);
        PropertyIterator propIterator = childrenContainer.getProperties();
        mapPropertiesToMap(obj, field, valueType, propIterator, false);
    } else {
        mapToField(name, field, obj, node);
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:14,代码来源:PropertyMapper.java

示例15: getReferenceMap

import javax.jcr.PropertyIterator; //导入依赖的package包/类
Map<String, Object> getReferenceMap(Field field, String containerName, Class<?> mapParamClass, Node node, Object obj, int depth, NodeFilter nodeFilter, Mapper mapper, JcrReference jcrReference) throws ClassNotFoundException, InstantiationException, RepositoryException, IllegalAccessException, IOException {

        Map<String, Object> references = new HashMap<String, Object>();
        if (node.hasNode(containerName)) {
            Node containerNode = node.getNode(containerName);
            PropertyIterator propertyIterator = containerNode.getProperties();
            while (propertyIterator.hasNext()) {
                Property p = propertyIterator.nextProperty();
                if (!p.getName().startsWith("jcr:") && !p.getName().startsWith(NamespaceRegistry.NAMESPACE_JCR)) {
                    if (isList(mapParamClass)) {
                        if (jcrReference.lazy()) {
                            references.put(p.getName(), ProxyFactory.createReferenceListProxy(Object.class, obj, containerNode.getPath(), p.getName(), node.getSession(), mapper, depth, nodeFilter, field));
                        } else {
                            references.put(p.getName(), getReferenceList(field, p.getName(), Object.class, containerNode, obj, depth, nodeFilter, mapper));
                        }
                    } else {
                        if (jcrReference.lazy()) {
                            Node referencedNode = getSingleReferencedNode(jcrReference, p.getValue(), node.getSession());
                            references.put(p.getName(), ProxyFactory.createReferenceProxy(mapper.findClassFromNode(Object.class, referencedNode), obj, containerNode.getPath(), p.getName(), node.getSession(), mapper, depth, nodeFilter, field));
                        } else {
                            references.put(p.getName(), createReferencedObject(field, p.getValue(), obj, containerNode.getSession(), Object.class, depth, nodeFilter, mapper));
                        }
                    }
                }
            }
        }
        return references;
    }
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:29,代码来源:ReferenceMapper.java


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