public class Utils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
GCUBE_REQUEST_URL |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getCurrentClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)
Needed to get the url of the client
|
static String |
getCurrentContext(javax.servlet.http.HttpServletRequest request,
boolean setInThread)
Retrieve the current scope by using the portal manager
|
static org.gcube.vomanagement.usermanagement.model.GCubeUser |
getCurrentUser(javax.servlet.http.HttpServletRequest request)
Retrieve the current user by using the portal manager
|
static Map<String,String> |
getGcubeItemProperties(org.gcube.common.homelibrary.home.workspace.WorkspaceItem item)
Gets the gcube item properties.
|
static org.gcube.vomanagement.usermanagement.model.GCubeGroup |
getGroupFromScope(String scope)
Retrieve the group given the scope
|
static org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg |
getHighestRole(String currentScope,
String username,
String groupName,
CKANPublisherServicesImpl gcubeCkanDataCatalogServiceImpl,
List<OrganizationBean> orgsInWhichAtLeastEditorRole)
Retrieve the highest ckan role the user has and also retrieve the list of organizations (scopes) in which the user has the ckan-admin or ckan-editor role
|
static List<MetaDataProfileBean> |
getMetadataProfilesList(String scope,
javax.servlet.http.HttpServletRequest request)
Retrieve the list of metadata beans
|
static String |
getOrganizationNameFromScope(String scope)
Given the scope in the infrastructure the method retrieves the name of the ckan organization
|
static Map<String,Object> |
getResponseEntityAsJSON(eu.trentorise.opendata.jackan.internal.org.apache.http.HttpResponse response)
Convert the json response to a map
|
static String |
getScopeFromClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)
Get the scope in which ckan information needs to be discovered from the url
|
static String |
retrieveScopeFromOrganizationName(String organizationName)
Given a ckan organization name retrieve the infrastructure scope
|
static String |
tryGetElseCreateToken(String username,
String context)
First check to retrieve the token, else create it
|
static void |
writeProductPost(String productName,
String productUrl,
String userFullname,
List<String> hashtags,
boolean enablePostNotification)
Send notification to vre members about the created product by writing a post.
|
public static final String GCUBE_REQUEST_URL
public static Map<String,String> getGcubeItemProperties(org.gcube.common.homelibrary.home.workspace.WorkspaceItem item)
item - the itempublic static org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg getHighestRole(String currentScope, String username, String groupName, CKANPublisherServicesImpl gcubeCkanDataCatalogServiceImpl, List<OrganizationBean> orgsInWhichAtLeastEditorRole)
currentScope - the current scopeusername - the current usernamegroupName - the current groupNamegcubeCkanDataCatalogServiceImpl - orgsInWhichAdminRole - ckanUtils - ckanUtilspublic static String retrieveScopeFromOrganizationName(String organizationName) throws Exception
organizationName - (prevre, devvre, ...)Exceptionpublic static String getOrganizationNameFromScope(String scope) throws Exception
Exceptionpublic static List<MetaDataProfileBean> getMetadataProfilesList(String scope, javax.servlet.http.HttpServletRequest request)
public static void writeProductPost(String productName, String productUrl, String userFullname, List<String> hashtags, boolean enablePostNotification)
productName - the title of the productproductUrl - the url of the producthashtags - a list of product's hashtagspublic static Map<String,Object> getResponseEntityAsJSON(eu.trentorise.opendata.jackan.internal.org.apache.http.HttpResponse response)
response - public static String tryGetElseCreateToken(String username, String context)
username - context - public static String getScopeFromClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)
httpServletRequest - public static String getCurrentClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)
httpServletRequest - the httpServletRequest objecturl at client sidepublic static org.gcube.vomanagement.usermanagement.model.GCubeUser getCurrentUser(javax.servlet.http.HttpServletRequest request)
public static String getCurrentContext(javax.servlet.http.HttpServletRequest request, boolean setInThread)
b - public static org.gcube.vomanagement.usermanagement.model.GCubeGroup getGroupFromScope(String scope) throws org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException, org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault
scope - org.gcube.vomanagement.usermanagement.exception.UserManagementSystemExceptionorg.gcube.vomanagement.usermanagement.exception.GroupRetrievalFaultCopyright © 2017. All Rights Reserved.