public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static ConnectedBean |
connectedBeanRecordFromUrl(String destUrl,
org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue clg,
String apiKey,
javax.servlet.http.HttpSession httpSession)
Get Connected bean from record
|
static String |
fetchSysAPI(String context)
Fetch the sysadmin key from the IS for this catalogue
|
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 eu.trentorise.opendata.jackan.model.CkanDataset |
getDatasetFromUrl(String url,
org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue clg,
String apiKey)
Exploits the fact that in GRSF the url of a record contains the name (which is unique) of the record itself
|
static String |
getDatasetKnowledgeBaseIdFromUrl(String url)
Exploits the fact that in GRSF the url of a record contains the name (which is unique) of the record itself
|
static Map<String,List<String>> |
getExtrasAsHashMap(List<eu.trentorise.opendata.jackan.model.CkanPair> extrasAsPairs)
Get the extras of this dataset as hashmap
|
static Map<String,String> |
getFieldToFieldNameSpaceMapping(javax.servlet.http.HttpSession httpSession,
String resourceName)
Return a map for converting a key to a namespace:key format by reading a generic resource.
|
static String |
getScopeFromClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)
Get the scope in which ckan information needs to be discovered from the url
|
static boolean |
isIntoPortal()
Checks if is into portal.
|
static Map<String,List<String>> |
replaceFieldsKey(List<eu.trentorise.opendata.jackan.model.CkanPair> extrasAsPairs,
Map<String,String> namespaces)
Replace the extras' keys if needed, e.g.
|
static void |
revertOperation(eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient httpClient,
String baseUrl,
javax.servlet.http.HttpServletRequest httpServletRequest,
RevertableOperationInfo rInfo,
String token,
String context,
long groupId)
Revert operation and alert admins/vre users
|
static SimilarGRSFRecord |
similarGRSFRecordFromJson(String json,
org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue ctl,
String apiKey,
javax.servlet.http.HttpSession httpSession)
Get a
SimilarGRSFRecord from a json string |
static void |
updateRecord(String serviceUrl,
ManageProductBean bean,
org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue catalogue,
String username,
String fullName,
javax.servlet.http.HttpServletRequest httpServletRequest,
long groupId,
String context,
String token)
Send an update for this bean
|
public static Map<String,String> getFieldToFieldNameSpaceMapping(javax.servlet.http.HttpSession httpSession, String resourceName)
httpSession - public static Map<String,List<String>> replaceFieldsKey(List<eu.trentorise.opendata.jackan.model.CkanPair> extrasAsPairs, Map<String,String> namespaces)
extrasAsPairs - namespaces - public static Map<String,List<String>> getExtrasAsHashMap(List<eu.trentorise.opendata.jackan.model.CkanPair> extrasAsPairs)
extrasAsPairs - public static void updateRecord(String serviceUrl, ManageProductBean bean, org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue catalogue, String username, String fullName, javax.servlet.http.HttpServletRequest httpServletRequest, long groupId, String context, String token) throws Exception
baseUrl - bean - username - catalogue - Exceptionpublic static void revertOperation(eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient httpClient,
String baseUrl,
javax.servlet.http.HttpServletRequest httpServletRequest,
RevertableOperationInfo rInfo,
String token,
String context,
long groupId)
throws Exception
httpClient - baseUrl - fullName - uuid - Exceptionpublic 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 String getCurrentContext(javax.servlet.http.HttpServletRequest request, boolean setInThread)
b - public static org.gcube.vomanagement.usermanagement.model.GCubeUser getCurrentUser(javax.servlet.http.HttpServletRequest request)
public static eu.trentorise.opendata.jackan.model.CkanDataset getDatasetFromUrl(String url, org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue clg, String apiKey) throws Exception
url - clg - Exceptionpublic static String getDatasetKnowledgeBaseIdFromUrl(String url)
url - clg - public static SimilarGRSFRecord similarGRSFRecordFromJson(String json, org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue ctl, String apiKey, javax.servlet.http.HttpSession httpSession) throws org.json.simple.parser.ParseException
SimilarGRSFRecord from a json stringjson - SimilarGRSFRecordorg.json.simple.parser.ParseExceptionpublic static boolean isIntoPortal()
public static ConnectedBean connectedBeanRecordFromUrl(String destUrl, org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue clg, String apiKey, javax.servlet.http.HttpSession httpSession) throws org.json.simple.parser.ParseException
httpSession - json - sourceIdentifier - sourceDomain - grsfDomain - org.json.simple.parser.ParseExceptionCopyright © 2019. All Rights Reserved.