|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sakaiproject.entitybroker.EntityReference
public class EntityReference
The class of all Entity references handled by the EntityBroker system. This provides the
entity prefix, which uniquely identifies the EntityProvider
responsible for handling the Entity. It optionally provides the entity id which
uniquely identifies an entity locally within the prefix space.
It also provides for all parsing methods for
entity references (always of the form /prefix or /prefix/id)
| Field Summary | |
|---|---|
protected String |
originalReference
|
static char |
PERIOD
|
String |
prefix
An entity prefix, should match with the prefix handled in an EntityProvider,
uniquely identifies an entity space or entity typeWARNING: use the getPrefix() method rather than referring to this directly |
static char |
SEPARATOR
|
static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
EntityReference()
|
|
EntityReference(String reference)
Constructor which takes an entity reference, this is the most common way to construct an entity reference object |
|
EntityReference(String prefix,
String id)
Convenience constructor for when you know the prefix and/or id |
|
| Method Summary | |
|---|---|
protected static void |
checkPrefixId(String prefix,
String id)
Checks this prefix and id to see if they are valid format, throw exceptions if they aren't |
protected static void |
checkReference(String reference)
Check if a reference is basically valid |
protected Object |
clone()
|
EntityReference |
copy()
|
static EntityReference |
copy(EntityReference ref)
Creates a copy of an entity reference |
protected static String |
findId(String reference)
Get the local entity id based on a full entity reference |
protected static String |
findPrefix(String reference)
Get the entity prefix based on an entity reference |
String |
getId()
A local entity id, represents an entity uniquely in a tool/webapp, could match with the actual id of a model data object, this will be null if this reference refers to an entity space only |
static String |
getIdFromRef(String reference)
Will convert a reference into an id (even if it is not a reference) |
static String |
getIdFromRefByKey(String reference,
String key)
Get the id value out of a reference by the key that preceeds it |
String |
getOriginalReference()
This is a special method and should not normally be used, use toString() or getReference() |
String |
getPrefix()
|
static String |
getPrefix(String reference)
Get the entity prefix based on an entity reference string, WARNING: this is meant for internal use, use EntityReference(String) and
the methods in EntityBroker to parse references |
String |
getReference()
Get the string reference for this entity reference object, same as calling toString() |
protected static int |
getSeparatorPos(String reference,
int number)
|
String |
getSpaceReference()
Get the space reference for this entity reference, this ignored any id and only returns the reference to the entity space |
boolean |
isEmpty()
|
protected String |
makeEntityId()
Override this if you are making a new class to define your entity reference, called by public getId() method |
protected String |
makeEntityPrefix()
Override this if you are making a new class to define your entity reference, called by public getPrefix() method |
protected String |
makeEntityReference(boolean spaceOnly)
Override this if you are making a new class to define your entity reference |
protected void |
setOriginalReference(String reference)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
public static final transient char SEPARATOR
public static final transient char PERIOD
protected transient String originalReference
public String prefix
EntityProvider,
uniquely identifies an entity space or entity typegetPrefix() method rather than referring to this directly
| Constructor Detail |
|---|
public EntityReference()
public EntityReference(String reference)
reference - a globally unique reference to an entity,
consists of the entity prefix and optional path segments
public EntityReference(String prefix,
String id)
prefix - the entity prefixid - the local entity id (can be empty string if there is no id)| Method Detail |
|---|
public String getOriginalReference()
toString() or getReference()
protected void setOriginalReference(String reference)
public String getPrefix()
public String getId()
public boolean isEmpty()
protected String makeEntityReference(boolean spaceOnly)
spaceOnly - if this is true then only return the entity space reference (e.g. /prefix),
otherwise return the full reference (e.g. /prefix/id)
protected String makeEntityPrefix()
getPrefix() method
protected String makeEntityId()
getId() method
public String getReference()
toString()
public String getSpaceReference()
public String toString()
toString in class Object
protected Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic EntityReference copy()
copy(EntityReference)public static String getPrefix(String reference)
EntityReference(String) and
the methods in EntityBroker to parse references
reference - an entity reference or entity URL
public static String getIdFromRef(String reference)
reference - an entity reference (e.g. /user/aaronz)
public static String getIdFromRefByKey(String reference,
String key)
reference - an entity reference (e.g. /site/siteId/group/groupId)key - the key to get the id from (e.g. 'group' yields groupId)
protected static String findPrefix(String reference)
reference - a globally unique reference to an entity,
consists of the entity prefix and optional id
protected static String findId(String reference)
reference - a globally unique reference to an entity,
consists of the entity prefix and optional id
protected static int getSeparatorPos(String reference,
int number)
reference - a globally unique reference to an entity,
consists of the entity prefix and optional idnumber - this is the separator to get,
0 would return the first one found, 1 would return the second
protected static void checkReference(String reference)
reference -
IllegalArgumentException - if the reference is not even basically valid
protected static void checkPrefixId(String prefix,
String id)
public static EntityReference copy(EntityReference ref)
ref - an entity reference object
IllegalArgumentException - if the ref is invalid OR null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||