Package org.sakaiproject.entitybroker
Interface EntityBrokerManager
-
public interface EntityBrokerManagerThe core of the EB system, this is generally not for use by developers and is mostly for internal use but it should be ok to use most of these methods- Author:
- Aaron Zeckoski (azeckoski @ gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description static StringPOST_METHOD
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<EntityData>browseEntities(String prefix, Search search, String userReference, String associatedReference, EntityReference parentEntityRef, Map<String,Object> params)Fetches the browseable entitiesEntityDataconvertToEntityData(Object entity, EntityReference ref)Convert a single object to an entity data object (also populates it), will preserve null (i.e. null in => null out)List<EntityData>convertToEntityData(List<?> entities, EntityReference ref)Convert a list of objects to entity data objects (also populates them), will preserve null (i.e. null in => null out)booleanentityExists(EntityReference ref)Determines if an entity exists based on the referenceList<?>fetchEntities(EntityReference ref, Search search, Map<String,Object> params)Get a list of entities fromCollectionResolvablefirst if available orBrowseSearchableif not, returns the entities as actual entities (converts fromEntityDataif that was used), correctly handles references to single entities as wellObjectfetchEntity(EntityReference ref)Get an entity object of some kind for this reference if it has an id, will simply return null if no id is available in this referenceList<BrowseEntity>getBrowseableEntities(String parentPrefix)Get the meta data about browseable entitiesList<EntityData>getEntitiesData(EntityReference ref, Search search, Map<String,Object> params)Get a list of entities fromCollectionResolvablefirst if available orBrowseSearchableif not, returns the entities wrapped inEntityData, correctly handles references to single entities as wellEntityDatagetEntityData(EntityReference ref)Get the entity data for a reference if possibleEntityPropertiesServicegetEntityPropertiesService()Allows access to the current EntityPropertiesServiceEntityProviderManagergetEntityProviderManager()Allows access to the current EntityProviderManager serviceEntityProviderMethodStoregetEntityProviderMethodStore()Allows access to the current EntityProviderMethodStore serviceEntityRESTProvidergetEntityRESTProvider()Allows access to the registered REST provider if there is oneStringgetEntityURL(String reference, String viewKey, String extension)Creates the full URL to an entity using the sakaiServerConfigurationService, (e.g. http://server:8080/direct/entity/123/)
Note: the webapp name (relative URL path) of the direct servlet, of "/direct" is hardcoded into this method, and theorg.sakaiproject.entitybroker.util.servlet.DirectServletmust be deployed there on this server.EntityViewAccessProviderManagergetEntityViewAccessProviderManager()Allows access to the current EntityViewAccessProviderManager serviceExternalIntegrationProvidergetExternalIntegrationProvider()Allows access to any registered ExternalIntegrationProviderintgetMaxJSONLevel()Returns the maximum depth of object graph allowed during transcoding to JSONRequestGetterWritegetRequestGetter()Allows access to the current RequestGetter serviceRequestStorageWritegetRequestStorage()Allows access to the current RequestStorageWrite serviceObjectgetSampleEntityObject(String prefix, String id)Safely get the sample entity object which is defined for a prefix, if there is not one then return nullStringgetServletContext()FOR INTERNAL USE ONLY (do not mess with this in other words) This gets the known REST servlet context if there is one, will return a default "/rest" if none is known, will not return "" or nullStringgetVersionInfo()Used to get a version info string which can be output to see what version we are working withEntityViewmakeEntityView(EntityReference ref, String viewKey, String extension)Reduce code duplication and ensure custom templates are usedStringmakeFullURL(String pathURL)Make a full entity URL (http://....) from just a path URL (/prefix/id.xml)EntityViewparseEntityURL(String entityURL)Parses an entity URL into an entity view object, handles custom parsing templatesEntityReferenceparseReference(String reference)Parses an entity reference into the appropriate reference formvoidpopulateEntityData(List<EntityData> data)Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)voidpopulateEntityData(EntityData[] data)Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)voidsetEntityRESTProvider(EntityRESTProvider entityRESTProvider)Allows the developer to set a REST provider to add functionality to theEntityBrokersystem from a REST handler, the system will operate without this set but some methods will failvoidsetExternalIntegrationProvider(ExternalIntegrationProvider externalIntegrationProvider)Allows developers to setup providers to handle parts of the EB system which cannot really be handled internally, the system will operate without this setvoidsetServletContext(String servletContext)FOR INTERNAL USE ONLY (do not mess with this in other words)
-
-
-
Field Detail
-
POST_METHOD
static final String POST_METHOD
- See Also:
- Constant Field Values
-
-
Method Detail
-
entityExists
boolean entityExists(EntityReference ref)
Determines if an entity exists based on the reference- Parameters:
reference- an entity reference object- Returns:
- true if entity exists, false otherwise
-
getEntityURL
String getEntityURL(String reference, String viewKey, String extension)
Creates the full URL to an entity using the sakaiServerConfigurationService, (e.g. http://server:8080/direct/entity/123/)
Note: the webapp name (relative URL path) of the direct servlet, of "/direct" is hardcoded into this method, and theorg.sakaiproject.entitybroker.util.servlet.DirectServletmust be deployed there on this server.- Parameters:
reference- a globally unique reference to an entity, consists of the entity prefix and optionally the local idviewKey- the specific view type to get the URL for, can be null to determine the key automaticallyextension- the optional extension to add to the end, can be null to use no extension- Returns:
- the full URL to a specific entity or space
-
makeEntityView
EntityView makeEntityView(EntityReference ref, String viewKey, String extension)
Reduce code duplication and ensure custom templates are used
-
parseReference
EntityReference parseReference(String reference)
Parses an entity reference into the appropriate reference form- Parameters:
reference- a unique entity reference- Returns:
- the entity reference object or null if there is no provider found for the prefix parsed out
- Throws:
IllegalArgumentException- if there is a failure during parsing
-
parseEntityURL
EntityView parseEntityURL(String entityURL)
Parses an entity URL into an entity view object, handles custom parsing templates- Parameters:
entityURL- an entity URL- Returns:
- the entity view object representing this URL or null if there is no provider found for the prefix parsed out
- Throws:
IllegalArgumentException- if there is a failure during parsing
-
makeFullURL
String makeFullURL(String pathURL)
Make a full entity URL (http://....) from just a path URL (/prefix/id.xml)- Parameters:
pathURL- a path (like pathInfo from a request) (e.g. /prefix/id.xml)- Throws:
IllegalArgumentException- is the pathURL is null
-
fetchEntity
Object fetchEntity(EntityReference ref)
Get an entity object of some kind for this reference if it has an id, will simply return null if no id is available in this reference- Parameters:
ref- an entity reference- Returns:
- the entity object for this reference OR null if none can be retrieved
-
getEntityData
EntityData getEntityData(EntityReference ref)
Get the entity data for a reference if possible- Parameters:
ref- an entity reference- Returns:
- an
EntityDataobject for this reference if one can be found OR null if not
-
fetchEntities
List<?> fetchEntities(EntityReference ref, Search search, Map<String,Object> params)
Get a list of entities fromCollectionResolvablefirst if available orBrowseSearchableif not, returns the entities as actual entities (converts fromEntityDataif that was used), correctly handles references to single entities as well- Parameters:
ref- the referencesearch- a search (should not be null)params-- Returns:
- a list of entities OR empty list if none found for the given reference
-
getEntitiesData
List<EntityData> getEntitiesData(EntityReference ref, Search search, Map<String,Object> params)
Get a list of entities fromCollectionResolvablefirst if available orBrowseSearchableif not, returns the entities wrapped inEntityData, correctly handles references to single entities as well- Parameters:
ref- the referencesearch- a search (should not be null)params-- Returns:
- a list of entities OR empty list if none found for the given reference
-
browseEntities
List<EntityData> browseEntities(String prefix, Search search, String userReference, String associatedReference, EntityReference parentEntityRef, Map<String,Object> params)
Fetches the browseable entities- Parameters:
prefix-search-userReference-associatedReference-parentEntityRef-params-- Returns:
- a list of entity data results to browse
-
getBrowseableEntities
List<BrowseEntity> getBrowseableEntities(String parentPrefix)
Get the meta data about browseable entities- Parameters:
parentPrefix- the prefix of the parent type (null for the root types)- Returns:
- the list of browseable entity meta data
-
convertToEntityData
List<EntityData> convertToEntityData(List<?> entities, EntityReference ref)
Convert a list of objects to entity data objects (also populates them), will preserve null (i.e. null in => null out)
-
convertToEntityData
EntityData convertToEntityData(Object entity, EntityReference ref)
Convert a single object to an entity data object (also populates it), will preserve null (i.e. null in => null out)
-
populateEntityData
void populateEntityData(List<EntityData> data)
Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)- Parameters:
data- a list of entity data
-
populateEntityData
void populateEntityData(EntityData[] data)
Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)- Parameters:
data- a list of entity data
-
getSampleEntityObject
Object getSampleEntityObject(String prefix, String id)
Safely get the sample entity object which is defined for a prefix, if there is not one then return null- Parameters:
prefix- the entity prefixid- (optional) will get the actual entity for this id as a sample- Returns:
- a sample object OR null if none can be found
-
getEntityProviderManager
EntityProviderManager getEntityProviderManager()
Allows access to the current EntityProviderManager service- Returns:
- the current EntityProviderManager service
-
getEntityPropertiesService
EntityPropertiesService getEntityPropertiesService()
Allows access to the current EntityPropertiesService- Returns:
- the current EntityPropertiesService
-
getEntityViewAccessProviderManager
EntityViewAccessProviderManager getEntityViewAccessProviderManager()
Allows access to the current EntityViewAccessProviderManager service- Returns:
- the current EntityViewAccessProviderManager
-
getEntityProviderMethodStore
EntityProviderMethodStore getEntityProviderMethodStore()
Allows access to the current EntityProviderMethodStore service- Returns:
- the current EntityProviderMethodStore
-
getRequestGetter
RequestGetterWrite getRequestGetter()
Allows access to the current RequestGetter service- Returns:
- the current RequestGetter
-
getRequestStorage
RequestStorageWrite getRequestStorage()
Allows access to the current RequestStorageWrite service- Returns:
- the current RequestStorageWrite
-
getExternalIntegrationProvider
ExternalIntegrationProvider getExternalIntegrationProvider()
Allows access to any registered ExternalIntegrationProvider- Returns:
- the external integration provider OR null if there is not one
-
getEntityRESTProvider
EntityRESTProvider getEntityRESTProvider()
Allows access to the registered REST provider if there is one- Returns:
- the REST provider OR null if there is not one
-
setExternalIntegrationProvider
void setExternalIntegrationProvider(ExternalIntegrationProvider externalIntegrationProvider)
Allows developers to setup providers to handle parts of the EB system which cannot really be handled internally, the system will operate without this set- Parameters:
externalIntegrationProvider- the external integration provider to use in the system
-
setEntityRESTProvider
void setEntityRESTProvider(EntityRESTProvider entityRESTProvider)
Allows the developer to set a REST provider to add functionality to theEntityBrokersystem from a REST handler, the system will operate without this set but some methods will fail- Parameters:
entityRESTProvider- a service to provide REST functionality
-
getVersionInfo
String getVersionInfo()
Used to get a version info string which can be output to see what version we are working with
-
setServletContext
void setServletContext(String servletContext)
FOR INTERNAL USE ONLY (do not mess with this in other words)- Parameters:
servletContext- sets the servlet context being used by the system (defaults to#DIRECT)
-
getServletContext
String getServletContext()
FOR INTERNAL USE ONLY (do not mess with this in other words) This gets the known REST servlet context if there is one, will return a default "/rest" if none is known, will not return "" or null
-
getMaxJSONLevel
int getMaxJSONLevel()
Returns the maximum depth of object graph allowed during transcoding to JSON
-
-