Class EntityData
- java.lang.Object
-
- org.sakaiproject.entitybroker.entityprovider.extension.EntityData
-
public class EntityData extends Object
This is an object to hold entity data (e.g. from a search which would normally return entity references), This is basically a POJO which allows us to return a few results instead of only the reference, it helps us get the entity data back more efficiently and makes it easier on developers who need to search for entities- Author:
- Aaron Zeckoski (azeckoski @ gmail.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEntityData.ReferenceComparatorstatic classEntityData.TitleComparator
-
Constructor Summary
Constructors Constructor Description EntityData(Object data)Using this as a data wrapper onlyEntityData(Object data, Map<String,Object> entityProperties)Using this as a data wrapper onlyEntityData(String reference, String displayTitle)Minimal constructor - used for most basic cases
Use the setters to add in properties or the entity if desiredEntityData(String reference, String displayTitle, Object entity)Basic constructor
Use this to construct a search result using the typical minimal amount of information, Use the setters to add in properties or the entity if desiredEntityData(String reference, String displayTitle, Object entity, Map<String,Object> entityProperties)Full constructor
Use this if you want to return the entity itself along with the key meta data and propertiesEntityData(EntityReference ref, String displayTitle)Minimal constructor - used for most basic cases
Use the setters to add in properties or the entity data if desiredEntityData(EntityReference ref, String displayTitle, Object entity)Basic constructor
Use this to construct a search result using the typical minimal amount of information, Use the setters to add in properties or the entity data if desiredEntityData(EntityReference ref, String displayTitle, Object entity, Map<String,Object> entityProperties)Full constructor
Use this if you want to return the entity itself along with the key meta data and properties
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)ObjectgetData()(OPTIONAL - may be null) This is the entity data object itself (if there is one), this is included at the discretion of the entity provider author, if this is null then the entity data is not available or would be prohibitively large (i.e. typically left out for efficiency)StringgetDisplayTitle()A string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the data represented by an entityStringgetEntityId()Map<String,Object>getEntityProperties()A set of properties to return along with the entity information, this may be presented and used for filtering, this will be empty if it is not usedEntityReferencegetEntityRef()The entity reference object which makes it easy to get to the prefix or id of this entity if neededStringgetEntityReference()The entity reference - a globally unique reference to an entity, consists of the entity prefix and optional segments (normally the id at least)StringgetEntityURL()The entityURL to the entity represented by this reference, should be an absolute entityURL (server name optional)inthashCode()booleanisDataOnly()booleanisDisplayTitleSet()booleanisPopulated()voidsetData(Object entity)voidsetDataOnly(boolean dataOnly)FOR INTERNAL USE ONLY - do not usevoidsetDisplayTitle(String displayTitle)A string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the data represented by an entityvoidsetEntityProperties(Map<String,Object> entityProperties)(OPTIONAL - may be null) A set of properties to return along with the entity information, this may be presented and used for filtering, should be null or empty if not usedvoidsetEntityURL(String url)WARNING: for internal use onlyvoidsetPopulated(boolean populated)FOR INTERNAL USE ONLY - do not useStringtoString()
-
-
-
Constructor Detail
-
EntityData
public EntityData(String reference, String displayTitle)
Minimal constructor - used for most basic cases
Use the setters to add in properties or the entity if desired- Parameters:
reference- a globally unique reference to an entity, consists of the entity prefix and id (e.g. /prefix/id)entityDisplayTitle- a string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the entity represented by an entity
-
EntityData
public EntityData(String reference, String displayTitle, Object entity)
Basic constructor
Use this to construct a search result using the typical minimal amount of information, Use the setters to add in properties or the entity if desired- Parameters:
reference- a globally unique reference to an entity, consists of the entity prefix and id (e.g. /prefix/id)entityDisplayTitle- a string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the entity represented by an entitydata- an entity data object, seeResolvable
-
EntityData
public EntityData(String reference, String displayTitle, Object entity, Map<String,Object> entityProperties)
Full constructor
Use this if you want to return the entity itself along with the key meta data and properties- Parameters:
reference- a globally unique reference to an entity, consists of the entity prefix and id (e.g. /prefix/id)entityDisplayTitle- a string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the entity represented by an entitydata- an entity data object, seeResolvableentityProperties- a set of properties to return along with the entity information, this may be presented and used for filtering,
-
EntityData
public EntityData(EntityReference ref, String displayTitle)
Minimal constructor - used for most basic cases
Use the setters to add in properties or the entity data if desired- Parameters:
ref- an object which represents a globally unique reference to an entity, consists of the entity prefix and identityDisplayTitle- a string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the entity represented by an entity
-
EntityData
public EntityData(EntityReference ref, String displayTitle, Object entity)
Basic constructor
Use this to construct a search result using the typical minimal amount of information, Use the setters to add in properties or the entity data if desired- Parameters:
ref- an object which represents a globally unique reference to an entity, consists of the entity prefix and identityDisplayTitle- a string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the entity represented by an entitydata- an entity data object, seeResolvable
-
EntityData
public EntityData(EntityReference ref, String displayTitle, Object entity, Map<String,Object> entityProperties)
Full constructor
Use this if you want to return the entity itself along with the key meta data and properties- Parameters:
ref- an object which represents a globally unique reference to an entity, consists of the entity prefix and identityDisplayTitle- a string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the entity represented by an entitydata- an entity data object, seeResolvableentityProperties- a set of properties to return along with the entity information, this may be presented and used for filtering,
-
EntityData
public EntityData(Object data)
Using this as a data wrapper only- Parameters:
data- any data to wrap this in
-
-
Method Detail
-
setData
public void setData(Object entity)
-
getData
public Object getData()
(OPTIONAL - may be null) This is the entity data object itself (if there is one), this is included at the discretion of the entity provider author, if this is null then the entity data is not available or would be prohibitively large (i.e. typically left out for efficiency)
-
getEntityId
public String getEntityId()
- Returns:
- the unique local id of the entity (null if there is none)
-
getEntityReference
public String getEntityReference()
The entity reference - a globally unique reference to an entity, consists of the entity prefix and optional segments (normally the id at least)
-
getEntityRef
public EntityReference getEntityRef()
The entity reference object which makes it easy to get to the prefix or id of this entity if needed
-
setDisplayTitle
public void setDisplayTitle(String displayTitle)
A string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the data represented by an entity
-
getDisplayTitle
public String getDisplayTitle()
A string which is suitable for display and provides a short summary of the entity, typically 100 chars or less, this may be the name or title of the data represented by an entity
-
isDisplayTitleSet
public boolean isDisplayTitleSet()
- Returns:
- true if the display title is actually set, false if it is null and will return an auto-generated value
-
setEntityURL
public void setEntityURL(String url)
WARNING: for internal use only- Parameters:
url- the url to access this entity
-
getEntityURL
public String getEntityURL()
The entityURL to the entity represented by this reference, should be an absolute entityURL (server name optional)
-
setEntityProperties
public void setEntityProperties(Map<String,Object> entityProperties)
(OPTIONAL - may be null) A set of properties to return along with the entity information, this may be presented and used for filtering, should be null or empty if not used- Parameters:
entityProperties- a map of property name => value
-
getEntityProperties
public Map<String,Object> getEntityProperties()
A set of properties to return along with the entity information, this may be presented and used for filtering, this will be empty if it is not used
-
setPopulated
public void setPopulated(boolean populated)
FOR INTERNAL USE ONLY - do not use
-
isPopulated
public boolean isPopulated()
- Returns:
- true if this object was populated, false otherwise
-
setDataOnly
public void setDataOnly(boolean dataOnly)
FOR INTERNAL USE ONLY - do not use
-
isDataOnly
public boolean isDataOnly()
- Returns:
- true if this is a data holder and the data inside it should be rendered alone without this wrapper
-
-