added method to get groups in the ckan instance
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@134140 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5a2df65687
commit
f146436ef5
|
@ -338,4 +338,10 @@ public interface DataCatalogue {
|
||||||
* @return true if the field is set, false otherwise
|
* @return true if the field is set, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean setSearchableField(String datasetId, boolean searchable);
|
boolean setSearchableField(String datasetId, boolean searchable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the list of groups in this instance
|
||||||
|
* @return a list of groups
|
||||||
|
*/
|
||||||
|
List<CkanGroup> getGroups();
|
||||||
}
|
}
|
||||||
|
|
|
@ -669,12 +669,12 @@ public class DataCatalogueImpl implements DataCatalogue{
|
||||||
|
|
||||||
// create the base dataset and fill it
|
// create the base dataset and fill it
|
||||||
CkanDataset dataset = new CkanDataset();
|
CkanDataset dataset = new CkanDataset();
|
||||||
|
|
||||||
// get the name from the title
|
// get the name from the title
|
||||||
String nameToUse = name;
|
String nameToUse = name;
|
||||||
if(nameToUse == null)
|
if(nameToUse == null)
|
||||||
nameToUse = UtilMethods.fromProductTitleToName(title);
|
nameToUse = UtilMethods.fromProductTitleToName(title);
|
||||||
|
|
||||||
logger.debug("Name of the dataset is going to be " + nameToUse + ". Title is going to be " + title);
|
logger.debug("Name of the dataset is going to be " + nameToUse + ". Title is going to be " + title);
|
||||||
dataset.setName(nameToUse);
|
dataset.setName(nameToUse);
|
||||||
dataset.setTitle(title);
|
dataset.setTitle(title);
|
||||||
|
@ -1611,4 +1611,17 @@ public class DataCatalogueImpl implements DataCatalogue{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CkanGroup> getGroups() {
|
||||||
|
|
||||||
|
try{
|
||||||
|
CkanClient client = new CkanClient(CKAN_CATALOGUE_URL);
|
||||||
|
return client.getGroupList();
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("Failed to retrieve the list groups", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue