fixed group name retrieving
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@98778 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a769cb4668
commit
86802d7eff
|
@ -167,21 +167,21 @@ public class GWTWorkspaceSharingBuilder {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param vrePath
|
||||
* @param voPath
|
||||
* @param list
|
||||
* @return
|
||||
* @throws InternalErrorException
|
||||
*/
|
||||
public List<InfoContactModel> buildGXTListContactsModelFromVOs(List<VO> listVO, String vrePath) throws InternalErrorException {
|
||||
public List<InfoContactModel> buildGXTListContactsModelFromVOs(List<VO> listVO, String voPath) throws InternalErrorException {
|
||||
|
||||
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
||||
|
||||
if(vrePath==null){
|
||||
vrePath=ConstantsSharing.PATH_SEPARATOR;
|
||||
if(voPath==null){
|
||||
voPath=ConstantsSharing.PATH_SEPARATOR;
|
||||
}
|
||||
|
||||
if(vrePath!=null && !vrePath.endsWith(ConstantsSharing.PATH_SEPARATOR)){
|
||||
vrePath+=ConstantsSharing.PATH_SEPARATOR;
|
||||
if(voPath!=null && !voPath.endsWith(ConstantsSharing.PATH_SEPARATOR)){
|
||||
voPath+=ConstantsSharing.PATH_SEPARATOR;
|
||||
}
|
||||
|
||||
if (listVO == null){
|
||||
|
@ -191,6 +191,7 @@ public class GWTWorkspaceSharingBuilder {
|
|||
|
||||
logger.trace("List<VO> size is: "+ listVO.size());
|
||||
logger.trace("Building list contact model...");
|
||||
logger.trace("voPath is: "+ voPath);
|
||||
|
||||
for (VO vo : listVO) {
|
||||
List<VRE> vres = vo.getVres();
|
||||
|
@ -204,9 +205,9 @@ public class GWTWorkspaceSharingBuilder {
|
|||
for (VRE vre : vres) {
|
||||
|
||||
if(vre.getName()!=null || !vre.getName().isEmpty()){
|
||||
String groupId = vrePath+vre.getName();
|
||||
String groupId = voPath+vre.getName();
|
||||
InfoContactModel contact = new InfoContactModel(groupId, groupId, vre.getName(), true);
|
||||
logger.trace("Adding VRE " + contact);
|
||||
logger.trace("Adding group contact " + contact);
|
||||
listContactsModel.add(contact);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,14 +135,15 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
|||
PortalContext context = PortalContext.getConfiguration();
|
||||
logger.info("context.getInfrastructureName(): "+context.getInfrastructureName());
|
||||
logger.info("aslSession.getGroupName(): "+ aslSession.getGroupName());
|
||||
logger.info("aslSession.getScope().toString(): "+ aslSession.getScope());
|
||||
try{
|
||||
ScopeUtility scopeUtility = new ScopeUtility(aslSession.getGroupName());
|
||||
ScopeUtility scopeUtility = new ScopeUtility(aslSession.getScope());
|
||||
|
||||
if(scopeUtility.getVo()!=null){
|
||||
logger.info("VO is not null, trying to calculate List VO");
|
||||
List<VO> lsVOs = WsUtil.getVresFromInfrastructure(context.getInfrastructureName(), aslSession.getGroupName());
|
||||
String vrePath = ConstantsSharing.PATH_SEPARATOR+context.getInfrastructureName() + ConstantsSharing.PATH_SEPARATOR + aslSession.getGroupName() + ConstantsSharing.PATH_SEPARATOR;
|
||||
listContactsModel.addAll(builder.buildGXTListContactsModelFromVOs(lsVOs, vrePath));
|
||||
if(scopeUtility.getVoName()!=null){
|
||||
logger.info("VO name is not null, trying to calculate List VO");
|
||||
List<VO> lsVOs = WsUtil.getVresFromInfrastructure(context.getInfrastructureName(), scopeUtility.getVoName());
|
||||
// String voPath = ConstantsSharing.PATH_SEPARATOR+context.getInfrastructureName() + ConstantsSharing.PATH_SEPARATOR + aslSession.getGroupName() + ConstantsSharing.PATH_SEPARATOR;
|
||||
listContactsModel.addAll(builder.buildGXTListContactsModelFromVOs(lsVOs, scopeUtility.getVo()));
|
||||
}else
|
||||
logger.warn("VO name is null, skipping list VO "+ aslSession.getGroupName());
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@ public class ScopeUtility {
|
|||
private String root;
|
||||
private String vo;
|
||||
private String vre;
|
||||
|
||||
private String rootName;
|
||||
private String voName;
|
||||
private String vreName;
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(ScopeUtility.class);
|
||||
|
||||
|
||||
|
@ -45,17 +50,23 @@ public class ScopeUtility {
|
|||
try{
|
||||
logger.info("splitted scopes legth is "+scopes.length);
|
||||
root = SCOPE_SEPARATOR+scopes[startIndex];
|
||||
rootName = scopes[startIndex];
|
||||
|
||||
logger.info("root is "+root);
|
||||
|
||||
int voIndex = startIndex+1;
|
||||
// logger.info("vo index is "+voIndex);
|
||||
if(scopes.length > voIndex)
|
||||
if(scopes.length > voIndex){
|
||||
vo = root+SCOPE_SEPARATOR+scopes[voIndex];
|
||||
voName = scopes[voIndex];
|
||||
}
|
||||
|
||||
int vreIndex = startIndex+2;
|
||||
// logger.info("vre index is "+vreIndex);
|
||||
if(scopes.length > vreIndex)
|
||||
if(scopes.length > vreIndex){
|
||||
vre = vo + SCOPE_SEPARATOR + scopes[vreIndex];
|
||||
vreName = scopes[vreIndex];
|
||||
}
|
||||
|
||||
logger.info("vo is "+vo);
|
||||
logger.info("vre is "+vre);
|
||||
|
@ -81,6 +92,17 @@ public class ScopeUtility {
|
|||
return vre;
|
||||
}
|
||||
|
||||
public String getRootName() {
|
||||
return rootName;
|
||||
}
|
||||
|
||||
public String getVoName() {
|
||||
return voName;
|
||||
}
|
||||
|
||||
public String getVreName() {
|
||||
return vreName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -91,16 +113,24 @@ public class ScopeUtility {
|
|||
builder.append(vo);
|
||||
builder.append(", vre=");
|
||||
builder.append(vre);
|
||||
builder.append(", rootName=");
|
||||
builder.append(rootName);
|
||||
builder.append(", voName=");
|
||||
builder.append(voName);
|
||||
builder.append(", vreName=");
|
||||
builder.append(vreName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String scope = "/gcube/devsec/devNEXT";
|
||||
String scope = "/gcube/devsec";
|
||||
|
||||
try {
|
||||
ScopeUtility filter = new ScopeUtility(scope);
|
||||
System.out.println(filter);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue