本文整理汇总了Java中javax.jcr.PropertyIterator类的典型用法代码示例。如果您正苦于以下问题:Java PropertyIterator类的具体用法?Java PropertyIterator怎么用?Java PropertyIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyIterator类属于javax.jcr包,在下文中一共展示了PropertyIterator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: 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
示例18: 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
示例19: 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
示例20: 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
注:本文中的javax.jcr.PropertyIterator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论