/** * Returns the path of this node. * <p> * The default implementation recursively calls this method on the * parent node and appends the name and optionally the index of this * node to construct the full path. Returns "/" if the parent node is * not available (i.e. this is the root node). * * @return node path * @throws RepositoryException if an error occurs */ public String getPath() throws RepositoryException { try { StringBuffer buffer = new StringBuffer(getParent().getPath()); if (buffer.length() > 1) { buffer.append('/'); } buffer.append(getName()); int index = getIndex(); if (index != 1) { buffer.append('['); buffer.append(index); buffer.append(']'); } return buffer.toString(); } catch (ItemNotFoundException e) { return "/"; } }
/** * Returns the path of this node. * <p> * The default implementation recursively calls this method on the * parent node and appends the name and optionally the index of this * node to construct the full path. Returns "/" if the parent node is * not available (i.e. this is the root node). * * @return node path * @throws RepositoryException if an error occurs */ public String getPath() throws RepositoryException { try { StringBuffer buffer = new StringBuffer(getParent().getPath()); if (buffer.length() > 1) { buffer.append('/'); } buffer.append(getName()); int index = getIndex(); if (index != 1) { buffer.append('['); buffer.append(index); buffer.append(']'); } return buffer.toString(); } catch (ItemNotFoundException e) { return "/"; } }
/** * Returns the path of this node. * <p> * The default implementation recursively calls this method on the * parent node and appends the name and optionally the index of this * node to construct the full path. Returns "/" if the parent node is * not available (i.e. this is the root node). * * @return node path * @throws RepositoryException if an error occurs */ public String getPath() throws RepositoryException { try { StringBuffer buffer = new StringBuffer(getParent().getPath()); if (buffer.length() > 1) { buffer.append('/'); } buffer.append(getName()); int index = getIndex(); if (index != 1) { buffer.append('['); buffer.append(index); buffer.append(']'); } return buffer.toString(); } catch (ItemNotFoundException e) { return "/"; } }
/** * Returns the path of this node. * <p> * The default implementation recursively calls this method on the * parent node and appends the name and optionally the index of this * node to construct the full path. Returns "/" if the parent node is * not available (i.e. this is the root node). * * @return node path * @throws RepositoryException if an error occurs */ public String getPath() throws RepositoryException { try { StringBuffer buffer = new StringBuffer(getParent().getPath()); if (buffer.length() > 1) { buffer.append('/'); } buffer.append(getName()); int index = getIndex(); if (index != 1) { buffer.append('['); buffer.append(index); buffer.append(']'); } return buffer.toString(); } catch (ItemNotFoundException e) { return "/"; } }
/** * Returns the UUID of this node. * <p> * The default implementation checks if this node is referenceable (i.e. of * type <code>mix:referenceable</code>) and returns the contents of the * <code>jcr:uuid</code> property if it is. * * @return node UUID * @throws UnsupportedRepositoryOperationException * if this node is not referenceable * @throws RepositoryException if an error occurs */ public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException { if (isNodeType(getName("mix:referenceable"))) { return getProperty(getName("jcr:uuid")).getString(); } else { throw new UnsupportedRepositoryOperationException( "This node is not referenceable: " + getPath()); } }
/** * Returns the UUID of this node. * <p> * The default implementation checks if this node is referenceable (i.e. of * type <code>mix:referenceable</code>) and returns the contents of the * <code>jcr:uuid</code> property if it is. * * @return node UUID * @throws UnsupportedRepositoryOperationException * if this node is not referenceable * @throws RepositoryException if an error occurs */ public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException { if (isNodeType(getName("mix:referenceable"))) { return getProperty(getName("jcr:uuid")).getString(); } else { throw new UnsupportedRepositoryOperationException( "This node is not referenceable: " + getPath()); } }
/** * Returns the UUID of this node. * <p> * The default implementation checks if this node is referenceable (i.e. of * type <code>mix:referenceable</code>) and returns the contents of the * <code>jcr:uuid</code> property if it is. * * @return node UUID * @throws UnsupportedRepositoryOperationException * if this node is not referenceable * @throws RepositoryException if an error occurs */ public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException { if (isNodeType(getName(MIX, "referenceable"))) { return getProperty(getName(JCR, "uuid")).getString(); } else { throw new UnsupportedRepositoryOperationException( "This node is not referenceable: " + getPath()); } }
/** * Returns the UUID of this node. * <p> * The default implementation checks if this node is referenceable (i.e. of * type <code>mix:referenceable</code>) and returns the contents of the * <code>jcr:uuid</code> property if it is. * * @return node UUID * @throws UnsupportedRepositoryOperationException * if this node is not referenceable * @throws RepositoryException if an error occurs */ public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException { if (isNodeType(getName("mix:referenceable"))) { return getProperty(getName("jcr:uuid")).getString(); } else { throw new UnsupportedRepositoryOperationException( "This node is not referenceable: " + getPath()); } }
/** * Returns the primary node type of this node. * <p> * The default implementation uses the value of the * <code>jcr:primaryType</code> property to look up the primary * node type from the {@link NodeTypeManager} of the current workspace. * * @return primary node type * @throws RepositoryException if an error occurs */ public NodeType getPrimaryNodeType() throws RepositoryException { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName("jcr:primaryType")); return manager.getNodeType(property.getString()); }
/** * Returns the primary node type of this node. * <p> * The default implementation uses the value of the * <code>jcr:primaryType</code> property to look up the primary * node type from the {@link NodeTypeManager} of the current workspace. * * @return primary node type * @throws RepositoryException if an error occurs */ public NodeType getPrimaryNodeType() throws RepositoryException { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName("jcr:primaryType")); return manager.getNodeType(property.getString()); }
/** * Returns the primary node type of this node. * <p> * The default implementation uses the value of the * <code>jcr:primaryType</code> property to look up the primary * node type from the {@link NodeTypeManager} of the current workspace. * * @return primary node type * @throws RepositoryException if an error occurs */ public NodeType getPrimaryNodeType() throws RepositoryException { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName(JCR, "primaryType")); return manager.getNodeType(property.getString()); }
/** * Returns the primary node type of this node. * <p> * The default implementation uses the value of the * <code>jcr:primaryType</code> property to look up the primary * node type from the {@link NodeTypeManager} of the current workspace. * * @return primary node type * @throws RepositoryException if an error occurs */ public NodeType getPrimaryNodeType() throws RepositoryException { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName("jcr:primaryType")); return manager.getNodeType(property.getString()); }
/** * Checks whether this node is checked out. * <p> * The default implementation checks the <code>jcr:isCheckedOut</code> * property if this node is versionable, and recursively calls this method * on the parent node if this node is not versionable. A non-versionable * root node always returns <code>true</code> from this method. * * @return <code>true</code> if this node is checked out, * <code>false</code> otherwise * @throws RepositoryException if an error occurs */ public boolean isCheckedOut() throws RepositoryException { if (isNodeType(getName(MIX, "versionable"))) { // This node is versionable, check the jcr:isCheckedOut property return getProperty(getName(JCR, "isCheckedOut")).getBoolean(); } else { try { // This node is not versionable, is the parent checked out? return getParent().isCheckedOut(); } catch (ItemNotFoundException e) { // This node is the root node, always checked out return true; } } }
/** * Checks whether this node is checked out. * <p> * The default implementation checks the <code>jcr:isCheckedOut</code> * property if this node is versionable, and recursively calls this method * on the parent node if this node is not versionable. A non-versionable * root node always returns <code>true</code> from this method. * * @return <code>true</code> if this node is checked out, * <code>false</code> otherwise * @throws RepositoryException if an error occurs */ public boolean isCheckedOut() throws RepositoryException { if (isNodeType(getName("jcr:versionable"))) { // This node is versionable, check the jcr:isCheckedOut property return getProperty(getName("jcr:isCheckedOut")).getBoolean(); } else { try { // This node is not versionable, is the parent checked out? return getParent().isCheckedOut(); } catch (ItemNotFoundException e) { // This node is the root node, always checked out return true; } } }
/** * Checks whether this node is checked out. * <p> * The default implementation checks the <code>jcr:isCheckedOut</code> * property if this node is versionable, and recursively calls this method * on the parent node if this node is not versionable. A non-versionable * root node always returns <code>true</code> from this method. * * @return <code>true</code> if this node is checked out, * <code>false</code> otherwise * @throws RepositoryException if an error occurs */ public boolean isCheckedOut() throws RepositoryException { if (isNodeType(getName("jcr:versionable"))) { // This node is versionable, check the jcr:isCheckedOut property return getProperty(getName("jcr:isCheckedOut")).getBoolean(); } else { try { // This node is not versionable, is the parent checked out? return getParent().isCheckedOut(); } catch (ItemNotFoundException e) { // This node is the root node, always checked out return true; } } }
/** * Checks whether this node is checked out. * <p> * The default implementation checks the <code>jcr:isCheckedOut</code> * property if this node is versionable, and recursively calls this method * on the parent node if this node is not versionable. A non-versionable * root node always returns <code>true</code> from this method. * * @return <code>true</code> if this node is checked out, * <code>false</code> otherwise * @throws RepositoryException if an error occurs */ public boolean isCheckedOut() throws RepositoryException { if (isNodeType(getName("jcr:versionable"))) { // This node is versionable, check the jcr:isCheckedOut property return getProperty(getName("jcr:isCheckedOut")).getBoolean(); } else { try { // This node is not versionable, is the parent checked out? return getParent().isCheckedOut(); } catch (ItemNotFoundException e) { // This node is the root node, always checked out return true; } } }
/** * Returns the declared mixin node types of this node. * <p> * The default implementation uses the values of the * <code>jcr:mixinTypes</code> property to look up the mixin node types * from the {@link NodeTypeManager} of the current workspace. * * @return mixin node types * @throws RepositoryException if an error occurs */ public NodeType[] getMixinNodeTypes() throws RepositoryException { try { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName("jcr:mixinTypes")); Value[] values = property.getValues(); NodeType[] types = new NodeType[values.length]; for (int i = 0; i < values.length; i++) { types[i] = manager.getNodeType(values[i].getString()); } return types; } catch (PathNotFoundException e) { // jcr:mixinTypes does not exist, i.e. no mixin types on this node return new NodeType[0]; } }
/** * Returns the declared mixin node types of this node. * <p> * The default implementation uses the values of the * <code>jcr:mixinTypes</code> property to look up the mixin node types * from the {@link NodeTypeManager} of the current workspace. * * @return mixin node types * @throws RepositoryException if an error occurs */ public NodeType[] getMixinNodeTypes() throws RepositoryException { try { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName("jcr:mixinTypes")); Value[] values = property.getValues(); NodeType[] types = new NodeType[values.length]; for (int i = 0; i < values.length; i++) { types[i] = manager.getNodeType(values[i].getString()); } return types; } catch (PathNotFoundException e) { // jcr:mixinTypes does not exist, i.e. no mixin types on this node return new NodeType[0]; } }
/** * Returns the declared mixin node types of this node. * <p> * The default implementation uses the values of the * <code>jcr:mixinTypes</code> property to look up the mixin node types * from the {@link NodeTypeManager} of the current workspace. * * @return mixin node types * @throws RepositoryException if an error occurs */ public NodeType[] getMixinNodeTypes() throws RepositoryException { try { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName("jcr:mixinTypes")); Value[] values = property.getValues(); NodeType[] types = new NodeType[values.length]; for (int i = 0; i < values.length; i++) { types[i] = manager.getNodeType(values[i].getString()); } return types; } catch (PathNotFoundException e) { // jcr:mixinTypes does not exist, i.e. no mixin types on this node return new NodeType[0]; } }
/** * Returns the declared mixin node types of this node. * <p> * The default implementation uses the values of the * <code>jcr:mixinTypes</code> property to look up the mixin node types * from the {@link NodeTypeManager} of the current workspace. * * @return mixin node types * @throws RepositoryException if an error occurs */ public NodeType[] getMixinNodeTypes() throws RepositoryException { try { NodeTypeManager manager = getSession().getWorkspace().getNodeTypeManager(); Property property = getProperty(getName(JCR, "mixinTypes")); Value[] values = property.getValues(); NodeType[] types = new NodeType[values.length]; for (int i = 0; i < values.length; i++) { types[i] = manager.getNodeType(values[i].getString()); } return types; } catch (PathNotFoundException e) { // jcr:mixinTypes does not exist, i.e. no mixin types on this node return new NodeType[0]; } }