git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/accounting-dashboard@169712 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
206d987dfd
commit
a0b4265079
|
@ -20,6 +20,8 @@ import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
|||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.gcube.vomanagement.usermanagement.model.VirtualGroup;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.liferay.portal.kernel.exception.PortalException;
|
||||
import com.liferay.portal.kernel.exception.SystemException;
|
||||
|
@ -28,37 +30,11 @@ import com.liferay.portal.model.VirtualHost;
|
|||
import com.liferay.portal.service.LayoutSetLocalServiceUtil;
|
||||
import com.liferay.portal.service.VirtualHostLocalServiceUtil;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class PortalContextTreeProvider implements ContextTreeProvider {
|
||||
|
||||
private static GroupManager groupsManager;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
private class VRECategory{
|
||||
private long categoryID;
|
||||
private String name;
|
||||
private String description;
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
private class VRE implements Comparable<VRE>{
|
||||
private String name;
|
||||
private String description;
|
||||
private long id;
|
||||
private String url;
|
||||
private String scope;
|
||||
|
||||
@Override
|
||||
public int compareTo(VRE vre) {
|
||||
return this.getName().compareTo(vre.getName());
|
||||
}
|
||||
}
|
||||
private static Logger log = LoggerFactory.getLogger(PortalContextTreeProvider.class);
|
||||
|
||||
|
||||
static {
|
||||
|
@ -90,17 +66,17 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
|||
return root;
|
||||
}
|
||||
|
||||
private ScopeDescriptor asScopeDescriptor(GCubeGroup group)
|
||||
throws UserManagementSystemException, GroupRetrievalFault {
|
||||
ScopeDescriptor toReturn = new ScopeDescriptor(group.getGroupName(),
|
||||
groupsManager.getInfrastructureScope(group.getGroupId()));
|
||||
if (group.getChildren() != null && !group.getChildren().isEmpty()) {
|
||||
for (GCubeGroup child : group.getChildren()) {
|
||||
toReturn.getChildren().add(asScopeDescriptor(child));
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
// private ScopeDescriptor asScopeDescriptor(GCubeGroup group)
|
||||
// throws UserManagementSystemException, GroupRetrievalFault {
|
||||
// ScopeDescriptor toReturn = new ScopeDescriptor(group.getGroupName(),
|
||||
// groupsManager.getInfrastructureScope(group.getGroupId()));
|
||||
// if (group.getChildren() != null && !group.getChildren().isEmpty()) {
|
||||
// for (GCubeGroup child : group.getChildren()) {
|
||||
// toReturn.getChildren().add(asScopeDescriptor(child));
|
||||
// }
|
||||
// }
|
||||
// return toReturn;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -158,21 +134,21 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
|||
for (VRECategory vre : toReturn.keySet()) {
|
||||
if (vre.getName().compareTo(vreGroup.getName())==0) {
|
||||
ArrayList<VRE> toUpdate = toReturn.get(vre);
|
||||
// UserBelonging belongs = UserBelonging.NOT_BELONGING;
|
||||
// VRE toAdd = new VRE(vreID,vreName, vreDescription, vreLogoURL, groupName, friendlyURL, belongs, getVREMembershipType(vreSite.getMembershipType()));
|
||||
// UserBelonging belongs = UserBelonging.NOT_BELONGING;
|
||||
// VRE toAdd = new VRE(vreID,vreName, vreDescription, vreLogoURL, groupName, friendlyURL, belongs, getVREMembershipType(vreSite.getMembershipType()));
|
||||
VRE toAdd= new VRE(vreName,vreDescription,vreID,friendlyURL,infraScope);
|
||||
// if (GroupLocalServiceUtil.getGroup(vreID).getPublicLayoutsPageCount() > 0) {
|
||||
// String publicURL = PREFIX_PUBLIC_URL+vreSite.getFriendlyURL();
|
||||
// toAdd.setPublicURL(publicURL);
|
||||
// }
|
||||
// if (currUser != null) {
|
||||
// //check if the user belongs to it
|
||||
// if (currUserGroups.contains(vreSite)) {
|
||||
// toAdd.setUserBelonging(UserBelonging.BELONGING);
|
||||
// }
|
||||
// else if (checkPending(currUser.getUsername(), vreSite.getGroupId()))
|
||||
// toAdd.setUserBelonging(UserBelonging.PENDING);
|
||||
// }
|
||||
// if (GroupLocalServiceUtil.getGroup(vreID).getPublicLayoutsPageCount() > 0) {
|
||||
// String publicURL = PREFIX_PUBLIC_URL+vreSite.getFriendlyURL();
|
||||
// toAdd.setPublicURL(publicURL);
|
||||
// }
|
||||
// if (currUser != null) {
|
||||
// //check if the user belongs to it
|
||||
// if (currUserGroups.contains(vreSite)) {
|
||||
// toAdd.setUserBelonging(UserBelonging.BELONGING);
|
||||
// }
|
||||
// else if (checkPending(currUser.getUsername(), vreSite.getGroupId()))
|
||||
// toAdd.setUserBelonging(UserBelonging.PENDING);
|
||||
// }
|
||||
toUpdate.add(toAdd);
|
||||
}
|
||||
}
|
||||
|
@ -212,4 +188,71 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private class VRECategory{
|
||||
private long categoryID;
|
||||
private String name;
|
||||
private String description;
|
||||
public VRECategory(long categoryID, String name, String description) {
|
||||
super();
|
||||
this.categoryID = categoryID;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public long getCategoryID() {
|
||||
return categoryID;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class VRE implements Comparable<VRE>{
|
||||
private String name;
|
||||
private String description;
|
||||
private long id;
|
||||
private String url;
|
||||
private String scope;
|
||||
|
||||
|
||||
public VRE(String name, String description, long id, String url, String scope) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.id = id;
|
||||
this.url = url;
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(VRE vre) {
|
||||
return this.getName().compareTo(vre.getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue