Class NodeRef

  • All Implemented Interfaces:
    java.io.Serializable, EntityRef

    @AlfrescoPublicApi
    public final class NodeRef
    extends java.lang.Object
    implements EntityRef, java.io.Serializable
    Reference to a node
    Author:
    Derek Hulley
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  NodeRef.Status
      Helper class to convey the status of a node.
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeRef​(java.lang.String nodeRef)
      Construct a Node Reference from a string representation of a Node Reference.
      NodeRef​(java.lang.String protocol, java.lang.String identifier, java.lang.String id)  
      NodeRef​(StoreRef storeRef, java.lang.String id)
      Construct a Node Reference from a Store Reference and Node Id
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Override equals for this ref type
      java.lang.String getId()  
      static java.util.List<NodeRef> getNodeRefs​(java.lang.String values)
      Converts a String containing a comma-separated list of NodeRef Ids into NodeRefs.
      static java.util.List<NodeRef> getNodeRefs​(java.lang.String values, org.apache.commons.logging.Log logger)
      Converts a String containing a comma-separated list of NodeRef Ids into NodeRefs.
      StoreRef getStoreRef()  
      int hashCode()
      Hashes on ID alone.
      static boolean isNodeRef​(java.lang.String nodeRef)
      Determine if passed string conforms to the pattern of a node reference
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NodeRef

        public NodeRef​(StoreRef storeRef,
                       java.lang.String id)
        Construct a Node Reference from a Store Reference and Node Id
        Parameters:
        storeRef - store reference
        id - the manually assigned identifier of the node
      • NodeRef

        public NodeRef​(java.lang.String nodeRef)
        Construct a Node Reference from a string representation of a Node Reference.

        The string representation of a Node Reference is as follows:

        /
        Parameters:
        nodeRef - the string representation of a node ref
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Override equals for this ref type
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Hashes on ID alone. As the number of copies of a particular node will be minimal, this is acceptable
        Overrides:
        hashCode in class java.lang.Object
      • getStoreRef

        public final StoreRef getStoreRef()
        Returns:
        The StoreRef part of this reference
      • getId

        public final java.lang.String getId()
        Returns:
        The Node Id part of this reference
      • isNodeRef

        public static boolean isNodeRef​(java.lang.String nodeRef)
        Determine if passed string conforms to the pattern of a node reference
        Parameters:
        nodeRef - the node reference as a string
        Returns:
        true => it matches the pattern of a node reference
      • getNodeRefs

        public static java.util.List<NodeRef> getNodeRefs​(java.lang.String values)
        Converts a String containing a comma-separated list of NodeRef Ids into NodeRefs.
        Parameters:
        values - the String of NodeRef ids.
        Returns:
        A List of NodeRefs.
      • getNodeRefs

        public static java.util.List<NodeRef> getNodeRefs​(java.lang.String values,
                                                          org.apache.commons.logging.Log logger)
        Converts a String containing a comma-separated list of NodeRef Ids into NodeRefs. If a logger is supplied then invalid ids are logged as warnings.
        Parameters:
        values - the String of NodeRef ids.
        logger - Log
        Returns:
        A List of NodeRefs.