Class AbstractDeveloperHelperService

  • All Implemented Interfaces:
    org.sakaiproject.entitybroker.DeveloperHelperService
    Direct Known Subclasses:
    DeveloperHelperServiceMock

    public abstract class AbstractDeveloperHelperService
    extends Object
    implements org.sakaiproject.entitybroker.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 Detail

      • entityRESTProviderWeak

        protected WeakReference<org.sakaiproject.entitybroker.providers.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
      • entityBroker

        public org.sakaiproject.entitybroker.EntityBroker entityBroker
      • entityBrokerManager

        public org.sakaiproject.entitybroker.EntityBrokerManager entityBrokerManager
      • requestStorage

        public org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage requestStorage
      • entityProperties

        public org.sakaiproject.entitybroker.providers.EntityPropertiesService entityProperties
    • Constructor Detail

      • AbstractDeveloperHelperService

        public AbstractDeveloperHelperService()
        EMPTY - do not use
      • AbstractDeveloperHelperService

        public AbstractDeveloperHelperService​(org.sakaiproject.entitybroker.EntityBroker entityBroker,
                                              org.sakaiproject.entitybroker.EntityBrokerManager entityBrokerManager)
        MINIMAL
        Parameters:
        entityBroker - the main EntityBroker service
        entityBrokerManager - the main EB manager service
    • Method Detail

      • getEntityRESTProvider

        public org.sakaiproject.entitybroker.providers.EntityRESTProvider getEntityRESTProvider()
      • setEntityRESTProvider

        public void setEntityRESTProvider​(org.sakaiproject.entitybroker.providers.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 org.sakaiproject.entitybroker.DeveloperHelperService
      • encodeData

        public String encodeData​(Object data,
                                 String format,
                                 String name,
                                 Map<String,​Object> properties)
        Specified by:
        encodeData in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • setEntityBroker

        public void setEntityBroker​(org.sakaiproject.entitybroker.EntityBroker entityBroker)
      • setEntityBrokerManager

        public void setEntityBrokerManager​(org.sakaiproject.entitybroker.EntityBrokerManager entityBrokerManager)
      • setRequestStorage

        public void setRequestStorage​(org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage requestStorage)
      • setEntityProperties

        public void setEntityProperties​(org.sakaiproject.entitybroker.providers.EntityPropertiesService entityProperties)
        Set this to include an optional properties handler
        Parameters:
        entityProperties -
      • entityExists

        public boolean entityExists​(String reference)
        Specified by:
        entityExists in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • fetchEntity

        public Object fetchEntity​(String reference)
        Specified by:
        fetchEntity in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • fireEvent

        public void fireEvent​(String eventName,
                              String reference)
        Specified by:
        fireEvent in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getEntityURL

        public String getEntityURL​(String reference,
                                   String viewKey,
                                   String extension)
        Specified by:
        getEntityURL in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getCurrentLocale

        public Locale getCurrentLocale()
        Specified by:
        getCurrentLocale in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getUserIdFromRef

        public String getUserIdFromRef​(String userReference)
        Specified by:
        getUserIdFromRef in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getUserRefFromUserId

        public String getUserRefFromUserId​(String userId)
        Specified by:
        getUserRefFromUserId in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getCurrentUserReference

        public String getCurrentUserReference()
        Specified by:
        getCurrentUserReference in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getLocationIdFromRef

        public String getLocationIdFromRef​(String locationReference)
        Specified by:
        getLocationIdFromRef in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getCurrentLocationReference

        public String getCurrentLocationReference()
        Specified by:
        getCurrentLocationReference in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getStartingLocationReference

        public String getStartingLocationReference()
        Specified by:
        getStartingLocationReference in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getUserHomeLocationReference

        public String getUserHomeLocationReference​(String userReference)
        Specified by:
        getUserHomeLocationReference in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getToolIdFromToolRef

        public String getToolIdFromToolRef​(String toolReference)
        Specified by:
        getToolIdFromToolRef in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getUserHomeLocationURL

        public String getUserHomeLocationURL​(String userReference)
        Specified by:
        getUserHomeLocationURL in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getLocationReferenceURL

        public String getLocationReferenceURL​(String locationReference)
        Specified by:
        getLocationReferenceURL in interface org.sakaiproject.entitybroker.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 org.sakaiproject.entitybroker.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 org.sakaiproject.entitybroker.DeveloperHelperService
      • copyBean

        public void copyBean​(Object orig,
                             Object dest,
                             int maxDepth,
                             String[] fieldNamesToSkip,
                             boolean ignoreNulls)
        Specified by:
        copyBean in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • populate

        public List<String> populate​(Object object,
                                     Map<String,​Object> properties)
        Specified by:
        populate in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • convert

        public <T> T convert​(Object object,
                             Class<T> type)
        Specified by:
        convert in interface org.sakaiproject.entitybroker.DeveloperHelperService
      • getMessage

        public String getMessage​(String prefix,
                                 String messageKey)
        Specified by:
        getMessage in interface org.sakaiproject.entitybroker.DeveloperHelperService