This commit is contained in:
Massimiliano Assante 2016-11-17 17:22:33 +00:00
parent 660ddada36
commit 8dfd57adb6
2 changed files with 19 additions and 7 deletions

View File

@ -1,4 +1,8 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlet.user.my-vres.2-2-0" date="2016-11-17">
<Change>Removed ASL Session</Change>
<Change>Implemented Feature #4877 remove VRE association to single Category constraint</Change>
</Changeset>
<Changeset component="org.gcube.portlet.user.my-vres.2-1-0" date="2016-09-12">
<Change>Shows only the virtual groups available in the Site it is deployed on</Change>
<Change>VRE was not updated in the portlet due to liferay versioning of Document Library</Change>

View File

@ -78,7 +78,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
LinkedHashMap<String, ArrayList<VRE>> toReturn = new LinkedHashMap<String, ArrayList<VRE>>();
List<VirtualGroup> currentSiteVGroups = ManagementUtils.getVirtualGroupsBySiteGroupId(ManagementUtils.getSiteGroupIdFromServletRequest(getThreadLocalRequest().getServerName()));
List<VirtualGroup> currentSiteVGroups = gm.getVirtualGroups(ManagementUtils.getSiteGroupIdFromServletRequest(getThreadLocalRequest().getServerName()));
for (VirtualGroup vg : currentSiteVGroups) {
String gName = vg.getName();
ArrayList<VRE> toCreate = new ArrayList<VRE>();
@ -109,16 +109,24 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
vreToAdd.setUserBelonging(UserBelonging.NOT_BELONGING);
GCubeUser currUser = new LiferayUserManager().getUserByUsername(username);
if (gm.listGroupsByUser(currUser.getUserId()).contains(vre)) {
vreToAdd.setUserBelonging(UserBelonging.BELONGING);
String catName = gm.getVirtualGroup(vre.getGroupId()).getName();
List<VirtualGroup> vreGroups = gm.getVirtualGroups(vre.getGroupId());
for (VirtualGroup vreGroup : vreGroups) {
for (String category : toReturn.keySet()) {
//for preserving order we inserted the keys before
if (vreGroup.getName().compareTo(category)==0) {
ArrayList<VRE> toUpdate = toReturn.get(category);
toUpdate.add(vreToAdd);
}
}
}
//for preserving order we inserted the keys before
if (toReturn.containsKey(catName)) {
ArrayList<VRE> toUpdate = toReturn.get(catName);
toUpdate.add(vreToAdd);
}
}
}
}