Package org.alfresco.repo.virtual.ref
Class Reference
- java.lang.Object
-
- org.alfresco.repo.virtual.ref.Reference
-
public class Reference extends java.lang.ObjectA 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
- a
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Stringencode()java.lang.Stringencode(Encoding anEncoding)booleanequals(java.lang.Object obj)<R> Rexecute(ProtocolMethod<R> method)Double-dispatchesProtocolMethods.
UsesProtocol.dispatch(ProtocolMethod, Reference)to trigger concrete protocol based double dispatchProtocolMethod::executeinvocation on the given method object.static ReferencefromNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)NodeRefReferencerepresentation decoder/converter method.
Creates aReferencerepresentation based on the ID of the givenNodeRef.
It expects aVIRTUAL_TOKENprefixed encoded string.EncodinggetEncoding()java.util.List<Parameter>getParameters()ProtocolgetProtocol()ResourcegetResource()inthashCode()static booleanisReference(org.alfresco.service.cmr.repository.NodeRef nodeRef)Deprecated.ReferencepropagateNodeRefMutations(org.alfresco.service.cmr.repository.NodeRef mutatedNodeRef)Despite claimedNodeRefopacity Alfresco sometimes alters NodeRefs representation to achieve functionality.org.alfresco.service.cmr.repository.NodeReftoNodeRef()org.alfresco.service.cmr.repository.NodeReftoNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef)org.alfresco.service.cmr.repository.NodeReftoNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef, Encoding encoding)java.lang.StringtoString()
-
-
-
Constructor Detail
-
Reference
public Reference(Encoding encoding, Protocol protocol, Resource resource, java.util.List<? extends Parameter> parameters)
Constructor- Parameters:
encoding- the defaultEncodingof 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 reference
-
-
Method Detail
-
isReference
public static final boolean isReference(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Deprecated.Quick Reference compliance check of aNodeRef.
NodeRef Reference representations validated by this method should produce valid Reference objects based on the givenNodeRefwhen passed to thefromNodeRef(NodeRef)method.- Parameters:
nodeRef-- Returns:
trueif the givenNodeRefis a valid Reference representation
falseotherwise
-
fromNodeRef
public static final Reference fromNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
NodeRefReferencerepresentation decoder/converter method.
Creates aReferencerepresentation based on the ID of the givenNodeRef.
It expects aVIRTUAL_TOKENprefixed encoded string. The encoded string must start with a validEncodingtoken. The Reference representation structure is (no delimiters between the 3 elements): VIRTUAL_TOKEN ENCODING_TOKEN referenceString Given that a valid encoding was detectedEncoding.urlNativeinformation is used to obtain a reference string. The reference string is parsed using the encoding configured parser.- Parameters:
nodeRef-- Returns:
- the
Referenceobject corresponding to the givenNodeRef
-
encode
public java.lang.String encode() throws ReferenceEncodingException- Returns:
- a
Stringrepresentation of this reference using its defaultEncoding - Throws:
ReferenceEncodingException
-
encode
public java.lang.String encode(Encoding anEncoding) throws ReferenceEncodingException
- Parameters:
anEncoding-- Returns:
- a
Stringrepresentation of this reference using the givenEncoding - Throws:
ReferenceEncodingException
-
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
NodeRefrepresentation of this resource using theStoreRef.STORE_REF_WORKSPACE_SPACESSTOREand 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
NodeRefrepresentation of this resource using the givenStoreRefand 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
NodeRefrepresentation of this resource using the givenStoreRefandEncoding - Throws:
ReferenceEncodingException
-
execute
public <R> R execute(ProtocolMethod<R> method) throws ProtocolMethodException
Double-dispatchesProtocolMethods.
UsesProtocol.dispatch(ProtocolMethod, Reference)to trigger concrete protocol based double dispatchProtocolMethod::executeinvocation on the given method object.- Parameters:
method-- Returns:
- the dispatched method execution result
- Throws:
ProtocolMethodException
-
propagateNodeRefMutations
public Reference propagateNodeRefMutations(org.alfresco.service.cmr.repository.NodeRef mutatedNodeRef)
Despite claimedNodeRefopacity Alfresco sometimes alters NodeRefs representation to achieve functionality. For example seeVersionUtil.convertNodeRef(NodeRef).
We say that alteredNodeRefs have suffered mutations and we try to detect those mutations and create a correspondent reference.- Parameters:
mutatedNodeRef-- Returns:
- a mutated version of this
Referencecorresponding to the given mutated node orthisReference if no mutations are detected
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-