|
|
|
@ -96,9 +96,9 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
|
|
|
|
LinkedList<ScopeDescriptor> infraChildren = new LinkedList<>();
|
|
|
|
|
PortalContext pContext = PortalContext.getConfiguration();
|
|
|
|
|
GCubeUser currUser = pContext.getCurrentUser(request);
|
|
|
|
|
|
|
|
|
|
InfraNode infraNode=BuildInfraNode.build(infrastructureScope);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InfraNode infraNode = BuildInfraNode.build(infrastructureScope);
|
|
|
|
|
|
|
|
|
|
List<GCubeGroup> theGateways = new LiferayGroupManager().getGateways();
|
|
|
|
|
for (GCubeGroup gCubeGroup : theGateways) {
|
|
|
|
|
logger.debug("Gateway: [id=" + gCubeGroup.getGroupId() + ", name=" + gCubeGroup.getGroupName() + "]");
|
|
|
|
@ -108,49 +108,45 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
|
|
|
|
|
|
|
|
|
LinkedList<ScopeDescriptor> gatewayChildren = retrieveGatewayChildren(request, gCubeGroup.getGroupId(),
|
|
|
|
|
currUser);
|
|
|
|
|
|
|
|
|
|
if(infraNode!=null){
|
|
|
|
|
String currScope=portalContext.getCurrentScope(gCubeGroup.getGroupId()+"");
|
|
|
|
|
ScopeDescriptor infraNodeScopeDescriptor=createRelativeInfraNode(infraNode, currScope);
|
|
|
|
|
if(gatewayChildren!=null){
|
|
|
|
|
|
|
|
|
|
if (infraNode != null) {
|
|
|
|
|
String currScope = portalContext.getCurrentScope(gCubeGroup.getGroupId() + "");
|
|
|
|
|
ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, currScope);
|
|
|
|
|
if (gatewayChildren != null) {
|
|
|
|
|
gatewayChildren.addFirst(infraNodeScopeDescriptor);
|
|
|
|
|
} else {
|
|
|
|
|
gatewayChildren=new LinkedList<>();
|
|
|
|
|
gatewayChildren = new LinkedList<>();
|
|
|
|
|
gatewayChildren.add(infraNodeScopeDescriptor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScopeDescriptor gatewayScopeDescriptor = new ScopeDescriptor(gCubeGroup.getGroupName(),
|
|
|
|
|
gCubeGroup.getGroupId() + "");
|
|
|
|
|
gatewayScopeDescriptor.setChildren(gatewayChildren);
|
|
|
|
|
infraChildren.add(gatewayScopeDescriptor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
infra.setChildren(infraChildren);
|
|
|
|
|
return infra;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ScopeDescriptor createRelativeInfraNode(InfraNode infraNode, String scope){
|
|
|
|
|
ScopeDescriptor scopeDescriptor=null;
|
|
|
|
|
if(infraNode!=null){
|
|
|
|
|
StringBuilder absoluteScope=new StringBuilder();
|
|
|
|
|
absoluteScope.append(scope);
|
|
|
|
|
absoluteScope.append("/");
|
|
|
|
|
absoluteScope.append(infraNode.getScope());
|
|
|
|
|
scopeDescriptor=new ScopeDescriptor(infraNode.getName(), absoluteScope.toString());
|
|
|
|
|
if(infraNode.getChildren()!=null&&!infraNode.getChildren().isEmpty()){
|
|
|
|
|
LinkedList<ScopeDescriptor> childsDescriptor=new LinkedList<>();
|
|
|
|
|
for(InfraNode child:infraNode.getChildren()){
|
|
|
|
|
ScopeDescriptor childScopeDescriptor=createRelativeInfraNode(child, absoluteScope.toString());
|
|
|
|
|
childsDescriptor.add(childScopeDescriptor);
|
|
|
|
|
}
|
|
|
|
|
scopeDescriptor.setChildren(childsDescriptor);
|
|
|
|
|
|
|
|
|
|
private ScopeDescriptor createRelativeInfraNode(InfraNode infraNode, String scope) {
|
|
|
|
|
StringBuilder absoluteScope = new StringBuilder();
|
|
|
|
|
absoluteScope.append(scope);
|
|
|
|
|
absoluteScope.append("/");
|
|
|
|
|
absoluteScope.append(infraNode.getScope());
|
|
|
|
|
ScopeDescriptor scopeDescriptor = new ScopeDescriptor(infraNode.getName(), absoluteScope.toString());
|
|
|
|
|
if (infraNode.getChildren() != null && !infraNode.getChildren().isEmpty()) {
|
|
|
|
|
LinkedList<ScopeDescriptor> childsScopeDescriptor = new LinkedList<>();
|
|
|
|
|
for (InfraNode child : infraNode.getChildren()) {
|
|
|
|
|
ScopeDescriptor childScopeDescriptor = createRelativeInfraNode(child, absoluteScope.toString());
|
|
|
|
|
childsScopeDescriptor.add(childScopeDescriptor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
scopeDescriptor.setChildren(childsScopeDescriptor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return scopeDescriptor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ScopeDescriptor recreateTreeForPortalContext(HttpServletRequest request)
|
|
|
|
|
throws Exception, PortalException, SystemException {
|
|
|
|
@ -160,23 +156,23 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
|
|
|
|
|
|
|
|
|
PortalContext pContext = PortalContext.getConfiguration();
|
|
|
|
|
GCubeUser currUser = pContext.getCurrentUser(request);
|
|
|
|
|
String currScope=pContext.getCurrentScope(currentSiteGroupId+"");
|
|
|
|
|
|
|
|
|
|
InfraNode infraNode=BuildInfraNode.build(currScope);
|
|
|
|
|
|
|
|
|
|
String currScope = pContext.getCurrentScope(currentSiteGroupId + "");
|
|
|
|
|
|
|
|
|
|
InfraNode infraNode = BuildInfraNode.build(currScope);
|
|
|
|
|
|
|
|
|
|
LinkedList<ScopeDescriptor> rootChildren = null;
|
|
|
|
|
rootChildren = retrieveGatewayChildren(request, currentSiteGroupId, currUser);
|
|
|
|
|
|
|
|
|
|
if(infraNode!=null){
|
|
|
|
|
ScopeDescriptor infraNodeScopeDescriptor=createRelativeInfraNode(infraNode, currScope);
|
|
|
|
|
if(rootChildren!=null){
|
|
|
|
|
|
|
|
|
|
if (infraNode != null) {
|
|
|
|
|
ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, currScope);
|
|
|
|
|
if (rootChildren != null) {
|
|
|
|
|
rootChildren.addFirst(infraNodeScopeDescriptor);
|
|
|
|
|
} else {
|
|
|
|
|
rootChildren=new LinkedList<>();
|
|
|
|
|
rootChildren = new LinkedList<>();
|
|
|
|
|
rootChildren.add(infraNodeScopeDescriptor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Group rootGroup = getSiteFromServletRequest(request);
|
|
|
|
|
root = new ScopeDescriptor(rootGroup.getDescriptiveName(), rootGroup.getGroupId() + "");
|
|
|
|
|
root.setChildren(rootChildren);
|
|
|
|
@ -186,17 +182,16 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
|
|
|
|
|
|
|
|
|
private LinkedList<ScopeDescriptor> retrieveGatewayChildren(HttpServletRequest request, long currentSiteGroupId,
|
|
|
|
|
GCubeUser currUser) throws Exception, PortalException, SystemException {
|
|
|
|
|
logger.info("Retrieve Gateway Children: currentSiteGroupId="+currentSiteGroupId);
|
|
|
|
|
|
|
|
|
|
logger.info("Retrieve Gateway Children: currentSiteGroupId=" + currentSiteGroupId);
|
|
|
|
|
|
|
|
|
|
// PARSE TREE
|
|
|
|
|
LinkedHashMap<VRECategory, ArrayList<VRE>> gatewayTree = getPortalSitesMappedToVRE(currUser,
|
|
|
|
|
currentSiteGroupId);
|
|
|
|
|
|
|
|
|
|
logger.debug("Parsing tree from gateway. Size {} ", gatewayTree.size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LinkedList<ScopeDescriptor> rootChildren = new LinkedList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Entry<VRECategory, ArrayList<VRE>> entry : gatewayTree.entrySet()) {
|
|
|
|
|
ScopeDescriptor rootChild = new ScopeDescriptor(entry.getKey().name, entry.getKey().categoryID + "");
|
|
|
|
|
for (VRE vre : entry.getValue())
|
|
|
|
|