/** * Returns the node referenced by this property. * <p> * The default implementation checks that this property is a reference * property (or tries to convert the property value to a reference) and * uses {@link Session#getNodeByUUID(String)} to retrieve the * referenced node. * * @return node referenced by this property * @throws RepositoryException if an error occurs */ public Node getNode() throws RepositoryException { Session session = getSession(); Value value = getValue(); if (value.getType() != PropertyType.REFERENCE) { value = session.getValueFactory().createValue( value.getString(), PropertyType.REFERENCE); } return session.getNodeByUUID(value.getString()); }
case PropertyType.REFERENCE: case PropertyType.WEAKREFERENCE: return getSession().getNodeByIdentifier(value); return (value.startsWith("/")) ? getSession().getNode(value) : getParent().getNode(value); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value); try { Value refValue = getSession().getValueFactory().createValue(value, PropertyType.REFERENCE); return getSession().getNodeByIdentifier(refValue.getString()); } catch (ItemNotFoundException e) { throw e; } catch (RepositoryException e) { Value pathValue = getSession().getValueFactory().createValue(value, PropertyType.PATH); try { return (value.startsWith("/")) ? getSession().getNode(pathValue.getString()) : getParent().getNode(pathValue.getString()); } catch (PathNotFoundException e1) { throw new ItemNotFoundException(pathValue.getString());
case PropertyType.REFERENCE: case PropertyType.WEAKREFERENCE: return getSession().getNodeByIdentifier(value); return (value.startsWith("/")) ? getSession().getNode(value) : getParent().getNode(value); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value); try { Value refValue = getSession().getValueFactory().createValue(value, PropertyType.REFERENCE); return getSession().getNodeByIdentifier(refValue.getString()); } catch (ItemNotFoundException e) { throw e; } catch (RepositoryException e) { Value pathValue = getSession().getValueFactory().createValue(value, PropertyType.PATH); try { return (value.startsWith("/")) ? getSession().getNode(pathValue.getString()) : getParent().getNode(pathValue.getString()); } catch (PathNotFoundException e1) { throw new ItemNotFoundException(pathValue.getString());
case PropertyType.REFERENCE: case PropertyType.WEAKREFERENCE: return getSession().getNodeByIdentifier(value); return (value.startsWith("/")) ? getSession().getNode(value) : getParent().getNode(value); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value); try { Value refValue = getSession().getValueFactory().createValue(value, PropertyType.REFERENCE); return getSession().getNodeByIdentifier(refValue.getString()); } catch (ItemNotFoundException e) { throw e; } catch (RepositoryException e) { Value pathValue = getSession().getValueFactory().createValue(value, PropertyType.PATH); try { return (value.startsWith("/")) ? getSession().getNode(pathValue.getString()) : getParent().getNode(pathValue.getString()); } catch (PathNotFoundException e1) { throw new ItemNotFoundException(pathValue.getString());
case PropertyType.PATH: try { return (value.startsWith("/")) ? getSession().getProperty(value) : getParent().getProperty(value); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value); String path = getSession().getValueFactory().createValue(value, PropertyType.PATH).getString(); return (path.startsWith("/")) ? getSession().getProperty(path) : getParent().getProperty(path); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value);
case PropertyType.PATH: try { return (value.startsWith("/")) ? getSession().getProperty(value) : getParent().getProperty(value); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value); String path = getSession().getValueFactory().createValue(value, PropertyType.PATH).getString(); return (path.startsWith("/")) ? getSession().getProperty(path) : getParent().getProperty(path); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value);
case PropertyType.PATH: try { return (value.startsWith("/")) ? getSession().getProperty(value) : getParent().getProperty(value); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value); String path = getSession().getValueFactory().createValue(value, PropertyType.PATH).getString(); return (path.startsWith("/")) ? getSession().getProperty(path) : getParent().getProperty(path); } catch (PathNotFoundException e) { throw new ItemNotFoundException(value);