Author: julien_viet
Date: 2010-02-11 11:38:15 -0500 (Thu, 11 Feb 2010)
New Revision: 1644
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
Log:
GTNPORTAL-628 : Filter "makable" navigation with the existing group sites as
some group may not have an associated site or navigation
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2010-02-11
16:37:02 UTC (rev 1643)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2010-02-11
16:38:15 UTC (rev 1644)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.config;
+import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentPlugin;
@@ -176,8 +177,7 @@
*/
public List<String> getMakableNavigations(String remoteUser) throws Exception
{
- List<String> list = new ArrayList<String>();
- Collection<?> groups = null;
+ Collection<Group> groups;
if (remoteUser.equals(userACL_.getSuperUser()))
{
groups = orgService_.getGroupHandler().getAllGroups();
@@ -186,15 +186,31 @@
{
groups = orgService_.getGroupHandler().findGroupByMembership(remoteUser,
userACL_.getMakableMT());
}
+
+ //
+ List<String> list = new ArrayList<String>();
if (groups != null)
{
- for (Object group : groups)
+ Query<PortalConfig> q = new Query<PortalConfig>("group",
null, PortalConfig.class);
+ LazyPageList<PortalConfig> lpl = storage_.find(q);
+ Set<String> existingNames = new HashSet<String>();
+ for (PortalConfig groupSite : lpl.getAll())
{
- Group m = (Group)group;
- String groupId = m.getId().trim();
- list.add(groupId);
+ existingNames.add(groupSite.getName());
}
+
+ //
+ for (Group group : groups)
+ {
+ String groupId = group.getId().trim();
+ if (existingNames.contains(groupId))
+ {
+ list.add(groupId);
+ }
+ }
}
+
+ //
return list;
}
Show replies by date