Class GenericUtils


  • public class GenericUtils
    extends Object
    Util class with static methods.
    Author:
    Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
    • Constructor Detail

      • GenericUtils

        public GenericUtils()
    • Method Detail

      • retrieveScopeFromOrganizationName

        public static String retrieveScopeFromOrganizationName​(String organizationName)
                                                        throws Exception
        Given a ckan organization name retrieve the infrastructure scope.
        Parameters:
        organizationName - (prevre, devvre, ...)
        Returns:
        the scope of the infrastructure
        Throws:
        Exception - the exception
      • tryGetElseCreateToken

        public static String tryGetElseCreateToken​(String username,
                                                   String context)
        First check to retrieve the token, else create it.
        Parameters:
        username - the username
        context - the context
        Returns:
        the user token for the context
      • getScopeFromClientUrl

        public static String getScopeFromClientUrl​(javax.servlet.http.HttpServletRequest httpServletRequest)
        Get the scope in which ckan information needs to be discovered from the url.
        Parameters:
        httpServletRequest - the http servlet request
        Returns:
        the scope from client url
      • getCurrentClientUrl

        public static String getCurrentClientUrl​(javax.servlet.http.HttpServletRequest httpServletRequest)
        Needed to get the url of the client.
        Parameters:
        httpServletRequest - the httpServletRequest object
        Returns:
        the instance of the user
        See Also:
        url at client side
      • getGatewayClientHostname

        public static String getGatewayClientHostname​(javax.servlet.http.HttpServletRequest httpServletRequest)
        Gets the gateway client hostname.
        Parameters:
        httpServletRequest - the http servlet request
        Returns:
        the gateway client hostname
      • getCurrentUser

        public static org.gcube.vomanagement.usermanagement.model.GCubeUser getCurrentUser​(javax.servlet.http.HttpServletRequest request)
        Retrieve the current user by using the portal manager.
        Parameters:
        request - the request
        Returns:
        a GcubeUser object
      • getCurrentContext

        public static String getCurrentContext​(javax.servlet.http.HttpServletRequest request,
                                               boolean setInThread)
        Retrieve the current scope by using the portal manager.
        Parameters:
        request - the request
        setInThread - the set in thread
        Returns:
        a GcubeUser object
      • getCurrentToken

        public static String getCurrentToken​(javax.servlet.http.HttpServletRequest request,
                                             boolean setInThread)
        Retrieve the current token by using the portal manager.
        Parameters:
        request - the request
        setInThread - the set in thread
        Returns:
        a GcubeUser object
      • getGroupFromScope

        public static org.gcube.vomanagement.usermanagement.model.GCubeGroup getGroupFromScope​(String scope)
                                                                                        throws org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException,
                                                                                               org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault
        Retrieve the group given the scope.
        Parameters:
        scope - the scope
        Returns:
        the group from scope
        Throws:
        org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException - the user management system exception
        org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault - the group retrieval fault