public class Reference extends Object
Protocol
- defines what kind of virtualzied artefact is
referred by this reference as well as what virtualization process was applied
Resource
- identifies the main resource used in the
virtualization (egg. a classpath location or repository node reference)ResourceParameter
s - used in customizing the
virtualization process (egg. a resource pointing to the actual node of a
semi-virtual folder reference)Constructor and Description |
---|
Reference(Encoding encoding,
Protocol protocol,
Resource resource) |
Reference(Encoding encoding,
Protocol protocol,
Resource resource,
List<? extends Parameter> parameters)
Constructor
|
Modifier and Type | Method and Description |
---|---|
String |
encode() |
String |
encode(Encoding anEncoding) |
boolean |
equals(Object obj) |
<R> R |
execute(ProtocolMethod<R> method)
Double-dispatches
ProtocolMethod s.Uses Protocol.dispatch(ProtocolMethod, Reference) to trigger
concrete protocol based double dispatch
ProtocolMethod::execute invocation on the given method
object. |
static 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. |
Encoding |
getEncoding() |
List<Parameter> |
getParameters() |
Protocol |
getProtocol() |
Resource |
getResource() |
int |
hashCode() |
static boolean |
isReference(org.alfresco.service.cmr.repository.NodeRef nodeRef)
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. |
Reference |
propagateNodeRefMutations(org.alfresco.service.cmr.repository.NodeRef mutatedNodeRef)
Despite claimed
NodeRef opacity Alfresco sometimes alters
NodeRefs representation to achieve functionality. |
org.alfresco.service.cmr.repository.NodeRef |
toNodeRef() |
org.alfresco.service.cmr.repository.NodeRef |
toNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef) |
org.alfresco.service.cmr.repository.NodeRef |
toNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef,
Encoding encoding) |
String |
toString() |
public Reference(Encoding encoding, Protocol protocol, Resource resource, List<? extends Parameter> parameters)
encoding
- the default Encoding
of the new resource - to be
used where an encoding is required and none is specifiedprotocol
- resource
- parameters
- resource parameters - a copy of the provided list will
be stored by this referencepublic static final boolean isReference(org.alfresco.service.cmr.repository.NodeRef nodeRef)
NodeRef
.NodeRef
when passed to
the fromNodeRef(NodeRef)
method.nodeRef
- true
if the given NodeRef
is a valid
Reference representationfalse
otherwisepublic static final Reference fromNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef) throws ReferenceParseException, ReferenceEncodingException
NodeRef
Reference
representation decoder/converter
method.Reference
representation based on the ID of the given
NodeRef
.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.nodeRef
- Reference
object corresponding to the given
NodeRef
ReferenceParseException
- if an error occurs during the reference
string parsingReferenceEncodingException
- if the NodeRef
ID has an
invalid virtual token prefix or it uses an invalid encoding
tokenpublic String encode() throws ReferenceEncodingException
String
representation of this reference using its
default Encoding
ReferenceEncodingException
public String encode(Encoding anEncoding) throws ReferenceEncodingException
anEncoding
- String
representation of this reference using the given
Encoding
ReferenceEncodingException
public Protocol getProtocol()
public Resource getResource()
public org.alfresco.service.cmr.repository.NodeRef toNodeRef() throws ReferenceEncodingException
NodeRef
representation of this resource using the
StoreRef.STORE_REF_WORKSPACE_SPACESSTORE
and the default
encoding of this resourceReferenceEncodingException
public org.alfresco.service.cmr.repository.NodeRef toNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef) throws ReferenceEncodingException
storeRef
- NodeRef
representation of this resource using the given
StoreRef
and the default encoding of this resourceReferenceEncodingException
public org.alfresco.service.cmr.repository.NodeRef toNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef, Encoding encoding) throws ReferenceEncodingException
storeRef
- encoding
- NodeRef
representation of this resource using the given
StoreRef
and Encoding
ReferenceEncodingException
public <R> R execute(ProtocolMethod<R> method) throws ProtocolMethodException
ProtocolMethod
s.Protocol.dispatch(ProtocolMethod, Reference)
to trigger
concrete protocol based double dispatch
ProtocolMethod::execute
invocation on the given method
object.method
- ProtocolMethodException
public Reference propagateNodeRefMutations(org.alfresco.service.cmr.repository.NodeRef mutatedNodeRef)
NodeRef
opacity Alfresco sometimes alters
NodeRefs representation to achieve functionality. For example see
VersionUtil.convertNodeRef(NodeRef)
.NodeRef
s have suffered mutations and we try
to detect those mutations and create a correspondent reference.mutatedNodeRef
- Reference
corresponding to the
given mutated node or
this
Reference if no mutations are detectedCopyright © 2005–2017 Alfresco Software. All rights reserved.