added method to fetch dataset also without api key (only public datasets)
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@146751 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ebadddd097
commit
440cc907e4
|
@ -381,6 +381,15 @@ public interface DataCatalogue {
|
|||
* @return
|
||||
*/
|
||||
CkanDataset getDataset(String datasetId, String apiKey);
|
||||
|
||||
/**
|
||||
* Retrieve a ckan dataset given its id. The CkanClient is used, without api key. The result
|
||||
* is null also when the dataset is private.
|
||||
* @param datasetId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
CkanDataset getDataset(String datasetId) throws Exception;
|
||||
|
||||
/**
|
||||
* Set searchable field
|
||||
|
|
|
@ -1685,6 +1685,19 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CkanDataset getDataset(String datasetId) throws Exception{
|
||||
logger.info("Request ckan dataset with id " + datasetId);
|
||||
|
||||
// checks
|
||||
checkNotNull(datasetId);
|
||||
checkArgument(!datasetId.isEmpty());
|
||||
|
||||
CkanClient client = new CkanClient(CKAN_CATALOGUE_URL);
|
||||
return client.getDataset(datasetId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setSearchableField(String datasetId, boolean searchable) {
|
||||
|
||||
|
@ -2569,4 +2582,5 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue