Class CommonsUtils


  • public class CommonsUtils
    extends Object
    • Constructor Detail

      • CommonsUtils

        public CommonsUtils()
    • Method Detail

      • getOrganizationService

        public static org.exoplatform.services.organization.OrganizationService getOrganizationService()
      • getConversationRegistry

        public static org.exoplatform.services.security.ConversationRegistry getConversationRegistry()
      • isUserEnabled

        public static boolean isUserEnabled​(String userId)
                                     throws Exception
        Gets the user state enabled/disabled from ConversationRegistry, if not found, get it from OrgnizationService
        Parameters:
        userId - username
        Returns:
        true if enabled, else false
        Throws:
        Exception - if an error occured during requesting the user from OrganizationService
      • getConversationState

        public static org.exoplatform.services.security.ConversationState getConversationState​(String userId)
        Get the last added ConversationState of a given user.
        Parameters:
        userId - username
        Returns:
        ConversationState entity of user
      • getUser

        public static org.exoplatform.services.organization.User getUser​(String userId)
                                                                  throws Exception
        Get the last User instance added in ConversationState of a given user
        Parameters:
        userId -
        Returns:
        User
        Throws:
        Exception - thrown when an exception occurs while getting user from IDM store
      • getGroupsOfUser

        public static Collection<String> getGroupsOfUser​(String userId)
                                                  throws Exception
        Gets groups of user from ConversationRegistry, if not found, get it from OrgnizationService
        Parameters:
        userId - username
        Returns:
        a collection of group Id of type String
        Throws:
        Exception - if an error occured during requesting the user from OrganizationService
      • getService

        public static <T> T getService​(Class<T> clazz)
        Gets the service.
        Parameters:
        clazz - the clazz
        Returns:
        the service
      • getService

        public static <T> T getService​(Class<T> clazz,
                                       String containerName)
        Gets the service.
        Parameters:
        clazz - the class
        containerName - the container's name
        Returns:
        the service
      • getRestContextName

        public static String getRestContextName()
      • isFeatureActive

        public static boolean isFeatureActive​(String featureName)
      • isFeatureActive

        public static boolean isFeatureActive​(String featureName,
                                              String username)
      • getCurrentDomain

        public static String getCurrentDomain()
        Get the current domain name by configuration
        Returns:
        the current domain name.
      • getCurrentPortalOwner

        public static String getCurrentPortalOwner()
        Get current portal owner
        Returns:
        current portal owner
      • getCurrentSite

        public static org.exoplatform.portal.mop.SiteKey getCurrentSite()
        Get SiteKey of current site
        Returns:
        currentSite if available or default site in otherwise
      • startRequest

        public static void startRequest​(Object service)
      • endRequest

        public static void endRequest​(Object service)