Massimiliano Assante 11 years ago
parent ae511ccb07
commit 95968f729d

@ -101,25 +101,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>

@ -95,59 +95,9 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
if (currOrg.getComments() != null)
desc = currOrg.getComments();
VREClient vre = new VREClient(name, "", desc, logoURL, "", UserBelongingClient.BELONGING);
setVREBelonginApplication(vre);
return vre;
}
/**
* recursive method which list the portlets belonging to the current VO/VRE whole layout
*
* @param layouts
* @param themeDisplay
* @param belongingPortletNames
* @throws SystemException
*/
private void findLayoutPortlets(List<Layout> layouts, ThemeDisplay themeDisplay, List<String> belongingPortletNames ) throws SystemException {
if (layouts == null)
return;
for (Layout curLayout : layouts) {
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)curLayout.getLayoutType();
List<String> actualPortletList = layoutTypePortlet.getPortletIds();
for (String portletID : actualPortletList) {
String pname = LanguageUtil.get(themeDisplay.getLocale(), portletID);
//adding the portlet name cutting the not need part e.g. WorkspacePortlet_WAR_WorkspacePortlet
if (pname.indexOf("WAR") > 0) {
pname = pname.substring(0, pname.indexOf("WAR")-1);
}
belongingPortletNames.add(pname);
}
findLayoutPortlets(curLayout.getChildren(), themeDisplay, belongingPortletNames);
}
}
/**
* TODO: Look which portlets are in the current VRE layout and create a List of names with them
* @param vre
*/
private void setVREBelonginApplication(VREClient vre) {
List<String> belongingPortletNames = new ArrayList<String>();
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
_log.debug("Reading Layouts...");
List<Layout> layouts = themeDisplay.getLayouts();
try {
findLayoutPortlets(layouts, themeDisplay, belongingPortletNames);
} catch (SystemException e) {
e.printStackTrace();
}
Collections.sort(belongingPortletNames);
_log.debug("AvailablePortlets STORE IN SESSION \n" + belongingPortletNames.toString());
getASLSession().setAttribute("availablePortlets", belongingPortletNames);
}
/**
* The Default Community is a community where all portal user belong to
* @return the default community URL

Loading…
Cancel
Save