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


Java PropertyIterator.hasNext方法代码示例

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


在下文中一共展示了PropertyIterator.hasNext方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: printNode

import javax.jcr.PropertyIterator; //导入方法依赖的package包/类
static void printNode(Node node, String indentation) throws Exception {
    System.out.println();
    System.out.println(indentation + "------- NODE -------");
    System.out.println(indentation + "Path: " + node.getPath());

    System.out.println(indentation + "------- Properties: ");
    PropertyIterator propertyIterator = node.getProperties();
    while (propertyIterator.hasNext()) {
        Property p = propertyIterator.nextProperty();
        if (!p.getName().equals("jcr:data") && !p.getName().equals("jcr:mixinTypes") && !p.getName().equals("fileBytes")) {
            System.out.print(indentation + p.getName() + ": ");
            if (p.getDefinition().getRequiredType() == PropertyType.BINARY) {
                System.out.print("binary, (length:" + p.getLength() + ") ");
            } else if (!p.getDefinition().isMultiple()) {
                System.out.print(p.getString());
            } else {
                for (Value v : p.getValues()) {
                    System.out.print(v.getString() + ", ");
                }
            }
            System.out.println();
        }

        if (p.getName().equals("jcr:childVersionHistory")) {
            System.out.println(indentation + "------- CHILD VERSION HISTORY -------");
            printNode(node.getSession().getNodeByIdentifier(p.getString()), indentation + "\t");
            System.out.println(indentation + "------- CHILD VERSION ENDS -------");
        }
    }

    NodeIterator nodeIterator = node.getNodes();
    while (nodeIterator.hasNext()) {
        printNode(nodeIterator.nextNode(), indentation + "\t");
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:36,代码来源:TestMapping.java

示例9: getNodeRepresentation

import javax.jcr.PropertyIterator; //导入方法依赖的package包/类
/**
 * Get the representation of a JCR node.
 *
 * @param node  the {@link javax.jcr.Node}
 * @param depth the amount of children to fetch underneath this node
 * @return a representation of a JCR node
 */
public static JcrNode getNodeRepresentation(final Node node, final int depth) {
    JcrNode jcrNode = new JcrNode();
    try {
        jcrNode.setName(node.getName());
        jcrNode.setIdentifier(node.getIdentifier());
        jcrNode.setPath(node.getPath());
        jcrNode.setPrimaryType(node.getPrimaryNodeType().getName());

        final NodeType[] mixinNodeTypes = node.getMixinNodeTypes();
        if (mixinNodeTypes != null) {
            List<String> mixins = new ArrayList<String>(mixinNodeTypes.length);
            for (NodeType mixinNodeType : mixinNodeTypes) {
                mixins.add(mixinNodeType.getName());
            }
            jcrNode.setMixinTypes(mixins);
        }

        PropertyIterator properties = node.getProperties();
        while (properties.hasNext()) {
            Property property = properties.nextProperty();
            if(!PROPERTY_BLACKLIST.containsValue(property.getName())) {
                jcrNode.getProperties().add(getPropertyRepresentation(property));
            }
        }

        if (depth > 0 && node.hasNodes()) {
            final NodeIterator childNodes = node.getNodes();
            while (childNodes.hasNext()) {
                jcrNode.addNode(getNodeRepresentation(childNodes.nextNode(), depth - 1));
            }
        }
    } catch (RepositoryException e) {
        log.error("An exception occurred while trying to marshall node: {} ", e);
    }
    return jcrNode;
}
 
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:44,代码来源:JcrDataBindingHelper.java

示例10: createUserFromNode

import javax.jcr.PropertyIterator; //导入方法依赖的package包/类
private User createUserFromNode(final Node userNode) throws RepositoryException {
    User user = new User(NodeNameCodec.decode(userNode.getName()));
    user.setPath(userNode.getPath().substring(1));
    if (userNode.isNodeType(HippoNodeType.NT_EXTERNALUSER)) {
        user.setExternal(true);
    }
    PropertyIterator pi = userNode.getProperties();

    while (pi.hasNext()) {
        final Property p = pi.nextProperty();
        String name = p.getName();
        if (name.startsWith("jcr:")) {
            //skip
            continue;
        } else if (name.equals(PROP_EMAIL) || name.equalsIgnoreCase("email")) {
            user.setEmail(p.getString());
        } else if (name.equals(PROP_FIRSTNAME) || name.equalsIgnoreCase("firstname")) {
            user.setFirstName(p.getString());
        } else if (name.equals(PROP_LASTNAME) || name.equalsIgnoreCase("lastname")) {
            user.setLastName(p.getString());
        } else if (name.equals(HippoNodeType.HIPPO_ACTIVE)) {
            user.setActive(p.getBoolean());
        } else if (name.equals(PROP_PASSWORD) || name.equals(PROP_PASSKEY) || name.equals(PROP_PREVIOUSPASSWORDS)) {
            // do not expose password hash
            continue;
        } else if (name.equals(PROP_PROVIDER)) {
            continue;
        } else if (name.equals(PROP_PASSWORDLASTMODIFIED)) {
            user.setPasswordLastModified(p.getDate());
        } else if (name.equals(PROP_SYSTEM)) {
            user.setSystem(p.getBoolean());
        }
    }
    return user;
}
 
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:36,代码来源:UsersResource.java

示例11: 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()));
            }
        }
    }
    field.set(obj, map);
}
 
开发者ID:sbrinkmann,项目名称:jcrom-extended,代码行数:34,代码来源:PropertyMapper.java

示例12: 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 (ReflectionUtils.implementsInterface(mapParamClass, List.class)) {
                        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:sbrinkmann,项目名称:jcrom-extended,代码行数:29,代码来源:ReferenceMapper.java

示例13: mapPropertiesToMap

import javax.jcr.PropertyIterator; //导入方法依赖的package包/类
private void mapPropertiesToMap(Object obj, Field field, Node node) throws RepositoryException
{
    JcrPropertyMap jcrPropertyMap = getJcrom().getAnnotationReader().getAnnotation(field, JcrPropertyMap.class);
    String childNodeName = field.getName();
    if (JcrChildNode.DEFAULT_NAME.equals(jcrPropertyMap.name()))
    {
        childNodeName = jcrPropertyMap.name();
    }
    if(node.hasNode(childNodeName))
    {
        Node childNode = node.getNode(childNodeName);
        Map<String, Object> properties = new HashMap<String, Object>();
        PropertyIterator propertyIterator = childNode.getProperties();
        while(propertyIterator.hasNext())
        {
            Property property = propertyIterator.nextProperty();
            if(property.getValue().getType() == PropertyType.STRING)
            {
                properties.put(property.getName(), property.getValue().getString());
            }
        }
        
        try
        {
            field.set(obj, properties);
        }
        catch (Exception ex)
        {
            LOG.error("Error while setting HashMap to property ["+ field.getName() +"] within class ["+ obj.getClass().getCanonicalName() +"]", ex);
        }
    }
}
 
开发者ID:sbrinkmann,项目名称:jcrom-extended,代码行数:33,代码来源:Mapper.java

示例14: dumpNode

import javax.jcr.PropertyIterator; //导入方法依赖的package包/类
/**
 * Recursive method for dumping a node. This method is separate to avoid the overhead of searching and
 * opening/closing JCR sessions.
 * @param node
 * @return
 * @throws RepositoryException
 */
protected String dumpNode(Node node) throws RepositoryException {
    StringBuffer buffer = new StringBuffer();
    buffer.append(node.getPath());

    PropertyIterator properties = node.getProperties();
    while (properties.hasNext()) {
        Property property = properties.nextProperty();
        buffer.append(property.getPath()).append("=");
        if (property.getDefinition().isMultiple()) {
            Value[] values = property.getValues();
            for (int i = 0; i < values.length; i++) {
                if (i > 0) {
                    buffer.append(",");
                }
                buffer.append(values[i].getString());
            }
        } else {
            buffer.append(property.getString());
        }
        buffer.append("\n");
    }

    NodeIterator nodes = node.getNodes();
    while (nodes.hasNext()) {
        Node child = nodes.nextNode();
        buffer.append(dumpNode(child));
    }
    return buffer.toString();

}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:38,代码来源:JcrTemplate.java

示例15: explore

import javax.jcr.PropertyIterator; //导入方法依赖的package包/类
/**
 * Utility method to display the contents of a node and its descendants
 * @param node
 * @throws RepositoryException 
 * @throws Exception
 */
public static void explore(Node node) throws RepositoryException  {
	log.info(node.getPath());
       // Skip the jcr:system subtree
       if (node.getName().equals("jcr:system")) {
           return;
       }
       // Output the properties
       PropertyIterator properties = node.getProperties();
       while (properties.hasNext()) {
           Property property = properties.nextProperty();
           if (property.getDefinition().isMultiple()) {
               // A multi-valued property, print all values
               Value[] values = property.getValues();
               for (int i = 0; i < values.length; i++) {
               	log.info(property.getPath() + " = " + values[i].getString());
               }
           } else {
               // A single-valued property
           	log.info(property.getPath() + " = " + property.getString());
           }
       }
       // Output all the child nodes recursively
       NodeIterator nodes = node.getNodes();
       while (nodes.hasNext()) {
           explore(nodes.nextNode());
       }	
}
 
开发者ID:sltang,项目名称:jackrabbit-migration,代码行数:34,代码来源:NodeUtils.java


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