added getGroupByName
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@148341 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
be0ab0518a
commit
612dcf19a6
|
@ -52,6 +52,12 @@ public interface DataCatalogue {
|
|||
*/
|
||||
List<CkanGroup> getGroupsByUser(String username);
|
||||
|
||||
/**
|
||||
* Returns a group given its name
|
||||
* @return return a {@link CkanGroup} or null if no group with this name exists
|
||||
*/
|
||||
CkanGroup getGroupByName(String nameOrId);
|
||||
|
||||
/**
|
||||
* Returns the list of organizations' names to whom the user belongs (with any role)
|
||||
* @param username
|
||||
|
|
|
@ -2581,4 +2581,15 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CkanGroup getGroupByName(String name) {
|
||||
String ckanName = UtilMethods.fromGroupTitleToName(name);
|
||||
try{
|
||||
return client.getGroup(ckanName);
|
||||
}catch(Exception e){
|
||||
logger.error("Failed to retrieve the group with name" + name, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue