diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/util/GroupNameUtilSeparator.java b/src/main/java/org/gcube/portlets/user/workspace/client/util/GroupNameUtilSeparator.java new file mode 100644 index 0000000..16f7794 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/util/GroupNameUtilSeparator.java @@ -0,0 +1,91 @@ +package org.gcube.portlets.user.workspace.client.util; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * @May 8, 2014 + * + */ +public class GroupNameUtilSeparator { + + private String stringSeparator = "/"; + + + /** + * + * @param separator - the string separator + */ + public GroupNameUtilSeparator(String separator) { + + if(separator!=null && !separator.isEmpty()) + this.stringSeparator = separator; + } + + /** + * Return Either subsequence of name from separatorStartIndex (including separator) to end, + * or name passed in input if split.length < separatorStartIndex + * @see main + * + * + * @param name + * @param separatorStartIndex - start index must be 1 + * @return + * @throws Exception + */ + public String getSubsequenceName(String name, int separatorStartIndex) throws Exception{ + + if(separatorStartIndex<1) + throw new Exception("Invalid start separator index: "+separatorStartIndex); + + if(name==null) + throw new Exception("Invalid name: "+name); + + String[] split = name.split(stringSeparator); + + + /*for (String sp : split) { + System.out.println("split: "+sp); + }*/ + + + if(split==null || split.length==0) + return ""; + + + String displayName =""; + + if(split.length>separatorStartIndex){ + + for (int i = separatorStartIndex; i < split.length; i++) { + displayName+= stringSeparator+split[i]; + } + + }else + displayName = name; + + return displayName; + } + + + /** + * + * @param args + */ + public static void main(String[] args) { + + GroupNameUtilSeparator filter = new GroupNameUtilSeparator("/"); + + String name = "/gcube/devsec/devVRE"; + + try { + String displayedName = filter.getSubsequenceName(name, 2); + System.out.println("display name: "+displayedName); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java index 8c72dbb..12f70ab 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java @@ -135,6 +135,8 @@ public class GWTWorkspaceBuilder { if(hashTestUser==null){ hashTestUser = new HashMap(); + + //USERS hashTestUser.put("federico.defaveri", new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri",false)); hashTestUser.put("antonio.gioia", new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia",false)); hashTestUser.put("fabio.sinibaldi", new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",false)); @@ -144,8 +146,10 @@ public class GWTWorkspaceBuilder { hashTestUser.put(WsUtil.TEST_USER.toString(), new InfoContactModel(WsUtil.TEST_USER, WsUtil.TEST_USER, WsUtil.TEST_USER_FULL_NAME,false)); hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",false)); hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",false)); - hashTestUser.put("gcube-test-test", new InfoContactModel("gcube-test-test", "gcube-test-test", "gcube-test-test",true)); - + + //GROUPS + hashTestUser.put("/gcube/devsec/devVRE", new InfoContactModel("/gcube/devsec/devVRE", "/gcube/devsec/devVRE", "",true)); + hashTestUser.put("/gcube/devsec/gcube-test-test", new InfoContactModel("/gcube/devsec/gcube-test-test", "/gcube/gcube-test-test", "",true)); } return hashTestUser; @@ -805,14 +809,10 @@ public class GWTWorkspaceBuilder { FolderModel root = new FolderModel(workspaceRoot.getId(),workspaceRoot.getName(),null, true, workspaceRoot.isShared(), false); root.setIsRoot(true); // root.setShareable(true); - // root.setOwner(new InfoContactModel(workspaceRoot.getOwner().getId(), workspaceRoot.getOwner().getPortalLogin(), "name")); // root.setShared(workspaceRoot.isShared()); // root.setMarkAsRead(workspaceRoot.isMarkedAsRead()); - - - return root; } @@ -1686,7 +1686,7 @@ public class GWTWorkspaceBuilder { if(fullName!=null && !fullName.isEmpty()) listContactsModel.add(new InfoContactModel(userModel.getUserId()+"", userModel.getScreenName(), fullName, false)); else - logger.trace("buildGXTListContactsModel doesn't return user: "+userModel.getScreenName()+ "because name is null or empty"); + logger.trace("buildGXTListContactsModel is not returning user: "+userModel.getScreenName()+ "because name is null or empty"); } logger.trace("List contact model completed, return " +listContactsModel.size()+" contacts"); diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java index 850dbbe..47ac3d7 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java @@ -6,6 +6,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -1394,14 +1395,20 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT workspaceLogger.warn("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS"); List listContactsModel = new ArrayList(); -// //TEST USERS - listContactsModel.add(new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri", false)); - listContactsModel.add(new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia",false)); - listContactsModel.add(new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",false)); - listContactsModel.add(new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",false)); - listContactsModel.add(new InfoContactModel(WsUtil.TEST_USER, WsUtil.TEST_USER, WsUtil.TEST_USER_FULL_NAME,false)); - listContactsModel.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",false)); - listContactsModel.add(new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",false)); + HashMap hashFakeUsers = GWTWorkspaceBuilder.getHashTestUsers(); + for (String login : hashFakeUsers.keySet()) { + + InfoContactModel contact = hashFakeUsers.get(login); + listContactsModel.add(contact); + + } +// //TEST USERS +// listContactsModel.add(new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia",false)); +// listContactsModel.add(new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",false)); +// listContactsModel.add(new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",false)); +// listContactsModel.add(new InfoContactModel(WsUtil.TEST_USER, WsUtil.TEST_USER, WsUtil.TEST_USER_FULL_NAME,false)); +// listContactsModel.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",false)); +// listContactsModel.add(new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",false)); workspaceLogger.trace("Home Library User Manager getting list Gcube Group"); listContactsModel.addAll(builder.buildGXTListContactsModelFromGcubeGroup(hlUserManager.getGroups())); diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java b/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java index b60b129..d8b35b4 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java @@ -90,7 +90,7 @@ public class NotificationsProducer { } }catch (Exception e) { logger.error("An error occured in notifyFolderSharing ", e); - e.printStackTrace(); +// e.printStackTrace(); } } @@ -147,7 +147,7 @@ public class NotificationsProducer { } }catch (Exception e) { logger.error("An error occured in notifyFolderRenamed ", e); - e.printStackTrace(); +// e.printStackTrace(); } } @@ -191,7 +191,7 @@ public class NotificationsProducer { } }catch (Exception e) { logger.error("An error occured in notifyItemUpdated ", e); - e.printStackTrace(); +// e.printStackTrace(); } } @@ -245,7 +245,7 @@ public class NotificationsProducer { }catch (Exception e) { logger.error("An error occured in notifyFolderAddedUser ", e); - e.printStackTrace(); +// e.printStackTrace(); } } @@ -273,7 +273,7 @@ public class NotificationsProducer { }catch (Exception e) { logger.error("An error occured in notifyFolderAddedUser ", e); - e.printStackTrace(); +// e.printStackTrace(); } } @@ -286,7 +286,7 @@ public class NotificationsProducer { }catch (Exception e) { logger.error("An error occured in notifyAddedUserToSharing ", e); - e.printStackTrace(); +// e.printStackTrace(); } } @@ -319,7 +319,7 @@ public class NotificationsProducer { logger.trace("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName()); //DEBUG - System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName()); +// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName()); boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), unSharedFolder); @@ -328,7 +328,7 @@ public class NotificationsProducer { } }catch (Exception e) { logger.error("An error occured in notifyFolderUnSharing ", e); - e.printStackTrace(); +// e.printStackTrace(); } } @@ -377,19 +377,19 @@ public class NotificationsProducer { if(!notify){ logger.error("An error occured when notify user: "+infoContactModel.getLogin()); //DEBUG - System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); +// System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); } } }catch (Exception e) { logger.error("An error occured in notifyAddedItemToSharing ", e); - e.printStackTrace(); +// e.printStackTrace(); } } logger.trace("notifies of added item in shared folder is completed"); //DEBUG - System.out.println("notifies of added item in shared folder is completed"); +// System.out.println("notifies of added item in shared folder is completed"); } }.start(); @@ -411,7 +411,7 @@ public class NotificationsProducer { logger.trace("Send notifies updated item in shared folder is running..."); //DEBUG - System.out.println("Send notifies updated item in shared folder is running..."); +// System.out.println("Send notifies updated item in shared folder is running..."); for (InfoContactModel infoContactModel : listContacts) { try{ @@ -422,7 +422,7 @@ public class NotificationsProducer { logger.trace("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); //DEBUG - System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); +// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); //DEBUG // System.out.println("Send notify folder un share user "+infoContactModel.getLogin()); @@ -432,7 +432,7 @@ public class NotificationsProducer { if(!notify){ logger.error("An error updated when notify user: "+infoContactModel.getLogin()); //DEBUG - System.out.println("An error updated when notify user: "+infoContactModel.getLogin()); +// System.out.println("An error updated when notify user: "+infoContactModel.getLogin()); } } }catch (Exception e) { @@ -444,7 +444,7 @@ public class NotificationsProducer { logger.trace("notifies of updated item in shared folder is completed"); //DEBUG - System.out.println("notifies of updated item in shared folder is completed"); +// System.out.println("notifies of updated item in shared folder is completed"); } }.start(); @@ -483,7 +483,7 @@ public class NotificationsProducer { logger.trace("Sending notification moved item in shared folder is running..."); - System.out.println("Sending notification moved item in shared folder is running..."); +// System.out.println("Sending notification moved item in shared folder is running..."); for (InfoContactModel infoContactModel : listContacts) { try{ @@ -494,7 +494,7 @@ public class NotificationsProducer { logger.trace("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); //DEBUG - System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); +// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName()); boolean notify = notificationsMng.notifyMovedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder); @@ -502,7 +502,7 @@ public class NotificationsProducer { logger.error("An error occured when notify user: "+infoContactModel.getLogin()); //DEBUG - System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); +// System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); } } }catch (Exception e) { @@ -514,7 +514,7 @@ public class NotificationsProducer { logger.trace("notifies of moved item in shared folder is completed"); //DEBUG - System.out.println("notifies of moved item in shared folder is completed"); +// System.out.println("notifies of moved item in shared folder is completed"); } @@ -550,7 +550,7 @@ public class NotificationsProducer { logger.trace("Sending notification removed item in shared folder is running..."); - System.out.println("Sending notification removed item in shared folder is running..."); +// System.out.println("Sending notification removed item in shared folder is running..."); for (InfoContactModel infoContactModel : listContacts) { try{ @@ -561,38 +561,78 @@ public class NotificationsProducer { logger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName()); //DEBUG - System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName()); +// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName()); - - boolean notify = notificationsMng.notifyRemovedItem(infoContactModel.getLogin(), itemName, sharedFolder); - if(!notify){ logger.error("An error occured when notify user: "+infoContactModel.getLogin()); //DEBUG - System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); +// System.out.println("An error occured when notify user: "+infoContactModel.getLogin()); } } }catch (Exception e) { logger.error("An error occurred in notifyRemovedItemToSharing ", e); - e.printStackTrace(); +// e.printStackTrace(); } } logger.trace("notifies of moved item in shared folder is completed"); //DEBUG - System.out.println("notifies of moved item in shared folder is completed"); +// System.out.println("notifies of moved item in shared folder is completed"); } - - - }.start(); } + /** + * Runs a new thread to notify the contacts passed in input + * @param listContacts + * @param unSharedFolder + */ + public void notifySharedFolderDeleted(final List listContacts, final String folderNameDeleted) { + + + new Thread() { + @Override + public void run() { + +// printContacts(listContacts); + logger.trace("Send notifies shared folder deleted is running..."); + + for (InfoContactModel infoContactModel : listContacts) { + try{ + + //NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER + if(infoContactModel.getLogin().compareTo(userId)!=0){ + + logger.trace("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted); + + //DEBUG + System.out.println("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted); + + //TODO +// boolean notify = notificationsMng. + +// if(!notify) +// logger.error("An error occured when notifies user: "+infoContactModel.getLogin()); + } + }catch (Exception e) { + logger.error("An error occured in notifySharedFolderDeleted ", e); +// e.printStackTrace(); + } + } + + logger.trace("notifies of deleted shared foder is completed"); + } + + }.start(); + + } + + //DEBUG private void printContacts(List listContacts){ diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsUtil.java b/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsUtil.java index a448a8e..467e989 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsUtil.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsUtil.java @@ -161,22 +161,22 @@ public class NotificationsUtil { boolean isRootFolderShared = checkIsRootFolderShared(oldItemId, idSharedFolder); logger.trace("isRootFolderShared is: "+ isRootFolderShared); + + /* if(isRootFolderShared){ - logger.trace("Notification doesn't send because the event is on root shared folder"); + logger.trace("Notification doesn't sent because the event is on root shared folder"); return; - } + }*/ boolean isSharedFolder = isASharedFolderForId(httpSession,idSharedFolder); - logger.trace("idSharedFolder is: "+ idSharedFolder +" is shared folder: "+isSharedFolder); - - - //Notify Removed Item To Sharing? - if(isSharedFolder && !isRootFolderShared){ - + if(isSharedFolder){ + + logger.trace("idSharedFolder is: "+ idSharedFolder +" is shared folder: "+isSharedFolder); + Workspace workspace = WsUtil.getWorkspace(httpSession); - + //get contacts List listContacts = getListUserSharedByFolderSharedId(workspace, idSharedFolder); @@ -186,10 +186,14 @@ public class NotificationsUtil { NotificationsProducer np = new NotificationsProducer(WsUtil.getAslSession(httpSession)); - np.notifyRemovedItemToSharing(listContacts, oldItemName, (WorkspaceFolder) sourceSharedFolder); - - logger.trace("The notifies was sent correctly"); - + //Notify Removed Item To Sharing? + if(!isRootFolderShared){ + np.notifyRemovedItemToSharing(listContacts, oldItemName, (WorkspaceFolder) sourceSharedFolder); + logger.trace("The notifies was sent correctly"); + }else{ + //Case removed shared folder + np.notifySharedFolderDeleted(listContacts, oldItemName); + } } }catch (Exception e) { diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/resolver/UriResolverReaderParameter.java b/src/main/java/org/gcube/portlets/user/workspace/server/resolver/UriResolverReaderParameter.java index f9beb1d..547c690 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/resolver/UriResolverReaderParameter.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/resolver/UriResolverReaderParameter.java @@ -56,7 +56,7 @@ public class UriResolverReaderParameter { logger.trace("UriResolverReaderParameter is istancing with scope: "+scope); - ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope); + ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope,true); ScopeProvider.instance.set(scopeUtil.getScopeRoot()); diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/shortener/UrlShortener.java b/src/main/java/org/gcube/portlets/user/workspace/server/shortener/UrlShortener.java index ab65292..fb83e08 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/shortener/UrlShortener.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/shortener/UrlShortener.java @@ -64,7 +64,7 @@ public final class UrlShortener { try{ logger.trace("Tentative reading HTTP-URL-Shortener RR"); - ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope); + ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope,true); ScopeProvider.instance.set(scopeUtil.getScopeRoot()); diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java index 4881a94..4f5290a 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java @@ -49,18 +49,21 @@ public class WsUtil { public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER"; public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV -// public static final String TEST_SCOPE = "/gcube/devsec"; -// public static final String TEST_USER = "pasquale.pagano"; - public static final String TEST_SCOPE = "/gcube/devsec"; + +// public static final String TEST_USER = "pasquale.pagano"; // public static final String TEST_USER = "federico.defaveri"; // public static final String TEST_USER = "massimiliano.assante"; // public static final String TEST_USER = "pasquale.pagano"; +// public static final String TEST_USER = "aureliano.gentile"; +// public static final String TEST_USER = "antonio.gioia"; + + //COMMENT THIS FOR RELEASE // public static final String TEST_USER = "francesco.mangiacrapa"; // public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa"; -// public static final String TEST_USER = "aureliano.gentile"; + + //UNCOMMENT THIS FOR RELEASE public static final String TEST_USER = "test.user"; -// public static final String TEST_USER = "antonio.gioia"; public static final String TEST_USER_FULL_NAME = "Test User"; @@ -303,7 +306,7 @@ public class WsUtil { scopeUtil = (ScopeUtilFilter) session.getAttribute(WsUtil.WORKSPACE_SCOPE_UTIL); if(scopeUtil==null){ - scopeUtil = new ScopeUtilFilter(session.getScopeName()); + scopeUtil = new ScopeUtilFilter(session.getScopeName(),true); } }catch (Exception e) { diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/scope/ScopeUtilFilter.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/scope/ScopeUtilFilter.java index ced5246..7a1331a 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/util/scope/ScopeUtilFilter.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/scope/ScopeUtilFilter.java @@ -19,7 +19,12 @@ public class ScopeUtilFilter { public static final String ALLSCOPE = "All spaces"; public static final String IDALLSCOPE = "ID All spaces"; - public ScopeUtilFilter(String scopeName) { + /** + * + * @param scopeName + * @param addIdAllSpaces if true add "ID All spaces" - "All spaces" pair into map + */ + public ScopeUtilFilter(String scopeName, boolean addIdAllSpaces) { if(scopeName!=null){ String[] scopes = scopeName.split(SCOPE_SEPARATOR); @@ -33,7 +38,8 @@ public class ScopeUtilFilter { scopeRoot = SCOPE_SEPARATOR; } - hashScopesFiltered.put(ALLSCOPE, IDALLSCOPE); //PUT DEFAULT ID ALL SCOPE + if(addIdAllSpaces) + hashScopesFiltered.put(ALLSCOPE, IDALLSCOPE); //PUT DEFAULT ID ALL SCOPE } } @@ -138,14 +144,14 @@ public class ScopeUtilFilter { List listTest = Arrays.asList(new String[]{"/gcube/devsec/devre", "/gcube/devsec","/gcube/devsec/devNEXT", "/", "/gcub", "/gcube"}); - ScopeUtilFilter filter = new ScopeUtilFilter(scope); + ScopeUtilFilter filter = new ScopeUtilFilter(scope, false); System.out.println("scope root is: "+filter.getScopeRoot()); filter.convertListScopeToPortlet(listTest); - System.out.println("get portal scope "+filter.getPortalScopeFromFilteredScope("/devsec")); + System.out.println("get portal scope for /devsec: "+filter.getPortalScopeFromFilteredScope("/devsec")); filter.printScopes();