ref 18291: Modify Accounting Dashboard portlet to support Core Services
https://support.d4science.org/issues/18291 Fixed infra nodes scope
This commit is contained in:
parent
d0e815d7f7
commit
d5266a0b7c
|
@ -110,10 +110,19 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
||||||
currUser);
|
currUser);
|
||||||
|
|
||||||
if (infraNode != null) {
|
if (infraNode != null) {
|
||||||
|
String scopeGroup="";
|
||||||
|
if(gCubeGroup.getGroupName().toUpperCase().endsWith(" GATEWAY")){
|
||||||
|
int l=gCubeGroup.getGroupName().length();
|
||||||
|
scopeGroup=gCubeGroup.getGroupName().substring(0, l-8);
|
||||||
|
} else {
|
||||||
|
scopeGroup=gCubeGroup.getGroupName();
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder gatewayScope=new StringBuilder();
|
StringBuilder gatewayScope=new StringBuilder();
|
||||||
gatewayScope.append(infrastructureScope);
|
gatewayScope.append(infrastructureScope);
|
||||||
gatewayScope.append("/");
|
gatewayScope.append("/");
|
||||||
gatewayScope.append(gCubeGroup.getGroupName());
|
gatewayScope.append(scopeGroup);
|
||||||
|
|
||||||
ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, gatewayScope.toString());
|
ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, gatewayScope.toString());
|
||||||
if (gatewayChildren != null) {
|
if (gatewayChildren != null) {
|
||||||
gatewayChildren.addFirst(infraNodeScopeDescriptor);
|
gatewayChildren.addFirst(infraNodeScopeDescriptor);
|
||||||
|
@ -163,10 +172,17 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
|
||||||
GCubeUser currUser = pContext.getCurrentUser(request);
|
GCubeUser currUser = pContext.getCurrentUser(request);
|
||||||
String portalScope = pContext.getCurrentScope(currentSiteGroupId + "");
|
String portalScope = pContext.getCurrentScope(currentSiteGroupId + "");
|
||||||
|
|
||||||
|
String scopeGroup="";
|
||||||
|
if(gatewayName.toUpperCase().endsWith(" GATEWAY")){
|
||||||
|
int l=gatewayName.length();
|
||||||
|
scopeGroup=gatewayName.substring(0, l-8);
|
||||||
|
} else {
|
||||||
|
scopeGroup=gatewayName;
|
||||||
|
}
|
||||||
StringBuilder gatewayScope=new StringBuilder();
|
StringBuilder gatewayScope=new StringBuilder();
|
||||||
gatewayScope.append(portalScope);
|
gatewayScope.append(portalScope);
|
||||||
gatewayScope.append("/");
|
gatewayScope.append("/");
|
||||||
gatewayScope.append(gatewayName);
|
gatewayScope.append(scopeGroup);
|
||||||
|
|
||||||
InfraNode infraNode = BuildInfraNode.build(portalScope);
|
InfraNode infraNode = BuildInfraNode.build(portalScope);
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,9 @@ public class BuildInfraNode {
|
||||||
if (accountingDashboardConfigJAXB != null) {
|
if (accountingDashboardConfigJAXB != null) {
|
||||||
logger.info("AccountingDashboard: use configuration in scope: " + scope);
|
logger.info("AccountingDashboard: use configuration in scope: " + scope);
|
||||||
if (accountingDashboardConfigJAXB.isEnabledInfraNode()) {
|
if (accountingDashboardConfigJAXB.isEnabledInfraNode()) {
|
||||||
logger.info("Infra Nodes configuration enabled in scope: " + scope);
|
logger.info("AccountingDashboard: Infra Nodes configuration enabled in scope: " + scope);
|
||||||
InfraNodeJAXB infraNodeJAXB = accountingDashboardConfigJAXB.getBaseInfraNode();
|
InfraNodeJAXB infraNodeJAXB = accountingDashboardConfigJAXB.getBaseInfraNode();
|
||||||
logger.info("Infra Nodes configuration: " + infraNodeJAXB);
|
logger.info("AccountingDashboard: Base Infra Nodes configuration: " + infraNodeJAXB);
|
||||||
if (infraNodeJAXB != null) {
|
if (infraNodeJAXB != null) {
|
||||||
infraNode = new InfraNode(infraNodeJAXB.getScope(), infraNodeJAXB.getName(),
|
infraNode = new InfraNode(infraNodeJAXB.getScope(), infraNodeJAXB.getName(),
|
||||||
infraNodeJAXB.getDescription());
|
infraNodeJAXB.getDescription());
|
||||||
|
@ -48,15 +48,18 @@ public class BuildInfraNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.info("Infra Nodes use default configuration for scope: " + scope);
|
logger.info(
|
||||||
infraNode = useDefaultConfiguration();
|
"AccountingDashboard: Base Infra Nodes is not present in configuration"
|
||||||
|
+ " resource for scope: "
|
||||||
|
+ scope);
|
||||||
|
//infraNode = useDefaultConfiguration();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("Infra Nodes configuration disabled in scope: " + scope);
|
logger.info("AccountingDashboard: Infra Nodes configuration disabled for scope: " + scope);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("AccountingDashboard: use infra nodes default configuration for scope: " + scope);
|
logger.info("AccountingDashboard: configuration resource is not present in scope: " + scope);
|
||||||
infraNode = useDefaultConfiguration();
|
// infraNode = useDefaultConfiguration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@ public class Constants {
|
||||||
public static final String CMEMS_IMPORTER_LANG = "AccountingDashBoradLang";
|
public static final String CMEMS_IMPORTER_LANG = "AccountingDashBoradLang";
|
||||||
|
|
||||||
public static final String DEFAULT_USER = "giancarlo.panichi";
|
public static final String DEFAULT_USER = "giancarlo.panichi";
|
||||||
public static final String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
|
//public static final String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
|
||||||
|
public static final String DEFAULT_SCOPE = "/gcube";
|
||||||
public static final String DEFAULT_TOKEN = "";
|
public static final String DEFAULT_TOKEN = "";
|
||||||
public static final String DEFAULT_ROLE = "OrganizationMember";
|
public static final String DEFAULT_ROLE = "OrganizationMember";
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ public class AccountingServiceTest extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AuthTest.setToken();
|
AuthTest.setToken();
|
||||||
AccountingService accountingService = new AccountingService(AccountingServiceType.CurrentScope);
|
new AccountingService(AccountingServiceType.CurrentScope);
|
||||||
// accountingService.getTree();
|
//accountingService.getTree();
|
||||||
|
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
Loading…
Reference in New Issue