org.sakaiproject.entitybroker.entityprovider.extension
Class EntityData

java.lang.Object
  extended by 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
static class EntityData.ReferenceComparator
           
static class EntityData.TitleComparator
           
 
Constructor Summary
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
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
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
EntityData(Object data)
          Using this as a data wrapper only
EntityData(Object data, Map<String,Object> entityProperties)
          Using this as a data wrapper only
EntityData(String reference, String displayTitle)
          Minimal constructor - used for most basic cases
Use the setters to add in properties or the entity if desired
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
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
 
Method Summary
 boolean equals(Object obj)
           
 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)
 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
 String getEntityId()
           
 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
 EntityReference getEntityRef()
          The entity reference object which makes it easy to get to the prefix or id of this entity if needed
 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)
 String getEntityURL()
          The entityURL to the entity represented by this reference, should be an absolute entityURL (server name optional)
 int hashCode()
           
 boolean isDataOnly()
           
 boolean isDisplayTitleSet()
           
 boolean isPopulated()
           
 void setData(Object entity)
           
 void setDataOnly(boolean dataOnly)
          FOR INTERNAL USE ONLY - do not use
 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
 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
 void setEntityURL(String url)
          WARNING: for internal use only
 void setPopulated(boolean populated)
          FOR INTERNAL USE ONLY - do not use
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 entity
data - an entity data object, see Resolvable

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 entity
data - an entity data object, see Resolvable
entityProperties - 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 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(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 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
data - an entity data object, see Resolvable

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 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
data - an entity data object, see Resolvable
entityProperties - 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

EntityData

public EntityData(Object data,
                  Map<String,Object> entityProperties)
Using this as a data wrapper only

Parameters:
data - any data to wrap this in
entityProperties - a set of properties to return along with the entity information, this may be presented and used for filtering,
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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2013 Sakai Project. All Rights Reserved.