try { Property property = node.getProperty(propertyName); type = PropertyType.fromValue(property.getType()); } catch (PathNotFoundException e) { type = PropertyType.fromCanonicalType(propertyValue.getClass()); property = type.set(node, propertyName, propertyValue); } else { property = null;
public final Property set(Node node, String name, Object value) throws RepositoryException { Value v = wrap(node.getSession().getValueFactory(), value); if (v != null) { try { return node.setProperty(name, v); } catch (ValueFormatException e) { return node.setProperty(name, new Value[]{v}); } } return null; }
private Object _getProperty(Object object, String propertyName) throws RepositoryException { Node node = (Node)object; // Access defined properties MetaProperty metaProperty = super.getMetaProperty(propertyName); if (metaProperty != null) { return metaProperty.getProperty(node); } // First we try to access a property try { Property property = node.getProperty(propertyName); PropertyType type = PropertyType.fromValue(property.getType()); return type.get(property); } catch (PathNotFoundException e) { } // If we don't find it as a property we try it as a child node try { return node.getNode(propertyName); } catch (PathNotFoundException e) { } // return null; }
public Object get(Property property) throws RepositoryException { if (this == REFERENCE) { return property.getNode(); } else { Value value; if (property.getDefinition().isMultiple()) { Value[] values = property.getValues(); value = values.length > 0 ? values[0] : null; } else { value = property.getValue(); } return value != null ? unwrap(value) : null; } }
private Object _getProperty(Object object, String propertyName) throws RepositoryException { Node node = (Node)object; // Access defined properties MetaProperty metaProperty = super.getMetaProperty(propertyName); if (metaProperty != null) { return metaProperty.getProperty(node); } // First we try to access a property try { Property property = node.getProperty(propertyName); PropertyType type = PropertyType.fromValue(property.getType()); return type.get(property); } catch (PathNotFoundException e) { } // If we don't find it as a property we try it as a child node try { return node.getNode(propertyName); } catch (PathNotFoundException e) { } // return null; }
public Object get(Property property) throws RepositoryException { if (this == REFERENCE) { return property.getNode(); } else { Value value; if (property.getDefinition().isMultiple()) { Value[] values = property.getValues(); value = values.length > 0 ? values[0] : null; } else { value = property.getValue(); } return value != null ? unwrap(value) : null; } }
try { Property property = node.getProperty(propertyName); type = PropertyType.fromValue(property.getType()); } catch (PathNotFoundException e) { type = PropertyType.fromCanonicalType(propertyValue.getClass()); property = type.set(node, propertyName, propertyValue); } else { property = null;
private Object _getProperty(Object object, String propertyName) throws RepositoryException { Node node = (Node)object; // Access defined properties MetaProperty metaProperty = super.getMetaProperty(propertyName); if (metaProperty != null) { return metaProperty.getProperty(node); } // First we try to access a property try { Property property = node.getProperty(propertyName); PropertyType type = PropertyType.fromValue(property.getType()); return type.get(property); } catch (PathNotFoundException e) { } // If we don't find it as a property we try it as a child node try { return node.getNode(propertyName); } catch (PathNotFoundException e) { } // return null; }
public final Property set(Node node, String name, Object value) throws RepositoryException { Value v = wrap(node.getSession().getValueFactory(), value); if (v != null) { try { return node.setProperty(name, v); } catch (ValueFormatException e) { return node.setProperty(name, new Value[]{v}); } } return null; }
public Object get(Property property) throws RepositoryException { if (this == REFERENCE) { return property.getNode(); } else { Value value; if (property.getDefinition().isMultiple()) { Value[] values = property.getValues(); value = values.length > 0 ? values[0] : null; } else { value = property.getValue(); } return value != null ? unwrap(value) : null; } }
try { Property property = node.getProperty(propertyName); type = PropertyType.fromValue(property.getType()); } catch (PathNotFoundException e) { type = PropertyType.fromCanonicalType(propertyValue.getClass()); property = type.set(node, propertyName, propertyValue); } else { property = null;
public final Property set(Node node, String name, Object value) throws RepositoryException { Value v = wrap(node.getSession().getValueFactory(), value); if (v != null) { try { return node.setProperty(name, v); } catch (ValueFormatException e) { return node.setProperty(name, new Value[]{v}); } } return null; }