Class GenericUtils
- java.lang.Object
-
- org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils.GenericUtils
-
public class GenericUtils extends Object
Util class with static methods.- Author:
- Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
-
-
Field Summary
Fields Modifier and Type Field Description static StringGCUBE_REQUEST_URL
-
Constructor Summary
Constructors Constructor Description GenericUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetCurrentClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)Needed to get the url of the client.static StringgetCurrentContext(javax.servlet.http.HttpServletRequest request, boolean setInThread)Retrieve the current scope by using the portal manager.static StringgetCurrentToken(javax.servlet.http.HttpServletRequest request, boolean setInThread)Retrieve the current token by using the portal manager.static org.gcube.vomanagement.usermanagement.model.GCubeUsergetCurrentUser(javax.servlet.http.HttpServletRequest request)Retrieve the current user by using the portal manager.static StringgetGatewayClientHostname(javax.servlet.http.HttpServletRequest httpServletRequest)Gets the gateway client hostname.static org.gcube.vomanagement.usermanagement.model.GCubeGroupgetGroupFromScope(String scope)Retrieve the group given the scope.static StringgetScopeFromClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)Get the scope in which ckan information needs to be discovered from the url.static StringretrieveScopeFromOrganizationName(String organizationName)Given a ckan organization name retrieve the infrastructure scope.static StringtryGetElseCreateToken(String username, String context)First check to retrieve the token, else create it.
-
-
-
Field Detail
-
GCUBE_REQUEST_URL
public static final String GCUBE_REQUEST_URL
- See Also:
- Constant Field Values
-
-
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 usernamecontext- 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 requestsetInThread- 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 requestsetInThread- 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 exceptionorg.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault- the group retrieval fault
-
-