Package org.silverpeas.core
Class ResourceReference
- java.lang.Object
-
- org.silverpeas.core.WAPrimaryKey
-
- org.silverpeas.core.ResourceReference
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ComponentResourceIdentifier
,ResourceIdentifier
- Direct Known Subclasses:
ContactPK
,ContributionRatingPK
,NodePK
,PublicationPK
,SimpleDocumentPK
,ThumbnailReference
public class ResourceReference extends WAPrimaryKey implements ComponentResourceIdentifier, Serializable
Reference to a resource managed by a component instance in Silverpeas. Such a reference is aComponentResourceIdentifier
used to identify any kinds of resources in Silverpeas without having knowledge on what this resource is. It is dedicated to be used to refer a given resource without having to pass it explicitly; information about the resource can be then passed from service to service without any coupling between them or with the underlying resource.For compatibility reason,
ResourceReference
extendsWAPrimaryKey
but this inheritance will be removed in the future.- Author:
- Nicolas Eysseric, mmoquillon
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
UNKNOWN_ID
Identifier referring that the resource behind is unknown and doesn't require to be known.-
Fields inherited from class org.silverpeas.core.WAPrimaryKey
componentName, id, space
-
-
Constructor Summary
Constructors Constructor Description ResourceReference(String id)
Constructs a new reference to a resource with the specified identifier.ResourceReference(String id, String componentInstanceId)
Constructs a new reference to a resource with the specified identifier and that is managed by the specified component instance.ResourceReference(ContributionIdentifier identifier)
Constructs a new reference to the specified contribution.ResourceReference(WAPrimaryKey pk)
Constructs a new reference to a resource from the old and deprecated WAPrimaryKey object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
asString()
Gets the value of this identifier as a String.boolean
equals(Object other)
Is the an another object is aResourceReference
instance and is equal to this object.String
getComponentInstanceId()
String
getLocalId()
int
hashCode()
Gets the hash code of this reference.static ResourceReference
to(ComponentResourceIdentifier resource)
Gets a reference to the specified resource managed by a component instance.-
Methods inherited from class org.silverpeas.core.WAPrimaryKey
clone, getComponentName, getId, getInstanceId, getRootTableName, getSpace, getSpaceId, getTableName, getTableName, setComponentName, setId, setSpace, toResourceReference, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.ComponentResourceIdentifier
toReference
-
-
-
-
Field Detail
-
UNKNOWN_ID
public static final String UNKNOWN_ID
Identifier referring that the resource behind is unknown and doesn't require to be known.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResourceReference
public ResourceReference(ContributionIdentifier identifier)
Constructs a new reference to the specified contribution.- Parameters:
identifier
- the unique identifier of a contribution.
-
ResourceReference
public ResourceReference(String id)
Constructs a new reference to a resource with the specified identifier. The resource doesn't belong to a component instance or that component instance isn't required to refer uniquely the resource.- Parameters:
id
- the unique identifier of a resource from which it can be explicitly and uniquely referred in the whole Silverpeas.
-
ResourceReference
public ResourceReference(String id, String componentInstanceId)
Constructs a new reference to a resource with the specified identifier and that is managed by the specified component instance.- Parameters:
id
- the identifier of the resource, unique in the given component instance.componentInstanceId
- the unique identifier of the component instance.
-
ResourceReference
public ResourceReference(WAPrimaryKey pk)
Constructs a new reference to a resource from the old and deprecated WAPrimaryKey object.- Parameters:
pk
- a WAPrimaryKey object used to identify uniquely a resource in Silverpeas.
-
-
Method Detail
-
to
public static ResourceReference to(ComponentResourceIdentifier resource)
Gets a reference to the specified resource managed by a component instance.- Parameters:
resource
- the unique identifier of a resource managed by a component.- Returns:
- a
ResourceReference
instance.
-
equals
public boolean equals(Object other)
Is the an another object is aResourceReference
instance and is equal to this object.- Specified by:
equals
in classWAPrimaryKey
- Parameters:
other
- the object to compare to this reference.- Returns:
- true if other is equals to this reference. False otherwise.
-
hashCode
public int hashCode()
Gets the hash code of this reference.- Overrides:
hashCode
in classWAPrimaryKey
- Returns:
- an integer
-
getLocalId
public String getLocalId()
- Specified by:
getLocalId
in interfaceComponentResourceIdentifier
-
getComponentInstanceId
public String getComponentInstanceId()
- Specified by:
getComponentInstanceId
in interfaceComponentResourceIdentifier
-
asString
public String asString()
Description copied from interface:ResourceIdentifier
Gets the value of this identifier as a String.- Specified by:
asString
in interfaceResourceIdentifier
- Returns:
- the String representation of this identifier.
-
-