added method getOrganization

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@141826 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-01-26 15:46:19 +00:00
parent c99954c9d5
commit 46fc1c8dd9
2 changed files with 21 additions and 0 deletions

View File

@ -103,6 +103,11 @@ public interface DataCatalogue {
* @return
*/
List<String> getOrganizationsNames();
/**
* Retrieve the organization with this name
*/
CkanOrganization getOrganizationByName(String name);
/**
* Finds the id associated to the chosen license

View File

@ -2512,4 +2512,20 @@ public class DataCatalogueImpl implements DataCatalogue{
return false;
}
}
@Override
public CkanOrganization getOrganizationByName(String name) {
checkNotNull(name);
String ckanName = name.toLowerCase();
try{
return client.getOrganization(ckanName);
}catch(Exception e){
logger.error("Failed to retrieve the organization with name" + name, e);
}
return null;
}
}