Class Reference


  • public class Reference
    extends java.lang.Object
    A generic, immutable virtualized artefact reference.
    Refers virtualized artefacts through :
    • a Protocol - defines what kind of virtualzied artefact is referred by this reference as well as what virtualization process was applied
    • a Resource - identifies the main resource used in the virtualization (egg. a classpath location or repository node reference)
    • a list of ResourceParameters - used in customizing the virtualization process (egg. a resource pointing to the actual node of a semi-virtual folder reference)
    Author:
    Bogdan Horje
    • Constructor Detail

      • Reference

        public Reference​(Encoding encoding,
                         Protocol protocol,
                         Resource resource,
                         java.util.List<? extends Parameter> parameters)
        Constructor
        Parameters:
        encoding - the default Encoding of the new resource - to be used where an encoding is required and none is specified
        protocol -
        resource -
        parameters - resource parameters - a copy of the provided list will be stored by this reference
    • Method Detail

      • isReference

        public static final boolean isReference​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Deprecated.
        Quick Reference compliance check of a NodeRef.
        NodeRef Reference representations validated by this method should produce valid Reference objects based on the given NodeRef when passed to the fromNodeRef(NodeRef) method.
        Parameters:
        nodeRef -
        Returns:
        true if the given NodeRef is a valid Reference representation
        false otherwise
      • fromNodeRef

        public static final Reference fromNodeRef​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        NodeRef Reference representation decoder/converter method.
        Creates a Reference representation based on the ID of the given NodeRef.
        It expects a VIRTUAL_TOKEN prefixed encoded string. The encoded string must start with a valid Encoding token. The Reference representation structure is (no delimiters between the 3 elements): VIRTUAL_TOKEN ENCODING_TOKEN referenceString Given that a valid encoding was detected Encoding.urlNative information is used to obtain a reference string. The reference string is parsed using the encoding configured parser.
        Parameters:
        nodeRef -
        Returns:
        the Reference object corresponding to the given NodeRef
      • getEncoding

        public Encoding getEncoding()
        Returns:
        the default Encoding of this reference
      • getProtocol

        public Protocol getProtocol()
      • getResource

        public Resource getResource()
      • getParameters

        public java.util.List<Parameter> getParameters()
      • toNodeRef

        public org.alfresco.service.cmr.repository.NodeRef toNodeRef()
                                                              throws ReferenceEncodingException
        Returns:
        a NodeRef representation of this resource using the StoreRef.STORE_REF_WORKSPACE_SPACESSTORE and the default encoding of this resource
        Throws:
        ReferenceEncodingException
      • toNodeRef

        public org.alfresco.service.cmr.repository.NodeRef toNodeRef​(org.alfresco.service.cmr.repository.StoreRef storeRef)
                                                              throws ReferenceEncodingException
        Parameters:
        storeRef -
        Returns:
        a NodeRef representation of this resource using the given StoreRef and the default encoding of this resource
        Throws:
        ReferenceEncodingException
      • toNodeRef

        public org.alfresco.service.cmr.repository.NodeRef toNodeRef​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                                     Encoding encoding)
                                                              throws ReferenceEncodingException
        Parameters:
        storeRef -
        encoding -
        Returns:
        a NodeRef representation of this resource using the given StoreRef and Encoding
        Throws:
        ReferenceEncodingException
      • propagateNodeRefMutations

        public Reference propagateNodeRefMutations​(org.alfresco.service.cmr.repository.NodeRef mutatedNodeRef)
        Despite claimed NodeRef opacity Alfresco sometimes alters NodeRefs representation to achieve functionality. For example see VersionUtil.convertNodeRef(NodeRef).
        We say that altered NodeRefs have suffered mutations and we try to detect those mutations and create a correspondent reference.
        Parameters:
        mutatedNodeRef -
        Returns:
        a mutated version of this Reference corresponding to the given mutated node or this Reference if no mutations are detected
      • toString

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

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object