getGroups and getOrganizations now use the newest and fastest ckan-utility-lib's methods which directly query the database
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@141851 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
19f7f71e02
commit
a7a1a9b637
|
@ -6,6 +6,8 @@ import java.util.Calendar;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
@ -490,18 +492,15 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
}else{
|
||||
|
||||
DataCatalogue catalogue = getCatalogue(scope);
|
||||
List<CkanGroup> ckanGroups = catalogue.getGroups();
|
||||
|
||||
String apiKey = catalogue.getApiKeyFromUsername(username);
|
||||
|
||||
for (CkanGroup ckanGroup : ckanGroups) {
|
||||
String role = catalogue.getRoleOfUserInGroup(username, ckanGroup.getName(), apiKey);
|
||||
if(role == null)
|
||||
continue;
|
||||
|
||||
toReturn.add(new GroupBean(ckanGroup.getTitle(), ckanGroup.getName()));
|
||||
Map<String, Map<CkanGroup, RolesCkanGroupOrOrg>> mapRoleGroup = catalogue.getUserRoleByGroup(username, apiKey);
|
||||
Set<Entry<String, Map<CkanGroup, RolesCkanGroupOrOrg>>> set = mapRoleGroup.entrySet();
|
||||
for (Entry<String, Map<CkanGroup, RolesCkanGroupOrOrg>> entry : set) {
|
||||
Set<Entry<CkanGroup, RolesCkanGroupOrOrg>> subSet = entry.getValue().entrySet();
|
||||
for (Entry<CkanGroup, RolesCkanGroupOrOrg> subEntry : subSet) {
|
||||
toReturn.add(new GroupBean(subEntry.getKey().getTitle(), subEntry.getKey().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
httpSession.setAttribute(keyPerScopeGroups, toReturn);
|
||||
}
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue