org.sakaiproject.entitybroker.util.devhelper
Class AbstractDeveloperHelperService

java.lang.Object
  extended by org.sakaiproject.entitybroker.util.devhelper.AbstractDeveloperHelperService
All Implemented Interfaces:
DeveloperHelperService
Direct Known Subclasses:
DeveloperHelperServiceMock

public abstract class AbstractDeveloperHelperService
extends Object
implements DeveloperHelperService

implementation of the helper service methods which are internal only NOTE: you should probably override encode and decode data rather than simply using the current impl

Author:
Aaron Zeckoski (aaron@caret.cam.ac.uk)

Field Summary
protected  String CURRENT_USER_MARKER
           
 EntityBroker entityBroker
           
 EntityBrokerManager entityBrokerManager
           
 EntityPropertiesService entityProperties
           
protected  WeakReference<EntityRESTProvider> entityRESTProviderWeak
           
static String GROUP_BASE
          The site reference base
 RequestStorage requestStorage
           
static String URL_ENCODING
          Encoding method to use when URL encoding
static String USER_BASE
          The user reference base
 
Fields inherited from interface org.sakaiproject.entitybroker.DeveloperHelperService
ADMIN_USER_ID, ADMIN_USER_REF, SETTING_AUTO_DDL, SETTING_PORTAL_URL, SETTING_SERVER_ID, SETTING_SERVER_NAME, SETTING_SERVER_URL
 
Constructor Summary
AbstractDeveloperHelperService()
          EMPTY - do not use
AbstractDeveloperHelperService(EntityBroker entityBroker, EntityBrokerManager entityBrokerManager)
          MINIMAL
 
Method Summary
<T> T
cloneBean(T bean, int maxDepth, String[] propertiesToSkip)
           
<T> T
convert(Object object, Class<T> type)
           
 void copyBean(Object orig, Object dest, int maxDepth, String[] fieldNamesToSkip, boolean ignoreNulls)
           
 Map<String,Object> decodeData(String data, String format)
           
 String encodeData(Object data, String format, String name, Map<String,Object> properties)
           
 boolean entityExists(String reference)
           
 Object fetchEntity(String reference)
           
 void fireEvent(String eventName, String reference)
           
 Locale getCurrentLocale()
           
 String getCurrentLocationReference()
           
 String getCurrentUserReference()
           
 EntityRESTProvider getEntityRESTProvider()
           
 String getEntityURL(String reference, String viewKey, String extension)
           
 String getLocationIdFromRef(String locationReference)
           
 String getLocationReferenceURL(String locationReference)
           
 String getMessage(String prefix, String messageKey)
           
 String getStartingLocationReference()
           
 String getToolIdFromToolRef(String toolReference)
           
 String getUserHomeLocationReference(String userReference)
           
 String getUserHomeLocationURL(String userReference)
           
 String getUserIdFromRef(String userReference)
           
 String getUserRefFromUserId(String userId)
           
 boolean isEntityRequestInternal(String reference)
          Checks to see if a request is internal and therefore can bypass some or all security
 List<String> populate(Object object, Map<String,Object> properties)
           
 void setEntityBroker(EntityBroker entityBroker)
           
 void setEntityBrokerManager(EntityBrokerManager entityBrokerManager)
           
 void setEntityProperties(EntityPropertiesService entityProperties)
          Set this to include an optional properties handler
 void setEntityRESTProvider(EntityRESTProvider entityRESTProvider)
          Set this to include an optional encoding/decoding handler
 void setRequestStorage(RequestStorage requestStorage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.entitybroker.DeveloperHelperService
getConfigurationSetting, getCurrentLocationId, getCurrentToolReference, getCurrentUserId, getEntityReferencesForUserAndPermission, getPortalURL, getServerURL, getToolData, getToolViewURL, getUserReferencesForEntityReference, getUserRefFromUserEid, isUserAdmin, isUserAllowedInEntityReference, registerPermission, restoreCurrentUser, setCurrentUser
 

Field Detail

entityRESTProviderWeak

protected WeakReference<EntityRESTProvider> entityRESTProviderWeak

URL_ENCODING

public static String URL_ENCODING
Encoding method to use when URL encoding


GROUP_BASE

public static String GROUP_BASE
The site reference base


USER_BASE

public static String USER_BASE
The user reference base


CURRENT_USER_MARKER

protected final String CURRENT_USER_MARKER
See Also:
Constant Field Values

entityBroker

public EntityBroker entityBroker

entityBrokerManager

public EntityBrokerManager entityBrokerManager

requestStorage

public RequestStorage requestStorage

entityProperties

public EntityPropertiesService entityProperties
Constructor Detail

AbstractDeveloperHelperService

public AbstractDeveloperHelperService()
EMPTY - do not use


AbstractDeveloperHelperService

public AbstractDeveloperHelperService(EntityBroker entityBroker,
                                      EntityBrokerManager entityBrokerManager)
MINIMAL

Parameters:
entityBroker - the main EntityBroker service
entityBrokerManager - the main EB manager service
Method Detail

getEntityRESTProvider

public EntityRESTProvider getEntityRESTProvider()

setEntityRESTProvider

public void setEntityRESTProvider(EntityRESTProvider entityRESTProvider)
Set this to include an optional encoding/decoding handler

Parameters:
entityRESTProvider - the encoding manager service

decodeData

public Map<String,Object> decodeData(String data,
                                     String format)
Specified by:
decodeData in interface DeveloperHelperService

encodeData

public String encodeData(Object data,
                         String format,
                         String name,
                         Map<String,Object> properties)
Specified by:
encodeData in interface DeveloperHelperService

setEntityBroker

public void setEntityBroker(EntityBroker entityBroker)

setEntityBrokerManager

public void setEntityBrokerManager(EntityBrokerManager entityBrokerManager)

setRequestStorage

public void setRequestStorage(RequestStorage requestStorage)

setEntityProperties

public void setEntityProperties(EntityPropertiesService entityProperties)
Set this to include an optional properties handler

Parameters:
entityProperties -

entityExists

public boolean entityExists(String reference)
Specified by:
entityExists in interface DeveloperHelperService

fetchEntity

public Object fetchEntity(String reference)
Specified by:
fetchEntity in interface DeveloperHelperService

fireEvent

public void fireEvent(String eventName,
                      String reference)
Specified by:
fireEvent in interface DeveloperHelperService

getEntityURL

public String getEntityURL(String reference,
                           String viewKey,
                           String extension)
Specified by:
getEntityURL in interface DeveloperHelperService

getCurrentLocale

public Locale getCurrentLocale()
Specified by:
getCurrentLocale in interface DeveloperHelperService

getUserIdFromRef

public String getUserIdFromRef(String userReference)
Specified by:
getUserIdFromRef in interface DeveloperHelperService

getUserRefFromUserId

public String getUserRefFromUserId(String userId)
Specified by:
getUserRefFromUserId in interface DeveloperHelperService

getCurrentUserReference

public String getCurrentUserReference()
Specified by:
getCurrentUserReference in interface DeveloperHelperService

getLocationIdFromRef

public String getLocationIdFromRef(String locationReference)
Specified by:
getLocationIdFromRef in interface DeveloperHelperService

getCurrentLocationReference

public String getCurrentLocationReference()
Specified by:
getCurrentLocationReference in interface DeveloperHelperService

getStartingLocationReference

public String getStartingLocationReference()
Specified by:
getStartingLocationReference in interface DeveloperHelperService

getUserHomeLocationReference

public String getUserHomeLocationReference(String userReference)
Specified by:
getUserHomeLocationReference in interface DeveloperHelperService

getToolIdFromToolRef

public String getToolIdFromToolRef(String toolReference)
Specified by:
getToolIdFromToolRef in interface DeveloperHelperService

getUserHomeLocationURL

public String getUserHomeLocationURL(String userReference)
Specified by:
getUserHomeLocationURL in interface DeveloperHelperService

getLocationReferenceURL

public String getLocationReferenceURL(String locationReference)
Specified by:
getLocationReferenceURL in interface DeveloperHelperService

isEntityRequestInternal

public boolean isEntityRequestInternal(String reference)
Checks to see if a request is internal and therefore can bypass some or all security

Specified by:
isEntityRequestInternal in interface DeveloperHelperService
Parameters:
reference - an entity reference string
Returns:
true if internal OR false if external or REST

cloneBean

public <T> T cloneBean(T bean,
                       int maxDepth,
                       String[] propertiesToSkip)
Specified by:
cloneBean in interface DeveloperHelperService

copyBean

public void copyBean(Object orig,
                     Object dest,
                     int maxDepth,
                     String[] fieldNamesToSkip,
                     boolean ignoreNulls)
Specified by:
copyBean in interface DeveloperHelperService

populate

public List<String> populate(Object object,
                             Map<String,Object> properties)
Specified by:
populate in interface DeveloperHelperService

convert

public <T> T convert(Object object,
                     Class<T> type)
Specified by:
convert in interface DeveloperHelperService

getMessage

public String getMessage(String prefix,
                         String messageKey)
Specified by:
getMessage in interface DeveloperHelperService


Copyright © 2007-2013 CARET, University of Cambridge. All Rights Reserved.