added num users into GcubeGroup model

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@160061 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-12-05 13:37:08 +00:00
parent 54ca85c686
commit 34a3936a64
2 changed files with 41 additions and 5 deletions

View File

@ -64,7 +64,7 @@ public class LiferayGroupManager implements GroupManager {
if (g != null) { if (g != null) {
long logoId = LayoutSetLocalServiceUtil.getLayoutSet(g.getGroupId(), true).getLogoId(); long logoId = LayoutSetLocalServiceUtil.getLayoutSet(g.getGroupId(), true).getLogoId();
if (isVRE(g.getGroupId())) { if (isVRE(g.getGroupId())) {
return new GCubeGroup(g.getGroupId(), g.getParentGroupId(), g.getName(), g.getDescription(), g.getFriendlyURL(), logoId, null, getMappedGroupMembershipType(g.getType())); return new GCubeGroup(g.getGroupId(), g.getParentGroupId(), g.getName(), g.getDescription(), g.getFriendlyURL(), logoId, UserLocalServiceUtil.getGroupUsersCount(g.getGroupId()), null, getMappedGroupMembershipType(g.getType()));
} }
else if (isVO(g.getGroupId())) { else if (isVO(g.getGroupId())) {
List<GCubeGroup> vres = new ArrayList<GCubeGroup>(); List<GCubeGroup> vres = new ArrayList<GCubeGroup>();
@ -72,13 +72,13 @@ public class LiferayGroupManager implements GroupManager {
for (Group vre : VREs) { for (Group vre : VREs) {
vres.add(mapLRGroup(vre)); vres.add(mapLRGroup(vre));
} }
return new GCubeGroup(g.getGroupId(), g.getParentGroupId(), g.getName(), g.getDescription(), g.getFriendlyURL(), logoId, vres, getMappedGroupMembershipType(g.getType())); return new GCubeGroup(g.getGroupId(), g.getParentGroupId(), g.getName(), g.getDescription(), g.getFriendlyURL(), logoId, UserLocalServiceUtil.getGroupUsersCount(g.getGroupId()), vres, getMappedGroupMembershipType(g.getType()));
} else if (isRootVO(g.getGroupId())) { } else if (isRootVO(g.getGroupId())) {
List<GCubeGroup> vos = new ArrayList<GCubeGroup>(); List<GCubeGroup> vos = new ArrayList<GCubeGroup>();
List<Group> children = g.getChildren(true); List<Group> children = g.getChildren(true);
for (Group vo : children) for (Group vo : children)
vos.add(mapLRGroup(vo)); vos.add(mapLRGroup(vo));
return new GCubeGroup(g.getGroupId(), -1, g.getName(), g.getDescription(), g.getFriendlyURL(), logoId, vos, getMappedGroupMembershipType(g.getType())); return new GCubeGroup(g.getGroupId(), -1, g.getName(), g.getDescription(), g.getFriendlyURL(), logoId, UserLocalServiceUtil.getGroupUsersCount(g.getGroupId()) ,vos, getMappedGroupMembershipType(g.getType()));
} else{ } else{
_log.warn("This groupId does not correspond to a VO ora VRE"); _log.warn("This groupId does not correspond to a VO ora VRE");
return null; return null;

View File

@ -13,6 +13,7 @@ public class GCubeGroup implements Serializable {
String description; String description;
String friendlyURL; String friendlyURL;
long logoId; long logoId;
int userCount;
List<GCubeGroup> children; List<GCubeGroup> children;
GroupMembershipType membershipType; GroupMembershipType membershipType;
@ -48,6 +49,31 @@ public class GCubeGroup implements Serializable {
this.membershipType = membershipType; this.membershipType = membershipType;
} }
/**
* @param groupId
* @param parentGroupId
* @param groupName
* @param description
* @param friendlyURL
* @param logoId
* @param userCount
* @param children
* @param membershipType
*/
public GCubeGroup(long groupId, long parentGroupId, String groupName,
String description, String friendlyURL, long logoId, int userCount,
List<GCubeGroup> children, GroupMembershipType membershipType) {
super();
this.groupId = groupId;
this.parentGroupId = parentGroupId;
this.groupName = groupName;
this.description = description;
this.friendlyURL = friendlyURL;
this.logoId = logoId;
this.userCount = userCount;
this.children = children;
this.membershipType = membershipType;
}
public long getGroupId() { public long getGroupId() {
return groupId; return groupId;
@ -136,10 +162,20 @@ public class GCubeGroup implements Serializable {
this.membershipType = membershipType; this.membershipType = membershipType;
} }
public int getUserCount() {
return userCount;
}
public void setUserCount(int userCount) {
this.userCount = userCount;
}
@Override @Override
public String toString() { public String toString() {
return "GCubeGroup [groupId=" + groupId + ", parentGroupId=" + parentGroupId + ", groupName=" + groupName return "GCubeGroup [groupId=" + groupId + ", parentGroupId="
+ ", description=" + description + ", friendlyURL=" + friendlyURL + ", logoId=" + logoId + ", children=" + parentGroupId + ", groupName=" + groupName + ", description="
+ description + ", friendlyURL=" + friendlyURL + ", logoId="
+ logoId + ", userCount=" + userCount + ", children="
+ children + ", membershipType=" + membershipType + "]"; + children + ", membershipType=" + membershipType + "]";
} }