gatein SVN: r6891 - components/wsrp/tags.
by do-not-reply@jboss.org
Author: theute
Date: 2011-07-20 05:19:08 -0400 (Wed, 20 Jul 2011)
New Revision: 6891
Added:
components/wsrp/tags/2.0.1-GA/
Log:
[maven-scm] copy for tag 2.0.1-GA
13 years, 5 months
gatein SVN: r6890 - in components/wsrp/branches/2.0.x: admin-gui and 9 other directories.
by do-not-reply@jboss.org
Author: theute
Date: 2011-07-20 05:18:39 -0400 (Wed, 20 Jul 2011)
New Revision: 6890
Modified:
components/wsrp/branches/2.0.x/admin-gui/pom.xml
components/wsrp/branches/2.0.x/api/pom.xml
components/wsrp/branches/2.0.x/common/pom.xml
components/wsrp/branches/2.0.x/consumer/pom.xml
components/wsrp/branches/2.0.x/hibernate-impl/pom.xml
components/wsrp/branches/2.0.x/pom.xml
components/wsrp/branches/2.0.x/producer/pom.xml
components/wsrp/branches/2.0.x/test/pom.xml
components/wsrp/branches/2.0.x/wsrp-producer-war/pom.xml
components/wsrp/branches/2.0.x/wsrp1-ws/pom.xml
components/wsrp/branches/2.0.x/wsrp2-ws/pom.xml
Log:
[maven-release-plugin] prepare release 2.0.1-GA
Modified: components/wsrp/branches/2.0.x/admin-gui/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/admin-gui/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/admin-gui/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-admin-gui</artifactId>
Modified: components/wsrp/branches/2.0.x/api/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/api/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/api/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-integration-api</artifactId>
Modified: components/wsrp/branches/2.0.x/common/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/common/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/common/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-common</artifactId>
Modified: components/wsrp/branches/2.0.x/consumer/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/consumer/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/consumer/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-consumer</artifactId>
Modified: components/wsrp/branches/2.0.x/hibernate-impl/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/hibernate-impl/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/hibernate-impl/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -28,7 +28,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<groupId>org.gatein.wsrp</groupId>
Modified: components/wsrp/branches/2.0.x/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -29,7 +29,7 @@
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
<packaging>pom</packaging>
@@ -40,10 +40,10 @@
</parent>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/branches/2....</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/branches/2.0.x/
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/tags/2.0.1-GA</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/tags/2.0.1-GA
</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/branches/2.0.x/</url>
+ <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/tags/2.0.1-GA</url>
</scm>
<properties>
Modified: components/wsrp/branches/2.0.x/producer/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/producer/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/producer/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-producer-lib</artifactId>
Modified: components/wsrp/branches/2.0.x/test/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/test/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/test/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: components/wsrp/branches/2.0.x/wsrp-producer-war/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/wsrp-producer-war/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/wsrp-producer-war/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: components/wsrp/branches/2.0.x/wsrp1-ws/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/wsrp1-ws/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/wsrp1-ws/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-wsrp1-ws</artifactId>
Modified: components/wsrp/branches/2.0.x/wsrp2-ws/pom.xml
===================================================================
--- components/wsrp/branches/2.0.x/wsrp2-ws/pom.xml 2011-07-19 21:08:02 UTC (rev 6889)
+++ components/wsrp/branches/2.0.x/wsrp2-ws/pom.xml 2011-07-20 09:18:39 UTC (rev 6890)
@@ -26,7 +26,7 @@
<parent>
<artifactId>wsrp-parent</artifactId>
<groupId>org.gatein.wsrp</groupId>
- <version>2.0.1-GA-SNAPSHOT</version>
+ <version>2.0.1-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-wsrp2-ws</artifactId>
13 years, 5 months
gatein SVN: r6889 - in portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl: portal and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-07-19 17:08:02 -0400 (Tue, 19 Jul 2011)
New Revision: 6889
Added:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PageImpl.java
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
Log:
- First implementation of Group sites: fixed some issues with Contexts for Ids.
- Added Page implementation and support for Page retrieval from Navigation and GateIn.
- Added NavigationImpl.loadChildrenIfNeeded to progressively load layers of chilren when needed.
- Improved NavigationImpl.toString method.
Modified: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-19 19:06:54 UTC (rev 6888)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-19 21:08:02 UTC (rev 6889)
@@ -33,8 +33,11 @@
import org.exoplatform.portal.pom.data.DashboardData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.data.PageData;
+import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
+import org.exoplatform.services.organization.Group;
+import org.exoplatform.services.organization.OrganizationService;
import org.gatein.api.GateIn;
import org.gatein.api.content.Application;
import org.gatein.api.content.Content;
@@ -48,12 +51,18 @@
import org.gatein.api.portal.Site;
import org.gatein.api.util.IterableResult;
import org.gatein.api.util.ParameterValidation;
+import org.gatein.portal.api.impl.portal.GroupSiteImpl;
+import org.gatein.portal.api.impl.portal.PageImpl;
import org.gatein.portal.api.impl.portal.PortalImpl;
import org.gatein.portal.api.impl.util.AdaptedIterableResult;
import org.picocontainer.Startable;
import java.net.URI;
+import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
import java.util.regex.Pattern;
/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
@@ -62,13 +71,18 @@
private static final Query<PortalData> PORTALS = new Query<PortalData>(SiteType.PORTAL.getName(), null, PortalData.class);
private static final Query<DashboardData> DASHBOARDS = new Query<DashboardData>(SiteType.USER.getName(), null, DashboardData.class);
private static final Query<PageData> GROUPS = new Query<PageData>(SiteType.GROUP.getName(), null, PageData.class);
- public static final Context CONTEXT = Context.builder().requiredComponent("owner", Site.class, Pattern.compile("\\w+"))
- .requiredComponent("portal", Portal.class, Pattern.compile("\\w+"))
+ private static final String GROUP_CHARS = "\\w|-|_";
+ public static final Context CONTEXT = Context.builder()
+ .requiredComponent("owner", Site.class, Pattern.compile(Site.Type.PORTAL_NAME + "|" + Site.Type.GROUP_NAME + "|" + Site.Type.DASHBOARD_NAME))
+ .requiredComponent("portal", Portal.class, Pattern.compile("(" + GROUP_CHARS + "|\\/)+"))
.optionalComponent("page", Page.class, Pattern.compile("\\w+"))
.withDefaultSeparator("::").build();
+ public static final Context GROUP_CONTEXT = Context.builder().requiredUnboundedHierarchicalComponent("group", Identifiable.class, Pattern.compile("(" + GROUP_CHARS + ")+"))
+ .withDefaultSeparator("/").requireSeparatorInFirstPosition().build();
private ExoContainer container;
private ModelDataStorage dataStorage;
private NavigationService navigationService;
+ private OrganizationService organizationService;
public GateInImpl(ExoContainerContext context, InitParams params, ConfigurationManager configurationManager)
{
@@ -128,12 +142,47 @@
public IterableResult<Site> getGroupSites()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ try
+ {
+ Collection groups = organizationService.getGroupHandler().getAllGroups(); // todo: a method that would just retrieve the group names would be a lot better for performance...
+ final SortedMap<Id<Site>, Site> groupSites = new TreeMap<Id<Site>, Site>();
+ for (Object o : groups)
+ {
+ Group group = (Group)o;
+ Site site = getGroupSite(Id.parse(GROUP_CONTEXT, group.getId()));
+ groupSites.put(site.getId(), site);
+ }
+
+ return new IterableResult<Site>()
+ {
+ public int size()
+ {
+ return groupSites.size();
+ }
+
+ public boolean contains(Id<Site> siteId)
+ {
+ return groupSites.containsKey(siteId);
+ }
+
+ public Iterator<Site> iterator()
+ {
+ return groupSites.values().iterator();
+ }
+ };
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
}
public Site getGroupSite(Id groupId)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ String groupName = groupId.toString();
+ Id<Site> siteId = siteId(Site.Type.GROUP, groupName);
+
+ return new GroupSiteImpl(siteId, groupName, this);
}
public IterableResult<Site> getGroupSites(Id userId)
@@ -163,6 +212,23 @@
{
result = getPortal((Id<Portal>)id);
}
+ else if (Page.class.getCanonicalName().equals(canonicalName))
+ {
+ try
+ {
+ begin();
+ PageData pageData = dataStorage.getPage(PageKey.create(id.toString()));
+ result = new PageImpl(pageData, id.getParent(), this);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ end();
+ }
+ }
else
{
throw new UnsupportedOperationException("Id<" + type.getSimpleName() + "> not yet supported");
@@ -211,15 +277,22 @@
return null; //To change body of implemented methods use File | Settings | File Templates.
}
- public <T extends Site> Id<T> siteId(Site.Type<T> siteType, String portalName)
+ public <T extends Site> Id<T> siteId(Site.Type<T> siteType, String siteName)
{
- return Id.create(CONTEXT, siteType.getValueType(), siteType.getName(), portalName);
+ return Id.create(CONTEXT, siteType.getValueType(), siteType.getName(), siteName);
}
+ public <T extends Site> Id<Page> pageId(Id<T> ownerSite, String pageName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(ownerSite, "Owner Site Id");
+ return ownerSite.getIdforChild(pageName);
+ }
+
public void start()
{
dataStorage = (ModelDataStorage)container.getComponentInstanceOfType(ModelDataStorage.class);
navigationService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
+ organizationService = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
}
public void stop()
Modified: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-07-19 19:06:54 UTC (rev 6888)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-07-19 21:08:02 UTC (rev 6889)
@@ -22,9 +22,11 @@
package org.gatein.portal.api.impl.portal;
+import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.mop.navigation.NodeContext;
import org.exoplatform.portal.mop.navigation.NodeModel;
import org.exoplatform.portal.mop.navigation.NodeState;
+import org.exoplatform.portal.mop.navigation.Scope;
import org.gatein.api.GateIn;
import org.gatein.api.id.Context;
import org.gatein.api.id.Id;
@@ -61,13 +63,27 @@
@Override
public String toString()
{
- String s = "Navigation@" + getId() + " target:" + context.getState().getPageRef() + "\nchildren:\n";
- Iterator<NavigationImpl> children = context.iterator();
- while (children.hasNext())
+ String pageRef = context.getState().getPageRef();
+ StringBuilder s = new StringBuilder("Navigation@").append(getId());
+
+ if (pageRef != null)
{
- s += " " + children.next() + "\n";
+ s.append("-target->").append(pageRef);
}
- return s;
+
+ if (size() != 0)
+ {
+ loadChildrenIfNeeded();
+ s.append("\n|");
+ Iterator<NavigationImpl> children = context.iterator();
+ while (children.hasNext())
+ {
+ s.append("\n+--").append(children.next());
+ }
+ s.append("\n");
+ }
+
+ return s.toString();
}
public NodeContext<NavigationImpl> getContext()
@@ -77,7 +93,15 @@
public Page getTargetPage()
{
- return null;
+ String pageRef = context.getState().getPageRef();
+ if (pageRef != null)
+ {
+ return gateIn.get(gateIn.pageId(site, pageRef));
+ }
+ else
+ {
+ return null;
+ }
}
public void setTargetPage(Page target)
@@ -97,6 +121,8 @@
public IterableResult<Navigation> getAll()
{
+ loadChildrenIfNeeded();
+
return new AdaptedIterableResult<NavigationImpl, Navigation>(size(), context.iterator())
{
public Navigation adapt(NavigationImpl old)
@@ -104,13 +130,30 @@
return old;
}
- public boolean contains(Id<Navigation> t)
+ public boolean contains(Id<Navigation> id)
{
- return context.get(t.toString()) != null;
+ return NavigationImpl.this.contains(id);
}
};
}
+ private void loadChildrenIfNeeded()
+ {
+ if (!context.isExpanded())
+ {
+ NavigationService service = gateIn.getNavigationService();
+ try
+ {
+ gateIn.begin();
+ service.rebaseNode(context, Scope.CHILDREN, null);
+ }
+ finally
+ {
+ gateIn.end();
+ }
+ }
+ }
+
public int size()
{
return context.getNodeSize();
@@ -118,17 +161,19 @@
public boolean contains(String key)
{
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return contains(getIdForChild(key));
}
public boolean contains(Id<Navigation> navigationId)
{
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ loadChildrenIfNeeded();
+
+ return context.get(navigationId.toString()) != null;
}
public Navigation createAndAdd(String key)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return createAndAdd(getIdForChild(key));
}
public Navigation createAndAdd(Id<Navigation> navigationId)
@@ -138,7 +183,7 @@
public Navigation get(String key)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return get(getIdForChild(key));
}
public Navigation get(Id<Navigation> navigationId)
@@ -148,7 +193,7 @@
public Id<Navigation> getIdForChild(String key)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return site.getIdforChild(key);
}
public <U extends Navigation> IterableResult<U> getAllWhere(Filter<U> filter)
Added: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PageImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PageImpl.java (rev 0)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PageImpl.java 2011-07-19 21:08:02 UTC (rev 6889)
@@ -0,0 +1,71 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.portal.api.impl.portal;
+
+import org.exoplatform.portal.pom.data.PageData;
+import org.gatein.api.id.Id;
+import org.gatein.api.portal.Navigation;
+import org.gatein.api.portal.Page;
+import org.gatein.api.portal.Site;
+import org.gatein.api.util.IterableResult;
+import org.gatein.portal.api.impl.GateInImpl;
+import org.gatein.portal.api.impl.IdentifiableImpl;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public class PageImpl extends IdentifiableImpl<Page> implements Page
+{
+ private final Id<? extends Site> site;
+ private String title;
+
+ public PageImpl(PageData pageData, Id<? extends Site> parent, GateInImpl gateIn)
+ {
+ super(gateIn.pageId(parent, pageData.getName()), pageData.getName(), gateIn);
+ this.site = parent;
+ this.title = pageData.getTitle();
+ }
+
+ public Site getSite()
+ {
+ return getGateIn().get(site);
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public IterableResult<Navigation> getInboundNavigations()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Navigation createInboundNavigationIn(Site site, Navigation parent)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Modified: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java 2011-07-19 19:06:54 UTC (rev 6888)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java 2011-07-19 21:08:02 UTC (rev 6889)
@@ -59,9 +59,16 @@
gateIn.begin();
NavigationContext navigation = service.loadNavigation(getSiteKey());
- NodeModel<NavigationImpl> nodeModel = new NavigationImpl.NavigationNodeModel(getId(), gateIn);
+ if (navigation != null)
+ {
+ NodeModel<NavigationImpl> nodeModel = new NavigationImpl.NavigationNodeModel(getId(), gateIn);
- return service.loadNode(nodeModel, navigation, Scope.CHILDREN, null).getNode();
+ return service.loadNode(nodeModel, navigation, Scope.CHILDREN, null).getNode();
+ }
+ else
+ {
+ return null;
+ }
}
finally
{
13 years, 5 months
gatein SVN: r6888 - portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-07-19 15:06:54 -0400 (Tue, 19 Jul 2011)
New Revision: 6888
Added:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java
Log:
- Extracted common behavior to SiteImpl class and added GroupSiteImpl and DashboardSiteImpl.
Added: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java (rev 0)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java 2011-07-19 19:06:54 UTC (rev 6888)
@@ -0,0 +1,48 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.portal.api.impl.portal;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.api.id.Id;
+import org.gatein.api.portal.Site;
+import org.gatein.portal.api.impl.GateInImpl;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public class DashboardSiteImpl extends SiteImpl
+{
+ public DashboardSiteImpl(Id<? extends Site> siteId, String name, GateInImpl gateIn)
+ {
+ super(siteId, name, gateIn);
+ }
+
+ @Override
+ protected SiteKey getSiteKey()
+ {
+ return SiteKey.user(getName());
+ }
+
+ public Type getType()
+ {
+ return Type.DASHBOARD;
+ }
+}
Added: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java (rev 0)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java 2011-07-19 19:06:54 UTC (rev 6888)
@@ -0,0 +1,48 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.portal.api.impl.portal;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.api.id.Id;
+import org.gatein.api.portal.Site;
+import org.gatein.portal.api.impl.GateInImpl;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public class GroupSiteImpl extends SiteImpl
+{
+ public GroupSiteImpl(Id<? extends Site> siteId, String name, GateInImpl gateIn)
+ {
+ super(siteId, name, gateIn);
+ }
+
+ @Override
+ protected SiteKey getSiteKey()
+ {
+ return SiteKey.group(getName());
+ }
+
+ public Type getType()
+ {
+ return Type.GROUP;
+ }
+}
Modified: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java 2011-07-19 12:19:04 UTC (rev 6887)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java 2011-07-19 19:06:54 UTC (rev 6888)
@@ -23,23 +23,14 @@
package org.gatein.portal.api.impl.portal;
import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.NavigationState;
-import org.exoplatform.portal.mop.navigation.NodeModel;
-import org.exoplatform.portal.mop.navigation.Scope;
import org.exoplatform.portal.pom.data.PortalData;
import org.gatein.api.content.ContentRegistry;
-import org.gatein.api.portal.Navigation;
-import org.gatein.api.portal.Page;
import org.gatein.api.portal.Portal;
import org.gatein.api.portal.Site;
-import org.gatein.api.util.Container;
import org.gatein.portal.api.impl.GateInImpl;
-import org.gatein.portal.api.impl.IdentifiableImpl;
/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
-public class PortalImpl extends IdentifiableImpl implements Portal
+public class PortalImpl extends SiteImpl implements Portal
{
public PortalImpl(PortalData portal, GateInImpl gateIn)
@@ -52,57 +43,13 @@
return null; //To change body of implemented methods use File | Settings | File Templates.
}
- public Container<String, Page> getPageRegistry()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public Navigation getNavigation()
- {
- GateInImpl gateIn = getGateInImpl();
- NavigationService service = gateIn.getNavigationService();
-
- try
- {
- gateIn.begin();
- NavigationContext navigation = service.loadNavigation(SiteKey.portal(getName()));
-
- NodeModel<NavigationImpl> nodeModel = new NavigationImpl.NavigationNodeModel(getId(), gateIn);
-
- return service.loadNode(nodeModel, navigation, Scope.CHILDREN, null).getNode();
- }
- finally
- {
- gateIn.end();
- }
- }
-
public Type getType()
{
return Type.PORTAL;
}
- public Navigation createNavigationTo(Page node, Navigation parent)
+ protected SiteKey getSiteKey()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return SiteKey.portal(getName());
}
-
- public int getPriority()
- {
- GateInImpl gateIn = getGateInImpl();
- NavigationService service = gateIn.getNavigationService();
-
- try
- {
- gateIn.begin();
- NavigationContext navigation = service.loadNavigation(SiteKey.portal(getName()));
-
- NavigationState state = navigation.getState();
- return state != null ? state.getPriority() : 1;
- }
- finally
- {
- gateIn.end();
- }
- }
}
Added: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java (rev 0)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java 2011-07-19 19:06:54 UTC (rev 6888)
@@ -0,0 +1,97 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.portal.api.impl.portal;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.gatein.api.id.Id;
+import org.gatein.api.portal.Navigation;
+import org.gatein.api.portal.Page;
+import org.gatein.api.portal.Site;
+import org.gatein.api.util.Container;
+import org.gatein.portal.api.impl.GateInImpl;
+import org.gatein.portal.api.impl.IdentifiableImpl;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public abstract class SiteImpl extends IdentifiableImpl implements Site
+{
+ public SiteImpl(Id<? extends Site> siteId, String name, GateInImpl gateIn)
+ {
+ super(siteId, name, gateIn);
+ }
+
+ public Container<String, Page> getPageRegistry()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Navigation getNavigation()
+ {
+ GateInImpl gateIn = getGateInImpl();
+ NavigationService service = gateIn.getNavigationService();
+
+ try
+ {
+ gateIn.begin();
+ NavigationContext navigation = service.loadNavigation(getSiteKey());
+
+ NodeModel<NavigationImpl> nodeModel = new NavigationImpl.NavigationNodeModel(getId(), gateIn);
+
+ return service.loadNode(nodeModel, navigation, Scope.CHILDREN, null).getNode();
+ }
+ finally
+ {
+ gateIn.end();
+ }
+ }
+
+ public int getPriority()
+ {
+ GateInImpl gateIn = getGateInImpl();
+ NavigationService service = gateIn.getNavigationService();
+
+ try
+ {
+ gateIn.begin();
+ NavigationContext navigation = service.loadNavigation(getSiteKey());
+
+ NavigationState state = navigation.getState();
+ return state != null ? state.getPriority() : 1;
+ }
+ finally
+ {
+ gateIn.end();
+ }
+ }
+
+ public Navigation createNavigationTo(Page node, Navigation parent)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ protected abstract SiteKey getSiteKey();
+}
13 years, 5 months
gatein SVN: r6887 - in epp/portal/branches/EPP_5_1_Branch: component and 85 other directories.
by do-not-reply@jboss.org
Author: hfnukal
Date: 2011-07-19 08:19:04 -0400 (Tue, 19 Jul 2011)
New Revision: 6887
Modified:
epp/portal/branches/EPP_5_1_Branch/component/application-registry/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/common/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/identity/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/management/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/pc/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/portal/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/resources/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/scripting/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/test/core/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/test/jcr/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/test/organization/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/test/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/web/api/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/web/controller/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/web/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/web/resources/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/web/security/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/web/server/pom.xml
epp/portal/branches/EPP_5_1_Branch/component/wsrp/pom.xml
epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/examples/pom.xml
epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/pom.xml
epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/portletbridge/pom.xml
epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/gatein.ear/pom.xml
epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/integration.war/pom.xml
epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/pom.xml
epp/portal/branches/EPP_5_1_Branch/distribution/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/extension/config/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/extension/ear/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/extension/jar/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/extension/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/extension/war/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portal/config/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portal/ear/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portal/jar/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portal/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portal/rest-war/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portal/war/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsfhellouser/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsphellouser/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/simplesthelloworld/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/skins/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/skins/simpleskin/pom.xml
epp/portal/branches/EPP_5_1_Branch/gadgets/core/pom.xml
epp/portal/branches/EPP_5_1_Branch/gadgets/eXoGadgets/pom.xml
epp/portal/branches/EPP_5_1_Branch/gadgets/pom.xml
epp/portal/branches/EPP_5_1_Branch/gadgets/server/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/ear/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/integration.war/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pkg/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/module/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/product/pom.xml
epp/portal/branches/EPP_5_1_Branch/packaging/reports/pom.xml
epp/portal/branches/EPP_5_1_Branch/pom.xml
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/pom.xml
epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/pom.xml
epp/portal/branches/EPP_5_1_Branch/portlet/pom.xml
epp/portal/branches/EPP_5_1_Branch/portlet/web/pom.xml
epp/portal/branches/EPP_5_1_Branch/server/jboss/patch-ear/pom.xml
epp/portal/branches/EPP_5_1_Branch/server/jboss/plugin/pom.xml
epp/portal/branches/EPP_5_1_Branch/server/jboss/pom.xml
epp/portal/branches/EPP_5_1_Branch/server/pom.xml
epp/portal/branches/EPP_5_1_Branch/starter/ear/pom.xml
epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml
epp/portal/branches/EPP_5_1_Branch/starter/pom.xml
epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml
epp/portal/branches/EPP_5_1_Branch/testsuite/pom.xml
epp/portal/branches/EPP_5_1_Branch/testsuite/selenium-snifftests/pom.xml
epp/portal/branches/EPP_5_1_Branch/testsuite/webuibasedsamples/pom.xml
epp/portal/branches/EPP_5_1_Branch/web/eXoResources/pom.xml
epp/portal/branches/EPP_5_1_Branch/web/pom.xml
epp/portal/branches/EPP_5_1_Branch/web/portal/pom.xml
epp/portal/branches/EPP_5_1_Branch/web/rest/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/core/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/dashboard/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/eXo/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/framework/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/portal/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/portlet/pom.xml
Log:
Version to 5.1.1-epp-CR01-SNAPSHOT
Modified: epp/portal/branches/EPP_5_1_Branch/component/application-registry/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/application-registry/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/application-registry/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/common/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/common/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/common/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>exo.portal.component.common</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/management/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/management/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/management/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/pc/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/pc/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/pc/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.component</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/component/portal/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/resources/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/resources/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/resources/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/scripting/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/scripting/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/scripting/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/test/core/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/test/core/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/test/core/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/test/jcr/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/test/jcr/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/test/jcr/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/test/organization/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/test/organization/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/test/organization/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/test/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/test/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/test/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/api/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/api/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/api/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/controller/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/controller/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/controller/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/resources/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/resources/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/resources/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/security/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/security/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/security/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/server/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/server/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/server/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/component/wsrp/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/wsrp/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/component/wsrp/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/examples/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/examples/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/examples/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>distribution.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>distribution.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>distribution</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/portletbridge/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/portletbridge/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/portletbridge/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>distribution.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/gatein.ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/gatein.ear/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/gatein.ear/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>distribution.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>gatein</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/integration.war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/integration.war/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/integration.war/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>distribution.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>integration</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/distribution/jboss-eap/serverAddon/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>distribution.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: epp/portal/branches/EPP_5_1_Branch/distribution/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/distribution/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/distribution/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>distribution.parent</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/extension/config/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/extension/config/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/extension/config/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/extension/ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/extension/ear/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/extension/ear/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -37,23 +37,23 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.sample.extension.config</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.sample.extension.jar</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.api</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.sample.extension.war</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/extension/jar/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/extension/jar/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/extension/jar/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/extension/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/extension/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/extension/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.sample.extension.root</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/extension/war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/extension/war/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/extension/war/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.sample</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portal/config/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portal/config/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portal/config/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portal/ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portal/ear/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portal/ear/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -37,29 +37,29 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.sample.portal.config</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.sample.portal.jar</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.api</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.sample.portal.war</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.sample.portal.rest-war</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portal/jar/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portal/jar/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portal/jar/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portal/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portal/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portal/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.sample.portal.root</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portal/rest-war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portal/rest-war/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portal/rest-war/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portal/war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portal/war/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portal/war/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
<artifactId>portlets-parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>gatein-api</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsfhellouser/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsfhellouser/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsfhellouser/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
<artifactId>portlets-parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>gatein-jsf-hellouser</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsphellouser/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsphellouser/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/jsphellouser/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
<artifactId>portlets-parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>gatein-jsp-hellouser</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/simplesthelloworld/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/simplesthelloworld/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/simplesthelloworld/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
<artifactId>portlets-parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>gatein-simplest-helloworld</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/struts-jpetstore/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
<artifactId>portlets-parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>struts-jpetstore</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/skins/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/skins/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/skins/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<groupId>org.gatein.portal.examples.skins</groupId>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/skins/simpleskin/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/skins/simpleskin/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/examples/skins/simpleskin/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.portal.examples.skins</groupId>
<artifactId>skins-parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>gatein-sample-skin</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/gadgets/core/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/gadgets/core/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/gadgets/core/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -14,7 +14,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.gadgets</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.gadgets-core</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/gadgets/eXoGadgets/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/gadgets/eXoGadgets/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/gadgets/eXoGadgets/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.gadgets</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/gadgets/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/gadgets/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/gadgets/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.gadgets</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/gadgets/server/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/gadgets/server/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/gadgets/server/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.gadgets</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.gadgets-server</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/ear/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/ear/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.packaging.jboss-as.ear</artifactId>
<packaging>ear</packaging>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/integration.war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/integration.war/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/integration.war/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.packaging.jboss-as.integration</artifactId>
<packaging>war</packaging>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pkg/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pkg/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pkg/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.packaging.jboss-as.pkg</artifactId>
<packaging>pom</packaging>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/jboss-as/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.packaging.jboss-as</artifactId>
<packaging>pom</packaging>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/module/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/module/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/module/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.packaging</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/pkg/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.packaging</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -67,13 +67,13 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>portal.packaging.module</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>js</type>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>portal.packaging.product</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>js</type>
</dependency>
</dependencies>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/product/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/product/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/product/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.packaging</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/packaging/reports/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/packaging/reports/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/packaging/reports/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.packaging</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -31,7 +31,7 @@
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<packaging>pom</packaging>
<name>EPP GateIn - Portal - ${project.version}</name>
@@ -363,68 +363,68 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.common</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.controller</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.security</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.server</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.api</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.web.resources</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.portal</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.portal</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.pc</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.identity</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.resources</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.application-registry</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
@@ -434,90 +434,90 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.scripting</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.management</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.framework</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.portlet</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.portal</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.eXo</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.core</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.dashboard</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.gadgets-core</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test.core</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test.core</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test.jcr</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test.jcr</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test.organization</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.test.organization</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>gatein.portal.component.wsrp</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server.jboss.plugin</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.portlet</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/web/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/web/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/web/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/server/jboss/patch-ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/server/jboss/patch-ear/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/server/jboss/patch-ear/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server.jboss</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/server/jboss/plugin/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/server/jboss/plugin/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/server/jboss/plugin/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server.jboss</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/server/jboss/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/server/jboss/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/server/jboss/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.server.jboss</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/server/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/server/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/server/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.server</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/starter/ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/ear/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/starter/ear/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -37,7 +37,7 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.starter.war</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
Modified: epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/starter/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/starter/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.starter.root</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -50,7 +50,7 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.starter.jar</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Modified: epp/portal/branches/EPP_5_1_Branch/testsuite/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/testsuite/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/testsuite/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.testsuite</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/testsuite/selenium-snifftests/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/testsuite/selenium-snifftests/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/testsuite/selenium-snifftests/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.testsuite</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.selenium.snifftests</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/testsuite/webuibasedsamples/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/testsuite/webuibasedsamples/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/testsuite/webuibasedsamples/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.testsuite</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.webui.based.samples</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/web/eXoResources/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/eXoResources/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/web/eXoResources/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/web/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/web/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.web</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/web/portal/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/portal/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/web/portal/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/web/rest/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/rest/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/web/rest/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.web</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/core/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/core/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/webui/core/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/dashboard/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/dashboard/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/webui/dashboard/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/eXo/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/eXo/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/webui/eXo/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/framework/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/framework/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/webui/framework/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/webui/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.parent</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<artifactId>exo.portal.webui</artifactId>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portlet/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portlet/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portlet/pom.xml 2011-07-19 12:19:04 UTC (rev 6887)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui</artifactId>
- <version>5.1.1-epp-DEV03</version>
+ <version>5.1.1-epp-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
13 years, 5 months
gatein SVN: r6886 - in epp/portal/branches/EPP_5_2_Branch: component and 34 other directories.
by do-not-reply@jboss.org
Author: theute
Date: 2011-07-19 03:40:27 -0400 (Tue, 19 Jul 2011)
New Revision: 6886
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/LocalizedValue.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelUnmarshaller.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/UnmarshalledObject.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Version.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/LocalizedValueMapper.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/SimpleUserPortalContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/test-i18nframework-configuration.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/extended-navigation.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/simple-navigation.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/navigation.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/portal.xml
Removed:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/navigation.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/portal.xml
Modified:
epp/portal/branches/EPP_5_2_Branch/
epp/portal/branches/EPP_5_2_Branch/component/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml
epp/portal/branches/EPP_5_2_Branch/pom.xml
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIWizard/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
Log:
JBEPP-934: EPP52-EID_102: Navigation i18n
JBEPP-1015: EPP52-EID_107: Sites describability
Property changes on: epp/portal/branches/EPP_5_2_Branch
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5622,5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573,6783
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5622,5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573,6783-6784
Property changes on: epp/portal/branches/EPP_5_2_Branch/component
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5622,5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573,6783
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5622,5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573,6783-6784
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/conf/gatein-nodetypes.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -18,28 +18,67 @@
-->
<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
- <nodeType name="gtn:protectedresource" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
- <propertyDefinitions>
- <propertyDefinition name="gtn:access-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="gtn:edit-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
+ <nodeType name="gtn:language" isMixin="false" hasOrderableChildNodes="false">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions/>
+ <childNodeDefinitions/>
+ </nodeType>
- <nodeType name="gtn:described" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
- <propertyDefinitions>
- <propertyDefinition name="gtn:name" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="gtn:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints/>
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
+ <nodeType name="gtn:languages" isMixin="false" hasOrderableChildNodes="false">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions/>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*" defaultPrimaryType="gtn:language" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>gtn:language</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+ <nodeType name="gtn:i18nized" isMixin="true" hasOrderableChildNodes="false">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions/>
+ <childNodeDefinitions>
+ <childNodeDefinition name="gtn:languages" defaultPrimaryType="gtn:languages" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>gtn:languages</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="gtn:protectedresource" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="gtn:access-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="gtn:edit-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+ <nodeType name="gtn:described" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="gtn:name" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="gtn:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
<nodeType name="gtn:visible" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
<propertyDefinitions>
<propertyDefinition name="gtn:startpublicationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd 2011-07-19 07:40:27 UTC (rev 6886)
@@ -32,176 +32,206 @@
attributeFormDefault="unqualified"
version="1.0">
- <!-- A top page element -->
- <xs:element name="page" type="pageType"/>
+ <!-- A top page element -->
+ <xs:element name="page" type="pageType"/>
- <!-- A top page-set element -->
- <xs:element name="page-set" type="pageSetType"/>
+ <!-- A top page-set element -->
+ <xs:element name="page-set" type="pageSetType"/>
- <!-- A top portal-config element -->
- <xs:element name="portal-config" type="portalConfigType"/>
+ <!-- A top portal-config element -->
+ <xs:element name="portal-config" type="portalConfigType"/>
- <!-- A top container element -->
- <xs:element name="container" type="containerType"/>
+ <!-- A top container element -->
+ <xs:element name="container" type="containerType"/>
- <!-- A top node-navigation element -->
- <xs:element name="node-navigation" type="nodeNavigationType"/>
+ <!-- A top node-navigation element -->
+ <xs:element name="node-navigation" type="nodeNavigationType"/>
- <!-- A localized string -->
- <xs:complexType name="localizedString">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute ref="xml:lang"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
+ <!-- A localized string -->
+ <xs:complexType name="localizedString">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute ref="xml:lang" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
- <!-- The type of a top navigation node -->
- <xs:complexType name="nodeNavigationType">
- <xs:sequence>
- <xs:element name="priority" type="xs:positiveInteger"/>
- <xs:element name="page-nodes" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
+ <!-- The type of a top navigation node -->
+ <xs:complexType name="nodeNavigationType">
+ <xs:sequence>
+ <xs:element name="priority" type="xs:positiveInteger"/>
+ <xs:element name="page-nodes" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
- <!-- The type of a navigation node -->
- <xs:complexType name="nodeType">
- <xs:sequence>
- <xs:element name="uri" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="name" type="xs:string"/>
- <xs:element name="label" type="localizedString" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="start-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="end-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="visibility" type="visibility" default="VISIBLE" minOccurs="0" maxOccurs="1"/>
- <xs:element name="page-reference" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
+ <!-- The type of a navigation node -->
+ <xs:complexType name="nodeType">
+ <xs:sequence>
+ <xs:element name="uri" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="label" type="localizedString" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="start-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="end-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="visibility" type="visibility" default="DISPLAYED" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="page-reference" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:simpleType name="visibility">
- <xs:restriction base='xs:string'>
- <xs:enumeration value="DISPLAYED"/>
- <xs:enumeration value="HIDDEN"/>
- <xs:enumeration value="TEMPORAL"/>
- <xs:enumeration value="SYSTEM"/>
- </xs:restriction>
- </xs:simpleType>
+ <xs:simpleType name="visibility">
+ <xs:restriction base='xs:string'>
+ <xs:enumeration value="DISPLAYED"/>
+ <xs:enumeration value="HIDDEN"/>
+ <xs:enumeration value="TEMPORAL"/>
+ <xs:enumeration value="SYSTEM"/>
+ </xs:restriction>
+ </xs:simpleType>
- <xs:complexType name="pageSetType">
- <xs:sequence>
- <xs:element name="page" type="pageType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="pageSetType">
+ <xs:sequence>
+ <xs:element name="page" type="pageType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="portalConfigType">
- <xs:sequence>
- <xs:element name="portal-name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="locale" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="skin" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="portal-layout" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:group ref="containerChildrenGroup"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portalConfigType">
+ <xs:sequence>
+ <xs:element name="portal-name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="label" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="locale" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="skin" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="portal-layout" minOccurs="1" maxOccurs="1">
+ <xs:complexType>
+ <xs:group ref="containerChildrenGroup"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="propertiesType">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:element name="entry" type="propertiesEntryType" minOccurs="1" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="propertiesType">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="entry" type="propertiesEntryType" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="propertiesEntryType">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="key" type="xs:string"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
+ <xs:complexType name="propertiesEntryType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="key" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
- <xs:group name="containerChildrenGroup">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="portlet-application" type="portletApplicationType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="container" type="containerType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="page-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="site-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
- </xs:choice>
- </xs:sequence>
- </xs:group>
+ <xs:group name="containerChildrenGroup">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="portlet-application" type="portletApplicationType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="gadget-application" type="gadgetApplicationType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="container" type="containerType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="page-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="site-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
- <xs:complexType name="pageType">
- <xs:sequence>
- <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="show-max-window" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:group ref="containerChildrenGroup"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="pageType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="show-max-window" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:group ref="containerChildrenGroup"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="containerType">
- <xs:sequence>
- <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:group ref="containerChildrenGroup"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:string"/>
- <xs:attribute name="template" type="xs:string"/>
- <xs:attribute name="attribute" type="xs:string"/>
- </xs:complexType>
+ <xs:complexType name="containerType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:group ref="containerChildrenGroup"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ <xs:attribute name="template" type="xs:string"/>
+ <xs:attribute name="attribute" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ </xs:complexType>
- <xs:complexType name="portletApplicationType">
- <xs:sequence>
- <xs:element name="portlet" type="portletType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="show-info-bar" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
- <xs:element name="show-application-state" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:element name="show-application-mode" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portletApplicationType">
+ <xs:sequence>
+ <xs:choice>
+ <xs:element name="portlet" type="portletType"/>
+ <xs:element name="wsrp" type="xs:string"/>
+ </xs:choice>
+ <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="show-info-bar" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="show-application-state" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="show-application-mode" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="portletType">
- <xs:sequence>
- <xs:element name="application-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="portlet-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="preferences" type="portletPreferencesType" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="gadgetApplicationType">
+ <xs:sequence>
+ <xs:element name="gadget" type="gadgetType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="theme" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="show-info-bar" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="show-application-state" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="show-application-mode" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="portletPreferencesType">
- <xs:sequence>
- <xs:element name="preference" type="portletPreferenceType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portletType">
+ <xs:sequence>
+ <xs:element name="application-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="portlet-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="preferences" type="portletPreferencesType" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="portletPreferenceType">
- <xs:sequence>
- <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="read-only" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="gadgetType">
+ <xs:sequence>
+ <xs:element name="gadget-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="portletPreferencesType">
+ <xs:sequence>
+ <xs:element name="preference" type="portletPreferenceType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="portletPreferenceType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="read-only" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -31,24 +31,28 @@
import org.exoplatform.portal.config.importer.ImportMode;
import org.exoplatform.portal.config.importer.NavigationImporter;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelUnmarshaller;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.Page.PageSet;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.Page.PageSet;
+import org.exoplatform.portal.config.model.UnmarshalledObject;
+import org.exoplatform.portal.config.model.Version;
+import org.exoplatform.portal.mop.description.DescriptionService;
import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
-import org.jibx.runtime.*;
-import org.jibx.runtime.impl.UnmarshallingContext;
+import org.jibx.runtime.JiBXException;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Set;
import java.util.regex.Pattern;
@@ -102,12 +106,22 @@
/** . */
private NavigationService navigationService_;
- public NewPortalConfigListener(POMSessionManager pomMgr, DataStorage dataStorage, ConfigurationManager cmanager, InitParams params, NavigationService navigationService)
+ /** . */
+ private DescriptionService descriptionService_;
+
+ public NewPortalConfigListener(
+ POMSessionManager pomMgr,
+ DataStorage dataStorage,
+ ConfigurationManager cmanager,
+ InitParams params,
+ NavigationService navigationService,
+ DescriptionService descriptionService)
throws Exception
{
cmanager_ = cmanager;
dataStorage_ = dataStorage;
navigationService_ = navigationService;
+ descriptionService_ = descriptionService;
ValueParam valueParam = params.getValueParam("page.templates.location");
if (valueParam != null)
@@ -396,9 +410,9 @@
try
{
String type = config.getOwnerType();
- PortalConfig pconfig = getConfig(config, owner, type, PortalConfig.class);
+ UnmarshalledObject<PortalConfig> obj = getConfig(config, owner, type, PortalConfig.class);
- if (pconfig == null)
+ if (obj == null)
{
// Ensure that the PortalConfig has been defined
// The PortalConfig could be empty if the related PortalConfigListener
@@ -414,6 +428,9 @@
return;
}
+ //
+ PortalConfig pconfig = obj.getObject();
+
// We use that owner value because it may have been fixed for group names
owner = pconfig.getName();
@@ -436,12 +453,12 @@
public void createPage(NewPortalConfig config, String owner) throws Exception
{
- PageSet pageSet = getConfig(config, owner, "pages", PageSet.class);
+ UnmarshalledObject<PageSet> pageSet = getConfig(config, owner, "pages", PageSet.class);
if (pageSet == null)
{
return;
}
- ArrayList<Page> list = pageSet.getPages();
+ ArrayList<Page> list = pageSet.getObject().getPages();
for (Page page : list)
{
RequestLifeCycle.begin(PortalContainer.getInstance());
@@ -458,29 +475,44 @@
public void createPageNavigation(NewPortalConfig config, String owner) throws Exception
{
- PageNavigation navigation = getConfig(config, owner, "navigation", PageNavigation.class);
- if (navigation == null)
+ UnmarshalledObject<PageNavigation> obj = getConfig(config, owner, "navigation", PageNavigation.class);
+ if (obj == null)
{
return;
}
//
+ PageNavigation navigation = obj.getObject();
ImportMode importMode = overrideExistingData ? ImportMode.REIMPORT : ImportMode.MERGE;
+ boolean extendedNavigation = obj.getVersion() == Version.V_1_2;
//
- NavigationImporter merge =new NavigationImporter(importMode, navigation, navigationService_);
+ Locale locale;
+ PortalConfig portalConfig = dataStorage_.getPortalConfig(config.getOwnerType(), owner);
+ if (portalConfig != null && portalConfig.getLocale() != null)
+ {
+ locale = new Locale(portalConfig.getLocale());
+ }
+ else
+ {
+ locale = Locale.ENGLISH;
+ }
//
+ NavigationImporter merge = new NavigationImporter(locale, importMode, extendedNavigation, navigation, navigationService_, descriptionService_);
+
+ //
merge.perform();
}
public void createPortletPreferences(NewPortalConfig config, String owner) throws Exception
{
- PortletPreferencesSet portletSet = getConfig(config, owner, "portlet-preferences", PortletPreferencesSet.class);
- if (portletSet == null)
+ UnmarshalledObject<PortletPreferencesSet> obj = getConfig(config, owner, "portlet-preferences", PortletPreferencesSet.class);
+ if (obj == null)
{
return;
}
+ PortletPreferencesSet portletSet = obj.getObject();
ArrayList<PortletPreferences> list = portletSet.getPortlets();
for (PortletPreferences portlet : list)
{
@@ -501,7 +533,7 @@
* @throws Exception any exception
* @param <T> the generic type to unmarshall to
*/
- private <T> T getConfig(NewPortalConfig config, String owner, String fileName, Class<T> type) throws Exception
+ private <T> UnmarshalledObject<T> getConfig(NewPortalConfig config, String owner, String fileName, Class<T> type) throws Exception
{
log.debug("About to load config=" + config + " owner=" + owner + " fileName=" + fileName);
@@ -533,9 +565,9 @@
boolean ok = false;
try
{
- final T t = fromXML(config.getOwnerType(), owner, xml, type);
+ final UnmarshalledObject<T> o = fromXML(config.getOwnerType(), owner, xml, type);
ok = true;
- return t;
+ return o;
}
catch (JiBXException e)
{
@@ -577,7 +609,7 @@
String path = pageTemplatesLocation_ + "/" + temp + "/page.xml";
InputStream is = cmanager_.getInputStream(path);
String xml = IOUtil.getStreamContentAsString(is);
- return fromXML(ownerType, owner, xml, Page.class);
+ return fromXML(ownerType, owner, xml, Page.class).getObject();
}
public String getTemplateConfig(String type, String name)
@@ -590,16 +622,60 @@
}
return null;
}
+
+ /**
+ * Get all template configurations
+ * @param siteType (portal, group, user)
+ * @return set of template name
+ */
+ public Set<String> getTemplateConfigs(String siteType)
+ {
+ Set<String> result = new HashSet<String>();
+ for(SiteConfigTemplates tempConfig : templateConfigs)
+ {
+ Set<String> templates = tempConfig.getTemplates(siteType);
+ if(templates != null && templates.size() > 0)
+ {
+ result.addAll(templates);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get detail configuration from a template file
+ * @param siteType (portal, group, user)
+ * @param templateName name of template
+ * @return PortalConfig object
+ */
+ public PortalConfig getPortalConfigFromTemplate(String siteType, String templateName)
+ {
+ String templatePath = getTemplateConfig(siteType, templateName);
+ NewPortalConfig config = new NewPortalConfig(templatePath);
+ config.setTemplateName(templateName);
+ config.setOwnerType(siteType);
+ UnmarshalledObject<PortalConfig> result = null;
+ try
+ {
+ result = getConfig(config, templateName, siteType, PortalConfig.class);
+ if (result != null)
+ {
+ return result.getObject();
+ }
+ }
+ catch (Exception e)
+ {
+ log.warn("Cannot find configuration of template: " + templateName);
+ }
+ return null;
+ }
// Deserializing code
- private <T> T fromXML(String ownerType, String owner, String xml, Class<T> clazz) throws Exception
+ private <T> UnmarshalledObject<T> fromXML(String ownerType, String owner, String xml, Class<T> clazz) throws Exception
{
- ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
- IBindingFactory bfact = BindingDirectory.getFactory(clazz);
- UnmarshallingContext uctx = (UnmarshallingContext)bfact.createUnmarshallingContext();
- uctx.setDocument(is, null, "UTF-8", false);
- T o = clazz.cast(uctx.unmarshalElement());
+ UnmarshalledObject<T> obj = ModelUnmarshaller.unmarshall(clazz, xml.getBytes("UTF-8"));
+ T o = obj.getObject();
if (o instanceof PageNavigation)
{
PageNavigation nav = (PageNavigation)o;
@@ -632,7 +708,7 @@
// pdcService_.create(page);
}
}
- return o;
+ return obj;
}
private static String fixOwnerName(String type, String owner)
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -39,7 +39,7 @@
private UserPortalImpl userPortal;
/** . */
- private UserPortalContext bundleResolver;
+ private UserPortalContext userPortalContext;
public UserPortalConfig()
{
@@ -47,29 +47,26 @@
this.service = null;
this.portalName = null;
this.accessUser = null;
- this.bundleResolver = null;
+ this.userPortalContext = null;
}
- public UserPortalConfig(PortalConfig portal, UserPortalConfigService service, String portalName, String accessUser, UserPortalContext bundleResolver)
+ public UserPortalConfig(PortalConfig portal, UserPortalConfigService service, String portalName, String accessUser, UserPortalContext userPortalContext)
{
this.portal = portal;
this.service = service;
this.portalName = portalName;
this.accessUser = accessUser;
- this.bundleResolver = bundleResolver;
+ this.userPortalContext = userPortalContext;
}
public UserPortal getUserPortal()
{
userPortal = new UserPortalImpl(
service,
- service.navService,
- service.orgService_,
- service.userACL_,
portalName,
portal,
accessUser,
- bundleResolver
+ userPortalContext
);
return userPortal;
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -28,9 +28,11 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.description.DescriptionService;
import org.exoplatform.portal.mop.navigation.NavigationContext;
import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.mop.user.UserPortalContext;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.services.log.ExoLogger;
@@ -58,17 +60,22 @@
/** . */
final NavigationService navService;
+ /** . */
+ final DescriptionService descriptionService;
+
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
public UserPortalConfigService(
UserACL userACL, DataStorage storage,
OrganizationService orgService,
- NavigationService navService) throws Exception
+ NavigationService navService,
+ DescriptionService descriptionService) throws Exception
{
this.storage_ = storage;
this.orgService_ = orgService;
this.userACL_ = userACL;
this.navService = navService;
+ this.descriptionService = descriptionService;
}
/**
@@ -81,6 +88,34 @@
return navService;
}
+ public DescriptionService getDescriptionService()
+ {
+ return descriptionService;
+ }
+
+ public UserACL getUserACL()
+ {
+ return userACL_;
+ }
+
+ public OrganizationService getOrganizationService()
+ {
+ return orgService_;
+ }
+
+ /** Temporary until the {@link #getUserPortalConfig(String, String)} is removed. */
+ private static final UserPortalContext NULL_CONTEXT = new UserPortalContext()
+ {
+ public ResourceBundle getBundle(UserNavigation navigation)
+ {
+ return null;
+ }
+ public Locale getUserLocale()
+ {
+ return Locale.ENGLISH;
+ }
+ };
+
/**
* <p> Build and returns an instance of <tt>UserPortalConfig</tt>. </p>
* <p/>
@@ -105,13 +140,15 @@
* @param accessUser the user name
* @return the config
* @throws Exception any exception
+ * @deprecated the method {@link #getUserPortalConfig(String, String, org.exoplatform.portal.mop.user.UserPortalContext)} should be used instead
*/
+ @Deprecated
public UserPortalConfig getUserPortalConfig(String portalName, String accessUser) throws Exception
{
- return getUserPortalConfig(portalName, accessUser, null);
+ return getUserPortalConfig(portalName, accessUser, NULL_CONTEXT);
}
- public UserPortalConfig getUserPortalConfig(String portalName, String accessUser, UserPortalContext bundleResolver) throws Exception
+ public UserPortalConfig getUserPortalConfig(String portalName, String accessUser, UserPortalContext userPortalContext) throws Exception
{
PortalConfig portal = storage_.getPortalConfig(portalName);
if (portal == null || !userACL_.hasPermission(portal))
@@ -120,7 +157,7 @@
}
- return new UserPortalConfig(portal, this, portalName, accessUser, bundleResolver);
+ return new UserPortalConfig(portal, this, portalName, accessUser, userPortalContext);
}
/**
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -19,10 +19,13 @@
package org.exoplatform.portal.config.importer;
+import org.exoplatform.portal.config.model.LocalizedValue;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PageNodeContainer;
+import org.exoplatform.portal.mop.Described;
import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.description.DescriptionService;
import org.exoplatform.portal.mop.navigation.NavigationContext;
import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.mop.navigation.NavigationState;
@@ -37,11 +40,15 @@
import org.exoplatform.portal.tree.diff.ListChangeIterator;
import org.exoplatform.portal.tree.diff.ListChangeType;
import org.exoplatform.portal.tree.diff.ListDiff;
+import org.gatein.common.i18n.LocaleFormat;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
+import java.util.Map;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -104,6 +111,12 @@
};
/** . */
+ private final Locale portalLocale;
+
+ /** . */
+ private final boolean extendedNavigation;
+
+ /** . */
private final PageNavigation src;
/** . */
@@ -112,11 +125,23 @@
/** . */
private final ImportMode mode;
- public NavigationImporter(ImportMode mode, PageNavigation src, NavigationService service)
+ /** . */
+ private final DescriptionService descriptionService;
+
+ public NavigationImporter(
+ Locale portalLocale,
+ ImportMode mode,
+ boolean extendedNavigation,
+ PageNavigation src,
+ NavigationService service,
+ DescriptionService descriptionService)
{
+ this.portalLocale = portalLocale;
+ this.extendedNavigation = extendedNavigation;
this.mode = mode;
this.src = src;
this.service = service;
+ this.descriptionService = descriptionService;
}
public void perform()
@@ -166,12 +191,26 @@
if (dst != null)
{
NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, dst, Scope.SINGLE, null).getNode();
- perform(src, node);
+
+ // Collect labels
+ Map<NodeContext<?>, Map<Locale, Described.State>> labelMap = new HashMap<NodeContext<?>, Map<Locale, Described.State>>();
+
+ // Perform save
+ perform(src, node, labelMap);
+
+ // Save the node
service.saveNode(node, null);
+
+ //
+ for (Map.Entry<NodeContext<?>, Map<Locale, Described.State>> entry : labelMap.entrySet())
+ {
+ String id = entry.getKey().getId();
+ descriptionService.setDescriptions(id, entry.getValue());
+ }
}
}
- private void perform(PageNodeContainer src, final NodeContext<?> dst)
+ private void perform(PageNodeContainer src, final NodeContext<?> dst, final Map<NodeContext<?>, Map<Locale, Described.State>> labelMap)
{
service.rebaseNode(dst, Scope.CHILDREN, null);
@@ -197,7 +236,7 @@
switch (changeType)
{
case SAME:
- perform(srcChild, dstChild);
+ perform(srcChild, dstChild, labelMap);
break;
case REMOVE:
if (dst.getNode(name) != null)
@@ -239,6 +278,70 @@
private void add(PageNode target, PageNode previous, NodeContext<?> dst)
{
+
+ //
+ LocalizedValue unqualifiedLabel = null;
+ List<LocalizedValue> labels = target.getLabels();
+ Map<Locale, Described.State> description = null;
+ if (labels.size() > 0)
+ {
+ for (LocalizedValue label : labels)
+ {
+ Locale lang = label.getLang();
+ if (lang != null)
+ {
+ if (description == null)
+ {
+ description = new HashMap<Locale, Described.State>(labels.size());
+ }
+ description.put(lang, new Described.State(label.getValue(), null));
+ }
+ else
+ {
+ unqualifiedLabel = label;
+ }
+ }
+ }
+
+ //
+ String label;
+ if (extendedNavigation)
+ {
+ if (description == null)
+ {
+ description = new HashMap<Locale, Described.State>();
+ }
+ if (!description.containsKey(portalLocale))
+ {
+ if (unqualifiedLabel != null)
+ {
+ description.put(portalLocale, new Described.State(unqualifiedLabel.getValue(), null));
+ }
+ }
+
+ //
+ label = null;
+ }
+ else
+ {
+ if (unqualifiedLabel != null)
+ {
+ label = unqualifiedLabel.getValue();
+ }
+ else if (description != null && description.containsKey(portalLocale))
+ {
+ label = description.get(portalLocale).getName();
+ }
+ else
+ {
+ label = null;
+ }
+
+ //
+ description = null;
+ }
+
+ //
String name = target.getName();
int index = 0;
if (previous != null)
@@ -249,7 +352,7 @@
Date start = target.getStartPublicationDate();
Date end = target.getEndPublicationDate();
NodeState state = new NodeState(
- target.getLabel(),
+ label,
target.getIcon(),
start == null ? -1 : start.getTime(),
end == null ? -1 : end.getTime(),
@@ -259,6 +362,12 @@
child.setState(state);
//
+ if (description != null)
+ {
+ labelMap.put(child, description);
+ }
+
+ //
List<PageNode> targetChildren = target.getNodes();
if (targetChildren != null)
{
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/LocalizedValue.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/LocalizedValue.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/LocalizedValue.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/LocalizedValue.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.model;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class LocalizedValue
+{
+
+ /** . */
+ private String value;
+
+ /** . */
+ private Locale lang;
+
+ public LocalizedValue()
+ {
+ }
+
+ public LocalizedValue(String value)
+ {
+ this.value = value;
+ }
+
+ public LocalizedValue(String value, Locale lang)
+ {
+ this.value = value;
+ this.lang = lang;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public Locale getLang()
+ {
+ return lang;
+ }
+
+ public void setLang(Locale lang)
+ {
+ this.lang = lang;
+ }
+}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelUnmarshaller.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelUnmarshaller.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelUnmarshaller.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelUnmarshaller.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.model;
+
+import org.gatein.common.io.IOTools;
+import org.jibx.runtime.BindingDirectory;
+import org.jibx.runtime.IBindingFactory;
+import org.jibx.runtime.impl.UnmarshallingContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class ModelUnmarshaller
+{
+
+ public static <T> UnmarshalledObject<T> unmarshall(Class<T> type, InputStream in) throws Exception
+ {
+ return unmarshall(type, IOTools.getBytes(in));
+ }
+
+ public static <T> UnmarshalledObject<T> unmarshall(Class<T> type, byte[] bytes) throws Exception
+ {
+ ByteArrayInputStream baos = new ByteArrayInputStream(bytes);
+
+ //
+ IBindingFactory bfact = BindingDirectory.getFactory(type);
+ UnmarshallingContext uctx = (UnmarshallingContext)bfact.createUnmarshallingContext();
+ uctx.setDocument(baos, null, "UTF-8", false);
+ T obj = type.cast(uctx.unmarshalElement());
+
+ // Find out version
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ baos.reset();
+ XMLStreamReader reader = factory.createXMLStreamReader(baos);
+ Version version = Version.UNKNOWN;
+ while (reader.hasNext())
+ {
+ int next = reader.next();
+ if (next == XMLStreamReader.START_ELEMENT)
+ {
+ QName name = reader.getName();
+ String uri = name.getNamespaceURI();
+ if (uri != null)
+ {
+ version = Version.forURI(uri);
+ }
+ break;
+ }
+ }
+
+ //
+ return new UnmarshalledObject<T>(version, obj);
+ }
+
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -22,8 +22,12 @@
import org.exoplatform.portal.mop.Visibility;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
+import java.util.Map;
public class PageNode extends PageNodeContainer
{
@@ -35,7 +39,7 @@
private String uri;
/** . */
- private String label;
+ private ArrayList<LocalizedValue> labels;
/** . */
private String icon;
@@ -70,14 +74,75 @@
uri = s;
}
+ public ArrayList<LocalizedValue> getLabels()
+ {
+ return labels;
+ }
+
+ public Map<Locale, String> getLocalizedLabel(Locale defaultLocale)
+ {
+ Map<Locale, String> map = Collections.emptyMap();
+ LocalizedValue portalLocaleLabel = null;
+ for (LocalizedValue label : labels)
+ {
+ if (label.getLang() != null)
+ {
+ if (map.isEmpty())
+ {
+ map = new HashMap<Locale, String>();
+ }
+ map.put(label.getLang(), label.getValue());
+ }
+ else
+ {
+ portalLocaleLabel = label;
+ }
+ }
+ if (map.isEmpty())
+ {
+ return null;
+ }
+ else
+ {
+ if (portalLocaleLabel != null && !map.containsKey(defaultLocale))
+ {
+ map.put(defaultLocale, portalLocaleLabel.getValue());
+ }
+ return map;
+ }
+ }
+
+ public void setLabels(ArrayList<LocalizedValue> labels)
+ {
+ this.labels = labels;
+ }
+
public String getLabel()
{
- return label;
+ if (labels != null)
+ {
+ for (LocalizedValue label : labels)
+ {
+ if (label.getLang() == null)
+ {
+ return label.getValue();
+ }
+ }
+ }
+ return null;
}
public void setLabel(String s)
{
- label = s;
+ if (labels == null)
+ {
+ labels = new ArrayList<LocalizedValue>();
+ }
+ else
+ {
+ labels.clear();
+ }
+ labels.add(new LocalizedValue(s));
}
public String getIcon()
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/UnmarshalledObject.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/UnmarshalledObject.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/UnmarshalledObject.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/UnmarshalledObject.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class UnmarshalledObject<T>
+{
+
+ /** . */
+ private final Version version;
+
+ /** . */
+ private final T object;
+
+ public UnmarshalledObject(Version version, T object)
+ {
+ this.version = version;
+ this.object = object;
+ }
+
+ public Version getVersion()
+ {
+ return version;
+ }
+
+ public T getObject()
+ {
+ return object;
+ }
+}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Version.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Version.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Version.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Version.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public enum Version
+{
+
+ UNKNOWN(null),
+
+ V_1_0("http://www.gatein.org/xml/ns/gatein_objects_1_0"),
+
+ V_1_1("http://www.gatein.org/xml/ns/gatein_objects_1_1"),
+
+ V_1_2("http://www.gatein.org/xml/ns/gatein_objects_1_2");
+
+ /** . */
+ private final String uri;
+
+ Version(String uri)
+ {
+ this.uri = uri;
+ }
+
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public static Version forURI(String uri)
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException();
+ }
+ for (Version version : values())
+ {
+ if (uri.equals(version.uri))
+ {
+ return version;
+ }
+ }
+ return null;
+ }
+}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/LocalizedValueMapper.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/LocalizedValueMapper.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/LocalizedValueMapper.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/LocalizedValueMapper.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.serialize;
+
+import org.exoplatform.portal.config.model.LocalizedValue;
+import org.gatein.common.i18n.LocaleFormat;
+import org.gatein.common.util.ConversionException;
+import org.jibx.runtime.IAliasable;
+import org.jibx.runtime.IMarshaller;
+import org.jibx.runtime.IMarshallingContext;
+import org.jibx.runtime.IUnmarshaller;
+import org.jibx.runtime.IUnmarshallingContext;
+import org.jibx.runtime.JiBXException;
+import org.jibx.runtime.JiBXParseException;
+import org.jibx.runtime.impl.UnmarshallingContext;
+
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class LocalizedValueMapper implements IUnmarshaller, IAliasable, IMarshaller
+{
+
+ /** . */
+ private String marshalURI;
+
+ /** . */
+ private String marshallName;
+
+ /** . */
+ private int marshallIndex;
+
+ public LocalizedValueMapper(String uri, int index, String name)
+ {
+ this.marshalURI = uri;
+ this.marshallName = name;
+ this.marshallIndex = index;
+ }
+
+ public LocalizedValueMapper()
+ {
+ this.marshalURI = null;
+ this.marshallName = "label";
+ this.marshallIndex = 0;
+ }
+
+ public boolean isPresent(IUnmarshallingContext ctx) throws JiBXException
+ {
+ return ctx.isAt(marshalURI, marshallName);
+ }
+
+ private static final Pattern RFC1766_PATTERN = Pattern.compile("^([a-zA-Z]{2})(?:-([a-zA-Z]{2}))?$");
+
+ public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
+ {
+ UnmarshallingContext ctx = (UnmarshallingContext)ictx;
+ if (!ctx.isAt(marshalURI, marshallName))
+ {
+ ctx.throwStartTagNameError(marshalURI, marshallName);
+ }
+ int count = ctx.getAttributeCount();
+ Locale lang = null;
+ for (int i = 0;i < count;i++)
+ {
+ String attrName = ctx.getAttributeName(i);
+ if (attrName.equals("xml:lang"))
+ {
+ String attrValue= ctx.getAttributeValue(i).trim();
+ Matcher matcher = RFC1766_PATTERN.matcher(attrValue);
+ if (matcher.matches())
+ {
+ String langISO = matcher.group(1);
+ String countryISO = matcher.group(2);
+ if (countryISO == null)
+ {
+ lang = new Locale(langISO.toLowerCase());
+ }
+ else
+ {
+ lang = new Locale(langISO.toLowerCase(), countryISO.toLowerCase());
+ }
+ }
+ else
+ {
+ throw new JiBXParseException("The attribute xml:lang " + attrValue + " does not represent a valid language as defined by RFC 1766", attrValue);
+ }
+ break;
+ }
+ }
+ ctx.parsePastStartTag(marshalURI, marshallName);
+ String value = ctx.getText();
+ ctx.parsePastEndTag(marshalURI, marshallName);
+ return new LocalizedValue(value, lang);
+ }
+
+ //
+
+
+ public boolean isExtension(String s)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void marshal(Object o, IMarshallingContext iMarshallingContext) throws JiBXException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -21,7 +21,10 @@
import org.chromattic.api.annotations.MixinType;
import org.chromattic.api.annotations.Property;
+import org.exoplatform.commons.utils.Safe;
+import java.io.Serializable;
+
/**
* Something having a human readable name and a description. The semantic of the name is to be human readable, it
* can be expressed under various ways : name, display name, label, title, etc...
@@ -33,15 +36,113 @@
public abstract class Described
{
+ /**
+ * Returns the namet.
+ *
+ * @return the name
+ */
@Property(name = "gtn:name")
public abstract String getName();
+ /**
+ * Update the name.
+ *
+ * @param name the new name
+ */
public abstract void setName(String name);
+ /**
+ * Returns the description.
+ *
+ * @return the description
+ */
@Property(name = "gtn:description")
public abstract String getDescription();
+ /**
+ * Update the description.
+ *
+ * @param description the new description
+ */
public abstract void setDescription(String description);
+ /**
+ * Return the state.
+ *
+ * @return the state
+ */
+ public State getState()
+ {
+ String name = getName();
+ String description = getDescription();
+ return new State(name, description);
+ }
+ /**
+ * Update the state.
+ *
+ * @param state the new state
+ * @throws NullPointerException if the new state is null
+ */
+ public void setState(State state) throws NullPointerException
+ {
+ if (state == null)
+ {
+ throw new NullPointerException("No null state accepted");
+ }
+
+ //
+ setName(state.getName());
+ setDescription(state.getDescription());
+ }
+
+ /**
+ * The composite state of the {@code Described} mixin.
+ */
+ public static class State implements Serializable
+ {
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String description;
+
+ public State(String name, String description)
+ {
+ this.name = name;
+ this.description = description;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof State)
+ {
+ State that = (State)obj;
+ return Safe.equals(name, that.name) && Safe.equals(description, that.description);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Description[name=" + name + ",description=" + description + "]";
+ }
+ }
}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import java.io.Serializable;
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public final class CacheKey implements Serializable
-{
-
- /** . */
- final Locale locale;
-
- /** . */
- final String id;
-
- public CacheKey(Locale locale, String id)
- {
- if (locale == null)
- {
- throw new NullPointerException();
- }
- if (id == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.locale = locale;
- this.id = id;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof CacheKey)
- {
- CacheKey that = (CacheKey)obj;
- return locale.equals(that.locale) && id.equals(that.id);
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return locale.hashCode() ^ id.hashCode();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheKey.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public final class CacheKey implements Serializable
+{
+
+ /** . */
+ final Locale locale;
+
+ /** . */
+ final String id;
+
+ public CacheKey(Locale locale, String id)
+ {
+ if (locale == null)
+ {
+ throw new NullPointerException();
+ }
+ if (id == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.locale = locale;
+ this.id = id;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof CacheKey)
+ {
+ CacheKey that = (CacheKey)obj;
+ return locale.equals(that.locale) && id.equals(that.id);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return locale.hashCode() ^ id.hashCode();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import org.exoplatform.portal.mop.Described;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class CacheValue
-{
-
- /** . */
- private static final AtomicLong SEQUENCE = new AtomicLong();
-
- /** . */
- final CacheKey origin;
-
- /** . */
- final long serial;
-
- /** . */
- final Described.State state;
-
- public CacheValue(CacheKey origin, long serial, Described.State state)
- {
- this.origin = origin;
- this.serial = serial;
- this.state = state;
- }
-
- public CacheValue(Described.State state)
- {
- this.origin = null;
- this.serial = SEQUENCE.incrementAndGet();
- this.state = state;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/CacheValue.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import org.exoplatform.portal.mop.Described;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class CacheValue
+{
+
+ /** . */
+ private static final AtomicLong SEQUENCE = new AtomicLong();
+
+ /** . */
+ final CacheKey origin;
+
+ /** . */
+ final long serial;
+
+ /** . */
+ final Described.State state;
+
+ public CacheValue(CacheKey origin, long serial, Described.State state)
+ {
+ this.origin = origin;
+ this.serial = serial;
+ this.state = state;
+ }
+
+ public CacheValue(Described.State state)
+ {
+ this.origin = null;
+ this.serial = SEQUENCE.incrementAndGet();
+ this.state = state;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.mop.i18n.I18NAdapter;
-import org.exoplatform.portal.mop.i18n.Resolution;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.gatein.mop.api.workspace.WorkspaceObject;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-abstract class DataCache
-{
-
- protected abstract void removeState(CacheKey key);
-
- protected abstract Described.State getState(POMSession session, CacheKey key);
-
- protected final CacheValue getValue(POMSession session, CacheKey key)
- {
- WorkspaceObject obj = session.findObjectById(key.id);
- I18NAdapter able = obj.adapt(I18NAdapter.class);
- Resolution<Described> res = able.resolveI18NMixin(Described.class, key.locale);
- if (res != null)
- {
- Described.State state = res.getMixin().getState();
- if (key.locale.equals(res.getLocale()))
- {
- CacheValue foo = new CacheValue(state);
- putValue(key, foo);
- return foo;
- }
- else
- {
- CacheValue origin = new CacheValue(state);
- CacheKey originKey = new CacheKey(res.getLocale(), key.id);
- putValue(originKey, origin);
- CacheValue foo = new CacheValue(originKey, origin.serial, state);
- putValue(key, foo);
- return foo;
- }
- }
- return null;
- }
-
- protected abstract void putValue(CacheKey key, CacheValue value);
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DataCache.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.i18n.I18NAdapter;
+import org.exoplatform.portal.mop.i18n.Resolution;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.gatein.mop.api.workspace.WorkspaceObject;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+abstract class DataCache
+{
+
+ protected abstract void removeState(CacheKey key);
+
+ protected abstract Described.State getState(POMSession session, CacheKey key);
+
+ protected final CacheValue getValue(POMSession session, CacheKey key)
+ {
+ WorkspaceObject obj = session.findObjectById(key.id);
+ I18NAdapter able = obj.adapt(I18NAdapter.class);
+ Resolution<Described> res = able.resolveI18NMixin(Described.class, key.locale);
+ if (res != null)
+ {
+ Described.State state = res.getMixin().getState();
+ if (key.locale.equals(res.getLocale()))
+ {
+ CacheValue foo = new CacheValue(state);
+ putValue(key, foo);
+ return foo;
+ }
+ else
+ {
+ CacheValue origin = new CacheValue(state);
+ CacheKey originKey = new CacheKey(res.getLocale(), key.id);
+ putValue(originKey, origin);
+ CacheValue foo = new CacheValue(originKey, origin.serial, state);
+ putValue(key, foo);
+ return foo;
+ }
+ }
+ return null;
+ }
+
+ protected abstract void putValue(CacheKey key, CacheValue value);
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import org.exoplatform.portal.mop.Described;
-
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * The description service provides configuration and runtime interaction of described objects.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public interface DescriptionService
-{
-
- /**
- * <p>Resolve a description with the <code>locale</code> argument.</p>
- *
- * @param id the object id
- * @param locale the locale to resolve
- * @return the description
- * @throws NullPointerException if the <code>id</code> or the <code>locale</code> argument is null
- */
- Described.State resolveDescription(String id, Locale locale) throws NullPointerException;
-
- /**
- * <p>Resolve a description, the <code>locale1</code> argument specifies which locale is relevant for retrieval,
- * the <code>locale2</code> specifies which locale should be defaulted to when the <code>locale1</code>
- * cannot provide any relevant match. The <code>locale2</code> argument is optional.</p>
- *
- * <p>The resolution follows those rules:
- * <ul>
- * <li>The resolution is performed against the locale1.</li>
- * <li>When the locale1 does not resolve and a locale2 is provided, a resolution is performed with locale2.</li>
- * <li>Otherwise null is returned.<li>
- * </ul>
- * </p>
- *
- * @param id the object id
- * @param locale2 the first locale
- * @param locale1 the second locale
- * @return the description
- * @throws NullPointerException if the <code>id</code> or the <code>locale1</code> argument is null
- */
- Described.State resolveDescription(String id, Locale locale2, Locale locale1) throws NullPointerException;
-
- /**
- * Returns the default description or null if it does not exist.
- *
- * @param id the object id
- * @return the description
- * @throws NullPointerException if the id argument is null
- */
- Described.State getDescription(String id) throws NullPointerException;
-
- /**
- * Update the default description to the new description or remove it if the description argument is null.
- *
- * @param id the object id
- * @param description the new description
- * @throws NullPointerException if the id argument is null
- */
- void setDescription(String id, Described.State description) throws NullPointerException;
-
- /**
- * Returns a description for the specified locale argument or null if it does not exist.
- *
- * @param id the object id
- * @param locale the locale
- * @return the description
- * @throws NullPointerException if the id or locale argument is null
- */
- Described.State getDescription(String id, Locale locale) throws NullPointerException;
-
- /**
- * Update the description for the specified locale to the new description or remove it if the description
- * argument is null.
- *
- * @param id the object id
- * @param locale the locale
- * @param description the new description
- * @throws NullPointerException if the id or locale argument is null
- */
- void setDescription(String id, Locale locale, Described.State description) throws NullPointerException;
-
- /**
- * Returns a map containing all the descriptions of an object or null if the object is not internationalized.
- *
- * @param id the object id
- * @return the map the description map
- * @throws NullPointerException if the id is null
- */
- Map<Locale, Described.State> getDescriptions(String id) throws NullPointerException;
-
- /**
- * Updates the description of the specified object or remove the internationalized characteristic of
- * the object if the description map is null.
- *
- * @param id the object id
- * @param descriptions the new descriptions
- * @throws NullPointerException if the id is null
- */
- void setDescriptions(String id, Map<Locale, Described.State> descriptions) throws NullPointerException;
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionService.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import org.exoplatform.portal.mop.Described;
+
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * The description service provides configuration and runtime interaction of described objects.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public interface DescriptionService
+{
+
+ /**
+ * <p>Resolve a description with the <code>locale</code> argument.</p>
+ *
+ * @param id the object id
+ * @param locale the locale to resolve
+ * @return the description
+ * @throws NullPointerException if the <code>id</code> or the <code>locale</code> argument is null
+ */
+ Described.State resolveDescription(String id, Locale locale) throws NullPointerException;
+
+ /**
+ * <p>Resolve a description, the <code>locale1</code> argument specifies which locale is relevant for retrieval,
+ * the <code>locale2</code> specifies which locale should be defaulted to when the <code>locale1</code>
+ * cannot provide any relevant match. The <code>locale2</code> argument is optional.</p>
+ *
+ * <p>The resolution follows those rules:
+ * <ul>
+ * <li>The resolution is performed against the locale1.</li>
+ * <li>When the locale1 does not resolve and a locale2 is provided, a resolution is performed with locale2.</li>
+ * <li>Otherwise null is returned.<li>
+ * </ul>
+ * </p>
+ *
+ * @param id the object id
+ * @param locale2 the first locale
+ * @param locale1 the second locale
+ * @return the description
+ * @throws NullPointerException if the <code>id</code> or the <code>locale1</code> argument is null
+ */
+ Described.State resolveDescription(String id, Locale locale2, Locale locale1) throws NullPointerException;
+
+ /**
+ * Returns the default description or null if it does not exist.
+ *
+ * @param id the object id
+ * @return the description
+ * @throws NullPointerException if the id argument is null
+ */
+ Described.State getDescription(String id) throws NullPointerException;
+
+ /**
+ * Update the default description to the new description or remove it if the description argument is null.
+ *
+ * @param id the object id
+ * @param description the new description
+ * @throws NullPointerException if the id argument is null
+ */
+ void setDescription(String id, Described.State description) throws NullPointerException;
+
+ /**
+ * Returns a description for the specified locale argument or null if it does not exist.
+ *
+ * @param id the object id
+ * @param locale the locale
+ * @return the description
+ * @throws NullPointerException if the id or locale argument is null
+ */
+ Described.State getDescription(String id, Locale locale) throws NullPointerException;
+
+ /**
+ * Update the description for the specified locale to the new description or remove it if the description
+ * argument is null.
+ *
+ * @param id the object id
+ * @param locale the locale
+ * @param description the new description
+ * @throws NullPointerException if the id or locale argument is null
+ */
+ void setDescription(String id, Locale locale, Described.State description) throws NullPointerException;
+
+ /**
+ * Returns a map containing all the descriptions of an object or null if the object is not internationalized.
+ *
+ * @param id the object id
+ * @return the map the description map
+ * @throws NullPointerException if the id is null
+ */
+ Map<Locale, Described.State> getDescriptions(String id) throws NullPointerException;
+
+ /**
+ * Updates the description of the specified object or remove the internationalized characteristic of
+ * the object if the description map is null.
+ *
+ * @param id the object id
+ * @param descriptions the new descriptions
+ * @throws NullPointerException if the id is null
+ */
+ void setDescriptions(String id, Map<Locale, Described.State> descriptions) throws NullPointerException;
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.mop.i18n.I18NAdapter;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.gatein.mop.api.workspace.WorkspaceObject;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class DescriptionServiceImpl implements DescriptionService
-{
-
- /** . */
- private final POMSessionManager manager;
-
- /** . */
- private DataCache cache;
-
- public DescriptionServiceImpl(POMSessionManager manager)
- {
- this(manager, new SimpleDataCache());
- }
-
- public DescriptionServiceImpl(POMSessionManager manager, DataCache cache)
- {
- this.manager = manager;
- this.cache = cache;
- }
-
- public Described.State resolveDescription(String id, Locale locale) throws NullPointerException
- {
- return resolveDescription(id, null, locale);
- }
-
- public Described.State resolveDescription(String id, Locale locale2, Locale locale1) throws NullPointerException
- {
- if (id == null)
- {
- throw new NullPointerException("No null id accepted");
- }
- if (locale1 == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
-
- //
- POMSession session = manager.getSession();
- Described.State state = resolveDescription(session, id, locale1);
- if (state == null && locale2 != null)
- {
- state = resolveDescription(session, id, locale2);
- }
- return state;
- }
-
- private Described.State resolveDescription(POMSession session, String id, Locale locale) throws NullPointerException
- {
- return cache.getState(session, new CacheKey(locale, id));
- }
-
- public Described.State getDescription(String id, Locale locale)
- {
- if (id == null)
- {
- throw new NullPointerException("No null id accepted");
- }
- if (locale == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
- POMSession session = manager.getSession();
- WorkspaceObject obj = session.findObjectById(id);
- I18NAdapter able = obj.adapt(I18NAdapter.class);
- Described desc = able.getI18NMixin(Described.class, locale, false);
- return desc != null ? desc.getState() : null;
- }
-
- public void setDescription(String id, Locale locale, Described.State description)
- {
- if (id == null)
- {
- throw new NullPointerException("No null id accepted");
- }
- if (locale == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
- POMSession session = manager.getSession();
- WorkspaceObject obj = session.findObjectById(id);
- I18NAdapter able = obj.adapt(I18NAdapter.class);
- Described desc = able.getI18NMixin(Described.class, locale, true);
- desc.setState(description);
- }
-
- public Described.State getDescription(String id)
- {
- if (id == null)
- {
- throw new NullPointerException("No null id accepted");
- }
- POMSession session = manager.getSession();
- WorkspaceObject obj = session.findObjectById(id);
- I18NAdapter able = obj.adapt(I18NAdapter.class);
- Described desc = able.getMixin(Described.class, false);
- return desc != null ? desc.getState() : null;
- }
-
- public void setDescription(String id, Described.State description)
- {
- if (id == null)
- {
- throw new NullPointerException("No null id accepted");
- }
- POMSession session = manager.getSession();
- WorkspaceObject obj = session.findObjectById(id);
- I18NAdapter able = obj.adapt(I18NAdapter.class);
- if (description != null)
- {
- Described desc = able.getMixin(Described.class, true);
- desc.setState(description);
- }
- else
- {
- able.removeMixin(Described.class);
- }
- }
-
- public Map<Locale, Described.State> getDescriptions(String id)
- {
- if (id == null)
- {
- throw new NullPointerException("No null id accepted");
- }
- POMSession session = manager.getSession();
- WorkspaceObject obj = session.findObjectById(id);
- I18NAdapter able = obj.adapt(I18NAdapter.class);
- Map<Locale, Described> mixins = able.getI18NMixin(Described.class);
- Map<Locale, Described.State> names = null;
- if (mixins != null)
- {
- names = new HashMap<Locale, Described.State>(mixins.size());
- for (Map.Entry<Locale, Described> entry : mixins.entrySet())
- {
- names.put(entry.getKey(), entry.getValue().getState());
- }
- }
- return names;
- }
-
- public void setDescriptions(String id, Map<Locale, Described.State> descriptions)
- {
- if (id == null)
- {
- throw new NullPointerException("No null id accepted");
- }
- POMSession session = manager.getSession();
- WorkspaceObject obj = session.findObjectById(id);
- I18NAdapter able = obj.adapt(I18NAdapter.class);
- Collection<Locale> locales = able.removeI18NMixin(Described.class);
- for (Locale locale : locales)
- {
- cache.removeState(new CacheKey(locale, id));
- }
- for (Map.Entry<Locale, Described.State> entry : descriptions.entrySet())
- {
- Described described = able.addI18NMixin(Described.class, entry.getKey());
- described.setState(entry.getValue());
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.i18n.I18NAdapter;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.gatein.mop.api.workspace.WorkspaceObject;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class DescriptionServiceImpl implements DescriptionService
+{
+
+ /** . */
+ private final POMSessionManager manager;
+
+ /** . */
+ private DataCache cache;
+
+ public DescriptionServiceImpl(POMSessionManager manager)
+ {
+ this(manager, new SimpleDataCache());
+ }
+
+ public DescriptionServiceImpl(POMSessionManager manager, DataCache cache)
+ {
+ this.manager = manager;
+ this.cache = cache;
+ }
+
+ public Described.State resolveDescription(String id, Locale locale) throws NullPointerException
+ {
+ return resolveDescription(id, null, locale);
+ }
+
+ public Described.State resolveDescription(String id, Locale locale2, Locale locale1) throws NullPointerException
+ {
+ if (id == null)
+ {
+ throw new NullPointerException("No null id accepted");
+ }
+ if (locale1 == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+
+ //
+ POMSession session = manager.getSession();
+ Described.State state = resolveDescription(session, id, locale1);
+ if (state == null && locale2 != null)
+ {
+ state = resolveDescription(session, id, locale2);
+ }
+ return state;
+ }
+
+ private Described.State resolveDescription(POMSession session, String id, Locale locale) throws NullPointerException
+ {
+ return cache.getState(session, new CacheKey(locale, id));
+ }
+
+ public Described.State getDescription(String id, Locale locale)
+ {
+ if (id == null)
+ {
+ throw new NullPointerException("No null id accepted");
+ }
+ if (locale == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+ POMSession session = manager.getSession();
+ WorkspaceObject obj = session.findObjectById(id);
+ I18NAdapter able = obj.adapt(I18NAdapter.class);
+ Described desc = able.getI18NMixin(Described.class, locale, false);
+ return desc != null ? desc.getState() : null;
+ }
+
+ public void setDescription(String id, Locale locale, Described.State description)
+ {
+ if (id == null)
+ {
+ throw new NullPointerException("No null id accepted");
+ }
+ if (locale == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+ POMSession session = manager.getSession();
+ WorkspaceObject obj = session.findObjectById(id);
+ I18NAdapter able = obj.adapt(I18NAdapter.class);
+ Described desc = able.getI18NMixin(Described.class, locale, true);
+ desc.setState(description);
+ }
+
+ public Described.State getDescription(String id)
+ {
+ if (id == null)
+ {
+ throw new NullPointerException("No null id accepted");
+ }
+ POMSession session = manager.getSession();
+ WorkspaceObject obj = session.findObjectById(id);
+ I18NAdapter able = obj.adapt(I18NAdapter.class);
+ Described desc = able.getMixin(Described.class, false);
+ return desc != null ? desc.getState() : null;
+ }
+
+ public void setDescription(String id, Described.State description)
+ {
+ if (id == null)
+ {
+ throw new NullPointerException("No null id accepted");
+ }
+ POMSession session = manager.getSession();
+ WorkspaceObject obj = session.findObjectById(id);
+ I18NAdapter able = obj.adapt(I18NAdapter.class);
+ if (description != null)
+ {
+ Described desc = able.getMixin(Described.class, true);
+ desc.setState(description);
+ }
+ else
+ {
+ able.removeMixin(Described.class);
+ }
+ }
+
+ public Map<Locale, Described.State> getDescriptions(String id)
+ {
+ if (id == null)
+ {
+ throw new NullPointerException("No null id accepted");
+ }
+ POMSession session = manager.getSession();
+ WorkspaceObject obj = session.findObjectById(id);
+ I18NAdapter able = obj.adapt(I18NAdapter.class);
+ Map<Locale, Described> mixins = able.getI18NMixin(Described.class);
+ Map<Locale, Described.State> names = null;
+ if (mixins != null)
+ {
+ names = new HashMap<Locale, Described.State>(mixins.size());
+ for (Map.Entry<Locale, Described> entry : mixins.entrySet())
+ {
+ names.put(entry.getKey(), entry.getValue().getState());
+ }
+ }
+ return names;
+ }
+
+ public void setDescriptions(String id, Map<Locale, Described.State> descriptions)
+ {
+ if (id == null)
+ {
+ throw new NullPointerException("No null id accepted");
+ }
+ POMSession session = manager.getSession();
+ WorkspaceObject obj = session.findObjectById(id);
+ I18NAdapter able = obj.adapt(I18NAdapter.class);
+ Collection<Locale> locales = able.removeI18NMixin(Described.class);
+ for (Locale locale : locales)
+ {
+ cache.removeState(new CacheKey(locale, id));
+ }
+ for (Map.Entry<Locale, Described.State> entry : descriptions.entrySet())
+ {
+ Described described = able.addI18NMixin(Described.class, entry.getKey());
+ described.setState(entry.getValue());
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import org.exoplatform.commons.cache.future.FutureExoCache;
-import org.exoplatform.commons.cache.future.Loader;
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.cache.ExoCache;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class ExoDataCache extends DataCache
-{
-
- /** . */
- protected ExoCache<CacheKey, CacheValue> cache;
-
- /** . */
- protected FutureExoCache<CacheKey, CacheValue, POMSession> values;
-
- /** . */
- private Loader<CacheKey, CacheValue, POMSession> valueLoader = new Loader<CacheKey, CacheValue, POMSession>()
- {
- public CacheValue retrieve(POMSession session, CacheKey key) throws Exception
- {
- return getValue(session, key);
- }
- };
-
- public ExoDataCache(CacheService cacheService)
- {
- this.cache = cacheService.getCacheInstance("NavigationService");
- this.values = new FutureExoCache<CacheKey, CacheValue, POMSession>(valueLoader, cache)
- {
- @Override
- protected void put(CacheKey key, CacheValue entry)
- {
- // Do nothing on purpose
- // as data in inserted with the putValue method
- // during the getValue method
- }
- };
- }
-
- @Override
- protected void removeState(CacheKey key)
- {
- cache.remove(key);
- }
-
- @Override
- protected Described.State getState(POMSession session, CacheKey key)
- {
- CacheValue value = values.get(session, key);
- return value != null ? value.state : null;
- }
-
- @Override
- protected void putValue(CacheKey key, CacheValue value)
- {
- cache.put(key, value);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import org.exoplatform.commons.cache.future.FutureExoCache;
+import org.exoplatform.commons.cache.future.Loader;
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.ExoCache;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class ExoDataCache extends DataCache
+{
+
+ /** . */
+ protected ExoCache<CacheKey, CacheValue> cache;
+
+ /** . */
+ protected FutureExoCache<CacheKey, CacheValue, POMSession> values;
+
+ /** . */
+ private Loader<CacheKey, CacheValue, POMSession> valueLoader = new Loader<CacheKey, CacheValue, POMSession>()
+ {
+ public CacheValue retrieve(POMSession session, CacheKey key) throws Exception
+ {
+ return getValue(session, key);
+ }
+ };
+
+ public ExoDataCache(CacheService cacheService)
+ {
+ this.cache = cacheService.getCacheInstance("NavigationService");
+ this.values = new FutureExoCache<CacheKey, CacheValue, POMSession>(valueLoader, cache)
+ {
+ @Override
+ protected void put(CacheKey key, CacheValue entry)
+ {
+ // Do nothing on purpose
+ // as data in inserted with the putValue method
+ // during the getValue method
+ }
+ };
+ }
+
+ @Override
+ protected void removeState(CacheKey key)
+ {
+ cache.remove(key);
+ }
+
+ @Override
+ protected Described.State getState(POMSession session, CacheKey key)
+ {
+ CacheValue value = values.get(session, key);
+ return value != null ? value.state : null;
+ }
+
+ @Override
+ protected void putValue(CacheKey key, CacheValue value)
+ {
+ cache.put(key, value);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.pom.config.POMSession;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class SimpleDataCache extends DataCache
-{
-
- /** . */
- private final ConcurrentHashMap<CacheKey, CacheValue> map;
-
- public SimpleDataCache()
- {
- this.map = new ConcurrentHashMap<CacheKey, CacheValue>();
- }
-
- @Override
- protected Described.State getState(POMSession session, CacheKey key)
- {
- CacheValue value = map.get(key);
- if (value == null)
- {
- value = getValue(session, key);
- }
- return value != null ? value.state : null;
- }
-
- @Override
- protected void removeState(CacheKey key)
- {
- map.remove(key);
- }
-
- @Override
- protected void putValue(CacheKey key, CacheValue value)
- {
- map.put(key, value);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/description/SimpleDataCache.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.pom.config.POMSession;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class SimpleDataCache extends DataCache
+{
+
+ /** . */
+ private final ConcurrentHashMap<CacheKey, CacheValue> map;
+
+ public SimpleDataCache()
+ {
+ this.map = new ConcurrentHashMap<CacheKey, CacheValue>();
+ }
+
+ @Override
+ protected Described.State getState(POMSession session, CacheKey key)
+ {
+ CacheValue value = map.get(key);
+ if (value == null)
+ {
+ value = getValue(session, key);
+ }
+ return value != null ? value.state : null;
+ }
+
+ @Override
+ protected void removeState(CacheKey key)
+ {
+ map.remove(key);
+ }
+
+ @Override
+ protected void putValue(CacheKey key, CacheValue value)
+ {
+ map.put(key, value);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.i18n;
-
-import org.gatein.common.i18n.LocaleFormat;
-import org.gatein.common.util.ConversionException;
-import org.gatein.mop.api.workspace.WorkspaceObject;
-import org.gatein.mop.spi.AdapterLifeCycle;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * An adapter that provides the i18n support for mop mixins, giving read/write access to default mixins and/or
- * i18n mixins.
- *
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class I18NAdapter
-{
-
- /** The locale serialization format. */
- private static final LocaleFormat format = LocaleFormat.DEFAULT;
-
- /** . */
- private final WorkspaceObject obj;
-
- private I18NAdapter(WorkspaceObject obj)
- {
- this.obj = obj;
- }
-
- static String toString(Locale locale)
- {
- return locale.toString();
- }
-
- static Locale parseLocale(String s) throws ConversionException
- {
- return format.getLocale(s);
- }
-
- public <M> M getMixin(Class<M> mixinType, boolean create) throws NullPointerException
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (obj.isAdapted(mixinType) || create)
- {
- return obj.adapt(mixinType);
- }
- else
- {
- return null;
- }
- }
-
- public <M> void removeMixin(Class<M> mixinType) throws NullPointerException
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (obj.isAdapted(mixinType))
- {
- obj.removeAdapter(mixinType);
- }
- }
-
- public <M> Resolution<M> resolveI18NMixin(Class<M> mixinType, Locale locale) throws NullPointerException
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (locale == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
- if (obj.isAdapted(I18Nized.class))
- {
- I18Nized ized = obj.adapt(I18Nized.class);
- return ized.resolveMixin(mixinType, locale);
- }
- else
- {
- return null;
- }
- }
-
- public <M> M getI18NMixin(Class<M> mixinType, Locale locale, boolean create) throws NullPointerException
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (locale == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
- if (obj.isAdapted(I18Nized.class))
- {
- I18Nized ized = obj.adapt(I18Nized.class);
- return ized.getMixin(mixinType, locale, create);
- }
- else if (create)
- {
- I18Nized ized = obj.adapt(I18Nized.class);
- return ized.getMixin(mixinType, locale, true);
- }
- else
- {
- return null;
- }
- }
-
- public <M> Map<Locale, M> getI18NMixin(Class<M> mixinType) throws NullPointerException
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (obj.isAdapted(I18Nized.class))
- {
- I18Nized ized = obj.adapt(I18Nized.class);
- return ized.getMixins(mixinType);
- }
- else
- {
- return null;
- }
- }
-
- public <M> M addI18NMixin(Class<M> mixinType, Locale locale)
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (locale == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
- I18Nized ized;
- if (obj.isAdapted(I18Nized.class))
- {
- ized = obj.adapt(I18Nized.class);
- }
- else
- {
- ized = obj.adapt(I18Nized.class);
- }
- return ized.getMixin(mixinType, locale, true);
- }
-
- public <M> Collection<Locale> removeI18NMixin(Class<M> mixinType)
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (obj.isAdapted(I18Nized.class))
- {
- I18Nized ized = obj.adapt(I18Nized.class);
- return ized.removeMixin(mixinType);
- }
- else
- {
- return Collections.emptyList();
- }
- }
-
- public static class LifeCycle extends AdapterLifeCycle<WorkspaceObject, I18NAdapter>
- {
- @Override
- public I18NAdapter create(WorkspaceObject adaptee, Class<I18NAdapter> adapterType)
- {
- return new I18NAdapter(adaptee);
- }
-
- @Override
- public void destroy(I18NAdapter adapter, WorkspaceObject adaptee, Class<I18NAdapter> adapterType)
- {
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18NAdapter.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.i18n;
+
+import org.gatein.common.i18n.LocaleFormat;
+import org.gatein.common.util.ConversionException;
+import org.gatein.mop.api.workspace.WorkspaceObject;
+import org.gatein.mop.spi.AdapterLifeCycle;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * An adapter that provides the i18n support for mop mixins, giving read/write access to default mixins and/or
+ * i18n mixins.
+ *
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class I18NAdapter
+{
+
+ /** The locale serialization format. */
+ private static final LocaleFormat format = LocaleFormat.DEFAULT;
+
+ /** . */
+ private final WorkspaceObject obj;
+
+ private I18NAdapter(WorkspaceObject obj)
+ {
+ this.obj = obj;
+ }
+
+ static String toString(Locale locale)
+ {
+ return locale.toString();
+ }
+
+ static Locale parseLocale(String s) throws ConversionException
+ {
+ return format.getLocale(s);
+ }
+
+ public <M> M getMixin(Class<M> mixinType, boolean create) throws NullPointerException
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (obj.isAdapted(mixinType) || create)
+ {
+ return obj.adapt(mixinType);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <M> void removeMixin(Class<M> mixinType) throws NullPointerException
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (obj.isAdapted(mixinType))
+ {
+ obj.removeAdapter(mixinType);
+ }
+ }
+
+ public <M> Resolution<M> resolveI18NMixin(Class<M> mixinType, Locale locale) throws NullPointerException
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (locale == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+ if (obj.isAdapted(I18Nized.class))
+ {
+ I18Nized ized = obj.adapt(I18Nized.class);
+ return ized.resolveMixin(mixinType, locale);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <M> M getI18NMixin(Class<M> mixinType, Locale locale, boolean create) throws NullPointerException
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (locale == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+ if (obj.isAdapted(I18Nized.class))
+ {
+ I18Nized ized = obj.adapt(I18Nized.class);
+ return ized.getMixin(mixinType, locale, create);
+ }
+ else if (create)
+ {
+ I18Nized ized = obj.adapt(I18Nized.class);
+ return ized.getMixin(mixinType, locale, true);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <M> Map<Locale, M> getI18NMixin(Class<M> mixinType) throws NullPointerException
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (obj.isAdapted(I18Nized.class))
+ {
+ I18Nized ized = obj.adapt(I18Nized.class);
+ return ized.getMixins(mixinType);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <M> M addI18NMixin(Class<M> mixinType, Locale locale)
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (locale == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+ I18Nized ized;
+ if (obj.isAdapted(I18Nized.class))
+ {
+ ized = obj.adapt(I18Nized.class);
+ }
+ else
+ {
+ ized = obj.adapt(I18Nized.class);
+ }
+ return ized.getMixin(mixinType, locale, true);
+ }
+
+ public <M> Collection<Locale> removeI18NMixin(Class<M> mixinType)
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (obj.isAdapted(I18Nized.class))
+ {
+ I18Nized ized = obj.adapt(I18Nized.class);
+ return ized.removeMixin(mixinType);
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+
+ public static class LifeCycle extends AdapterLifeCycle<WorkspaceObject, I18NAdapter>
+ {
+ @Override
+ public I18NAdapter create(WorkspaceObject adaptee, Class<I18NAdapter> adapterType)
+ {
+ return new I18NAdapter(adaptee);
+ }
+
+ @Override
+ public void destroy(I18NAdapter adapter, WorkspaceObject adaptee, Class<I18NAdapter> adapterType)
+ {
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,186 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.mop.i18n;
-
-import org.chromattic.api.annotations.Create;
-import org.chromattic.api.annotations.MappedBy;
-import org.chromattic.api.annotations.MixinType;
-import org.chromattic.api.annotations.OneToOne;
-import org.chromattic.api.annotations.Owner;
-import org.gatein.common.util.ConversionException;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 15, 2011
- */
-
-/**
- * The entry point for carrying the information
- * and can be attached to mop entities
- */
-@MixinType(name = "gtn:i18nized")
-public abstract class I18Nized
-{
-
- private static Locale parent(Locale locale)
- {
- if (locale.getVariant() != null && !locale.getVariant().isEmpty())
- {
- return new Locale(locale.getLanguage(), locale.getCountry());
- }
- else if (locale.getCountry() != null && !locale.getCountry().isEmpty())
- {
- return new Locale(locale.getLanguage());
- }
- else
- {
- return null;
- }
- }
-
- @Create
- public abstract LanguageSpace createLanguageSpace();
-
- @OneToOne
- @Owner
- @MappedBy("gtn:languages")
- public abstract LanguageSpace getLanguageSpace();
-
- public abstract void setLanguageSpace(LanguageSpace languageSpace);
-
- public <M> Resolution<M> resolveMixin(Class<M> mixinType, Locale wantedLocale)
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (wantedLocale == null)
- {
- throw new NullPointerException("No null wanted locale accepted");
- }
- for (Locale current = wantedLocale;current != null;current = parent(current))
- {
- M mixin = getMixin(mixinType, current, false);
- if (mixin != null)
- {
- return new Resolution<M>(current, mixin);
- }
- }
- return null;
- }
-
- public <M> Map<Locale, M> getMixins(Class<M> mixinType)
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- Map<Locale, M> mixins = new HashMap<Locale, M>();
- LanguageSpace languageSpace = getLanguageSpace();
- if (languageSpace != null)
- {
- for (Map.Entry<String, Language> entry : languageSpace.getChildren().entrySet())
- {
- M mixin = entry.getValue().getMixin(mixinType, false);
- if (mixin != null)
- {
- try
- {
- Locale locale = I18NAdapter.parseLocale(entry.getKey());
- mixins.put(locale, mixin);
- }
- catch (ConversionException e)
- {
- // Handle me gracefully
- e.printStackTrace();
- }
- }
- }
- }
- return mixins;
- }
-
- public <M> M getMixin(Class<M> mixinType, Locale locale, boolean createMixin) throws NullPointerException
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- if (locale == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
- LanguageSpace languageSpace = getLanguageSpace();
- if (languageSpace == null && createMixin)
- {
- languageSpace = createLanguageSpace();
- setLanguageSpace(languageSpace);
- }
- if (languageSpace != null)
- {
- return languageSpace.getLanguage(mixinType, I18NAdapter.toString(locale), createMixin);
- }
- else
- {
- return null;
- }
- }
-
- public <M> Collection<Locale> removeMixin(Class<M> mixinType)
- {
- if (mixinType == null)
- {
- throw new NullPointerException("No null mixin type accepted");
- }
- Collection<Locale> locales = Collections.emptyList();
- LanguageSpace languageSpace = getLanguageSpace();
- if (languageSpace != null)
- {
- for (Language language : languageSpace.getChildren().values())
- {
- if (language.removeMixin(mixinType))
- {
- try
- {
- String lang = language.getName();
- Locale locale = I18NAdapter.parseLocale(lang);
- if (locales.isEmpty())
- {
- locales = new ArrayList<Locale>();
- }
- locales.add(locale);
- }
- catch (ConversionException e)
- {
- // Handle me gracefully
- e.printStackTrace();
- }
- }
- }
- }
- return locales;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/I18Nized.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,186 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.mop.i18n;
+
+import org.chromattic.api.annotations.Create;
+import org.chromattic.api.annotations.MappedBy;
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.OneToOne;
+import org.chromattic.api.annotations.Owner;
+import org.gatein.common.util.ConversionException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 15, 2011
+ */
+
+/**
+ * The entry point for carrying the information
+ * and can be attached to mop entities
+ */
+@MixinType(name = "gtn:i18nized")
+public abstract class I18Nized
+{
+
+ private static Locale parent(Locale locale)
+ {
+ if (locale.getVariant() != null && !locale.getVariant().isEmpty())
+ {
+ return new Locale(locale.getLanguage(), locale.getCountry());
+ }
+ else if (locale.getCountry() != null && !locale.getCountry().isEmpty())
+ {
+ return new Locale(locale.getLanguage());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Create
+ public abstract LanguageSpace createLanguageSpace();
+
+ @OneToOne
+ @Owner
+ @MappedBy("gtn:languages")
+ public abstract LanguageSpace getLanguageSpace();
+
+ public abstract void setLanguageSpace(LanguageSpace languageSpace);
+
+ public <M> Resolution<M> resolveMixin(Class<M> mixinType, Locale wantedLocale)
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (wantedLocale == null)
+ {
+ throw new NullPointerException("No null wanted locale accepted");
+ }
+ for (Locale current = wantedLocale;current != null;current = parent(current))
+ {
+ M mixin = getMixin(mixinType, current, false);
+ if (mixin != null)
+ {
+ return new Resolution<M>(current, mixin);
+ }
+ }
+ return null;
+ }
+
+ public <M> Map<Locale, M> getMixins(Class<M> mixinType)
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ Map<Locale, M> mixins = new HashMap<Locale, M>();
+ LanguageSpace languageSpace = getLanguageSpace();
+ if (languageSpace != null)
+ {
+ for (Map.Entry<String, Language> entry : languageSpace.getChildren().entrySet())
+ {
+ M mixin = entry.getValue().getMixin(mixinType, false);
+ if (mixin != null)
+ {
+ try
+ {
+ Locale locale = I18NAdapter.parseLocale(entry.getKey());
+ mixins.put(locale, mixin);
+ }
+ catch (ConversionException e)
+ {
+ // Handle me gracefully
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ return mixins;
+ }
+
+ public <M> M getMixin(Class<M> mixinType, Locale locale, boolean createMixin) throws NullPointerException
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ if (locale == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+ LanguageSpace languageSpace = getLanguageSpace();
+ if (languageSpace == null && createMixin)
+ {
+ languageSpace = createLanguageSpace();
+ setLanguageSpace(languageSpace);
+ }
+ if (languageSpace != null)
+ {
+ return languageSpace.getLanguage(mixinType, I18NAdapter.toString(locale), createMixin);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <M> Collection<Locale> removeMixin(Class<M> mixinType)
+ {
+ if (mixinType == null)
+ {
+ throw new NullPointerException("No null mixin type accepted");
+ }
+ Collection<Locale> locales = Collections.emptyList();
+ LanguageSpace languageSpace = getLanguageSpace();
+ if (languageSpace != null)
+ {
+ for (Language language : languageSpace.getChildren().values())
+ {
+ if (language.removeMixin(mixinType))
+ {
+ try
+ {
+ String lang = language.getName();
+ Locale locale = I18NAdapter.parseLocale(lang);
+ if (locales.isEmpty())
+ {
+ locales = new ArrayList<Locale>();
+ }
+ locales.add(locale);
+ }
+ catch (ConversionException e)
+ {
+ // Handle me gracefully
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ return locales;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,72 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.mop.i18n;
-
-import org.chromattic.api.ChromatticSession;
-import org.chromattic.api.event.LifeCycleListener;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 22, 2011
- */
-
-/**
- *
- */
-public class Injector implements LifeCycleListener
-{
- private ChromatticSession session;
-
- public Injector(ChromatticSession session)
- {
- this.session = session;
- }
-
- @Override
- public void created(Object o)
- {
- }
-
- @Override
- public void loaded(String id, String path, String name, Object o)
- {
- if (o instanceof Language)
- {
- ((Language)o).session = this.session;
- }
- }
-
- @Override
- public void added(String id, String path, String name, Object o)
- {
- if (o instanceof Language)
- {
- ((Language)o).session = this.session;
- }
- }
-
- @Override
- public void removed(String id, String path, String name, Object o)
- {
- if (o instanceof Language)
- {
- ((Language)o).session = null;
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Injector.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,72 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.mop.i18n;
+
+import org.chromattic.api.ChromatticSession;
+import org.chromattic.api.event.LifeCycleListener;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 22, 2011
+ */
+
+/**
+ *
+ */
+public class Injector implements LifeCycleListener
+{
+ private ChromatticSession session;
+
+ public Injector(ChromatticSession session)
+ {
+ this.session = session;
+ }
+
+ @Override
+ public void created(Object o)
+ {
+ }
+
+ @Override
+ public void loaded(String id, String path, String name, Object o)
+ {
+ if (o instanceof Language)
+ {
+ ((Language)o).session = this.session;
+ }
+ }
+
+ @Override
+ public void added(String id, String path, String name, Object o)
+ {
+ if (o instanceof Language)
+ {
+ ((Language)o).session = this.session;
+ }
+ }
+
+ @Override
+ public void removed(String id, String path, String name, Object o)
+ {
+ if (o instanceof Language)
+ {
+ ((Language)o).session = null;
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,68 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.mop.i18n;
-
-import org.chromattic.api.ChromatticSession;
-import org.chromattic.api.annotations.Name;
-import org.chromattic.api.annotations.PrimaryType;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 15, 2011
- */
-
-/**
- * A nake node type that describe a language entry
- * This node is able to support data through addition of mixins
- */
-@PrimaryType(name = "gtn:language")
-public abstract class Language
-{
-
- /** . */
- public ChromatticSession session;
-
- @Name
- abstract String getName();
-
- <M> M getMixin(Class<M> mixinType, boolean create)
- {
- M mixin = session.getEmbedded(this, mixinType);
- if (mixin == null && create)
- {
- mixin = session.create(mixinType);
- session.setEmbedded(this, mixinType, mixin);
- }
- return mixin;
- }
-
- <M> boolean removeMixin(Class<M> mixinType)
- {
- M mixin = session.getEmbedded(this, mixinType);
- if (mixin != null)
- {
- session.setEmbedded(this, mixinType, null);
- return true;
- }
- else
- {
- return false;
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Language.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,68 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.mop.i18n;
+
+import org.chromattic.api.ChromatticSession;
+import org.chromattic.api.annotations.Name;
+import org.chromattic.api.annotations.PrimaryType;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 15, 2011
+ */
+
+/**
+ * A nake node type that describe a language entry
+ * This node is able to support data through addition of mixins
+ */
+@PrimaryType(name = "gtn:language")
+public abstract class Language
+{
+
+ /** . */
+ public ChromatticSession session;
+
+ @Name
+ abstract String getName();
+
+ <M> M getMixin(Class<M> mixinType, boolean create)
+ {
+ M mixin = session.getEmbedded(this, mixinType);
+ if (mixin == null && create)
+ {
+ mixin = session.create(mixinType);
+ session.setEmbedded(this, mixinType, mixin);
+ }
+ return mixin;
+ }
+
+ <M> boolean removeMixin(Class<M> mixinType)
+ {
+ M mixin = session.getEmbedded(this, mixinType);
+ if (mixin != null)
+ {
+ session.setEmbedded(this, mixinType, null);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,67 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.mop.i18n;
-
-import java.util.Map;
-
-import org.chromattic.api.ChromatticSession;
-import org.chromattic.api.annotations.Create;
-import org.chromattic.api.annotations.OneToMany;
-import org.chromattic.api.annotations.PrimaryType;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 15, 2011
- */
-
-/**
- * A bare node container for language entries
- */
-@PrimaryType(name = "gtn:languages")
-public abstract class LanguageSpace
-{
-
- @Create
- public abstract Language createLanguage();
-
- @OneToMany
- public abstract Map<String, Language> getChildren();
-
- protected <E> E getLanguage(Class<E> mixinType, String locale, boolean create)
- {
- Language language;
- Map<String, Language> children = getChildren();
- if (children.containsKey(locale))
- {
- language = children.get(locale);
- }
- else if (create)
- {
- language = createLanguage();
- children.put(locale, language);
- }
- else
- {
- return null;
- }
-
- //
- return language.getMixin(mixinType, create);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/LanguageSpace.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,67 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.mop.i18n;
+
+import java.util.Map;
+
+import org.chromattic.api.ChromatticSession;
+import org.chromattic.api.annotations.Create;
+import org.chromattic.api.annotations.OneToMany;
+import org.chromattic.api.annotations.PrimaryType;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 15, 2011
+ */
+
+/**
+ * A bare node container for language entries
+ */
+@PrimaryType(name = "gtn:languages")
+public abstract class LanguageSpace
+{
+
+ @Create
+ public abstract Language createLanguage();
+
+ @OneToMany
+ public abstract Map<String, Language> getChildren();
+
+ protected <E> E getLanguage(Class<E> mixinType, String locale, boolean create)
+ {
+ Language language;
+ Map<String, Language> children = getChildren();
+ if (children.containsKey(locale))
+ {
+ language = children.get(locale);
+ }
+ else if (create)
+ {
+ language = createLanguage();
+ children.put(locale, language);
+ }
+ else
+ {
+ return null;
+ }
+
+ //
+ return language.getMixin(mixinType, create);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.i18n;
-
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class Resolution<M>
-{
-
- /** . */
- private final Locale locale;
-
- /** . */
- private final M mixin;
-
- public Resolution(Locale locale, M mixin)
- {
- if (locale == null)
- {
- throw new NullPointerException("No null locale accepted");
- }
- if (mixin == null)
- {
- throw new NullPointerException("No null mixin accepted");
- }
-
- //
- this.locale = locale;
- this.mixin = mixin;
- }
-
- public Locale getLocale()
- {
- return locale;
- }
-
- public M getMixin()
- {
- return mixin;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java (from rev 6784, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/i18n/Resolution.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.i18n;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class Resolution<M>
+{
+
+ /** . */
+ private final Locale locale;
+
+ /** . */
+ private final M mixin;
+
+ public Resolution(Locale locale, M mixin)
+ {
+ if (locale == null)
+ {
+ throw new NullPointerException("No null locale accepted");
+ }
+ if (mixin == null)
+ {
+ throw new NullPointerException("No null mixin accepted");
+ }
+
+ //
+ this.locale = locale;
+ this.mixin = mixin;
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public M getMixin()
+ {
+ return mixin;
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -20,15 +20,16 @@
package org.exoplatform.portal.mop.user;
import org.exoplatform.commons.utils.ExpressionUtil;
+import org.exoplatform.portal.mop.Described;
import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.description.DescriptionService;
import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeFilter;
import org.exoplatform.portal.mop.navigation.NodeState;
import org.gatein.common.text.EntityEncoder;
import java.util.Collection;
import java.util.Collections;
+import java.util.Locale;
import java.util.ResourceBundle;
/**
@@ -185,15 +186,27 @@
{
if (resolvedLabel == null)
{
- String resolvedLabel;
+ String resolvedLabel = null;
+
+ //
+ String id = context.getId();
+
+ //
if (context.getState().getLabel() != null)
{
ResourceBundle bundle = owner.navigation.getBundle();
resolvedLabel = ExpressionUtil.getExpressionValue(bundle, context.getState().getLabel());
}
- else
+ else if (id != null)
{
- resolvedLabel = null;
+ Locale userLocale = owner.navigation.portal.context.getUserLocale();
+ Locale portalLocale = owner.navigation.portal.getLocale();
+ DescriptionService descriptionService = owner.navigation.portal.service.getDescriptionService();
+ Described.State description = descriptionService.resolveDescription(id, portalLocale, userLocale);
+ if (description != null)
+ {
+ resolvedLabel = description.getName();
+ }
}
//
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -75,7 +75,7 @@
{
if (visibility == Visibility.SYSTEM)
{
- UserACL acl = userPortal.acl;
+ UserACL acl = userPortal.service.getUserACL();
String userName = userPortal.userName;
if (!acl.getSuperUser().equals(userName))
{
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.mop.user;
import java.util.List;
+import java.util.Locale;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.navigation.NavigationServiceException;
@@ -36,6 +37,13 @@
{
/**
+ * Returns the portal locale.
+ *
+ * @return the portal locale
+ */
+ Locale getLocale();
+
+ /**
* Returns the sorted list of current user navigations.
*
* @return the current user navigations
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.mop.user;
+import java.util.Locale;
import java.util.ResourceBundle;
/**
@@ -39,4 +40,10 @@
*/
ResourceBundle getBundle(UserNavigation navigation);
+ /**
+ * Returns the user locale.
+ *
+ * @return the user locale
+ */
+ Locale getUserLocale();
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -24,15 +24,13 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import java.util.ResourceBundle;
+import java.util.Locale;
-import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.mop.navigation.NavigationServiceException;
import org.exoplatform.portal.mop.navigation.NodeChangeListener;
import org.exoplatform.portal.mop.navigation.NodeContext;
@@ -41,7 +39,6 @@
import org.exoplatform.portal.mop.navigation.Scope;
import org.exoplatform.portal.mop.navigation.VisitMode;
import org.exoplatform.services.organization.Group;
-import org.exoplatform.services.organization.OrganizationService;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -50,30 +47,10 @@
public class UserPortalImpl implements UserPortal
{
- /**
- * A context that always return null.
- */
- private static final UserPortalContext NULL_CONTEXT = new UserPortalContext()
- {
- public ResourceBundle getBundle(UserNavigation navigation)
- {
- return null;
- }
- };
-
/** . */
final UserPortalConfigService service;
/** . */
- final NavigationService navigationService;
-
- /** . */
- private final OrganizationService organizationService;
-
- /** . */
- final UserACL acl;
-
- /** . */
private final PortalConfig portal;
/** . */
@@ -88,33 +65,39 @@
/** . */
private final String portalName;
+ /** . */
+ private final Locale portalLocale;
+
public UserPortalImpl(
UserPortalConfigService service,
- NavigationService navigationService,
- OrganizationService organizationService,
- UserACL acl,
String portalName,
PortalConfig portal,
String userName,
UserPortalContext context)
{
- // So we don't care about testing nullity
if (context == null)
{
- context = NULL_CONTEXT;
+ throw new NullPointerException("No null context argument allowed");
}
//
+ String locale = portal.getLocale();
+
+ //
+ this.portalLocale = locale != null ? new Locale(locale) : null;
this.service = service;
- this.navigationService = navigationService;
- this.organizationService = organizationService;
- this.acl = acl;
this.portalName = portalName;
this.portal = portal;
this.userName = userName;
this.context = context;
this.navigations = null;
}
+
+ public Locale getLocale()
+ {
+ return portalLocale;
+ }
+
/**
* Returns an immutable sorted list of the valid navigations related to the user.
*
@@ -126,16 +109,16 @@
if (navigations == null)
{
List<UserNavigation> navigations = new ArrayList<UserNavigation>(userName == null ? 1 : 10);
- NavigationContext portalNav = navigationService.loadNavigation(new SiteKey(SiteType.PORTAL, portalName));
+ NavigationContext portalNav = service.getNavigationService().loadNavigation(new SiteKey(SiteType.PORTAL, portalName));
if (portalNav != null && portalNav.getState() != null)
{
- navigations.add(new UserNavigation(this, portalNav, acl.hasEditPermission(portal)));
+ navigations.add(new UserNavigation(this, portalNav, service.getUserACL().hasEditPermission(portal)));
}
//
if (userName != null)
{
// Add user nav if any
- NavigationContext userNavigation = navigationService.loadNavigation(SiteKey.user(userName));
+ NavigationContext userNavigation = service.getNavigationService().loadNavigation(SiteKey.user(userName));
if (userNavigation != null && userNavigation.getState() != null)
{
navigations.add(new UserNavigation(this, userNavigation, true));
@@ -145,13 +128,13 @@
Collection<?> groups;
try
{
- if (acl.getSuperUser().equals(userName))
+ if (service.getUserACL().getSuperUser().equals(userName))
{
- groups = organizationService.getGroupHandler().getAllGroups();
+ groups = service.getOrganizationService().getGroupHandler().getAllGroups();
}
else
{
- groups = organizationService.getGroupHandler().findGroupsOfUser(userName);
+ groups = service.getOrganizationService().getGroupHandler().findGroupsOfUser(userName);
}
}
catch (Exception e)
@@ -164,15 +147,15 @@
{
Group m = (Group)group;
String groupId = m.getId().trim();
- if (!groupId.equals(acl.getGuestsGroup()))
+ if (!groupId.equals(service.getUserACL().getGuestsGroup()))
{
- NavigationContext groupNavigation = navigationService.loadNavigation(SiteKey.group(groupId));
+ NavigationContext groupNavigation = service.getNavigationService().loadNavigation(SiteKey.group(groupId));
if (groupNavigation != null && groupNavigation.getState() != null)
{
navigations.add(new UserNavigation(
this,
groupNavigation,
- acl.hasEditPermissionOnNavigation(groupNavigation.getKey())));
+ service.getUserACL().hasEditPermissionOnNavigation(groupNavigation.getKey())));
}
}
}
@@ -218,7 +201,7 @@
NodeChangeListener<UserNode> listener) throws NullPointerException, UserPortalException, NavigationServiceException
{
UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
- NodeContext<UserNode> nodeContext = navigationService.loadNode(context, userNavigation.navigation, scope, NodeContextChangeAdapter.safeWrap(listener));
+ NodeContext<UserNode> nodeContext = service.getNavigationService().loadNode(context, userNavigation.navigation, scope, NodeContextChangeAdapter.safeWrap(listener));
if (nodeContext != null)
{
return nodeContext.getNode().filter();
@@ -236,7 +219,7 @@
{
throw new NullPointerException("No null node accepted");
}
- navigationService.updateNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
+ service.getNavigationService().updateNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
node.filter();
}
@@ -247,7 +230,7 @@
{
throw new NullPointerException("No null node accepted");
}
- navigationService.rebaseNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
+ service.getNavigationService().rebaseNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
node.filter();
}
@@ -257,7 +240,7 @@
{
throw new NullPointerException("No null node accepted");
}
- navigationService.saveNode(node.context, NodeContextChangeAdapter.safeWrap(listener));
+ service.getNavigationService().saveNode(node.context, NodeContextChangeAdapter.safeWrap(listener));
node.filter();
}
@@ -280,7 +263,7 @@
void resolve() throws NavigationServiceException
{
UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
- NodeContext<UserNode> nodeContext = navigationService.loadNode(context, userNavigation.navigation, this, null);
+ NodeContext<UserNode> nodeContext = service.getNavigationService().loadNode(context, userNavigation.navigation, this, null);
if (context != null)
{
if (score > 0)
@@ -329,7 +312,7 @@
if (navigation.getState() != null)
{
UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
- NodeContext<UserNode> nodeContext = navigationService.loadNode(context, navigation, Scope.CHILDREN, null);
+ NodeContext<UserNode> nodeContext = service.getNavigationService().loadNode(context, navigation, Scope.CHILDREN, null);
if (nodeContext != null)
{
UserNode root = nodeContext.getNode().filter();
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -21,6 +21,7 @@
import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
import org.exoplatform.commons.chromattic.SessionContext;
import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.portal.mop.i18n.Injector;
/**
* Extends the chromattic life cycle to associate the mop session as an attachment of the chromattic session.
@@ -43,6 +44,7 @@
protected void onOpenSession(SessionContext context)
{
POMSession session = new POMSession(manager, this, context);
+ context.getSession().addEventListener(new Injector(context.getSession()));
context.setAttachment("mopsession", session);
}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle
===================================================================
--- portal/trunk/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1 +0,0 @@
-org.exoplatform.portal.mop.i18n.I18NAdapter$LifeCycle
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle (from rev 6784, portal/trunk/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/META-INF/services/org.gatein.mop.spi.AdapterLifeCycle 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1 @@
+org.exoplatform.portal.mop.i18n.I18NAdapter$LifeCycle
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -19,15 +19,21 @@
-->
-<binding>
+<binding>
- <format type="java.lang.String[]"
+ <format type="java.lang.String[]"
serializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.serializeStringArray"
deserializer="org.exoplatform.portal.config.serialize.JibxArraySerialize.deserializeStringArray"/>
<mapping class="org.exoplatform.portal.config.model.Properties" name="properties"
marshaller="org.exoplatform.portal.config.serialize.JibxPropertiesMapper"
- unmarshaller="org.exoplatform.portal.config.serialize.JibxPropertiesMapper"/>
+ unmarshaller="org.exoplatform.portal.config.serialize.JibxPropertiesMapper"/>
+
+ <mapping class="org.exoplatform.portal.config.model.LocalizedValue"
+ name="label"
+ unmarshaller="org.exoplatform.portal.config.serialize.LocalizedValueMapper"
+ marshaller="org.exoplatform.portal.config.serialize.LocalizedValueMapper">
+ </mapping>
<mapping
name="application"
@@ -92,7 +98,9 @@
<mapping name="node" label="node" class="org.exoplatform.portal.config.model.PageNode">
<value name="uri" field="uri" usage="optional"/>
<value name="name" field="name"/>
- <value name="label" field="label" usage="optional" set-method="setLabel"/>
+ <collection field="labels" ordered="false">
+ <structure map-as="org.exoplatform.portal.config.model.LocalizedValue" usage="optional"/>
+ </collection>
<value name="icon" field="icon" usage="optional"/>
<value name="start-publication-date" field="startPublicationDate" usage="optional"/>
<value name="end-publication-date" field="endPublicationDate" usage="optional"/>
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -20,6 +20,7 @@
package org.exoplatform.portal;
import junit.framework.TestCase;
+
import org.gatein.common.io.IOTools;
import java.io.InputStream;
@@ -55,10 +56,10 @@
assertEquals(expected, sb.toString());
}
- public void testGateInResources1_x() throws Exception
+ public void testGateInObjects1_x() throws Exception
{
assertHash("d0591b0a022a0c2929e1aed8979857cd", "gatein_objects_1_0.xsd");
assertHash("99ae24c9bbfe1b59e066756a29ab6c79", "gatein_objects_1_1.xsd");
- assertHash("a2d34899c8b645e32bfa7fc03b7cbe4d", "gatein_objects_1_2.xsd");
+ assertHash("8bb0cd234fc32e11149e38f689dd7cef", "gatein_objects_1_2.xsd");
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractPortalTest.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -58,6 +58,18 @@
super.end();
}
+ protected final void sync()
+ {
+ end();
+ begin();
+ }
+
+ protected final void sync(boolean save)
+ {
+ end(save);
+ begin();
+ }
+
@Override
protected void setUp() throws Exception
{
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -22,13 +22,19 @@
import org.exoplatform.component.test.AbstractGateInTest;
import org.exoplatform.portal.application.PortletPreferences.PortletPreferencesSet;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.LocalizedValue;
+import org.exoplatform.portal.config.model.ModelUnmarshaller;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.Page.PageSet;
import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.Page.PageSet;
+import org.exoplatform.portal.config.model.UnmarshalledObject;
+import org.exoplatform.portal.config.model.Version;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
+import org.gatein.common.util.Tools;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IMarshallingContext;
@@ -36,6 +42,8 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Locale;
/**
* Thu, May 15, 2003 @
@@ -86,12 +94,14 @@
PageNavigation pageNavigation = (PageNavigation)obj;
assertEquals("portal::classic::homepage", pageNavigation.getNode("home").getPageReference());
+/*
IMarshallingContext mctx = bfact.createMarshallingContext();
mctx.setIndent(2);
mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/navigation.xml"));
obj = uctx.unmarshalDocument(new FileInputStream("target/navigation.xml"), null);
assertEquals(PageNavigation.class, obj.getClass());
+*/
}
public void testPortletPreferencesMapping() throws Exception
@@ -122,4 +132,66 @@
Portlet preferences = (Portlet)portletState.getContentState();
assertEquals(new PortletBuilder().add("template", "template_value").build(), preferences);
}
+
+ public void testSimpleNavigationMapping() throws Exception
+ {
+ UnmarshalledObject<PageNavigation> obj = ModelUnmarshaller.unmarshall(PageNavigation.class, new FileInputStream("src/test/resources/jibx/simple-navigation.xml"));;
+ PageNavigation nav = obj.getObject();
+ assertEquals(Version.V_1_1, obj.getVersion());
+
+ //
+ PageNode bar = nav.getNode("bar");
+ assertEquals("bar_label", bar.getLabel());
+ ArrayList<LocalizedValue> barLabels = bar.getLabels();
+ assertNotNull(barLabels);
+ assertEquals(1, barLabels.size());
+ assertEquals("bar_label", barLabels.get(0).getValue());
+ assertEquals(null, barLabels.get(0).getLang());
+ assertEquals(null, bar.getLocalizedLabel(Locale.ENGLISH));
+ }
+
+ public void testExtendedNavigationMapping() throws Exception
+ {
+ UnmarshalledObject<PageNavigation> obj = ModelUnmarshaller.unmarshall(PageNavigation.class, new FileInputStream("src/test/resources/jibx/extended-navigation.xml"));;
+ PageNavigation nav = obj.getObject();
+ assertEquals(Version.V_1_2, obj.getVersion());
+
+ //
+ PageNode foo = nav.getNode("foo");
+ assertEquals("foo_label", foo.getLabel());
+ ArrayList<LocalizedValue> fooLabels = foo.getLabels();
+ assertNotNull(fooLabels);
+ assertEquals(3, fooLabels.size());
+ assertEquals("foo_label_en", fooLabels.get(0).getValue());
+ assertEquals(Locale.ENGLISH, fooLabels.get(0).getLang());
+ assertEquals("foo_label", fooLabels.get(1).getValue());
+ assertEquals(null, fooLabels.get(1).getLang());
+ assertEquals("foo_label_fr", fooLabels.get(2).getValue());
+ assertEquals(Locale.FRENCH, fooLabels.get(2).getLang());
+ assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH), foo.getLocalizedLabel(Locale.ENGLISH).keySet());
+ assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH, Locale.GERMAN), foo.getLocalizedLabel(Locale.GERMAN).keySet());
+
+ //
+ PageNode bar = nav.getNode("bar");
+ assertEquals("bar_label", bar.getLabel());
+ ArrayList<LocalizedValue> barLabels = bar.getLabels();
+ assertNotNull(barLabels);
+ assertEquals(1, barLabels.size());
+ assertEquals("bar_label", barLabels.get(0).getValue());
+ assertEquals(null, barLabels.get(0).getLang());
+ assertEquals(null, bar.getLocalizedLabel(Locale.ENGLISH));
+
+ //
+ PageNode juu = nav.getNode("juu");
+ assertEquals(null, juu.getLabel());
+ ArrayList<LocalizedValue> juuLabels = juu.getLabels();
+ assertNotNull(juuLabels);
+ assertEquals(3, juuLabels.size());
+ assertEquals("juu_label_en", juuLabels.get(0).getValue());
+ assertEquals(Locale.ENGLISH, juuLabels.get(0).getLang());
+ assertEquals("juu_label_fr", juuLabels.get(1).getValue());
+ assertEquals(Locale.FRENCH, juuLabels.get(1).getLang());
+ assertEquals("juu_label_fr_FR", juuLabels.get(2).getValue());
+ assertEquals(Locale.FRANCE, juuLabels.get(2).getLang());
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -19,12 +19,20 @@
package org.exoplatform.portal.config.importer;
+import org.exoplatform.portal.config.model.LocalizedValue;
import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.Described;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.navigation.*;
+import org.gatein.common.util.Tools;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.core.api.MOPService;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.Map;
+
import static org.exoplatform.portal.config.importer.Builder.*;
/**
@@ -62,7 +70,7 @@
PageNavigation src = navigation(name).build();
src.setPriority(2);
src.setOwnerId(name);
- NavigationImporter merge = new NavigationImporter(mode, src, service);
+ NavigationImporter merge = new NavigationImporter(Locale.ENGLISH, mode, false, src, service, descriptionService);
merge.perform();
//
@@ -85,7 +93,7 @@
//
PageNavigation src = builder.build();
src.setOwnerId("merge_create");
- NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
+ NavigationImporter merge = new NavigationImporter(Locale.ENGLISH, ImportMode.MERGE, false, src, service, descriptionService);
merge.perform();
//
@@ -113,7 +121,7 @@
//
PageNavigation src = builder.build();
src.setOwnerId("merge_nested");
- NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
+ NavigationImporter merge = new NavigationImporter(Locale.ENGLISH, ImportMode.MERGE, false, src, service, descriptionService);
merge.perform();
//
@@ -159,7 +167,7 @@
//
PageNavigation src = builder.build();
src.setOwnerId(name);
- NavigationImporter merge = new NavigationImporter(ImportMode.CONSERVE, src, service);
+ NavigationImporter merge = new NavigationImporter(Locale.ENGLISH, ImportMode.CONSERVE, false, src, service, descriptionService);
merge.perform();
//
@@ -178,7 +186,7 @@
builder = navigation(name).add(node("a").add(node("d"))).add(node("c"));
src = builder.build();
src.setOwnerId(name);
- merge = new NavigationImporter(importMode, src, service);
+ merge = new NavigationImporter(Locale.ENGLISH, importMode, false, src, service, descriptionService);
merge.perform();
//
@@ -250,7 +258,7 @@
//
PageNavigation src = navigation("merge_order").add(node("a"), node("b"), node("c")).build();
src.setOwnerId("merge_order");
- NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
+ NavigationImporter merge = new NavigationImporter(Locale.ENGLISH, ImportMode.MERGE, false, src, service, descriptionService);
merge.perform();
//
@@ -261,4 +269,94 @@
assertEquals("b", node.get(1).getName());
assertEquals("c", node.get(2).getName());
}
+
+ public void testExtendedLabel()
+ {
+ MOPService mop = mgr.getPOMService();
+ mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "importer_extended_label");
+ sync(true);
+
+ //
+ assertNull(service.loadNavigation(SiteKey.portal("importer_extended_label")));
+
+ //
+ PageNavigation src = navigation("importer_extended_label").add(node("a"), node("b"), node("c")).build();
+ src.getNode("a").setLabels(new ArrayList<LocalizedValue>(Arrays.asList(new LocalizedValue("a_en", Locale.ENGLISH), new LocalizedValue("a_fr", Locale.FRENCH))));
+ src.getNode("b").setLabels(new ArrayList<LocalizedValue>(Arrays.asList(new LocalizedValue("b_en"), new LocalizedValue("b_fr", Locale.FRENCH))));
+ src.getNode("c").setLabels(new ArrayList<LocalizedValue>(Arrays.asList(new LocalizedValue("c_en"))));
+ src.setOwnerId("importer_extended_label");
+ NavigationImporter importer = new NavigationImporter(Locale.ENGLISH, ImportMode.REIMPORT, true, src, service, descriptionService);
+ importer.perform();
+
+ //
+ NavigationContext ctx = service.loadNavigation(SiteKey.portal("importer_extended_label"));
+ NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
+
+ // The fully explicit case
+ NodeContext<?> a = (NodeContext<?>)node.getNode("a");
+ Map<Locale, Described.State> aDesc = descriptionService.getDescriptions(a.getId());
+ assertNotNull(aDesc);
+ assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH), aDesc.keySet());
+ assertEquals(new Described.State("a_en", null), aDesc.get(Locale.ENGLISH));
+ assertEquals(new Described.State("a_fr", null), aDesc.get(Locale.FRENCH));
+ assertNull(a.getState().getLabel());
+
+ // No explicit language means to use the portal locale
+ NodeContext<?> b = (NodeContext<?>)node.getNode("b");
+ Map<Locale, Described.State> bDesc = descriptionService.getDescriptions(b.getId());
+ assertNotNull(bDesc);
+ assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH), bDesc.keySet());
+ assertEquals(new Described.State("b_en", null), bDesc.get(Locale.ENGLISH));
+ assertEquals(new Described.State("b_fr", null), bDesc.get(Locale.FRENCH));
+ assertNull(b.getState().getLabel());
+
+ // The simple use case : one single label without the xml:lang attribute
+ NodeContext<?> c = (NodeContext<?>)node.getNode("c");
+ Map<Locale, Described.State> cDesc = descriptionService.getDescriptions(c.getId());
+ assertNotNull(cDesc);
+ assertEquals(Tools.toSet(Locale.ENGLISH), cDesc.keySet());
+ assertEquals(new Described.State("c_en", null), cDesc.get(Locale.ENGLISH));
+ assertEquals(null, c.getState().getLabel());
+ }
+
+ public void testSimpleLabel()
+ {
+ MOPService mop = mgr.getPOMService();
+ mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "importer_simple_label");
+ sync(true);
+
+ //
+ assertNull(service.loadNavigation(SiteKey.portal("importer_simple_label")));
+
+ //
+ PageNavigation src = navigation("importer_simple_label").add(node("a"), node("b"), node("c")).build();
+ src.getNode("a").setLabels(new ArrayList<LocalizedValue>(Arrays.asList(new LocalizedValue("a_en", Locale.ENGLISH), new LocalizedValue("a_fr", Locale.FRENCH))));
+ src.getNode("b").setLabels(new ArrayList<LocalizedValue>(Arrays.asList(new LocalizedValue("b_en"), new LocalizedValue("b_fr", Locale.FRENCH))));
+ src.getNode("c").setLabels(new ArrayList<LocalizedValue>(Arrays.asList(new LocalizedValue("c_en"))));
+ src.setOwnerId("importer_simple_label");
+ NavigationImporter importer = new NavigationImporter(Locale.ENGLISH, ImportMode.REIMPORT, false, src, service, descriptionService);
+ importer.perform();
+
+ //
+ NavigationContext ctx = service.loadNavigation(SiteKey.portal("importer_simple_label"));
+ NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
+
+ // The fully explicit case
+ NodeContext<?> a = (NodeContext<?>)node.getNode("a");
+ Map<Locale, Described.State> aDesc = descriptionService.getDescriptions(a.getId());
+ assertNull(aDesc);
+ assertEquals("a_en", a.getState().getLabel());
+
+ // No explicit language means to use the portal locale
+ NodeContext<?> b = (NodeContext<?>)node.getNode("b");
+ Map<Locale, Described.State> bDesc = descriptionService.getDescriptions(b.getId());
+ assertNull(bDesc);
+ assertEquals("b_en", b.getState().getLabel());
+
+ // The simple use case : one single label without the xml:lang attribute
+ NodeContext<?> c = (NodeContext<?>)node.getNode("c");
+ Map<Locale, Described.State> cDesc = descriptionService.getDescriptions(c.getId());
+ assertNull(cDesc);
+ assertEquals("c_en", c.getState().getLabel());
+ }
}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,36 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.i18n;
-
-import org.chromattic.api.annotations.MixinType;
-import org.chromattic.api.annotations.Property;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 22, 2011
- */
-
-@MixinType(name = "gtn:a")
-public abstract class A
-{
- @Property(name = "description")
- public abstract void setDescription(String description);
-
- public abstract String getDescription();
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/A.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.i18n;
+
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.Property;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 22, 2011
+ */
+
+@MixinType(name = "gtn:a")
+public abstract class A
+{
+ @Property(name = "description")
+ public abstract void setDescription(String description);
+
+ public abstract String getDescription();
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,32 +0,0 @@
-/**
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.i18n;
-
-import org.chromattic.api.annotations.MixinType;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 26, 2011
- */
-
-@MixinType(name = "gtn:b")
-public class B
-{
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/B.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.i18n;
+
+import org.chromattic.api.annotations.MixinType;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 26, 2011
+ */
+
+@MixinType(name = "gtn:b")
+public class B
+{
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,41 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.i18n;
-
-import org.chromattic.api.annotations.MixinType;
-import org.chromattic.api.annotations.Property;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 21, 2011
- */
-
-@MixinType(name = "gtn:described")
-public abstract class Described
-{
- @Property(name = "gtn:name")
- public abstract String getName();
-
- public abstract void setName(String name);
-
- @Property(name = "gtn:description")
- public abstract String getDescription();
-
- public abstract void setDescription(String description);
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/Described.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,41 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.i18n;
+
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.Property;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 21, 2011
+ */
+
+@MixinType(name = "gtn:described")
+public abstract class Described
+{
+ @Property(name = "gtn:name")
+ public abstract String getName();
+
+ public abstract void setName(String name);
+
+ @Property(name = "gtn:description")
+ public abstract String getDescription();
+
+ public abstract void setDescription(String description);
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,31 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.i18n;
-
-import org.chromattic.api.annotations.PrimaryType;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 21, 2011
- */
-@PrimaryType(name = "gtn:node")
-public abstract class NavigationNode
-{
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/NavigationNode.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.i18n;
+
+import org.chromattic.api.annotations.PrimaryType;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 21, 2011
+ */
+@PrimaryType(name = "gtn:node")
+public abstract class NavigationNode
+{
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,179 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.i18n;
-
-import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
-import org.exoplatform.commons.chromattic.ChromatticManager;
-import org.exoplatform.component.test.AbstractKernelTest;
-import org.exoplatform.component.test.ConfigurationUnit;
-import org.exoplatform.component.test.ConfiguredBy;
-import org.exoplatform.component.test.ContainerScope;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.mop.i18n.Injector;
-
-import org.chromattic.api.ChromatticSession;
-
-/**
- * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
- * Apr 21, 2011
- */
-
-@ConfiguredBy(
-{@ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.test.jcr-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/test-i18nframework-configuration.xml")})
-public class TestI18NFramework extends AbstractKernelTest
-{
- private ChromatticLifeCycle lifeCycle;
-
- private ChromatticManager chromatticManager;
-
- @Override
- protected void setUp() throws Exception
- {
-/*
- PortalContainer container = PortalContainer.getInstance();
- chromatticManager = (ChromatticManager) container.getComponentInstanceOfType(ChromatticManager.class);
- lifeCycle = chromatticManager.getLifeCycle("i18n");
- lifeCycle.openContext();
-*/
- }
-
- private <E> ChromatticSession createSampleData(String nodeName)
- {
- ChromatticSession session = lifeCycle.getChromattic().openSession();
- session.addEventListener(new Injector(session));
- NavigationNode node = session.insert(NavigationNode.class, nodeName);
- Described described = session.getEmbedded(node, Described.class);
- if (described == null)
- {
- described = session.create(Described.class);
- }
-
- A a = session.getEmbedded(node, A.class);
- if (a == null)
- {
- a = session.create(A.class);
- }
-
- session.setEmbedded(node, Described.class, described);
- session.setEmbedded(node, A.class, a);
-
- return session;
- }
-
- public void testFoo()
- {
-
- }
-
-/*
- public void testI18N()
- {
- String homepage_en = "Homepage";
- String homepage_vi = "Trangchu";
- String description_en = "This is the homepage";
-
- ChromatticSession session = createSampleData("node1");
- NavigationNode node = session.findByPath(NavigationNode.class, "node1");
-
- I18NFramework framework = new I18NFramework(session);
- Described describe_en = framework.putMixin(node, Described.class, "en");
- describe_en.setName(homepage_en);
-
- Described describe_vi = framework.putMixin(node, Described.class, "vi");
- describe_vi.setName(homepage_vi);
-
- Language language = session.findByPath(Language.class, "node1/gtn:languages/en");
- assertNotNull(language);
- Described describe_en_new = session.getEmbedded(language, Described.class);
- assertEquals(describe_en_new.getName(), homepage_en);
-
- language = session.findByPath(Language.class, "node1/gtn:languages/vi");
- assertNotNull(language);
- Described describe_vi_new = session.getEmbedded(language, Described.class);
- assertEquals(describe_vi_new.getName(), homepage_vi);
-
- A a_en = framework.putMixin(node, A.class, "en");
- a_en.setDescription(description_en);
-
- a_en = framework.getMixin(node, A.class, "en");
- assertEquals(description_en, a_en.getDescription());
- session.save();
- session.close();
- }
-
- public void testNotEmbedded()
- {
- String nodeTest = "testNotEmbedded";
- ChromatticSession session = this.createSampleData(nodeTest);
- NavigationNode node = session.findByPath(NavigationNode.class, nodeTest);
- I18NFramework framework = new I18NFramework(session);
- try
- {
- framework.putMixin(node, B.class, "en");
- fail();
- }
- catch (IllegalStateException e)
- {
- e.printStackTrace();
- }
-
- try
- {
- framework.getMixin(node, B.class, "en");
- fail();
- }
- catch(IllegalStateException e)
- {
- e.printStackTrace();
- }
- }
-
- public void testGetDefaultLanguage()
- {
- String nodeTest = "testGetDefaultLanguage";
- String name_en = "homepage";
- String name_vi = "trangchu";
- ChromatticSession session = this.createSampleData(nodeTest);
- NavigationNode node = session.findByPath(NavigationNode.class, nodeTest);
- Described described = session.getEmbedded(node, Described.class);
- described.setName(name_en);
-
- I18NFramework framework = new I18NFramework(session);
- described = framework.putMixin(node, Described.class, "vi");
- described.setName(name_vi);
-
- described = framework.getMixin(node, Described.class, "en");
- assertNotNull(described);
- assertEquals(described.getName(), name_en);
-
- described = framework.getMixin(node, Described.class, "vi");
- assertNotNull(described);
- assertEquals(described.getName(), name_vi);
- }
-*/
-
- @Override
- protected void tearDown() throws Exception
- {
-/*
- lifeCycle.closeContext(false);
-*/
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/TestI18NFramework.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,179 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.i18n;
+
+import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
+import org.exoplatform.commons.chromattic.ChromatticManager;
+import org.exoplatform.component.test.AbstractKernelTest;
+import org.exoplatform.component.test.ConfigurationUnit;
+import org.exoplatform.component.test.ConfiguredBy;
+import org.exoplatform.component.test.ContainerScope;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.mop.i18n.Injector;
+
+import org.chromattic.api.ChromatticSession;
+
+/**
+ * @author <a href="mailto:khoi.nguyen@exoplatform.com">Nguyen Duc Khoi</a>
+ * Apr 21, 2011
+ */
+
+@ConfiguredBy(
+{@ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.test.jcr-configuration.xml"),
+ @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/test-i18nframework-configuration.xml")})
+public class TestI18NFramework extends AbstractKernelTest
+{
+ private ChromatticLifeCycle lifeCycle;
+
+ private ChromatticManager chromatticManager;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+/*
+ PortalContainer container = PortalContainer.getInstance();
+ chromatticManager = (ChromatticManager) container.getComponentInstanceOfType(ChromatticManager.class);
+ lifeCycle = chromatticManager.getLifeCycle("i18n");
+ lifeCycle.openContext();
+*/
+ }
+
+ private <E> ChromatticSession createSampleData(String nodeName)
+ {
+ ChromatticSession session = lifeCycle.getChromattic().openSession();
+ session.addEventListener(new Injector(session));
+ NavigationNode node = session.insert(NavigationNode.class, nodeName);
+ Described described = session.getEmbedded(node, Described.class);
+ if (described == null)
+ {
+ described = session.create(Described.class);
+ }
+
+ A a = session.getEmbedded(node, A.class);
+ if (a == null)
+ {
+ a = session.create(A.class);
+ }
+
+ session.setEmbedded(node, Described.class, described);
+ session.setEmbedded(node, A.class, a);
+
+ return session;
+ }
+
+ public void testFoo()
+ {
+
+ }
+
+/*
+ public void testI18N()
+ {
+ String homepage_en = "Homepage";
+ String homepage_vi = "Trangchu";
+ String description_en = "This is the homepage";
+
+ ChromatticSession session = createSampleData("node1");
+ NavigationNode node = session.findByPath(NavigationNode.class, "node1");
+
+ I18NFramework framework = new I18NFramework(session);
+ Described describe_en = framework.putMixin(node, Described.class, "en");
+ describe_en.setName(homepage_en);
+
+ Described describe_vi = framework.putMixin(node, Described.class, "vi");
+ describe_vi.setName(homepage_vi);
+
+ Language language = session.findByPath(Language.class, "node1/gtn:languages/en");
+ assertNotNull(language);
+ Described describe_en_new = session.getEmbedded(language, Described.class);
+ assertEquals(describe_en_new.getName(), homepage_en);
+
+ language = session.findByPath(Language.class, "node1/gtn:languages/vi");
+ assertNotNull(language);
+ Described describe_vi_new = session.getEmbedded(language, Described.class);
+ assertEquals(describe_vi_new.getName(), homepage_vi);
+
+ A a_en = framework.putMixin(node, A.class, "en");
+ a_en.setDescription(description_en);
+
+ a_en = framework.getMixin(node, A.class, "en");
+ assertEquals(description_en, a_en.getDescription());
+ session.save();
+ session.close();
+ }
+
+ public void testNotEmbedded()
+ {
+ String nodeTest = "testNotEmbedded";
+ ChromatticSession session = this.createSampleData(nodeTest);
+ NavigationNode node = session.findByPath(NavigationNode.class, nodeTest);
+ I18NFramework framework = new I18NFramework(session);
+ try
+ {
+ framework.putMixin(node, B.class, "en");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ e.printStackTrace();
+ }
+
+ try
+ {
+ framework.getMixin(node, B.class, "en");
+ fail();
+ }
+ catch(IllegalStateException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void testGetDefaultLanguage()
+ {
+ String nodeTest = "testGetDefaultLanguage";
+ String name_en = "homepage";
+ String name_vi = "trangchu";
+ ChromatticSession session = this.createSampleData(nodeTest);
+ NavigationNode node = session.findByPath(NavigationNode.class, nodeTest);
+ Described described = session.getEmbedded(node, Described.class);
+ described.setName(name_en);
+
+ I18NFramework framework = new I18NFramework(session);
+ described = framework.putMixin(node, Described.class, "vi");
+ described.setName(name_vi);
+
+ described = framework.getMixin(node, Described.class, "en");
+ assertNotNull(described);
+ assertEquals(described.getName(), name_en);
+
+ described = framework.getMixin(node, Described.class, "vi");
+ assertNotNull(described);
+ assertEquals(described.getName(), name_vi);
+ }
+*/
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+/*
+ lifeCycle.closeContext(false);
+*/
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,22 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-@NodeTypeDefs package org.exoplatform.portal.i18n;
-
-import org.chromattic.api.annotations.NodeTypeDefs;
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/i18n/package-info.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,22 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+@NodeTypeDefs package org.exoplatform.portal.i18n;
+
+import org.chromattic.api.annotations.NodeTypeDefs;
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.description;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.config.AbstractPortalTest;
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.mop.i18n.I18Nized;
-import org.exoplatform.portal.mop.navigation.NavigationServiceImpl;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.gatein.common.util.Tools;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.core.api.MOPService;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class TestDescriptionService extends AbstractPortalTest
-{
-
- /** . */
- protected POMSessionManager mgr;
-
- /** . */
- protected NavigationServiceImpl service;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- //
- PortalContainer container = PortalContainer.getInstance();
- mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- service = new NavigationServiceImpl(mgr);
-// dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-
- // Clear the cache for each test
- service.clearCache();
-
- //
- begin();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- end();
- super.tearDown();
- }
-
- public void testResolveNoDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- String id = nav.getObjectId();
-
- //
- assertEquals(null, svc.resolveDescription(id, null, Locale.ENGLISH));
- }
-
- public void testResolveDefaultDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- Described described = nav.adapt(Described.class);
- described.setName("foo_name");
- String id = nav.getObjectId();
-
- //
- assertEquals(null, svc.resolveDescription(id, null, Locale.ENGLISH));
- }
-
- public void testResolveLocalizedDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- I18Nized i18nized = nav.adapt(I18Nized.class);
- Described described = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
- described.setName("name_en");
- described = i18nized.getMixin(Described.class, Locale.UK, true);
- described.setName("name_en_GB");
- String id = nav.getObjectId();
-
- //
- assertEquals(null, svc.resolveDescription(id, null, Locale.GERMAN));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.ENGLISH, Locale.GERMAN));
- assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, Locale.UK, Locale.GERMAN));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.US, Locale.GERMAN));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.ENGLISH));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.US));
- assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, null, Locale.UK));
- }
-
- public void testResolveDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- Described described = nav.adapt(Described.class);
- described.setName("name");
- I18Nized i18nized = nav.adapt(I18Nized.class);
- described = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
- described.setName("name_en");
- described = i18nized.getMixin(Described.class, Locale.UK, true);
- described.setName("name_en_GB");
- String id = nav.getObjectId();
-
- //
- assertEquals(null, svc.resolveDescription(id, null, Locale.GERMAN));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.ENGLISH, Locale.GERMAN));
- assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, Locale.UK, Locale.GERMAN));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.US, Locale.GERMAN));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.ENGLISH));
- assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.US));
- assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, null, Locale.UK));
- }
-
- public void testGetDefaultDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- String id = nav.getObjectId();
- Described described = nav.adapt(Described.class);
- described.setName("foo_name");
-
- //
- assertEquals(new Described.State("foo_name", null), svc.getDescription(id));
- }
-
- public void testSetDefaultDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- String id = nav.getObjectId();
-
- //
- assertNull(svc.getDescription(id));
-
- //
- svc.setDescription(id, new Described.State("foo_name", null));
-
- //
- assertTrue(nav.isAdapted(Described.class));
- Described described = nav.adapt(Described.class);
- assertEquals("foo_name", described.getName());
- }
-
- public void testRemoveDefaultDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- String id = nav.getObjectId();
- Described described = nav.adapt(Described.class);
- described.setName("foo_name");
-
- //
- svc.setDescription(id, null);
- }
-
- public void testSetLocalizedDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
-
- //
- svc.setDescription(nav.getObjectId(), Locale.ENGLISH, new Described.State("foo_english", null));
-
- //
- assertTrue(nav.isAdapted(I18Nized.class));
- I18Nized ized = nav.adapt(I18Nized.class);
- Described desc = ized.getMixin(Described.class, Locale.ENGLISH, false);
- assertNotNull(desc);
- assertEquals("foo_english", desc.getName());
- }
-
- public void testAddLocalizedDescription() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
- I18Nized i18nized = nav.adapt(I18Nized.class);
- Described desc = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
- desc.setName("add_english");
-
- //
- svc.setDescription(nav.getObjectId(), Locale.FRENCH, new Described.State("add_french", null));
-
- //
- assertTrue(nav.isAdapted(I18Nized.class));
- I18Nized ized = nav.adapt(I18Nized.class);
- desc = ized.getMixin(Described.class, Locale.ENGLISH, false);
- assertNotNull(desc);
- assertEquals("add_english", desc.getName());
- desc = ized.getMixin(Described.class, Locale.FRENCH, false);
- assertNotNull(desc);
- assertEquals("add_french", desc.getName());
- }
-
- public void testGetDescriptions() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
-
- //
- assertNull(svc.getDescriptions(nav.getObjectId()));
-
- //
- I18Nized i18nized = nav.adapt(I18Nized.class);
- Described described = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
- described.setName("foo_english");
- described = i18nized.getMixin(Described.class, Locale.FRENCH, true);
- described.setName("foo_french");
-
- //
- Map<Locale, Described.State> description = svc.getDescriptions(nav.getObjectId());
- assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH), description.keySet());
- assertEquals(new Described.State("foo_english", null), description.get(Locale.ENGLISH));
- assertEquals(new Described.State("foo_french", null), description.get(Locale.FRENCH));
- }
-
- public void testSetDescriptions() throws Exception
- {
- DescriptionService svc = new DescriptionServiceImpl(mgr);
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
- Navigation nav = portal.getRootNavigation().addChild("default");
-
- //
- assertNull(svc.getDescriptions(nav.getObjectId()));
-
- //
- Map<Locale, Described.State> description = new HashMap<Locale, Described.State>();
- description.put(Locale.ENGLISH, new Described.State("bar_english", null));
- description.put(Locale.FRENCH, new Described.State("bar_french", null));
- svc.setDescriptions(nav.getObjectId(), description);
-
- //
- description = svc.getDescriptions(nav.getObjectId());
- assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH), description.keySet());
- assertEquals(new Described.State("bar_english", null), description.get(Locale.ENGLISH));
- assertEquals(new Described.State("bar_french", null), description.get(Locale.FRENCH));
-
- //
- description = new HashMap<Locale, Described.State>();
- description.put(Locale.ENGLISH, new Described.State("bar_english_2", null));
- svc.setDescriptions(nav.getObjectId(), description);
-
- //
- description = svc.getDescriptions(nav.getObjectId());
- assertEquals(Tools.toSet(Locale.ENGLISH), description.keySet());
- assertEquals(new Described.State("bar_english_2", null), description.get(Locale.ENGLISH));
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,295 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.description;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.AbstractPortalTest;
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.i18n.I18Nized;
+import org.exoplatform.portal.mop.navigation.NavigationServiceImpl;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.gatein.common.util.Tools;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.core.api.MOPService;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestDescriptionService extends AbstractPortalTest
+{
+
+ /** . */
+ protected POMSessionManager mgr;
+
+ /** . */
+ protected NavigationServiceImpl service;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ //
+ PortalContainer container = PortalContainer.getInstance();
+ mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ service = new NavigationServiceImpl(mgr);
+// dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+
+ // Clear the cache for each test
+ service.clearCache();
+
+ //
+ begin();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ end();
+ super.tearDown();
+ }
+
+ public void testResolveNoDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ String id = nav.getObjectId();
+
+ //
+ assertEquals(null, svc.resolveDescription(id, null, Locale.ENGLISH));
+ }
+
+ public void testResolveDefaultDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ Described described = nav.adapt(Described.class);
+ described.setName("foo_name");
+ String id = nav.getObjectId();
+
+ //
+ assertEquals(null, svc.resolveDescription(id, null, Locale.ENGLISH));
+ }
+
+ public void testResolveLocalizedDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ I18Nized i18nized = nav.adapt(I18Nized.class);
+ Described described = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
+ described.setName("name_en");
+ described = i18nized.getMixin(Described.class, Locale.UK, true);
+ described.setName("name_en_GB");
+ String id = nav.getObjectId();
+
+ //
+ assertEquals(null, svc.resolveDescription(id, null, Locale.GERMAN));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.ENGLISH, Locale.GERMAN));
+ assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, Locale.UK, Locale.GERMAN));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.US, Locale.GERMAN));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.ENGLISH));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.US));
+ assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, null, Locale.UK));
+ }
+
+ public void testResolveDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ Described described = nav.adapt(Described.class);
+ described.setName("name");
+ I18Nized i18nized = nav.adapt(I18Nized.class);
+ described = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
+ described.setName("name_en");
+ described = i18nized.getMixin(Described.class, Locale.UK, true);
+ described.setName("name_en_GB");
+ String id = nav.getObjectId();
+
+ //
+ assertEquals(null, svc.resolveDescription(id, null, Locale.GERMAN));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.ENGLISH, Locale.GERMAN));
+ assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, Locale.UK, Locale.GERMAN));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, Locale.US, Locale.GERMAN));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.ENGLISH));
+ assertEquals(new Described.State("name_en", null), svc.resolveDescription(id, null, Locale.US));
+ assertEquals(new Described.State("name_en_GB", null), svc.resolveDescription(id, null, Locale.UK));
+ }
+
+ public void testGetDefaultDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ String id = nav.getObjectId();
+ Described described = nav.adapt(Described.class);
+ described.setName("foo_name");
+
+ //
+ assertEquals(new Described.State("foo_name", null), svc.getDescription(id));
+ }
+
+ public void testSetDefaultDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ String id = nav.getObjectId();
+
+ //
+ assertNull(svc.getDescription(id));
+
+ //
+ svc.setDescription(id, new Described.State("foo_name", null));
+
+ //
+ assertTrue(nav.isAdapted(Described.class));
+ Described described = nav.adapt(Described.class);
+ assertEquals("foo_name", described.getName());
+ }
+
+ public void testRemoveDefaultDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ String id = nav.getObjectId();
+ Described described = nav.adapt(Described.class);
+ described.setName("foo_name");
+
+ //
+ svc.setDescription(id, null);
+ }
+
+ public void testSetLocalizedDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+
+ //
+ svc.setDescription(nav.getObjectId(), Locale.ENGLISH, new Described.State("foo_english", null));
+
+ //
+ assertTrue(nav.isAdapted(I18Nized.class));
+ I18Nized ized = nav.adapt(I18Nized.class);
+ Described desc = ized.getMixin(Described.class, Locale.ENGLISH, false);
+ assertNotNull(desc);
+ assertEquals("foo_english", desc.getName());
+ }
+
+ public void testAddLocalizedDescription() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ I18Nized i18nized = nav.adapt(I18Nized.class);
+ Described desc = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
+ desc.setName("add_english");
+
+ //
+ svc.setDescription(nav.getObjectId(), Locale.FRENCH, new Described.State("add_french", null));
+
+ //
+ assertTrue(nav.isAdapted(I18Nized.class));
+ I18Nized ized = nav.adapt(I18Nized.class);
+ desc = ized.getMixin(Described.class, Locale.ENGLISH, false);
+ assertNotNull(desc);
+ assertEquals("add_english", desc.getName());
+ desc = ized.getMixin(Described.class, Locale.FRENCH, false);
+ assertNotNull(desc);
+ assertEquals("add_french", desc.getName());
+ }
+
+ public void testGetDescriptions() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+
+ //
+ assertNull(svc.getDescriptions(nav.getObjectId()));
+
+ //
+ I18Nized i18nized = nav.adapt(I18Nized.class);
+ Described described = i18nized.getMixin(Described.class, Locale.ENGLISH, true);
+ described.setName("foo_english");
+ described = i18nized.getMixin(Described.class, Locale.FRENCH, true);
+ described.setName("foo_french");
+
+ //
+ Map<Locale, Described.State> description = svc.getDescriptions(nav.getObjectId());
+ assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH), description.keySet());
+ assertEquals(new Described.State("foo_english", null), description.get(Locale.ENGLISH));
+ assertEquals(new Described.State("foo_french", null), description.get(Locale.FRENCH));
+ }
+
+ public void testSetDescriptions() throws Exception
+ {
+ DescriptionService svc = new DescriptionServiceImpl(mgr);
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "foo");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+
+ //
+ assertNull(svc.getDescriptions(nav.getObjectId()));
+
+ //
+ Map<Locale, Described.State> description = new HashMap<Locale, Described.State>();
+ description.put(Locale.ENGLISH, new Described.State("bar_english", null));
+ description.put(Locale.FRENCH, new Described.State("bar_french", null));
+ svc.setDescriptions(nav.getObjectId(), description);
+
+ //
+ description = svc.getDescriptions(nav.getObjectId());
+ assertEquals(Tools.toSet(Locale.ENGLISH, Locale.FRENCH), description.keySet());
+ assertEquals(new Described.State("bar_english", null), description.get(Locale.ENGLISH));
+ assertEquals(new Described.State("bar_french", null), description.get(Locale.FRENCH));
+
+ //
+ description = new HashMap<Locale, Described.State>();
+ description.put(Locale.ENGLISH, new Described.State("bar_english_2", null));
+ svc.setDescriptions(nav.getObjectId(), description);
+
+ //
+ description = svc.getDescriptions(nav.getObjectId());
+ assertEquals(Tools.toSet(Locale.ENGLISH), description.keySet());
+ assertEquals(new Described.State("bar_english_2", null), description.get(Locale.ENGLISH));
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -23,6 +23,8 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.config.AbstractPortalTest;
import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.mop.description.DescriptionService;
+import org.exoplatform.portal.mop.description.DescriptionServiceImpl;
import org.exoplatform.portal.pom.config.POMSessionManager;
/**
@@ -40,6 +42,9 @@
/** . */
protected DataStorage dataStorage;
+ /** . */
+ protected DescriptionService descriptionService;
+
@Override
protected void setUp() throws Exception
{
@@ -49,6 +54,7 @@
PortalContainer container = PortalContainer.getInstance();
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
service = new NavigationServiceImpl(mgr);
+ descriptionService = new DescriptionServiceImpl(mgr);
dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
// Clear the cache for each test
@@ -58,18 +64,6 @@
begin();
}
- protected void sync()
- {
- end();
- begin();
- }
-
- protected void sync(boolean save)
- {
- end(save);
- begin();
- }
-
@Override
protected void end(boolean save)
{
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/SimpleUserPortalContext.java (from rev 6784, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/SimpleUserPortalContext.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/SimpleUserPortalContext.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/SimpleUserPortalContext.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import org.exoplatform.portal.mop.SiteKey;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * A simple implementation for unit tests.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class SimpleUserPortalContext implements UserPortalContext
+{
+
+ /** . */
+ private final Map<SiteKey, ResourceBundle> bundles;
+
+ /** . */
+ private final Locale locale;
+
+ public SimpleUserPortalContext(Locale locale)
+ {
+ this.locale = locale;
+ this.bundles = new HashMap<SiteKey, ResourceBundle>();
+ }
+
+ void add(SiteKey key, ResourceBundle bundle)
+ {
+ bundles.put(key, bundle);
+ }
+
+ public ResourceBundle getBundle(UserNavigation navigation)
+ {
+ return bundles.get(navigation.getKey());
+ }
+
+ public Locale getUserLocale()
+ {
+ return locale;
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -48,6 +48,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.TimeZone;
@@ -469,23 +470,12 @@
{
public void execute() throws Exception
{
- UserPortalContext userPortalContext = new UserPortalContext()
- {
- final MapResourceBundle bundle;
-
- {
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("portal.classic.home", "foo");
- map.put("portal.classic.emoh", "bar");
- bundle = new MapResourceBundle(map);
- }
-
- public ResourceBundle getBundle(UserNavigation navigation)
- {
- return bundle;
- }
- };
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId(), userPortalContext);
+ SimpleUserPortalContext ctx = new SimpleUserPortalContext(Locale.ENGLISH);
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("portal.classic.home", "foo");
+ map.put("portal.classic.emoh", "bar");
+ ctx.add(SiteKey.portal("classic"), new MapResourceBundle(map));
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId(), ctx);
UserPortal userPortal = userPortalCfg.getUserPortal();
//
@@ -501,6 +491,33 @@
}.execute("root");
}
+ public void testExtendedLabel()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalContext ctx = new SimpleUserPortalContext(Locale.ENGLISH);
+ UserPortal portal = userPortalConfigSer_.getUserPortalConfig("extended", getUserId(), ctx).getUserPortal();
+ UserNode path = portal.resolvePath(null, "/bar");
+ assertEquals(null, path.getLabel());
+ assertEquals("bar_label_en", path.getResolvedLabel());
+
+ // Now test transient node
+ UserNode juu = path.addChild("juu");
+ assertEquals(null, juu.getLabel());
+ assertEquals("juu", juu.getResolvedLabel());
+
+ //
+ ctx = new SimpleUserPortalContext(Locale.FRENCH);
+ portal = userPortalConfigSer_.getUserPortalConfig("extended", getUserId(), ctx).getUserPortal();
+ path = portal.resolvePath(null, "/bar");
+ assertEquals(null, path.getLabel());
+ assertEquals("bar_label_fr", path.getResolvedLabel());
+ }
+ }.execute("root");
+ }
+
public void testLoadNode()
{
new UnitTest()
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -111,6 +111,11 @@
</component>
<component>
+ <key>org.exoplatform.portal.mop.description.DescriptionService</key>
+ <type>org.exoplatform.portal.mop.description.DescriptionServiceImpl</type>
+ </component>
+
+ <component>
<key>org.exoplatform.portal.config.UserPortalConfigService</key>
<type>org.exoplatform.portal.config.UserPortalConfigService</type>
</component>
@@ -201,6 +206,9 @@
<value>org.exoplatform.portal.mop.Described</value>
<value>org.exoplatform.portal.mop.Visible</value>
<value>org.exoplatform.portal.config.SampleMixin</value>
+ <value>org.exoplatform.portal.mop.i18n.I18Nized</value>
+ <value>org.exoplatform.portal.mop.i18n.LanguageSpace</value>
+ <value>org.exoplatform.portal.mop.i18n.Language</value>
</values-param>
</init-params>
</component-plugin>
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -98,6 +98,9 @@
<value>
<string>large</string>
</value>
+ <value>
+ <string>extended</string>
+ </value>
</collection>
</field>
<field name="ownerType">
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/test-i18nframework-configuration.xml (from rev 6784, portal/trunk/component/portal/src/test/resources/conf/test-i18nframework-configuration.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/test-i18nframework-configuration.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/test-i18nframework-configuration.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Copyright (C) 2011 eXo Platform SAS.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.commons.chromattic.ChromatticManager</key>
+ <type>org.exoplatform.commons.chromattic.ChromatticManager</type>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.commons.chromattic.ChromatticManager</target-component>
+ <component-plugin>
+ <name>Chromattic</name>
+ <set-method>addLifeCycle</set-method>
+ <type>org.exoplatform.commons.chromattic.ChromatticLifeCycle</type>
+ <init-params>
+ <value-param>
+ <name>domain-name</name>
+ <value>i18n</value>
+ </value-param>
+ <value-param>
+ <name>workspace-name</name>
+ <value>portal-test</value>
+ </value-param>
+ <values-param>
+ <name>entities</name>
+ <value>org.exoplatform.portal.i18n.A</value>
+ <value>org.exoplatform.portal.i18n.B</value>
+ <value>org.exoplatform.portal.i18n.Described</value>
+ <value>org.exoplatform.portal.i18n.NavigationNode</value>
+ <value>org.exoplatform.portal.mop.i18n.I18Nized</value>
+ <value>org.exoplatform.portal.mop.i18n.LanguageSpace</value>
+ <value>org.exoplatform.portal.mop.i18n.Language</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
+ <component-plugin>
+ <name>add.namespaces</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+ <init-params>
+ <properties-param>
+ <name>namespaces</name>
+ <property name="gtn" value="http://www.gatein.org/jcr/gatein/1.0/" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>add.nodeType</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin
+ </type>
+ <init-params>
+ <values-param>
+ <name>autoCreatedInNewRepository</name>
+ <description>Node types configuration file</description>
+ <value>jar:/org/exoplatform/portal/i18n/nodetypes.xml</value>
+ <value>jar:/org/exoplatform/portal/mop/i18n/nodetypes.xml</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/extended-navigation.xml (from rev 6784, portal/trunk/component/portal/src/test/resources/jibx/extended-navigation.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/extended-navigation.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/extended-navigation.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (C) 2011 eXo Platform SAS.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<node-navigation
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>1</priority>
+
+ <page-nodes>
+ <node>
+ <uri>bar</uri>
+ <name>bar</name>
+ <label>bar_label</label>
+ </node>
+ <node>
+ <uri>foo</uri>
+ <name>foo</name>
+ <label xml:lang="en">foo_label_en</label>
+ <label>foo_label</label>
+ <label xml:lang="fr">foo_label_fr</label>
+ </node>
+ <node>
+ <uri>juu</uri>
+ <name>juu</name>
+ <label xml:lang="en">juu_label_en</label>
+ <label xml:lang="fr">juu_label_fr</label>
+ <label xml:lang="fr-FR">juu_label_fr_FR</label>
+ </node>
+ </page-nodes>
+</node-navigation>
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/simple-navigation.xml (from rev 6784, portal/trunk/component/portal/src/test/resources/jibx/simple-navigation.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/simple-navigation.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/jibx/simple-navigation.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (C) 2011 eXo Platform SAS.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<node-navigation
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_1 http://www.gatein.org/xml/ns/gatein_objects_1_1"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_1">
+ <priority>1</priority>
+
+ <page-nodes>
+ <node>
+ <uri>bar</uri>
+ <name>bar</name>
+ <label>bar_label</label>
+ </node>
+ </page-nodes>
+</node-navigation>
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/navigation.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/portal/portal/extended/navigation.xml 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/navigation.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright (C) 2011 eXo Platform SAS.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
-<node-navigation
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
- xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <priority>1</priority>
- <page-nodes>
- <node>
- <uri>foo</uri>
- <name>foo</name>
- <label>foo_label</label>
- </node>
- <node>
- <uri>bar</uri>
- <name>bar</name>
- <label xml:lang="en">bar_label_en</label>
- <label xml:lang="fr">bar_label_fr</label>
- </node>
- </page-nodes>
-</node-navigation>
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/navigation.xml (from rev 6784, portal/trunk/component/portal/src/test/resources/portal/portal/extended/navigation.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/navigation.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/navigation.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (C) 2011 eXo Platform SAS.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<node-navigation
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <priority>1</priority>
+ <page-nodes>
+ <node>
+ <uri>foo</uri>
+ <name>foo</name>
+ <label>foo_label</label>
+ </node>
+ <node>
+ <uri>bar</uri>
+ <name>bar</name>
+ <label xml:lang="en">bar_label_en</label>
+ <label xml:lang="fr">bar_label_fr</label>
+ </node>
+ </page-nodes>
+</node-navigation>
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/portal.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/portal/portal/extended/portal.xml 2011-07-01 07:05:25 UTC (rev 6784)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/portal.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Copyright (C) 2011 eXo Platform SAS.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
-<portal-config>
- <portal-name>extended</portal-name>
- <locale>en</locale>
- <access-permissions>Everyone</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
- <portal-layout>
- </portal-layout>
-</portal-config>
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/portal.xml (from rev 6784, portal/trunk/component/portal/src/test/resources/portal/portal/extended/portal.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/portal.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/extended/portal.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Copyright (C) 2011 eXo Platform SAS.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<portal-config>
+ <portal-name>extended</portal-name>
+ <locale>en</locale>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <portal-layout>
+ </portal-layout>
+</portal-config>
Modified: epp/portal/branches/EPP_5_2_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -49,17 +49,13 @@
<org.gatein.pc.version>2.3.0-Beta04</org.gatein.pc.version>
<org.picketlink.idm>1.3.0.Alpha03</org.picketlink.idm>
<org.gatein.wsrp.version>2.1.0-Beta04</org.gatein.wsrp.version>
- <org.gatein.mop.version>1.1.0-Beta03</org.gatein.mop.version>
+ <org.gatein.mop.version>1.1.0-Beta05</org.gatein.mop.version>
<org.slf4j.version>1.5.8</org.slf4j.version>
<commons-pool.version>1.5.5</commons-pool.version>
<rhino.version>1.6R5</rhino.version>
<org.codehaus.groovy.version>1.7.6</org.codehaus.groovy.version>
<javax.servlet.version>2.5</javax.servlet.version>
- <org.slf4j.version>1.5.6</org.slf4j.version>
- <rhino.version>1.6R5</rhino.version>
- <org.codehaus.groovy.version>1.7.6</org.codehaus.groovy.version>
- <javax.servlet.version>2.5</javax.servlet.version>
- <version.chromattic>1.1.0-beta5</version.chromattic>
+ <version.chromattic>1.1.0-beta6</version.chromattic>
<version.reflect>1.1.0-beta12</version.reflect>
<jcip.version>1.0</jcip.version>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -1,17 +1,19 @@
package org.exoplatform.navigation.webui;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
+import org.exoplatform.portal.mop.Described.State;
import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.mop.navigation.NavigationServiceException;
import org.exoplatform.portal.mop.navigation.NodeChangeListener;
import org.exoplatform.portal.mop.navigation.NodeState;
import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.webui.util.Util;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
/**
* A wrapper class of {@link UserNode} for manipulation in WebUI part
*
@@ -35,6 +37,8 @@
private String id;
private List<TreeNode> children;
+
+ private Map<Locale, State> i18nizedLabels;
public TreeNode(UserNavigation nav, UserNode node)
{
@@ -50,7 +54,7 @@
this.nav = nav;
this.node = node;
}
-
+
public List<TreeNode> getChildren()
{
if (children == null)
@@ -205,6 +209,26 @@
public String getEncodedResolvedLabel()
{
+ if (getLabel() == null)
+ {
+ if (i18nizedLabels != null)
+ {
+ Locale locale = Util.getPortalRequestContext().getLocale();
+ for (Locale key : i18nizedLabels.keySet())
+ {
+ if (key.equals(locale))
+ {
+ String label = i18nizedLabels.get(key).getName();
+ if (label == null || label.trim().length() == 0)
+ {
+ return node.getName();
+ }
+
+ return label;
+ }
+ }
+ }
+ }
String encodedLabel = node.getEncodedResolvedLabel();
return encodedLabel == null ? "" : encodedLabel;
}
@@ -360,4 +384,14 @@
fromTreeNode.children = null;
toTreeNode.children = null;
}
+
+ public void setI18nizedLabels(Map<Locale, State> labels)
+ {
+ this.i18nizedLabels = labels;
+ }
+
+ public Map<Locale, State> getI18nizedLabels()
+ {
+ return i18nizedLabels;
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -50,6 +50,7 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.event.EventListener;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -71,6 +72,8 @@
@ComponentConfig(type = UIPageNodeForm.class, lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(listeners = UIPageNodeForm.SaveActionListener.class),
@EventConfig(listeners = UIGroupNavigationManagement.BackActionListener.class, phase = Phase.DECODE),
+ @EventConfig(listeners = UIPageNodeForm.ChangeLanguageActionListener.class, phase = Phase.DECODE),
+ @EventConfig(listeners = UIPageNodeForm.SwitchLabelModeActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchPublicationDateActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchVisibleActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.ClearPageActionListener.class, phase = Phase.DECODE),
@@ -298,6 +301,7 @@
uiNavigationPopup.setRendered(true);
event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
+ selector.getUserNodeLabels().put(uiPageNodeForm.getPageNode().getId(), uiPageNodeForm.getPageNode().getI18nizedLabels());
selector.createEvent("NodeModified", Phase.PROCESS, event.getRequestContext()).broadcast();
}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -19,16 +19,16 @@
package org.exoplatform.navigation.webui.component;
-import java.util.Collection;
-
import org.exoplatform.navigation.webui.TreeNode;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.mop.Described.State;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.description.DescriptionService;
import org.exoplatform.portal.mop.navigation.NavigationError;
import org.exoplatform.portal.mop.navigation.NavigationServiceException;
import org.exoplatform.portal.mop.navigation.Scope;
@@ -60,6 +60,11 @@
import org.exoplatform.webui.event.EventListener;
import org.gatein.common.util.ParameterValidation;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
/** Copied by The eXo Platform SARL Author May 28, 2009 3:07:15 PM */
@ComponentConfigs({
@ComponentConfig(template = "system:/groovy/portal/webui/navigation/UINavigationNodeSelector.gtmpl", events = {
@@ -94,6 +99,8 @@
private UserPortal userPortal;
private UserNodeFilterConfig filterConfig;
+
+ private Map<String, Map<Locale, State>> userNodeLabels;
private static final Scope NODE_SCOPE = Scope.GRANDCHILDREN;
@@ -116,8 +123,20 @@
uiPopupMenu.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode",
"CutNode", "DeleteNode", "MoveUp", "MoveDown"});
uiTree.setUIRightClickPopupMenu(uiPopupMenu);
+
+ userNodeLabels = new HashMap<String, Map<Locale,State>>();
}
+ public void setUserNodeLabels(Map<String, Map<Locale, State>> labels)
+ {
+ this.userNodeLabels = labels;
+ }
+
+ public Map<String, Map<Locale, State>> getUserNodeLabels()
+ {
+ return this.userNodeLabels;
+ }
+
/**
* Init the UITree wrapped in UINavigationNodeSelector
*
@@ -216,7 +235,23 @@
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
try
{
- userPortal.saveNode(getRootNode().getNode(), null);
+ userPortal.saveNode(getRootNode().getNode(), getRootNode());
+ DescriptionService descriptionService = getApplicationComponent(DescriptionService.class);
+ Map<String, Map<Locale, State>> i18nizedLabels = this.userNodeLabels;
+
+ for (String treeNodeId : i18nizedLabels.keySet())
+ {
+ TreeNode node = findNode(treeNodeId);
+ if (node != null)
+ {
+ Map<Locale, State> labels = i18nizedLabels.get(treeNodeId);
+ if (labels != null && labels.size() > 0)
+ {
+ descriptionService.setDescriptions(node.getNode().getId(), labels);
+ }
+ }
+
+ }
}
catch (NavigationServiceException ex)
{
@@ -269,6 +304,21 @@
}
return getRootNode().findNode(nodeID);
}
+
+ private void invokeI18NizedLabels(TreeNode node)
+ {
+ DescriptionService descriptionService = this.getApplicationComponent(DescriptionService.class);
+ try
+ {
+ Map<Locale, State> labels = descriptionService.getDescriptions(node.getId());
+ node.setI18nizedLabels(labels);
+ }
+ catch(NullPointerException npe)
+ {
+ // set label list is null if Described mixin has been removed or not exists.
+ node.setI18nizedLabels(null);
+ }
+ }
static public abstract class BaseActionListener<T> extends EventListener<T>
{
@@ -283,6 +333,8 @@
TreeNode rebased = selector.rebaseNode(node, scope);
if (rebased == null)
{
+ selector.getUserNodeLabels().remove(node.getId());
+
context.getUIApplication().addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.staleData", null,
ApplicationMessage.WARNING));
selector.selectNode(selector.getRootNode());
@@ -294,6 +346,7 @@
protected void handleError(NavigationError error, UINavigationNodeSelector selector) throws Exception
{
selector.initTreeData();
+ selector.getUserNodeLabels().clear();
if (selector.getRootNode() != null)
{
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
@@ -496,7 +549,12 @@
return;
}
}
-
+
+ if (node.getI18nizedLabels() == null)
+ {
+ uiNodeSelector.invokeI18NizedLabels(node);
+ }
+
UIPopupWindow uiManagementPopup = uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
UIPageNodeForm uiNodeForm = uiApp.createUIComponent(UIPageNodeForm.class, null, null);
uiManagementPopup.setUIComponent(uiNodeForm);
@@ -532,6 +590,10 @@
}
node.setDeleteNode(false);
+ if (node.getI18nizedLabels() == null)
+ {
+ uiNodeSelector.invokeI18NizedLabels(node);
+ }
uiNodeSelector.setCopyNode(node);
event.getSource().setActions(
new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode", "CutNode",
@@ -585,6 +647,11 @@
String nodeID = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
if (currNode != null && currNode.getId().equals(nodeID))
currNode.setCloneNode(true);
+
+ if (currNode.getI18nizedLabels() == null)
+ {
+ uiNodeSelector.invokeI18NizedLabels(currNode);
+ }
}
}
@@ -684,7 +751,9 @@
{
pasteNode(child, node, isClone);
}
-
+
+ node.setI18nizedLabels(sourceNode.getI18nizedLabels());
+ uiNodeSelector.getUserNodeLabels().put(node.getId(), node.getI18nizedLabels());
return node;
}
@@ -809,8 +878,8 @@
uiApp.addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.systemnode-delete", null));
return;
}
-
- parentNode.removeChild(childNode);
+ uiNodeSelector.getUserNodeLabels().remove(childNode.getId());
+ parentNode.removeChild(childNode);
uiNodeSelector.selectNode(parentNode);
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -19,6 +19,8 @@
package org.exoplatform.navigation.webui.component;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.navigation.webui.TreeNode;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
@@ -26,6 +28,7 @@
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.Described;
import org.exoplatform.portal.mop.Visibility;
import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.webui.page.UIPageSelector;
@@ -33,11 +36,16 @@
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.services.resources.LocaleConfig;
+import org.exoplatform.services.resources.LocaleConfigService;
+import org.exoplatform.services.resources.ResourceBundleService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIPopupWindow;
+import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.event.EventListener;
@@ -47,6 +55,7 @@
import org.exoplatform.webui.form.UIFormInputBase;
import org.exoplatform.webui.form.UIFormInputIconSelector;
import org.exoplatform.webui.form.UIFormInputSet;
+import org.exoplatform.webui.form.UIFormSelectBox;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.UIFormTabPane;
import org.exoplatform.webui.form.validator.DateTimeValidator;
@@ -57,9 +66,17 @@
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
/**
* Author : Dang Van Minh, Pham Tuan minhdv81(a)yahoo.com Jun 14, 2006
@@ -83,21 +100,47 @@
final private static String END_PUBLICATION_DATE = "endPublicationDate";
final private static String VISIBLE = "visible";
+
+ private Map<String, Described.State> cachedLabels;
+
+ private String selectedLocale;
+ private static final String I18N_LABEL = "i18nizedLabel";
+
+ private static final String LANGUAGES = "languages";
+
+ private static final String LANGUAGES_ONCHANGE = "ChangeLanguage";
+
+ private static final String SWITCH_MODE = "switchmode";
+
+ private static final String SWITCH_MODE_ONCHANGE = "SwitchLabelMode";
+
+ private static final String LABEL = "label";
+
public UIPageNodeForm() throws Exception
{
super("UIPageNodeForm");
-
+
UIFormInputSet uiSettingSet = new UIFormInputSet("PageNodeSetting");
UIFormCheckBoxInput<Boolean> uiDateInputCheck =
new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, null, false);
UIFormCheckBoxInput<Boolean> uiVisibleCheck = new UIFormCheckBoxInput<Boolean>(VISIBLE, null, true);
+ UIFormCheckBoxInput<Boolean> uiSwitchLabelMode = new UIFormCheckBoxInput<Boolean>(SWITCH_MODE, null, true);
uiDateInputCheck.setOnChange("SwitchPublicationDate");
uiVisibleCheck.setOnChange("SwitchVisible");
+ uiSwitchLabelMode.setOnChange(SWITCH_MODE_ONCHANGE);
+
+ UIFormSelectBox uiFormLanguagesSelectBox = new UIFormSelectBox(LANGUAGES, null, null);
+ initLanguageSelectBox(uiFormLanguagesSelectBox);
+ uiFormLanguagesSelectBox.setOnChange(LANGUAGES_ONCHANGE);
+
uiSettingSet.addUIFormInput(new UIFormStringInput("URI", "URI", null).setEditable(false))
.addUIFormInput(new UIFormStringInput("name", "name", null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class))
- .addUIFormInput(new UIFormStringInput("label", "label", null).addValidator(StringLengthValidator.class, 3, 120))
+ .addUIFormInput(uiSwitchLabelMode)
+ .addUIFormInput(new UIFormStringInput(LABEL, LABEL, null).addValidator(StringLengthValidator.class, 3, 120))
+ .addUIFormInput(uiFormLanguagesSelectBox)
+ .addUIFormInput(new UIFormStringInput(I18N_LABEL, null, null).setMaxLength(255).addValidator(StringLengthValidator.class, 3, 120))
.addUIFormInput(uiVisibleCheck.setChecked(true))
.addUIFormInput(uiDateInputCheck)
.addUIFormInput(new UIFormDateTimeInput(START_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class))
@@ -114,7 +157,7 @@
addUIFormInput(uiIconSelector);
setActions(new String[]{"Save", "Back"});
}
-
+
public TreeNode getPageNode()
{
return pageNode_;
@@ -123,27 +166,134 @@
public void setValues(TreeNode pageNode) throws Exception
{
pageNode_ = pageNode;
+ selectedLocale = getUIFormSelectBox(LANGUAGES).getValue();
+ cachedLabels = new HashMap<String, Described.State>();
if (pageNode == null)
{
getUIStringInput("name").setEditable(UIFormStringInput.ENABLE);
getChild(UIFormInputIconSelector.class).setSelectedIcon("Default");
setShowPublicationDate(false);
+ switchLabelMode(false);
return;
}
getUIStringInput("name").setEditable(UIFormStringInput.DISABLE);
invokeGetBindingBean(pageNode_);
}
+ private void initLanguageSelectBox(UIFormSelectBox langSelectBox)
+ {
+ List<SelectItemOption<String>> lang = new ArrayList<SelectItemOption<String>>();
+ LocaleConfigService localeService = getApplicationComponent(LocaleConfigService.class);
+ Locale currentLocale = ((PortletRequestContext) WebuiRequestContext.getCurrentInstance()).getLocale();
+ Iterator<LocaleConfig> i = localeService.getLocalConfigs().iterator();
+ String displayName = null;
+ String language = null;
+ String country = null;
+ String defaultValue = null;
+ SelectItemOption<String> option;
+ while (i.hasNext())
+ {
+ LocaleConfig config = i.next();
+ Locale locale = config.getLocale();
+
+ language = locale.getLanguage();
+ country = locale.getCountry();
+ if (country != null && country.length() > 0)
+ {
+ language = language + "_" + country;
+ }
+
+ ResourceBundle localeResourceBundle;
+
+ displayName = null;
+ try
+ {
+ localeResourceBundle = getResourceBundle(currentLocale);
+ String key = "Locale." + language;
+ String translation = localeResourceBundle.getString(key);
+ displayName = translation;
+ }
+ catch (MissingResourceException e)
+ {
+ displayName = capitalizeFirstLetter(locale.getDisplayName(currentLocale));
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ option = new SelectItemOption<String>(displayName, language);
+ if (locale.getDisplayName().equals(currentLocale.getDisplayName()))
+ {
+ option.setSelected(true);
+ defaultValue = language;
+ }
+
+ lang.add(option);
+ }
+
+ Collections.sort(lang, new LanguagesComparator());
+ langSelectBox.setOptions(lang);
+ langSelectBox.setValue(defaultValue);
+ }
+ private ResourceBundle getResourceBundle(Locale locale) throws Exception
+ {
+ ExoContainer appContainer = ExoContainerContext.getCurrentContainer();
+ ResourceBundleService service =
+ (ResourceBundleService)appContainer.getComponentInstanceOfType(ResourceBundleService.class);
+ ResourceBundle res = service.getResourceBundle("locale.portal.webui", locale);
+ return res;
+ }
+
+ private String capitalizeFirstLetter(String word)
+ {
+ if (word == null)
+ {
+ return null;
+ }
+ if (word.length() == 0)
+ {
+ return word;
+ }
+ StringBuilder result = new StringBuilder(word);
+ result.replace(0, 1, result.substring(0, 1).toUpperCase());
+ return result.toString();
+ }
+
+ private class LanguagesComparator implements Comparator<SelectItemOption<String>>
+ {
+ public int compare(SelectItemOption<String> o1, SelectItemOption<String> o2)
+ {
+ return o1.getLabel().compareToIgnoreCase(o2.getLabel());
+ }
+ }
+
public void invokeGetBindingBean(Object bean) throws Exception
{
super.invokeGetBindingBean(bean);
+
TreeNode pageNode = (TreeNode)bean;
String icon = pageNode.getIcon();
if (icon == null || icon.length() < 0)
icon = "Default";
getChild(UIFormInputIconSelector.class).setSelectedIcon(icon);
- getUIStringInput("label").setValue(pageNode.getLabel());
+ getUIStringInput(LABEL).setValue(pageNode.getLabel());
+ Map<Locale, Described.State> i18nizedLabels = pageNode.getI18nizedLabels();
+ if (i18nizedLabels != null)
+ {
+ for (Locale key : i18nizedLabels.keySet())
+ {
+ String locale = key.getCountry() != "" ? key.getLanguage() + "_" + key.getCountry() : key.getLanguage();
+ cachedLabels.put(locale, i18nizedLabels.get(key));
+ }
+ }
+
+ if (cachedLabels.get(selectedLocale) != null)
+ {
+ getUIStringInput(I18N_LABEL).setValue(cachedLabels.get(selectedLocale).getName());
+ }
+
if(pageNode.getVisibility() == Visibility.SYSTEM)
{
UIFormInputSet uiSettingSet = getChildById("PageNodeSetting");
@@ -175,6 +325,15 @@
else
getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
}
+
+ boolean isExtendedMode = true;
+ if (pageNode.getNode().getLabel() != null && pageNode.getNode().getLabel().trim().length() > 0)
+ {
+ isExtendedMode = false;
+ }
+
+ getUIFormCheckBoxInput(SWITCH_MODE).setChecked(isExtendedMode);
+ this.switchLabelMode(isExtendedMode);
}
public void invokeSetBindingBean(Object bean) throws Exception
@@ -203,14 +362,46 @@
date = (cal != null) ? cal.getTime() : null;
node.setEndPublicationTime(date == null ? -1 : date.getTime());
}
+
+
+ cachedLabels.put(getUIFormSelectBox(LANGUAGES).getValue(), new Described.State(getUIStringInput(I18N_LABEL).getValue(), null));
+ Map<Locale, Described.State> labels = new HashMap<Locale, Described.State>(cachedLabels.size());
+ getUIFormSelectBox(LANGUAGES).getValue();
+ for (String strLocale : cachedLabels.keySet())
+ {
+ Locale locale;
+ if (strLocale.contains("_"))
+ {
+ String[] arr = strLocale.split("_");
+ if (arr.length > 2)
+ {
+ locale = new Locale(arr[0], arr[1], arr[2]);
+ }
+ else
+ {
+ locale = new Locale(arr[0], arr[1]);
+ }
+ }
+ else
+ {
+ locale = new Locale(strLocale);
+ }
+
+ labels.put(locale, cachedLabels.get(strLocale));
+ }
+
+ node.setI18nizedLabels(labels);
+
+ if (getUIFormCheckBoxInput(SWITCH_MODE).getValue().toString().equals("true"))
+ node.setLabel(null);
}
public void setShowCheckPublicationDate(boolean show)
{
- getUIFormCheckBoxInput(VISIBLE).setChecked(show);
- UIFormCheckBoxInput<Boolean> uiForm = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
- uiForm.setRendered(show);
- setShowPublicationDate(show && uiForm.isChecked());
+ getUIFormCheckBoxInput(VISIBLE).setChecked(show);
+ UIFormCheckBoxInput<Boolean> uiForm = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ uiForm.setRendered(show);
+ setShowPublicationDate(show && uiForm.isChecked());
}
public void setShowPublicationDate(boolean show)
@@ -323,6 +514,7 @@
if (pageNode == null)
{
pageNode = selectedParent.addChild(nodeName);
+ uiPageNodeForm.pageNode_ = pageNode;
}
@@ -341,17 +533,17 @@
pageSelector.setValue(page.getPageId());
}
}
+
+ if (pageNode.getLabel() == null)
+ pageNode.setLabel(pageNode.getName());
+ uiPageNodeForm.invokeSetBindingBean(pageNode);
UIFormInputIconSelector uiIconSelector = uiPageNodeForm.getChild(UIFormInputIconSelector.class);
if (uiIconSelector.getSelectedIcon().equals("Default"))
pageNode.setIcon(null);
else
pageNode.setIcon(uiIconSelector.getSelectedIcon());
- if (pageNode.getLabel() == null)
- pageNode.setLabel(pageNode.getName());
- uiPageNodeForm.invokeSetBindingBean(pageNode);
-
uiPageNodeForm.createEvent("Back", Phase.DECODE, ctx).broadcast();
}
}
@@ -361,10 +553,51 @@
public void execute(Event<UIPageNodeForm> event) throws Exception
{
+
}
+ }
+
+ public static class ChangeLanguageActionListener extends EventListener<UIPageNodeForm>
+ {
+ @Override
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ UIPageNodeForm uiForm = event.getSource();
+ UIFormSelectBox languageSelection = uiForm.getUIFormSelectBox(LANGUAGES);
+ UIFormStringInput label = uiForm.getUIStringInput(I18N_LABEL);
+ uiForm.updateCachedLabels(uiForm.getSelectedLocale(), label.getValue());
+
+ uiForm.setSelectedLocale(languageSelection.getValue());
+ label.setValue(uiForm.getLabelOnLocale(uiForm.getSelectedLocale()));
+ }
+ }
+
+ private String getLabelOnLocale(String locale)
+ {
+ if (cachedLabels.get(locale) != null)
+ {
+ return cachedLabels.get(locale).getName();
+ }
+
+ return null;
+ }
+
+ private void updateCachedLabels(String locale, String label)
+ {
+ cachedLabels.put(locale, new Described.State(label, null));
+ }
+
+ public void setSelectedLocale(String selectedLocale)
+ {
+ this.selectedLocale = selectedLocale;
}
+ public String getSelectedLocale()
+ {
+ return selectedLocale;
+ }
+
static public class SwitchPublicationDateActionListener extends EventListener<UIPageNodeForm>
{
public void execute(Event<UIPageNodeForm> event) throws Exception
@@ -387,6 +620,18 @@
event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
}
}
+
+ static public class SwitchLabelModeActionListener extends EventListener<UIPageNodeForm>
+ {
+ @Override
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ UIPageNodeForm uiForm = event.getSource();
+ boolean isExtendedMode = uiForm.getUIFormCheckBoxInput(SWITCH_MODE).isChecked();
+ uiForm.switchLabelMode(isExtendedMode);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
+ }
static public class ClearPageActionListener extends EventListener<UIPageNodeForm>
{
@@ -492,4 +737,11 @@
pageSelector.setPage(page);
}
}
+
+ private void switchLabelMode(boolean isExtendedMode)
+ {
+ getUIStringInput(LABEL).setRendered(!isExtendedMode);
+ getUIStringInput(I18N_LABEL).setRendered(isExtendedMode);
+ getUIFormSelectBox(LANGUAGES).setRendered(isExtendedMode);
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -54,12 +54,14 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.event.EventListener;
+
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
+
import javax.servlet.http.HttpServletRequest;
@ComponentConfigs({
@@ -69,7 +71,9 @@
@EventConfig(listeners = UISiteManagement.DeletePortalActionListener.class, confirm = "UIPortalBrowser.deletePortal")}),
@ComponentConfig(type = UIPageNodeForm.class, lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(listeners = UIPageNodeForm.SaveActionListener.class),
+ @EventConfig(listeners = UIPageNodeForm.ChangeLanguageActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UISiteManagement.BackActionListener.class, phase = Phase.DECODE),
+ @EventConfig(listeners = UIPageNodeForm.SwitchLabelModeActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchPublicationDateActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchVisibleActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.ClearPageActionListener.class, phase = Phase.DECODE),
@@ -407,6 +411,7 @@
uiNavigationPopup.setWindowSize(400, 400);
context.addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
+ selector.getUserNodeLabels().put(uiPageNodeForm.getPageNode().getId(), uiPageNodeForm.getPageNode().getI18nizedLabels());
selector.createEvent("NodeModified", Phase.PROCESS, context).broadcast();
}
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIWizard/Stylesheet.css
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIWizard/Stylesheet.css 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIWizard/Stylesheet.css 2011-07-19 07:40:27 UTC (rev 6886)
@@ -241,7 +241,7 @@
.UIWizard .UIWizardPageSetInfo .UIFormWithTitle .HorizontalLayout {
background: white;
- height: 175px;
+ height: auto;
}
.UIWizard .UIWizardPageSetInfo .UIFormWithTitle textarea {
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-07-19 07:40:27 UTC (rev 6886)
@@ -542,6 +542,9 @@
UIPageNodeForm.label.startPublicationDate=Start Publication Date:
UIPageNodeForm.label.endPublicationDate=End Publication Date:
UIPageNodeForm.label.pageName=Name:
+UIPageNodeForm.label.i18nizedLabel=#{word.label}:
+UIPageNodeForm.label.languages=#{word.language}:
+UIPageNodeForm.label.switchmode=Extended label mode:
UIPageNodeForm.Icon.title.SetDefault=Get Default
UIPageNodeForm.tab.label.PageNodeSetting=Page Node Setting
UIPageNodeForm.tab.label.Icon=#{word.icon}
@@ -744,6 +747,9 @@
UIWizardPageSetInfo.label.showPublicationDate=Publication date & time
UIWizardPageSetInfo.label.startPublicationDate=Start Publication Date
UIWizardPageSetInfo.label.endPublicationDate=End Publication Date
+UIWizardPageSetInfo.label.i18nizedLabel=Display Name
+UIWizardPageSetInfo.label.languages=#{word.language}
+UIWizardPageSetInfo.label.switchmode=Extended label mode
UIWizardPageSetInfo.action.Save=#{word.save}
UIWizardPageSetInfo.msg.null=No page not found.
UIWizardPageSetInfo.msg.node.deleted=Concurrent modification error : The node you select has been deleted
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-07-19 07:40:27 UTC (rev 6886)
@@ -496,6 +496,7 @@
UIPageNodeForm.label.creator=Người khởi tạo trang
UIPageNodeForm.label.modifier=Người chỉnh sửa trang
UIPageNodeForm.label.label=#{word.label}:
+UIPageNodeForm.label.switchmode=Chế độ nhãn mở rộng:
UIPageNodeForm.label.visible=Hiển thị:
UIPageNodeForm.label.showPublicationDate=Thời gian hiển thị
UIPageNodeForm.label.startPublicationDate=Thời gian bắt đầu
@@ -693,6 +694,8 @@
UIWizardPageSetInfo.label.curentSelectedNodeInfo=Node vừa chọn
UIWizardPageSetInfo.label.pageName=Tên Node
UIWizardPageSetInfo.label.pageDisplayName=Tên node hiển thị
+UIWizardPageSetInfo.label.switchmode=Chế độ nhãn mở rộng
+UIWizardPageSetInfo.label.i18nizedLabel=Tên node hiển thị
UIWizardPageSetInfo.label.visible=Hiển thị
UIWizardPageSetInfo.label.showPublicationDate=Thời gian hiển thị
UIWizardPageSetInfo.label.startPublicationDate=Thời gian bắt đầu
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -22,36 +22,106 @@
<node-navigation
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0"
- xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
+ xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
<priority>1</priority>
<page-nodes>
<node>
<name>home</name>
- <label>#{portal.classic.home}</label>
- <page-reference>portal::classic::homepage</page-reference>
+ <label xml:lang="en">Home</label>
+ <label xml:lang="fr">Accueil</label>
+ <label xml:lang="es">Inicio</label>
+ <label xml:lang="de">Startseite</label>
+ <label xml:lang="it">Home</label>
+ <label xml:lang="nl">Home</label>
+ <label xml:lang="pt-BR">Principal</label>
+ <label xml:lang="ja">ホーム</label>
+ <label xml:lang="ne">गृह पृष्‍ठ</label>
+ <label xml:lang="ru">Главная</label>
+ <label xml:lang="uk">Додому</label>
+ <label xml:lang="ar">ترحيب</label>
+ <label xml:lang="ko">홈</label>
+ <label xml:lang="vi">Trang chủ</label>
+ <label xml:lang="zh">主页</label>
+ <label xml:lang="zh-TW">首頁</label>
+ <page-reference>portal::classic::homepage</page-reference>
</node>
<node>
<name>sitemap</name>
- <label>#{portal.classic.sitemap}</label>
+ <label xml:lang="en">SiteMap</label>
+ <label xml:lang="fr">SiteMap</label>
+ <label xml:lang="es">Mapa del Sitio</label>
+ <label xml:lang="de">Seitenübersicht</label>
+ <label xml:lang="it">Mappa del Sito</label>
+ <label xml:lang="nl">Sitemap</label>
+ <label xml:lang="pt-BR">Mapa do Site</label>
+ <label xml:lang="ja">サイトマップ</label>
+ <label xml:lang="ne">साईटम्याप</label>
+ <label xml:lang="ru">SiteMap</label>
+ <label xml:lang="ar">خريطة الموقع</label>
+ <label xml:lang="ko">사이트맵</label>
+ <label xml:lang="vi">Sơ đồ</label>
+ <label xml:lang="zh">网站地图</label>
+ <label xml:lang="zh-TW">網站導覽</label>
<visibility>DISPLAYED</visibility>
<page-reference>portal::classic::sitemap</page-reference>
</node>
<node>
<name>groupnavigation</name>
- <label>#{portal.classic.groupnavigation}</label>
+ <label xml:lang="en">Group Navigation</label>
+ <label xml:lang="fr">Group Navigation</label>
+ <label xml:lang="es">Navegación por Grupos</label>
+ <label xml:lang="de">Gruppennavigation</label>
+ <label xml:lang="it">Navigazione dei Gruppi</label>
+ <label xml:lang="nl">Groep navigatie</label>
+ <label xml:lang="pt-BR">Navegação do Grupo</label>
+ <label xml:lang="ja">グループナビゲーション</label>
+ <label xml:lang="ne">समुह न्याभिगेसन</label>
+ <label xml:lang="ru">Навигация по группам</label>
+ <label xml:lang="uk">Навігація груп</label>
+ <label xml:lang="ar">مجموعة الملاحة</label>
+ <label xml:lang="ko">그룹 내비게이션</label>
+ <label xml:lang="vi">Group Navigation</label>
+ <label xml:lang="zh">组导航</label>
+ <label xml:lang="zh-TW">瀏覽群組</label>
<visibility>SYSTEM</visibility>
<page-reference>portal::classic::groupnavigation</page-reference>
</node>
<node>
<name>portalnavigation</name>
- <label>#{portal.classic.portalnavigation}</label>
+ <label xml:lang="en">Portal Navigation</label>
+ <label xml:lang="fr">Portal Navigation</label>
+ <label xml:lang="es">Navegación por Portales</label>
+ <label xml:lang="de">Portalnavigation</label>
+ <label xml:lang="it">Navigazione del Portale</label>
+ <label xml:lang="nl">Portaal navigatie</label>
+ <label xml:lang="pt-BR">Navegação do Portal</label>
+ <label xml:lang="ja">ポータルナビゲーション</label>
+ <label xml:lang="ne">पोर्टल न्याभिगेसन</label>
+ <label xml:lang="ru">Навигация по порталу</label>
+ <label xml:lang="uk">Навігація порталу</label>
+ <label xml:lang="ar">بوابة الملاحة</label>
+ <label xml:lang="ko">포탈 내비게이션</label>
+ <label xml:lang="vi">Portal Navigation</label>
+ <label xml:lang="zh">门户导航</label>
+ <label xml:lang="zh-TW">瀏覽入口網</label>
<visibility>SYSTEM</visibility>
<page-reference>portal::classic::portalnavigation</page-reference>
</node>
<node>
<name>register</name>
- <label>#{portal.classic.register}</label>
+ <label xml:lang="en">Register</label>
+ <label xml:lang="es">Registrarse</label>
+ <label xml:lang="de">Registrieren</label>
+ <label xml:lang="it">Registrazione</label>
+ <label xml:lang="nl">Registreren</label>
+ <label xml:lang="pt-BR">Cadastrar-se</label>
+ <label xml:lang="ja">登録</label>
+ <label xml:lang="ne">दर्ता</label>
+ <label xml:lang="ko">등록</label>
+ <label xml:lang="vi">Đăng ký</label>
+ <label xml:lang="zh">注册</label>
+ <label xml:lang="zh-TW">註冊</label>
<visibility>SYSTEM</visibility>
<page-reference>portal::classic::register</page-reference>
</node>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-19 07:40:27 UTC (rev 6886)
@@ -94,11 +94,24 @@
</component>
<component>
+ <key>org.exoplatform.portal.mop.navigation.DataCache</key>
+ <type>org.exoplatform.portal.mop.navigation.ExoDataCache</type>
+ </component>
+ <component>
<key>org.exoplatform.portal.mop.navigation.NavigationService</key>
<type>org.exoplatform.portal.mop.navigation.NavigationServiceWrapper</type>
</component>
<component>
+ <key>org.exoplatform.portal.mop.description.DataCache</key>
+ <type>org.exoplatform.portal.mop.description.ExoDataCache</type>
+ </component>
+ <component>
+ <key>org.exoplatform.portal.mop.description.DescriptionService</key>
+ <type>org.exoplatform.portal.mop.description.DescriptionServiceImpl</type>
+ </component>
+
+ <component>
<key>org.exoplatform.portal.config.UserPortalConfigService</key>
<type>org.exoplatform.portal.config.UserPortalConfigService</type>
<component-plugins>
@@ -275,6 +288,9 @@
<value>org.exoplatform.portal.mop.ProtectedResource</value>
<value>org.exoplatform.portal.mop.Described</value>
<value>org.exoplatform.portal.mop.Visible</value>
+ <value>org.exoplatform.portal.mop.i18n.I18Nized</value>
+ <value>org.exoplatform.portal.mop.i18n.LanguageSpace</value>
+ <value>org.exoplatform.portal.mop.i18n.Language</value>
</values-param>
<properties-param>
<name>options</name>
@@ -287,6 +303,8 @@
<external-component-plugins>
<target-component>org.exoplatform.services.cache.CacheService</target-component>
+
+ <!-- MOPSessionManager configuration -->
<component-plugin>
<name>addExoCacheConfig</name>
<set-method>addExoCacheConfig</set-method>
@@ -336,6 +354,8 @@
</object-param>
</init-params>
</component-plugin>
+
+ <!-- NavigationService configuration -->
<component-plugin>
<name>addExoCacheConfig</name>
<set-method>addExoCacheConfig</set-method>
@@ -385,6 +405,57 @@
</object-param>
</init-params>
</component-plugin>
+
+ <!-- DescriptionService configuration -->
+ <component-plugin>
+ <name>addExoCacheConfig</name>
+ <set-method>addExoCacheConfig</set-method>
+ <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+ <description>add Exo Cache Config</description>
+ <init-params>
+ <object-param>
+ <name>cache.config.NavigationService</name>
+ <description>The JBoss Cache configuration for the dezcription service</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name">
+ <string>DescriptionService</string>
+ </field>
+ <field name="maxSize">
+ <int>5000</int>
+ </field>
+ <field name="liveTime">
+ <long>600</long>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin profiles="cluster">
+ <name>addExoCacheConfig</name>
+ <set-method>addExoCacheConfig</set-method>
+ <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+ <description>add Exo Cache Config</description>
+ <init-params>
+ <object-param>
+ <name>cache.config.ConfigurationService</name>
+ <description>The JBoss Cache configuration for the description service</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
+ <field name="name">
+ <string>DescriptionService</string>
+ </field>
+ <field name="expirationTimeout">
+ <long>600000</long>
+ </field>
+ <field name="maxNodes">
+ <int>5000</int>
+ </field>
+ <field name="distributed">
+ <boolean>true</boolean>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
</external-component-plugins>
</configuration>
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -497,7 +497,10 @@
navigation.getKey().getTypeName(),
navigation.getKey().getName());
}
+
+ public Locale getUserLocale()
+ {
+ return Util.getPortalRequestContext().getLocale();
+ }
};
-
-
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -21,12 +21,17 @@
import java.util.Calendar;
import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.description.DescriptionService;
import org.exoplatform.portal.mop.navigation.NavigationServiceException;
import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.mop.user.UserNode;
@@ -47,6 +52,7 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIFormStringInput;
+import org.exoplatform.webui.form.UIFormCheckBoxInput;
/** Created by The eXo Platform SARL Author : Dang Van Minh minhdv81(a)yahoo.com Jun 23, 2006 */
@ComponentConfigs(@ComponentConfig(template = "system:/groovy/webui/core/UIWizard.gtmpl", events = {
@@ -103,9 +109,37 @@
dataService.create(page);
UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
- userPortal.saveNode(selectedNode, null);
+ userPortal.saveNode(selectedNode, null);
+
+ DescriptionService descriptionService = getApplicationComponent(DescriptionService.class);
+ Map<Locale, Described.State> descriptions = new HashMap<Locale, Described.State>();
+ Map<String, String> cachedLabels = uiPageInfo.getCachedLabels();
+
+ for (String strLocale : cachedLabels.keySet())
+ {
+ Locale locale;
+ if (strLocale.contains("_"))
+ {
+ String[] arr = strLocale.split("_");
+ if (arr.length > 2)
+ {
+ locale = new Locale(arr[0], arr[1], arr[2]);
+ }
+ else
+ {
+ locale = new Locale(arr[0], arr[1]);
+ }
+ }
+ else
+ {
+ locale = new Locale(strLocale);
+ }
+
+ descriptions.put(locale, new Described.State(cachedLabels.get(strLocale), null));
+ }
+
+ descriptionService.setDescriptions(createdNode.getId(), descriptions);
return createdNode;
-
}
/**
@@ -182,7 +216,7 @@
return;
}
- if (uiPageSetInfo.getUIFormCheckBoxInput(UIWizardPageSetInfo.SHOW_PUBLICATION_DATE).isChecked())
+ if (((UIFormCheckBoxInput)uiPageSetInfo.getUIInput(UIWizardPageSetInfo.SHOW_PUBLICATION_DATE)).isChecked())
{
Calendar currentCalendar = Calendar.getInstance();
@@ -221,6 +255,10 @@
return;
}
}
+
+ // Update the last value of selected locale to cached labels
+ UIFormStringInput label = uiPageSetInfo.getUIStringInput(UIWizardPageSetInfo.I18N_LABEL);
+ uiPageSetInfo.updateCachedLabels(uiPageSetInfo.getSelectedLocale(), label.getValue());
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-07-18 22:48:36 UTC (rev 6885)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-07-19 07:40:27 UTC (rev 6886)
@@ -19,33 +19,50 @@
package org.exoplatform.portal.webui.page;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.model.PortalConfig;
-import java.util.Calendar;
-
import org.exoplatform.portal.mop.Visibility;
import org.exoplatform.portal.mop.navigation.NavigationServiceException;
import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.services.resources.LocaleConfig;
+import org.exoplatform.services.resources.LocaleConfigService;
+import org.exoplatform.services.resources.ResourceBundleService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIWizard;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
+import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.form.UIForm;
-import org.exoplatform.webui.form.UIFormCheckBoxInput;
import org.exoplatform.webui.form.UIFormDateTimeInput;
import org.exoplatform.webui.form.UIFormInputBase;
+import org.exoplatform.webui.form.UIFormSelectBox;
import org.exoplatform.webui.form.UIFormStringInput;
+import org.exoplatform.webui.form.UIFormCheckBoxInput;
import org.exoplatform.webui.form.validator.DateTimeValidator;
import org.exoplatform.webui.form.validator.IdentifierValidator;
import org.exoplatform.webui.form.validator.MandatoryValidator;
import org.exoplatform.webui.form.validator.StringLengthValidator;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
/**
* Created by The eXo Platform SARL
* Author : Nguyen Thi Hoa
@@ -55,10 +72,14 @@
@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl", events = {
@EventConfig(listeners = UIWizardPageSetInfo.ChangeNodeActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIWizardPageSetInfo.SwitchVisibleActionListener.class, phase = Phase.DECODE),
- @EventConfig(listeners = UIWizardPageSetInfo.SwitchPublicationDateActionListener.class, phase = Phase.DECODE)})
+ @EventConfig(listeners = UIWizardPageSetInfo.SwitchPublicationDateActionListener.class, phase = Phase.DECODE),
+ @EventConfig(listeners = UIWizardPageSetInfo.ChangeLanguageActionListener.class, phase = Phase.DECODE),
+ @EventConfig(listeners = UIWizardPageSetInfo.SwitchLabelModeActionListener.class, phase = Phase.DECODE)
+})
public class UIWizardPageSetInfo extends UIForm
{
+
final public static String PAGE_NAME = "pageName";
final public static String PAGE_DISPLAY_NAME = "pageDisplayName";
@@ -70,24 +91,47 @@
final public static String START_PUBLICATION_DATE = "startPublicationDate";
final public static String END_PUBLICATION_DATE = "endPublicationDate";
+
+ public static final String I18N_LABEL = "i18nizedLabel";
+
+ private static final String LANGUAGES = "languages";
+
+ private static final String LANGUAGES_ONCHANGE = "ChangeLanguage";
+ private static final String SWITCH_MODE = "switchmode";
+
+ private static final String SWITCH_MODE_ONCHANGE = "SwitchLabelMode";
+
private boolean isEditMode = false;
private boolean firstTime = true;
+
+ private String selectedLocale;
+ private Map<String, String> cachedLabels;
+
public UIWizardPageSetInfo() throws Exception
{
- UIFormCheckBoxInput<Boolean> uiDateInputCheck =
- new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, null, false);
- UIFormCheckBoxInput<Boolean> uiVisibleCheck = new UIFormCheckBoxInput<Boolean>(VISIBLE, null, false);
+ UIFormCheckBoxInput uiDateInputCheck =
+ new UIFormCheckBoxInput(SHOW_PUBLICATION_DATE, null, false);
+ UIFormCheckBoxInput uiVisibleCheck = new UIFormCheckBoxInput(VISIBLE, null, false);
+ UIFormCheckBoxInput uiSwitchLabelMode = new UIFormCheckBoxInput(SWITCH_MODE, null, true);
uiDateInputCheck.setOnChange("SwitchPublicationDate");
uiVisibleCheck.setOnChange("SwitchVisible");
+ uiSwitchLabelMode.setOnChange(SWITCH_MODE_ONCHANGE);
+
+ UIFormSelectBox uiFormLanguagesSelectBox = new UIFormSelectBox(LANGUAGES, null, null);
+ initLanguageSelectBox(uiFormLanguagesSelectBox);
+ uiFormLanguagesSelectBox.setOnChange(LANGUAGES_ONCHANGE);
addChild(UIPageNodeSelector.class, null, null);
addUIFormInput(new UIFormStringInput(PAGE_NAME, "name", null).addValidator(MandatoryValidator.class)
.addValidator(StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class));
+ addUIFormInput(uiSwitchLabelMode);
addUIFormInput(new UIFormStringInput(PAGE_DISPLAY_NAME, "label", null).setMaxLength(255).addValidator(
StringLengthValidator.class, 3, 120));
+ addUIFormInput(uiFormLanguagesSelectBox);
+ addUIFormInput(new UIFormStringInput(I18N_LABEL, null, null).setMaxLength(255).addValidator(StringLengthValidator.class, 3, 120));
addUIFormInput(uiVisibleCheck.setChecked(true));
addUIFormInput(uiDateInputCheck);
UIFormInputBase<String> startPubDateInput = new UIFormDateTimeInput(START_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class);
@@ -103,6 +147,10 @@
startPubDateInput.setRendered(false);
endPubDateInput.setRendered(false);
}
+
+ this.selectedLocale = getUIFormSelectBox(LANGUAGES).getValue();
+ cachedLabels = new HashMap<String, String>();
+ switchLabelMode(true);
}
//TODO: it looks like this method is not used
@@ -117,6 +165,16 @@
{
return isEditMode;
}
+
+ public Map<String, String> getCachedLabels()
+ {
+ return cachedLabels;
+ }
+
+ public String getSelectedLocale()
+ {
+ return selectedLocale;
+ }
public void invokeSetBindingBean(Object bean) throws Exception
{
@@ -128,10 +186,19 @@
UserNode node = (UserNode)bean;
+ if (((UIFormCheckBoxInput)getUIInput(SWITCH_MODE)).isChecked())
+ {
+ node.setLabel(null);
+ }
+ else if (node.getLabel() == null || node.getLabel().trim().length() == 0)
+ {
+ node.setLabel(node.getName());
+ }
+
Visibility visibility;
- if (getUIFormCheckBoxInput(VISIBLE).isChecked())
+ if (((UIFormCheckBoxInput)getUIInput(VISIBLE)).isChecked())
{
- UIFormCheckBoxInput showPubDate = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ UIFormCheckBoxInput showPubDate = getUIInput(SHOW_PUBLICATION_DATE);
visibility = showPubDate.isChecked() ? Visibility.TEMPORAL : Visibility.DISPLAYED;
}
else
@@ -155,17 +222,13 @@
UserNode child = parent.addChild(nodeName);
invokeSetBindingBean(child);
- if (child.getLabel() == null || child.getLabel().trim().length() == 0)
- {
- child.setLabel(child.getName());
- }
return child;
}
public void setShowCheckPublicationDate(boolean show)
{
- getUIFormCheckBoxInput(VISIBLE).setChecked(show);
- UIFormCheckBoxInput<Boolean> uiForm = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ ((UIFormCheckBoxInput)getUIInput(VISIBLE)).setChecked(show);
+ UIFormCheckBoxInput uiForm = getUIInput(SHOW_PUBLICATION_DATE);
uiForm.setRendered(show);
setShowPublicationDate(show && uiForm.isChecked());
}
@@ -198,7 +261,116 @@
{
this.firstTime = firstTime;
}
+
+ private void initLanguageSelectBox(UIFormSelectBox langSelectBox)
+ {
+ List<SelectItemOption<String>> lang = new ArrayList<SelectItemOption<String>>();
+ LocaleConfigService localeService = getApplicationComponent(LocaleConfigService.class);
+ Locale currentLocale = WebuiRequestContext.getCurrentInstance().getLocale();
+ Iterator<LocaleConfig> i = localeService.getLocalConfigs().iterator();
+ String displayName = null;
+ String language = null;
+ String country = null;
+ String defaultValue = null;
+ SelectItemOption<String> option;
+ while (i.hasNext())
+ {
+ LocaleConfig config = i.next();
+ Locale locale = config.getLocale();
+ language = locale.getLanguage();
+ country = locale.getCountry();
+ if (country != null && country.length() > 0)
+ {
+ language = language + "_" + country;
+ }
+
+ ResourceBundle localeResourceBundle;
+
+ displayName = null;
+ try
+ {
+ localeResourceBundle = getResourceBundle(currentLocale);
+ String key = "Locale." + language;
+ String translation = localeResourceBundle.getString(key);
+ displayName = translation;
+ }
+ catch (MissingResourceException e)
+ {
+ displayName = capitalizeFirstLetter(locale.getDisplayName(currentLocale));
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ option = new SelectItemOption<String>(displayName, language);
+ if (locale.getDisplayName().equals(currentLocale.getDisplayName()))
+ {
+ option.setSelected(true);
+ defaultValue = language;
+ }
+
+ lang.add(option);
+ }
+
+ Collections.sort(lang, new LanguagesComparator());
+ langSelectBox.setOptions(lang);
+ langSelectBox.setValue(defaultValue);
+ }
+
+ private ResourceBundle getResourceBundle(Locale locale) throws Exception
+ {
+ ExoContainer appContainer = ExoContainerContext.getCurrentContainer();
+ ResourceBundleService service = (ResourceBundleService) appContainer
+ .getComponentInstanceOfType(ResourceBundleService.class);
+ ResourceBundle res = service.getResourceBundle("locale.portal.webui", locale);
+ return res;
+ }
+
+ private String capitalizeFirstLetter(String word)
+ {
+ if (word == null)
+ {
+ return null;
+ }
+ if (word.length() == 0)
+ {
+ return word;
+ }
+ StringBuilder result = new StringBuilder(word);
+ result.replace(0, 1, result.substring(0, 1).toUpperCase());
+ return result.toString();
+ }
+
+ private class LanguagesComparator implements Comparator<SelectItemOption<String>>
+ {
+ public int compare(SelectItemOption<String> o1, SelectItemOption<String> o2)
+ {
+ return o1.getLabel().compareToIgnoreCase(o2.getLabel());
+ }
+ }
+
+ private void switchLabelMode(boolean isExtendedMode)
+ {
+ getUIStringInput(PAGE_DISPLAY_NAME).setRendered(!isExtendedMode);
+ getUIStringInput(I18N_LABEL).setRendered(isExtendedMode);
+ getUIFormSelectBox(LANGUAGES).setRendered(isExtendedMode);
+ }
+
+ private String getLabelOnLocale(String locale)
+ {
+ return cachedLabels.get(locale);
+ }
+
+ public void updateCachedLabels(String locale, String label)
+ {
+ if (label != null)
+ {
+ cachedLabels.put(locale, label);
+ }
+ }
+
static public class ChangeNodeActionListener extends EventListener<UIWizardPageSetInfo>
{
public void execute(Event<UIWizardPageSetInfo> event) throws Exception
@@ -233,7 +405,7 @@
public void execute(Event<UIWizardPageSetInfo> event) throws Exception
{
UIWizardPageSetInfo uiForm = event.getSource();
- boolean isCheck = uiForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked();
+ boolean isCheck = ((UIFormCheckBoxInput)uiForm.getUIInput(SHOW_PUBLICATION_DATE)).isChecked();
uiForm.getUIFormDateTimeInput(START_PUBLICATION_DATE).setRendered(isCheck);
uiForm.getUIFormDateTimeInput(END_PUBLICATION_DATE).setRendered(isCheck);
UIWizard uiWizard = uiForm.getAncestorOfType(UIWizard.class);
@@ -248,10 +420,43 @@
public void execute(Event<UIWizardPageSetInfo> event) throws Exception
{
UIWizardPageSetInfo uiForm = event.getSource();
- boolean isCheck = uiForm.getUIFormCheckBoxInput(VISIBLE).isChecked();
+ boolean isCheck = ((UIFormCheckBoxInput)uiForm.getUIInput(VISIBLE)).isChecked();
uiForm.setShowCheckPublicationDate(isCheck);
event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
}
}
-
+
+ /**
+ * Update the transient label from cache to I18N_LABEL field and add value in this field to the cached labels.
+ */
+ static public class ChangeLanguageActionListener extends EventListener<UIWizardPageSetInfo>
+ {
+ @Override
+ public void execute(Event<UIWizardPageSetInfo> event) throws Exception
+ {
+ UIWizardPageSetInfo uiForm = event.getSource();
+ UIFormSelectBox languageSelection = uiForm.getUIFormSelectBox(LANGUAGES);
+ UIFormStringInput label = uiForm.getUIStringInput(I18N_LABEL);
+ uiForm.updateCachedLabels(uiForm.selectedLocale, label.getValue());
+
+ uiForm.selectedLocale = languageSelection.getValue();
+ label.setValue(uiForm.getLabelOnLocale(uiForm.selectedLocale));
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
+ }
+
+ /**
+ * Change between simple and extended mode of label.
+ */
+ static public class SwitchLabelModeActionListener extends EventListener<UIWizardPageSetInfo>
+ {
+ @Override
+ public void execute(Event<UIWizardPageSetInfo> event) throws Exception
+ {
+ UIWizardPageSetInfo uiForm = event.getSource();
+ boolean isExtendedMode = ((UIFormCheckBoxInput)uiForm.getUIInput(SWITCH_MODE)).isChecked();
+ uiForm.switchLabelMode(isExtendedMode);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
+ }
}
13 years, 5 months
gatein SVN: r6885 - in epp/portal/branches/EPP_5_2_Branch: component and 70 other directories.
by do-not-reply@jboss.org
Author: theute
Date: 2011-07-18 18:48:36 -0400 (Mon, 18 Jul 2011)
New Revision: 6885
Added:
epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Queues.java
epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Spliterator.java
epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestQueues.java
epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSpliterator.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/EventType.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteKey.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteType.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NodeData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/navigation.xml
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationManagement.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationManagement.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSearchForm.gtmpl
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSearchForm.java
Removed:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/navigation.xml
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/NewUIGroupManagement.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/conf/portlet/web/PortalNavigationPortlet/webui/configuration.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation2.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationManagement.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/NewUIGroupManagement.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap2.gtmpl
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/ParentChildPair.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNodeSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageUtils.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java
Modified:
epp/portal/branches/EPP_5_2_Branch/
epp/portal/branches/EPP_5_2_Branch/component/
epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java
epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestUserACL.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestGroupNavACL.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestPortalNavACL.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestUserNavACL.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml
epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml
epp/portal/branches/EPP_5_2_Branch/pom.xml
epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalControl.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationNodeSelector.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java
epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java
epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java
Log:
JBEPP-933
EPP52-EID_101: Navigations optimizations
Property changes on: epp/portal/branches/EPP_5_2_Branch
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5622,5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5622,5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573,6783
Property changes on: epp/portal/branches/EPP_5_2_Branch/component
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5622,5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5622,5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573,6783
Copied: epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Queues.java (from rev 6783, portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/Queues.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Queues.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Queues.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.commons.utils;
+
+import java.util.AbstractQueue;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Queue;
+
+/**
+ * A LIFO stack implementing the {@link java.util.Queue} interface backed by an array.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class Queues
+{
+
+ /** . */
+ private static final Queue<Object> EMPTY = new AbstractQueue<Object>()
+ {
+ @Override
+ public Iterator<Object> iterator()
+ {
+ return Collections.emptyList().iterator();
+ }
+
+ @Override
+ public int size()
+ {
+ return 0;
+ }
+
+ public boolean offer(Object o)
+ {
+ return false;
+ }
+
+ public Object poll()
+ {
+ return null;
+ }
+
+ public Object peek()
+ {
+ return null;
+ }
+ };
+
+ private static class LIFO<E> extends AbstractQueue<E>
+ {
+ /** . */
+ private Object[] elements;
+
+ /** . */
+ private int size;
+
+ public LIFO(int initialCapacity)
+ {
+ this.elements = new Object[initialCapacity];
+ this.size = 0;
+ }
+
+ @Override
+ public Iterator<E> iterator()
+ {
+ return new Iterator<E>()
+ {
+ int count = size;
+ public boolean hasNext()
+ {
+ return count > 0;
+ }
+ public E next()
+ {
+ if (!hasNext())
+ {
+ throw new NoSuchElementException();
+ }
+ else
+ {
+ @SuppressWarnings("unchecked")
+ E element = (E)elements[--count];
+ return element;
+ }
+ }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ @Override
+ public int size()
+ {
+ return size;
+ }
+
+ public boolean offer(E e)
+ {
+ int length = elements.length;
+ if (size == length)
+ {
+ Object[] tmp = new Object[(length * 3) / 2 + 1];
+ System.arraycopy(elements, 0, tmp, 0, length);
+ elements = tmp;
+ }
+ elements[size++] = e;
+ return true;
+ }
+
+ public E poll()
+ {
+ if (size > 0)
+ {
+ int index = --size;
+ @SuppressWarnings("unchecked")
+ E element = (E)elements[index];
+ elements[index] = null;
+ return element;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public E peek()
+ {
+ if (size > 0)
+ {
+ @SuppressWarnings("unchecked")
+ E element = (E)elements[size - 1];
+ return element;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static <E> Queue<E> empty()
+ {
+ @SuppressWarnings("unchecked")
+ Queue<E> queue = (Queue<E>)EMPTY;
+ return queue;
+ }
+
+ public static <E> Queue<E> lifo()
+ {
+ return lifo(10);
+ }
+
+ public static <E> Queue<E> lifo(int initialCapacity)
+ {
+ return new LIFO<E>(initialCapacity);
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -26,6 +26,8 @@
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Collections;
+import java.util.Set;
/**
* A class that contains utility method that make the caller not worry much about the unexpectable expected such as
@@ -113,6 +115,26 @@
}
}
+ /**
+ * Wrap the set so that it is unmodifiable when it is not null, otherwise returns null.
+ *
+ * @todo it would be nice to avoid to rewrap unmodifiable set (not sure it is non proprietary possible)
+ * @param set the set to wrap
+ * @param <E> the set generic element type
+ * @return the unmodifiable set
+ */
+ public static <E> Set<E> unmodifiableSet(Set<E> set)
+ {
+ if (set == null)
+ {
+ return null;
+ }
+ else
+ {
+ return Collections.unmodifiableSet(set);
+ }
+ }
+
// THIS CODE IS TEMPORARY
/** . */
Copied: epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Spliterator.java (from rev 6783, portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/Spliterator.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Spliterator.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Spliterator.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.commons.utils;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * An iterator that splits a string into chunks without requiring to allocate an array to hold
+ * the various chunks of the splitted string.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Spliterator implements Iterator<String>
+{
+
+ /** . */
+ private final String s;
+
+ /** . */
+ private final char separator;
+
+ /** . */
+ private int from;
+
+ /** . */
+ private Integer to;
+
+ /**
+ * Creates a spliterator.
+ *
+ * @param s the string to split
+ * @param separator the separator
+ * @throws NullPointerException if the string is null
+ */
+ public Spliterator(String s, char separator) throws NullPointerException
+ {
+ if (s == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.s = s;
+ this.separator = separator;
+ this.from = 0;
+ this.to = null;
+ }
+
+ public boolean hasNext()
+ {
+ if (from == -1)
+ {
+ return false;
+ }
+ else
+ {
+ if (to == null)
+ {
+ to = s.indexOf(separator, from);
+ }
+ return true;
+ }
+ }
+
+ public String next()
+ {
+ if (hasNext())
+ {
+ String next;
+ if (to == -1)
+ {
+ next = s.substring(from);
+ from = -1;
+ }
+ else
+ {
+ next = s.substring(from, to);
+ from = to + 1;
+ }
+ to = null;
+ return next;
+ }
+ else
+ {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Copied: epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestQueues.java (from rev 6783, portal/trunk/component/common/src/test/java/org/exoplatform/commons/utils/TestQueues.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestQueues.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestQueues.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.commons.utils;
+
+import junit.framework.TestCase;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Queue;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestQueues extends TestCase
+{
+ public void testLIFO()
+ {
+ Queue<String> lifo = Queues.lifo();
+ assertEquals(0, lifo.size());
+ assertTrue(lifo.add("a"));
+ assertEquals(1, lifo.size());
+ assertTrue(lifo.add("b"));
+ assertEquals(2, lifo.size());
+ assertTrue(lifo.add("c"));
+ assertEquals(3, lifo.size());
+ Iterator<String> it = lifo.iterator();
+ assertEquals("c", it.next());
+ assertEquals("b", it.next());
+ assertEquals("a", it.next());
+ assertFalse(it.hasNext());
+ assertEquals("c", lifo.peek());
+ assertEquals(3, lifo.size());
+ assertEquals("c", lifo.poll());
+ assertEquals(2, lifo.size());
+ assertEquals("b", lifo.poll());
+ assertEquals(1, lifo.size());
+ assertEquals("a", lifo.poll());
+ assertEquals(0, lifo.size());
+ assertEquals(null, lifo.poll());
+ assertEquals(null, lifo.peek());
+ assertEquals(0, lifo.size());
+ assertEquals(null, lifo.poll());
+ assertEquals(null, lifo.peek());
+ assertEquals(0, lifo.size());
+ }
+
+ public void testLIFOResize()
+ {
+ Queue<String> lifo = Queues.lifo(0);
+ assertEquals(0, lifo.size());
+ lifo.add("a");
+ assertEquals(1, lifo.size());
+ assertEquals("a", lifo.peek());
+ assertEquals("a", lifo.poll());
+ assertEquals(0, lifo.size());
+ }
+
+ public void testEmpty()
+ {
+ Queue<String> lifo = Queues.empty();
+ assertFalse(lifo.offer(""));
+ try
+ {
+ lifo.add("");
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ assertEquals(0, lifo.size());
+ assertNull(lifo.peek());
+ assertNull(lifo.poll());
+ try
+ {
+ lifo.element();
+ fail();
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -25,6 +25,9 @@
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -139,4 +142,21 @@
}
}
+ public void testSetUnmodifiable()
+ {
+ assertNull(Safe.unmodifiableSet(null));
+ Set<String> strings = new HashSet<String>();
+ strings.add("a");
+ strings = Safe.unmodifiableSet(strings);
+ try
+ {
+ strings.add("b");
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+ assertEquals(Collections.singleton("a"), strings);
+ }
+
}
Copied: epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSpliterator.java (from rev 6783, portal/trunk/component/common/src/test/java/org/exoplatform/commons/utils/TestSpliterator.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSpliterator.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSpliterator.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.commons.utils;
+
+import org.exoplatform.component.test.AbstractGateInTest;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestSpliterator extends AbstractGateInTest
+{
+
+ public void testEmptyString()
+ {
+ Spliterator i = new Spliterator("", ' ');
+ assertTrue(i.hasNext());
+ assertEquals("", i.next());
+ assertFalse(i.hasNext());
+ }
+
+ public void testSeparatorString()
+ {
+ Spliterator i = new Spliterator(" ", ' ');
+ assertTrue(i.hasNext());
+ assertEquals("", i.next());
+ assertTrue(i.hasNext());
+ assertEquals("", i.next());
+ assertFalse(i.hasNext());
+ }
+
+ public void testEntireString()
+ {
+ Spliterator i = new Spliterator("a", ' ');
+ assertTrue(i.hasNext());
+ assertEquals("a", i.next());
+ assertFalse(i.hasNext());
+ }
+
+ public void testNormal()
+ {
+ Spliterator i = new Spliterator("a b", ' ');
+ assertTrue(i.hasNext());
+ assertEquals("a", i.next());
+ assertTrue(i.hasNext());
+ assertEquals("b", i.next());
+ assertFalse(i.hasNext());
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/gatein_objects_1_2.xsd 2011-07-18 22:48:36 UTC (rev 6885)
@@ -32,197 +32,176 @@
attributeFormDefault="unqualified"
version="1.0">
- <!-- A top page element -->
- <xs:element name="page" type="pageType"/>
+ <!-- A top page element -->
+ <xs:element name="page" type="pageType"/>
- <!-- A top page-set element -->
- <xs:element name="page-set" type="pageSetType"/>
+ <!-- A top page-set element -->
+ <xs:element name="page-set" type="pageSetType"/>
- <!-- A top portal-config element -->
- <xs:element name="portal-config" type="portalConfigType"/>
+ <!-- A top portal-config element -->
+ <xs:element name="portal-config" type="portalConfigType"/>
- <!-- A top container element -->
- <xs:element name="container" type="containerType"/>
+ <!-- A top container element -->
+ <xs:element name="container" type="containerType"/>
- <!-- A top node-navigation element -->
- <xs:element name="node-navigation" type="nodeNavigationType"/>
+ <!-- A top node-navigation element -->
+ <xs:element name="node-navigation" type="nodeNavigationType"/>
- <!-- The type of a top navigation node -->
- <xs:complexType name="nodeNavigationType">
- <xs:sequence>
- <xs:element name="priority" type="xs:positiveInteger"/>
- <xs:element name="page-nodes" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
+ <!-- A localized string -->
+ <xs:complexType name="localizedString">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute ref="xml:lang"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
- <!-- The type of a navigation node -->
- <xs:complexType name="nodeType">
- <xs:sequence>
- <xs:element name="uri" type="xs:string"/>
- <xs:element name="name" type="xs:string"/>
- <xs:element name="label" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="start-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="end-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="visibility" type="visibility" default="DISPLAYED" minOccurs="0" maxOccurs="1"/>
- <xs:element name="page-reference" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
+ <!-- The type of a top navigation node -->
+ <xs:complexType name="nodeNavigationType">
+ <xs:sequence>
+ <xs:element name="priority" type="xs:positiveInteger"/>
+ <xs:element name="page-nodes" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
- <xs:simpleType name="visibility">
- <xs:restriction base='xs:string'>
- <xs:enumeration value="DISPLAYED"/>
- <xs:enumeration value="HIDDEN"/>
- <xs:enumeration value="TEMPORAL"/>
- <xs:enumeration value="SYSTEM"/>
- </xs:restriction>
- </xs:simpleType>
+ <!-- The type of a navigation node -->
+ <xs:complexType name="nodeType">
+ <xs:sequence>
+ <xs:element name="uri" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="label" type="localizedString" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="start-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="end-publication-date" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="visibility" type="visibility" default="VISIBLE" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="page-reference" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="node" type="nodeType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="pageSetType">
- <xs:sequence>
- <xs:element name="page" type="pageType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:simpleType name="visibility">
+ <xs:restriction base='xs:string'>
+ <xs:enumeration value="DISPLAYED"/>
+ <xs:enumeration value="HIDDEN"/>
+ <xs:enumeration value="TEMPORAL"/>
+ <xs:enumeration value="SYSTEM"/>
+ </xs:restriction>
+ </xs:simpleType>
- <xs:complexType name="portalConfigType">
- <xs:sequence>
- <xs:element name="portal-name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="label" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="locale" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="skin" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="portal-layout" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:group ref="containerChildrenGroup"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="pageSetType">
+ <xs:sequence>
+ <xs:element name="page" type="pageType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="propertiesType">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:element name="entry" type="propertiesEntryType" minOccurs="1" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portalConfigType">
+ <xs:sequence>
+ <xs:element name="portal-name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="locale" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="skin" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="portal-layout" minOccurs="1" maxOccurs="1">
+ <xs:complexType>
+ <xs:group ref="containerChildrenGroup"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="propertiesEntryType">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="key" type="xs:string"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
+ <xs:complexType name="propertiesType">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="entry" type="propertiesEntryType" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:group name="containerChildrenGroup">
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="portlet-application" type="portletApplicationType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="gadget-application" type="gadgetApplicationType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="container" type="containerType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="page-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="site-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
- </xs:choice>
- </xs:sequence>
- </xs:group>
+ <xs:complexType name="propertiesEntryType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="key" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
- <xs:complexType name="pageType">
- <xs:sequence>
- <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="show-max-window" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:group ref="containerChildrenGroup"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:group name="containerChildrenGroup">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="portlet-application" type="portletApplicationType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="container" type="containerType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="page-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="site-body" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
- <xs:complexType name="containerType">
- <xs:sequence>
- <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:group ref="containerChildrenGroup"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:string"/>
- <xs:attribute name="template" type="xs:string"/>
- <xs:attribute name="attribute" type="xs:string"/>
- <xs:attribute name="width" type="xs:string"/>
- <xs:attribute name="height" type="xs:string"/>
- </xs:complexType>
+ <xs:complexType name="pageType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="edit-permission" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="show-max-window" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:group ref="containerChildrenGroup"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="portletApplicationType">
- <xs:sequence>
- <xs:choice>
- <xs:element name="portlet" type="portletType"/>
- <xs:element name="wsrp" type="xs:string"/>
- </xs:choice>
- <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="show-info-bar" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
- <xs:element name="show-application-state" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:element name="show-application-mode" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="containerType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="factory-id" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:group ref="containerChildrenGroup"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ <xs:attribute name="template" type="xs:string"/>
+ <xs:attribute name="attribute" type="xs:string"/>
+ </xs:complexType>
- <xs:complexType name="gadgetApplicationType">
- <xs:sequence>
- <xs:element name="gadget" type="gadgetType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="theme" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="access-permissions" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="show-info-bar" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
- <xs:element name="show-application-state" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:element name="show-application-mode" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="icon" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portletApplicationType">
+ <xs:sequence>
+ <xs:element name="portlet" type="portletType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="access-permissions" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="show-info-bar" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="show-application-state" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="show-application-mode" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="portletType">
- <xs:sequence>
- <xs:element name="application-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="portlet-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="preferences" type="portletPreferencesType" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portletType">
+ <xs:sequence>
+ <xs:element name="application-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="portlet-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="preferences" type="portletPreferencesType" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="gadgetType">
- <xs:sequence>
- <xs:element name="gadget-ref" type="xs:string" minOccurs="1" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portletPreferencesType">
+ <xs:sequence>
+ <xs:element name="preference" type="portletPreferenceType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
- <xs:complexType name="portletPreferencesType">
- <xs:sequence>
- <xs:element name="preference" type="portletPreferenceType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="portletPreferenceType">
- <xs:sequence>
- <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="read-only" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:complexType name="portletPreferenceType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="read-only" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -27,10 +27,10 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.pom.config.tasks.PreferencesTask;
+import org.exoplatform.portal.pom.data.ModelChange;
import java.util.Comparator;
import java.util.List;
@@ -50,12 +50,6 @@
public final static String PAGE_UPDATED = "org.exoplatform.portal.config.DataStorage.pageUpdated".intern();
- public final static String NAVIGATION_CREATED = "org.exoplatform.portal.config.DataStorage.navigationCreated".intern();
-
- public final static String NAVIGATION_REMOVED = "org.exoplatform.portal.config.DataStorage.navigationRemoved".intern();
-
- public final static String NAVIGATION_UPDATED = "org.exoplatform.portal.config.DataStorage.navigationUpdated".intern();
-
public final static String PORTAL_CONFIG_CREATED = "org.exoplatform.portal.config.DataStorage.portalConfigCreated".intern();
public final static String PORTAL_CONFIG_REMOVED = "org.exoplatform.portal.config.DataStorage.portalConfigRemoved".intern();
@@ -148,47 +142,6 @@
public List<ModelChange> save(Page page) throws Exception;
/**
- * Return PageNavigation object from the database according to the fullId <br />
- * If can't find, return null
- * @param fullId - must be valid (2 parts, split by :: )
- * @throws Exception
- */
- public PageNavigation getPageNavigation(String fullId) throws Exception;
-
- /**
- * Return PageNavigation object from the database according to the onwnerType (portal, group or user) and id
- * @param ownerType
- * @param id
- * @throws Exception
- */
- public PageNavigation getPageNavigation(String ownerType, String id) throws Exception;
-
- /**
- * This method should update the navigation object in the database <br />
- * Then broadcast NAVIGATION_UPDATED event
- * @param navigation - PageNavigation object to update
- * @throws Exception
- */
- public void save(PageNavigation navigation) throws Exception;
-
- /**
- * This method should create the navigation object in the database <br />
- * Then broadcast NAVIGATION_CREATED event
- * @param navigation - PageNavigation object to create
- * @throws Exception
- */
- public void create(PageNavigation navigation) throws Exception;
-
- /**
- * Remove the navigation object from the database <br />
- * If can't find it in database, ignore
- * Then broadcast NAVIGATION_REMOVED event
- * @param navigation - PageNavigation object to remove
- * @throws Exception
- */
- public void remove(PageNavigation navigation) throws Exception;
-
- /**
* Save PortletPreferences config node
* @param portletPreferences - PortletPreferences object
*/
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -18,13 +18,6 @@
*/
package org.exoplatform.portal.config;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.application.PortletPreferences;
@@ -34,20 +27,24 @@
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.pom.data.DashboardData;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.data.ModelData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
-import org.exoplatform.portal.pom.data.NavigationData;
-import org.exoplatform.portal.pom.data.NavigationKey;
import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
import org.exoplatform.services.listener.ListenerService;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -72,12 +69,6 @@
return new Page(delegate.clonePage(key, cloneKey));
}
- public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
- {
- NavigationData data = delegate.getPageNavigation(new NavigationKey(ownerType, id));
- return data != null ? new PageNavigation(data) : null;
- }
-
public void create(PortalConfig config) throws Exception
{
delegate.create(config.build());
@@ -115,24 +106,6 @@
listenerServ_.broadcast(PAGE_REMOVED, this, page);
}
- public void create(PageNavigation navigation) throws Exception
- {
- delegate.create(navigation.build());
- listenerServ_.broadcast(NAVIGATION_CREATED, this, navigation);
- }
-
- public void save(PageNavigation navigation) throws Exception
- {
- delegate.save(navigation.build());
- listenerServ_.broadcast(NAVIGATION_UPDATED, this, navigation);
- }
-
- public void remove(PageNavigation navigation) throws Exception
- {
- delegate.remove(navigation.build());
- listenerServ_.broadcast(NAVIGATION_REMOVED, this, navigation);
- }
-
public <S> S load(ApplicationState<S> state, ApplicationType<S> type) throws Exception
{
return delegate.load(state, type);
@@ -158,13 +131,6 @@
return getPortalConfig(PortalConfig.PORTAL_TYPE, portalName);
}
- public PageNavigation getPageNavigation(String fullId) throws Exception
- {
- NavigationKey key = NavigationKey.create(fullId);
- NavigationData data = delegate.getPageNavigation(key);
- return data != null ? new PageNavigation(data) : null;
- }
-
public Page getPage(String pageId) throws Exception
{
PageKey key = PageKey.create(pageId);
@@ -225,23 +191,27 @@
private List<D> sort(List<D> list, final Comparator<O> comparator) {
- List<D> tmpList = new ArrayList<D>();
- for (int i=0; i<list.size();i++) {
- tmpList.add(list.get(i));
- }
- Collections.sort(tmpList, new Comparator<D>() {
- public int compare(D d1, D d2)
- {
- if (comparator == null) {
- return d1.getStorageId().compareTo(d2.getStorageId());
- }
- O o1 = create(d1);
- O o2 = create(d2);
- return comparator.compare(o1, o2);
+ if (comparator != null)
+ {
+ List<D> tmpList = new ArrayList<D>();
+ for (int i=0; i<list.size();i++) {
+ tmpList.add(list.get(i));
}
-
- });
- return tmpList;
+ Collections.sort(tmpList, new Comparator<D>() {
+ public int compare(D d1, D d2)
+ {
+ O o1 = create(d1);
+ O o2 = create(d2);
+ return comparator.compare(o1, o2);
+ }
+
+ });
+ return tmpList;
+ }
+ else
+ {
+ return list;
+ }
}
}
@@ -282,18 +252,6 @@
};
return (ListAccess<T>)bilto.execute();
}
- else if (type == PageNavigation.class)
- {
- Bilto<PageNavigation, NavigationData> bilto = new Bilto<PageNavigation, NavigationData>((Query<PageNavigation>)q, NavigationData.class, (Comparator<PageNavigation>)sortComparator)
- {
- @Override
- protected PageNavigation create(NavigationData page)
- {
- return new PageNavigation(page);
- }
- };
- return (ListAccess<T>)bilto.execute();
- }
else if (type == PortalConfig.class)
{
Bilto<PortalConfig, PortalData> bilto = new Bilto<PortalConfig, PortalData>((Query<PortalConfig>)q, PortalData.class, (Comparator<PortalConfig>)sortComparator)
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -21,9 +21,10 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupEventListener;
import org.exoplatform.services.organization.GroupHandler;
@@ -44,16 +45,11 @@
private final UserPortalConfigService portalConfigService;
/** . */
- private final DataStorage dataStorage;
-
- /** . */
private final OrganizationService orgService;
- public GroupPortalConfigListener(UserPortalConfigService portalConfigService, DataStorage dataStorage,
- OrganizationService orgService)
+ public GroupPortalConfigListener(UserPortalConfigService portalConfigService, OrganizationService orgService)
{
this.portalConfigService = portalConfigService;
- this.dataStorage = dataStorage;
this.orgService = orgService;
}
@@ -65,7 +61,7 @@
String groupId = group.getId().trim();
// Remove all descendant navigations
- removeGroupNavigation(group, dataStorage);
+ removeGroupNavigation(group);
portalConfigService.removeUserPortalConfig(PortalConfig.GROUP_TYPE, groupId);
}
@@ -150,19 +146,22 @@
}
}
- private void removeGroupNavigation(Group group, DataStorage dataService) throws Exception
+ private void removeGroupNavigation(Group group) throws Exception
{
GroupHandler groupHandler = orgService.getGroupHandler();
Collection<String> descendantGroups = getDescendantGroups(group, groupHandler);
Collection<String> deletedNavigationGroups = new ArrayList<String>();
deletedNavigationGroups.addAll(descendantGroups);
deletedNavigationGroups.add(group.getId());
- PageNavigation navigation = null;
for (String childGroup : deletedNavigationGroups)
{
- navigation = dataService.getPageNavigation(PortalConfig.GROUP_TYPE, childGroup);
- if (navigation != null)
- dataService.remove(navigation);
+ SiteKey key = SiteKey.group(childGroup);
+ NavigationService navService = portalConfigService.getNavigationService();
+ NavigationContext nav = navService.loadNavigation(key);
+ if (nav != null)
+ {
+ navService.destroyNavigation(nav);
+ }
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -28,12 +28,16 @@
import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.PortletPreferences.PortletPreferencesSet;
+import org.exoplatform.portal.config.importer.ImportMode;
+import org.exoplatform.portal.config.importer.NavigationImporter;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.Page.PageSet;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.pom.config.POMSessionManager;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.jibx.runtime.*;
@@ -92,11 +96,18 @@
/** . */
private Logger log = LoggerFactory.getLogger(getClass());
- public NewPortalConfigListener(DataStorage dataStorage, ConfigurationManager cmanager, InitParams params)
+ /** . */
+ private final POMSessionManager pomMgr;
+
+ /** . */
+ private NavigationService navigationService_;
+
+ public NewPortalConfigListener(POMSessionManager pomMgr, DataStorage dataStorage, ConfigurationManager cmanager, InitParams params, NavigationService navigationService)
throws Exception
{
cmanager_ = cmanager;
dataStorage_ = dataStorage;
+ navigationService_ = navigationService;
ValueParam valueParam = params.getValueParam("page.templates.location");
if (valueParam != null)
@@ -143,15 +154,16 @@
overrideExistingData = false;
}
+ this.pomMgr = pomMgr;
}
public void run() throws Exception
{
+ //DANGEROUS! If the user delete the defaultPortal (ie: classic), the next time he restarts
+ //the server. Data of predefined owners would be overriden
RequestLifeCycle.begin(PortalContainer.getInstance());
try
{
- //DANGEROUS! If the user delete the defaultPortal (ie: classic), the next time he restarts
- //the server. Data of predefined owners would be overriden
if (dataStorage_.getPortalConfig(defaultPortal) != null && !overrideExistingData)
return;
}
@@ -451,24 +463,15 @@
{
return;
}
- PageNavigation currentNavigation = dataStorage_.getPageNavigation(navigation.getOwner());
- if (currentNavigation == null)
- {
- dataStorage_.create(navigation);
- }
- else
- {
- if(overrideExistingData)
- {
- dataStorage_.remove(currentNavigation);
- dataStorage_.create(navigation);
- }
- else
- {
- navigation.merge(currentNavigation);
- dataStorage_.save(navigation);
- }
- }
+
+ //
+ ImportMode importMode = overrideExistingData ? ImportMode.REIMPORT : ImportMode.MERGE;
+
+ //
+ NavigationImporter merge =new NavigationImporter(importMode, navigation, navigationService_);
+
+ //
+ merge.perform();
}
public void createPortletPreferences(NewPortalConfig config, String owner) throws Exception
@@ -702,9 +705,9 @@
pageRef = type + "::" + owner + "::" + name;
pageNode.setPageReference(pageRef);
}
- if (pageNode.getChildren() != null)
+ if (pageNode.getNodes() != null)
{
- for (PageNode childPageNode : pageNode.getChildren())
+ for (PageNode childPageNode : pageNode.getNodes())
{
fixOwnerName(childPageNode);
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -23,8 +23,8 @@
import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.container.xml.ValuesParam;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
@@ -293,43 +293,46 @@
return false;
}
- public boolean hasEditPermission(PageNavigation pageNav)
+ // copied from @link{#hasEditPermission}
+ public boolean hasEditPermissionOnNavigation(SiteKey siteKey)
{
Identity identity = getIdentity();
if (superUser_.equals(identity.getUserId()))
{
- pageNav.setModifiable(true);
return true;
}
- String ownerType = pageNav.getOwnerType();
-
- if (PortalConfig.GROUP_TYPE.equals(ownerType))
+
+ //
+ switch (siteKey.getType())
{
- String temp = pageNav.getOwnerId().trim();
- String expAdminGroup = getAdminGroups();
- String expPerm = null;
+ case PORTAL:
+ //TODO: We should also take care of Portal's navigation
+ return false;
+ case GROUP:
+ String temp = siteKey.getName().trim();
+ String expAdminGroup = getAdminGroups();
+ String expPerm = null;
- // Check to see whether current user is member of admin group or not,
- // if so grant
- // edit permission for group navigation for that user.
- if (expAdminGroup != null)
- {
- expAdminGroup = expAdminGroup.startsWith("/") ? expAdminGroup : "/" + expAdminGroup;
- expPerm = temp.startsWith("/") ? temp : "/" + temp;
- if (isUserInGroup(expPerm) && isUserInGroup(expAdminGroup))
+ // Check to see whether current user is member of admin group or not,
+ // if so grant
+ // edit permission for group navigation for that user.
+ if (expAdminGroup != null)
{
- return true;
+ expAdminGroup = expAdminGroup.startsWith("/") ? expAdminGroup : "/" + expAdminGroup;
+ expPerm = temp.startsWith("/") ? temp : "/" + temp;
+ if (isUserInGroup(expPerm) && isUserInGroup(expAdminGroup))
+ {
+ return true;
+ }
}
- }
- expPerm = navigationCreatorMembershipType_ + (temp.startsWith("/") ? ":" + temp : ":/" + temp);
- return hasPermission(identity, expPerm);
+ expPerm = navigationCreatorMembershipType_ + (temp.startsWith("/") ? ":" + temp : ":/" + temp);
+ return hasPermission(identity, expPerm);
+ case USER:
+ return siteKey.getName().equals(identity.getUserId());
+ default:
+ return false;
}
- else if (PortalConfig.USER_TYPE.equals(ownerType))
- {
- return pageNav.getOwnerId().equals(identity.getUserId());
- }
- return false;
}
public boolean hasPermission(Page page)
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,92 +19,68 @@
package org.exoplatform.portal.config;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.user.UserPortalContext;
+import org.exoplatform.portal.mop.user.UserPortal;
+import org.exoplatform.portal.mop.user.UserPortalImpl;
-import java.util.ArrayList;
-import java.util.List;
-
public class UserPortalConfig
{
- private PortalConfig portal;
+ PortalConfig portal;
- private List<PageNavigation> navigations;
-
- /** Added by Minh Hoang TO */
- private PageNavigation selectedNavigation;
+ final UserPortalConfigService service;
- public UserPortalConfig()
- {
+ final String portalName;
- }
+ final String accessUser;
- public UserPortalConfig(PortalConfig portal, List<PageNavigation> navigations)
- {
- this.portal = portal;
- this.navigations = navigations;
- }
+ /** . */
+ private UserPortalImpl userPortal;
- public PortalConfig getPortalConfig()
+ /** . */
+ private UserPortalContext bundleResolver;
+
+ public UserPortalConfig()
{
- return portal;
+ this.portal = null;
+ this.service = null;
+ this.portalName = null;
+ this.accessUser = null;
+ this.bundleResolver = null;
}
- public void setPortal(PortalConfig portal)
+ public UserPortalConfig(PortalConfig portal, UserPortalConfigService service, String portalName, String accessUser, UserPortalContext bundleResolver)
{
this.portal = portal;
+ this.service = service;
+ this.portalName = portalName;
+ this.accessUser = accessUser;
+ this.bundleResolver = bundleResolver;
}
-
- public void setSelectedNavigation(PageNavigation _selectedNavigation)
- {
- this.selectedNavigation = _selectedNavigation;
- }
- /** Fetch navigation (specified by ownerType, ownerId) from the list of all navigations and set it as selected navigation **/
- public void updateSelectedNavigation(String ownerType, String ownerId)
+ public UserPortal getUserPortal()
{
- PageNavigation targetNavigation = null;
- for (PageNavigation nav : navigations)
- {
- if (nav.getOwnerType().equals(ownerType) && nav.getOwnerId().equals(ownerId))
- {
- targetNavigation = nav;
- break;
- }
- }
-
- if (targetNavigation != null)
- {
- this.setSelectedNavigation(targetNavigation);
- }
+ userPortal = new UserPortalImpl(
+ service,
+ service.navService,
+ service.orgService_,
+ service.userACL_,
+ portalName,
+ portal,
+ accessUser,
+ bundleResolver
+ );
+ return userPortal;
}
-
- public PageNavigation getSelectedNavigation()
- {
- if(this.selectedNavigation != null)
- {
- return this.selectedNavigation;
- }
- return navigations.get(0);
- }
-
- public void setNavigations(List<PageNavigation> navs)
- {
- navigations = navs;
- }
- public List<PageNavigation> getNavigations()
+ public PortalConfig getPortalConfig()
{
- return navigations;
+ return portal;
}
- public void addNavigation(PageNavigation nav)
+ public void setPortal(PortalConfig portal)
{
- if (navigations == null)
- navigations = new ArrayList<PageNavigation>();
- if (nav == null)
- return;
- navigations.add(nav);
+ this.portal = portal;
}
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -20,17 +20,18 @@
package org.exoplatform.portal.config;
import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentPlugin;
-import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.user.UserPortalContext;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -46,26 +47,41 @@
*/
public class UserPortalConfigService implements Startable
{
- private DataStorage storage_;
+ DataStorage storage_;
- private UserACL userACL_;
+ UserACL userACL_;
- private OrganizationService orgService_;
+ OrganizationService orgService_;
private NewPortalConfigListener newPortalConfigListener_;
+
+ /** . */
+ final NavigationService navService;
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
public UserPortalConfigService(
UserACL userACL, DataStorage storage,
- OrganizationService orgService) throws Exception
+ OrganizationService orgService,
+ NavigationService navService) throws Exception
{
this.storage_ = storage;
this.orgService_ = orgService;
this.userACL_ = userACL;
+ this.navService = navService;
}
/**
+ * Returns the navigation service associated with this service.
+ *
+ * @return the navigation service;
+ */
+ public NavigationService getNavigationService()
+ {
+ return navService;
+ }
+
+ /**
* <p> Build and returns an instance of <tt>UserPortalConfig</tt>. </p>
* <p/>
* <p> To return a valid config, the current thread must be associated with an identity that will grant him access to
@@ -92,71 +108,19 @@
*/
public UserPortalConfig getUserPortalConfig(String portalName, String accessUser) throws Exception
{
+ return getUserPortalConfig(portalName, accessUser, null);
+ }
+
+ public UserPortalConfig getUserPortalConfig(String portalName, String accessUser, UserPortalContext bundleResolver) throws Exception
+ {
PortalConfig portal = storage_.getPortalConfig(portalName);
if (portal == null || !userACL_.hasPermission(portal))
{
return null;
}
- List<PageNavigation> navigations = new ArrayList<PageNavigation>();
- PageNavigation navigation = storage_.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
- if (navigation != null)
- {
- navigation.setModifiable(userACL_.hasPermission(portal.getEditPermission()));
- navigations.add(navigation);
- }
- if (accessUser == null)
- {
- // navigation = getPageNavigation(PortalConfig.GROUP_TYPE,
- // userACL_.getGuestsGroup());
- // if (navigation != null)
- // navigations.add(navigation);
- }
- else
- {
- navigation = storage_.getPageNavigation(PortalConfig.USER_TYPE, accessUser);
- if (navigation != null)
- {
- navigation.setModifiable(true);
- navigations.add(navigation);
- }
-
- Collection<?> groups = null;
- if (userACL_.getSuperUser().equals(accessUser))
- {
- groups = orgService_.getGroupHandler().getAllGroups();
- }
- else
- {
- groups = orgService_.getGroupHandler().findGroupsOfUser(accessUser);
- }
- for (Object group : groups)
- {
- Group m = (Group)group;
- String groupId = m.getId().trim();
- if (groupId.equals(userACL_.getGuestsGroup()))
- {
- continue;
- }
- navigation = storage_.getPageNavigation(PortalConfig.GROUP_TYPE, groupId);
- if (navigation == null)
- {
- continue;
- }
- navigation.setModifiable(userACL_.hasEditPermission(navigation));
- navigations.add(navigation);
- }
- }
- Collections.sort(navigations, new Comparator<PageNavigation>()
- {
- public int compare(PageNavigation nav1, PageNavigation nav2)
- {
- return nav1.getPriority() - nav2.getPriority();
- }
- });
-
- return new UserPortalConfig(portal, navigations);
+ return new UserPortalConfig(portal, this, portalName, accessUser, bundleResolver);
}
/**
@@ -240,15 +204,12 @@
}
// Create a blank navigation if needed
- PageNavigation navigation = storage_.getPageNavigation(PortalConfig.USER_TYPE, userName);
- if (navigation == null)
+ SiteKey key = SiteKey.user(userName);
+ NavigationContext nav = navService.loadNavigation(key);
+ if (nav == null)
{
- PageNavigation pageNav = new PageNavigation();
- pageNav.setOwnerType(PortalConfig.USER_TYPE);
- pageNav.setOwnerId(userName);
- pageNav.setPriority(5);
- pageNav.setNodes(new ArrayList<PageNode>());
- storage_.create(pageNav);
+ nav = new NavigationContext(key, new NavigationState(5));
+ navService.saveNavigation(nav);
}
}
@@ -435,96 +396,6 @@
}
/**
- * Creates a navigation and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#CREATE_NAVIGATION_EVENT}
- * when the creation is successful.
- *
- * @deprecated This method is not useful anymore. The preferred way to do this is
- * using directly {@link org.exoplatform.portal.config.DataStorage#create(PageNavigation)}
- *
- * @param navigation the navigation to create
- * @throws Exception any exception
- */
- @Deprecated
- public void create(PageNavigation navigation) throws Exception
- {
- storage_.create(navigation);
- }
-
- /**
- * Updates a page navigation broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_UPDATED}
- * when the creation is successful.
- *
- * @deprecated This method is not useful anymore. The preferred way to do this is
- * using directly {@link org.exoplatform.portal.config.DataStorage#save(PageNavigation)}
- *
- * @param navigation the navigation to update
- * @throws Exception any exception
- */
- @Deprecated
- public void update(PageNavigation navigation) throws Exception
- {
- storage_.save(navigation);
- }
-
- /**
- * Removes a navigation and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_REMOVED}
- * when the removal is successful.
- *
- * @deprecated This method is not useful anymore. The preferred way to do this is
- * using directly {@link org.exoplatform.portal.config.DataStorage#remove(PageNavigation)}
- *
- * @param navigation the navigation to remove
- * @throws Exception any exception
- */
- @Deprecated
- public void remove(PageNavigation navigation) throws Exception
- {
- storage_.remove(navigation);
- }
-
- /**
- * @deprecated This method is not useful anymore. The preferred way to do this is
- * using directly {@link org.exoplatform.portal.config.DataStorage#getPageNavigation(String, String)}
- *
- * @param ownerType
- * @param id
- * @return
- * @throws Exception
- */
- @Deprecated
- public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
- {
- PageNavigation navigation = storage_.getPageNavigation(ownerType, id);
- return navigation;
- }
-
- /**
- * This method creates new page from an existing page and links new page to a PageNode.
- *
- * @param nodeName
- * @param nodeLabel
- * @param pageId
- * @param ownerType
- * @param ownerId
- * @return
- * @throws Exception
- */
- public PageNode createNodeFromPageTemplate(String nodeName, String nodeLabel, String pageId, String ownerType,
- String ownerId) throws Exception
- {
- Page page = storage_.clonePage(pageId, nodeName, ownerType, ownerId);
- PageNode pageNode = new PageNode();
- if (nodeLabel == null || nodeLabel.trim().length() < 1)
- {
- nodeLabel = nodeName;
- }
- pageNode.setName(nodeName);
- pageNode.setLabel(nodeLabel);
- pageNode.setPageReference(page.getPageId());
- return pageNode;
- }
-
- /**
* Clones a page.
*
* @deprecated This method is not useful anymore. The preferred way to do this is
@@ -560,53 +431,6 @@
}
/**
- * Load all navigation that user has edit permission.
- *
- * @return the navigation the user can edit
- * @throws Exception any exception
- */
- public List<PageNavigation> loadEditableNavigations() throws Exception
- {
- Query<PageNavigation> query = new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
- List<PageNavigation> navis = storage_.find(query, new Comparator<PageNavigation>()
- {
- public int compare(PageNavigation pconfig1, PageNavigation pconfig2)
- {
- return pconfig1.getOwnerId().compareTo(pconfig2.getOwnerId());
- }
- }).getAll();
-
- //
- List<PageNavigation> navigations = new ArrayList<PageNavigation>();
- for (PageNavigation ele : navis)
- {
- if (userACL_.hasEditPermission(ele))
- {
- navigations.add(ele);
- }
- }
- return navigations;
- }
-
- /**
- * Returns the list of group ids having navigation.
- *
- * @return the group id having navigation
- * @throws Exception any exception
- */
- public Set<String> findGroupHavingNavigation() throws Exception
- {
- Query<PageNavigation> query = new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
- Set<String> groupIds = new HashSet<String>();
- List<PageNavigation> navis = storage_.find(query).getAll();
- for (PageNavigation ele : navis)
- {
- groupIds.add(ele.getOwnerId());
- }
- return groupIds;
- }
-
- /**
* Returns the list of all portal names.
*
* @return the list of all portal names
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.config.importer;
-
-/**
- * The import mode.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public enum ImportMode
-{
-
- /**
- * Import data when it does not exist, otherwise do nothing.
- */
- CONSERVE,
-
- /**
- * Import data when it does not exist, otherwise try a merge strategy that adds new data but ignore other modifications.
- */
- MERGE,
-
- /**
- * Reimport data whatsoever.
- */
- REIMPORT
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/ImportMode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.importer;
+
+/**
+ * The import mode.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public enum ImportMode
+{
+
+ /**
+ * Import data when it does not exist, otherwise do nothing.
+ */
+ CONSERVE,
+
+ /**
+ * Import data when it does not exist, otherwise try a merge strategy that adds new data but ignore other modifications.
+ */
+ MERGE,
+
+ /**
+ * Reimport data whatsoever.
+ */
+ REIMPORT
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.config.importer;
-
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PageNodeContainer;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.NavigationState;
-import org.exoplatform.portal.mop.navigation.NodeChangeListener;
-import org.exoplatform.portal.mop.navigation.NodeChangeQueue;
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeModel;
-import org.exoplatform.portal.mop.navigation.NodeState;
-import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.tree.diff.Adapters;
-import org.exoplatform.portal.tree.diff.ListAdapter;
-import org.exoplatform.portal.tree.diff.ListChangeIterator;
-import org.exoplatform.portal.tree.diff.ListChangeType;
-import org.exoplatform.portal.tree.diff.ListDiff;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class NavigationImporter
-{
-
- private static final ListAdapter<PageNodeContainer, String> PAGE_NODE_CONTAINER_ADAPTER = new ListAdapter<PageNodeContainer, String>()
- {
- public int size(PageNodeContainer list)
- {
- List<PageNode> nodes = list.getNodes();
- if (nodes == null)
- {
- return 0;
- }
- else
- {
- return nodes.size();
- }
- }
-
- public Iterator<String> iterator(PageNodeContainer list, boolean reverse)
- {
- List<PageNode> nodes = list.getNodes();
- if (nodes == null)
- {
- return Collections.<String>emptyList().iterator();
- }
- else {
- String[] names = new String[nodes.size()];
- int index = 0;
- for (PageNode child : nodes)
- {
- names[index++] = child.getName();
- }
- return Adapters.<String>list().iterator(names, reverse);
- }
- }
- };
-
- private static final ListAdapter<NodeContext<?>, String> NODE_ADAPTER = new ListAdapter<NodeContext<?>, String>()
- {
- public int size(NodeContext<?> list)
- {
- return list.getNodeCount();
- }
-
- public Iterator<String> iterator(NodeContext<?> list, boolean reverse)
- {
- int size = list.getNodeCount();
- String[] names = new String[size];
- int index = 0;
- for (NodeContext<?> child = list.getFirst();child != null;child = child.getNext())
- {
- names[index++] = child.getName();
- }
- return Adapters.<String>list().iterator(names, reverse);
- }
- };
-
- /** . */
- private final PageNavigation src;
-
- /** . */
- private final NavigationService service;
-
- /** . */
- private final ImportMode mode;
-
- public NavigationImporter(ImportMode mode, PageNavigation src, NavigationService service)
- {
- this.mode = mode;
- this.src = src;
- this.service = service;
- }
-
- public void perform()
- {
-
- //
- SiteKey key = new SiteKey(src.getOwnerType(), src.getOwnerId());
-
- //
- NavigationContext dst = service.loadNavigation(key);
-
- //
- switch (mode)
- {
- case CONSERVE:
- if (dst == null)
- {
- dst = new NavigationContext(key, new NavigationState(src.getPriority()));
- service.saveNavigation(dst);
- }
- else
- {
- dst = null;
- }
- break;
- case MERGE:
- if (dst == null)
- {
- dst = new NavigationContext(key, new NavigationState(src.getPriority()));
- service.saveNavigation(dst);
- }
- break;
- case REIMPORT:
- if (dst != null)
- {
- service.destroyNavigation(dst);
- }
- else
- {
- dst = new NavigationContext(key, new NavigationState(src.getPriority()));
- }
- service.saveNavigation(dst);
- break;
- }
-
- //
- if (dst != null)
- {
- NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, dst, Scope.SINGLE, null).getNode();
- perform(src, node);
- service.saveNode(node, null);
- }
- }
-
- private void perform(PageNodeContainer src, final NodeContext<?> dst)
- {
- service.rebaseNode(dst, Scope.CHILDREN, null);
-
- //
- ListDiff<PageNodeContainer, NodeContext<?>, String> diff = new ListDiff<PageNodeContainer, NodeContext<?>, String>(
- PAGE_NODE_CONTAINER_ADAPTER,
- NODE_ADAPTER);
-
- //
- List<PageNode> srcChildren = src.getNodes();
- ListChangeIterator<PageNodeContainer, NodeContext<?>, String> it = diff.iterator(src, dst);
- NodeChangeQueue<PageNodeContainer> changes = new NodeChangeQueue<PageNodeContainer>();
-
- //
- while (it.hasNext())
- {
- ListChangeType changeType = it.next();
- String name = it.getElement();
- PageNode srcChild = src.getNode(name);
- NodeContext<?> dstChild = dst.get(name);
-
- //
- switch (changeType)
- {
- case SAME:
- perform(srcChild, dstChild);
- break;
- case REMOVE:
- if (dst.getNode(name) != null)
- {
- // It's a move we do nothing
- }
- else
- {
- // It's an addition
- int index = srcChildren.indexOf(srcChild);
- PageNode previous = index == 0 ? null : srcChildren.get(index - 1);
- changes.onAdd(srcChild, src, previous);
- }
- break;
- case ADD:
- if (src.getNode(name) != null)
- {
- // It's a move
- int index = srcChildren.indexOf(srcChild);
- PageNode previous = index == 0 ? null : srcChildren.get(index - 1);
- changes.onMove(srcChild, src, src, previous);
- }
- else
- {
- // It's a removal we do nothing
- }
- break;
- }
- }
-
- //
- changes.broadcast(new NodeChangeListener.Base<PageNodeContainer>()
- {
- @Override
- public void onAdd(PageNodeContainer target, PageNodeContainer parent, PageNodeContainer previous)
- {
- add((PageNode)target, (PageNode)previous, dst);
- }
-
- private void add(PageNode target, PageNode previous, NodeContext<?> dst)
- {
- String name = target.getName();
- int index = 0;
- if (previous != null)
- {
- index = dst.get((previous).getName()).getIndex() + 1;
- }
- NodeContext<?> child = dst.add(index, name);
- Date start = target.getStartPublicationDate();
- Date end = target.getEndPublicationDate();
- NodeState state = new NodeState(
- target.getLabel(),
- target.getIcon(),
- start == null ? -1 : start.getTime(),
- end == null ? -1 : end.getTime(),
- target.getVisibility(),
- target.getPageReference()
- );
- child.setState(state);
-
- //
- List<PageNode> targetChildren = target.getNodes();
- if (targetChildren != null)
- {
- PageNode targetPrevious = null;
- for (PageNode targetChild : targetChildren)
- {
- add(targetChild, targetPrevious, child);
- targetPrevious = targetChild;
- }
- }
- }
- });
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/importer/NavigationImporter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.importer;
+
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.config.model.PageNodeContainer;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.navigation.NodeChangeListener;
+import org.exoplatform.portal.mop.navigation.NodeChangeQueue;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.NodeState;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.tree.diff.Adapters;
+import org.exoplatform.portal.tree.diff.ListAdapter;
+import org.exoplatform.portal.tree.diff.ListChangeIterator;
+import org.exoplatform.portal.tree.diff.ListChangeType;
+import org.exoplatform.portal.tree.diff.ListDiff;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class NavigationImporter
+{
+
+ private static final ListAdapter<PageNodeContainer, String> PAGE_NODE_CONTAINER_ADAPTER = new ListAdapter<PageNodeContainer, String>()
+ {
+ public int size(PageNodeContainer list)
+ {
+ List<PageNode> nodes = list.getNodes();
+ if (nodes == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return nodes.size();
+ }
+ }
+
+ public Iterator<String> iterator(PageNodeContainer list, boolean reverse)
+ {
+ List<PageNode> nodes = list.getNodes();
+ if (nodes == null)
+ {
+ return Collections.<String>emptyList().iterator();
+ }
+ else {
+ String[] names = new String[nodes.size()];
+ int index = 0;
+ for (PageNode child : nodes)
+ {
+ names[index++] = child.getName();
+ }
+ return Adapters.<String>list().iterator(names, reverse);
+ }
+ }
+ };
+
+ private static final ListAdapter<NodeContext<?>, String> NODE_ADAPTER = new ListAdapter<NodeContext<?>, String>()
+ {
+ public int size(NodeContext<?> list)
+ {
+ return list.getNodeCount();
+ }
+
+ public Iterator<String> iterator(NodeContext<?> list, boolean reverse)
+ {
+ int size = list.getNodeCount();
+ String[] names = new String[size];
+ int index = 0;
+ for (NodeContext<?> child = list.getFirst();child != null;child = child.getNext())
+ {
+ names[index++] = child.getName();
+ }
+ return Adapters.<String>list().iterator(names, reverse);
+ }
+ };
+
+ /** . */
+ private final PageNavigation src;
+
+ /** . */
+ private final NavigationService service;
+
+ /** . */
+ private final ImportMode mode;
+
+ public NavigationImporter(ImportMode mode, PageNavigation src, NavigationService service)
+ {
+ this.mode = mode;
+ this.src = src;
+ this.service = service;
+ }
+
+ public void perform()
+ {
+
+ //
+ SiteKey key = new SiteKey(src.getOwnerType(), src.getOwnerId());
+
+ //
+ NavigationContext dst = service.loadNavigation(key);
+
+ //
+ switch (mode)
+ {
+ case CONSERVE:
+ if (dst == null)
+ {
+ dst = new NavigationContext(key, new NavigationState(src.getPriority()));
+ service.saveNavigation(dst);
+ }
+ else
+ {
+ dst = null;
+ }
+ break;
+ case MERGE:
+ if (dst == null)
+ {
+ dst = new NavigationContext(key, new NavigationState(src.getPriority()));
+ service.saveNavigation(dst);
+ }
+ break;
+ case REIMPORT:
+ if (dst != null)
+ {
+ service.destroyNavigation(dst);
+ }
+ else
+ {
+ dst = new NavigationContext(key, new NavigationState(src.getPriority()));
+ }
+ service.saveNavigation(dst);
+ break;
+ }
+
+ //
+ if (dst != null)
+ {
+ NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, dst, Scope.SINGLE, null).getNode();
+ perform(src, node);
+ service.saveNode(node, null);
+ }
+ }
+
+ private void perform(PageNodeContainer src, final NodeContext<?> dst)
+ {
+ service.rebaseNode(dst, Scope.CHILDREN, null);
+
+ //
+ ListDiff<PageNodeContainer, NodeContext<?>, String> diff = new ListDiff<PageNodeContainer, NodeContext<?>, String>(
+ PAGE_NODE_CONTAINER_ADAPTER,
+ NODE_ADAPTER);
+
+ //
+ List<PageNode> srcChildren = src.getNodes();
+ ListChangeIterator<PageNodeContainer, NodeContext<?>, String> it = diff.iterator(src, dst);
+ NodeChangeQueue<PageNodeContainer> changes = new NodeChangeQueue<PageNodeContainer>();
+
+ //
+ while (it.hasNext())
+ {
+ ListChangeType changeType = it.next();
+ String name = it.getElement();
+ PageNode srcChild = src.getNode(name);
+ NodeContext<?> dstChild = dst.get(name);
+
+ //
+ switch (changeType)
+ {
+ case SAME:
+ perform(srcChild, dstChild);
+ break;
+ case REMOVE:
+ if (dst.getNode(name) != null)
+ {
+ // It's a move we do nothing
+ }
+ else
+ {
+ // It's an addition
+ int index = srcChildren.indexOf(srcChild);
+ PageNode previous = index == 0 ? null : srcChildren.get(index - 1);
+ changes.onAdd(srcChild, src, previous);
+ }
+ break;
+ case ADD:
+ if (src.getNode(name) != null)
+ {
+ // It's a move
+ int index = srcChildren.indexOf(srcChild);
+ PageNode previous = index == 0 ? null : srcChildren.get(index - 1);
+ changes.onMove(srcChild, src, src, previous);
+ }
+ else
+ {
+ // It's a removal we do nothing
+ }
+ break;
+ }
+ }
+
+ //
+ changes.broadcast(new NodeChangeListener.Base<PageNodeContainer>()
+ {
+ @Override
+ public void onAdd(PageNodeContainer target, PageNodeContainer parent, PageNodeContainer previous)
+ {
+ add((PageNode)target, (PageNode)previous, dst);
+ }
+
+ private void add(PageNode target, PageNode previous, NodeContext<?> dst)
+ {
+ String name = target.getName();
+ int index = 0;
+ if (previous != null)
+ {
+ index = dst.get((previous).getName()).getIndex() + 1;
+ }
+ NodeContext<?> child = dst.add(index, name);
+ Date start = target.getStartPublicationDate();
+ Date end = target.getEndPublicationDate();
+ NodeState state = new NodeState(
+ target.getLabel(),
+ target.getIcon(),
+ start == null ? -1 : start.getTime(),
+ end == null ? -1 : end.getTime(),
+ target.getVisibility(),
+ target.getPageReference()
+ );
+ child.setState(state);
+
+ //
+ List<PageNode> targetChildren = target.getNodes();
+ if (targetChildren != null)
+ {
+ PageNode targetPrevious = null;
+ for (PageNode targetChild : targetChildren)
+ {
+ add(targetChild, targetPrevious, child);
+ targetPrevious = targetChild;
+ }
+ }
+ }
+ });
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,69 +19,28 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.pom.data.NavigationData;
-import org.exoplatform.portal.pom.data.NavigationNodeData;
-
import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
public class PageNavigation extends PageNodeContainer
{
+ /** . */
private String ownerType;
+ /** . */
private String ownerId;
- private transient boolean modifiable;
-
+ /** . */
private ArrayList<PageNode> pageNodes;
+ /** . */
private int priority = 1;
- PageNavigation(String storageId)
+ public PageNavigation()
{
- super(storageId);
-
- //
this.pageNodes = new ArrayList<PageNode>();
}
- public PageNavigation()
- {
- this((String)null);
- }
-
- public PageNavigation(NavigationData nav)
- {
- super(nav.getStorageId());
-
- ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getNodes().size());
- for (NavigationNodeData child : nav.getNodes())
- {
- PageNode node = new PageNode(child);
- children.add(node);
- }
-
- //
- this.ownerType = nav.getOwnerType();
- this.ownerId = nav.getOwnerId();
- this.priority = nav.getPriority();
- this.pageNodes = children;
- }
-
- // Make gtmpl happy with that for now
- public String getDescription()
- {
- return null;
- }
-
- public int getId()
- {
- return getOwner().hashCode();
- }
-
public String getOwnerId()
{
return ownerId;
@@ -102,16 +61,6 @@
this.ownerType = ownerType;
}
- public boolean isModifiable()
- {
- return modifiable;
- }
-
- public void setModifiable(boolean b)
- {
- modifiable = b;
- }
-
public int getPriority()
{
return priority;
@@ -122,18 +71,6 @@
priority = i;
}
- public String getOwner()
- {
- return ownerType + "::" + ownerId;
- }
-
- public void addNode(PageNode node)
- {
- if (pageNodes == null)
- pageNodes = new ArrayList<PageNode>();
- pageNodes.add(node);
- }
-
public ArrayList<PageNode> getNodes()
{
return pageNodes;
@@ -144,78 +81,9 @@
pageNodes = nodes;
}
- public PageNode getNode(String name)
- {
- for (PageNode node : pageNodes)
- {
- if (node.getName().equals(name))
- return node;
- }
- return null;
- }
-
- public PageNavigation clone()
- {
- PageNavigation newNav = new PageNavigation();
- newNav.setOwnerId(ownerId);
- newNav.setOwnerType(ownerType);
- newNav.setPriority(priority);
- newNav.setModifiable(modifiable);
-
- if (pageNodes == null || pageNodes.isEmpty())
- return newNav;
- for (PageNode ele : pageNodes)
- {
- newNav.getNodes().add(ele.clone());
- }
- return newNav;
- }
-
- public void merge(PageNavigation nav)
- {
- if (ownerId == null)
- setOwnerId(nav.ownerId);
- if (ownerType == null)
- setOwnerType(nav.ownerType);
- if (priority == 1)
- setPriority(nav.priority);
- if (!modifiable)
- setModifiable(nav.modifiable);
-
- if (nav.pageNodes == null || nav.pageNodes.isEmpty())
- {
- return;
- }
- if (pageNodes == null || pageNodes.isEmpty())
- {
- this.pageNodes = nav.pageNodes;
- return;
- }
- Map<String, PageNode> mPageNodes = new LinkedHashMap<String, PageNode>();
- for (PageNode node : nav.pageNodes)
- {
- mPageNodes.put(node.getName(), node);
- }
- if (pageNodes != null)
- {
- for (PageNode node : pageNodes)
- {
- mPageNodes.put(node.getName(), node);
- }
- }
- this.pageNodes = new ArrayList<PageNode>(mPageNodes.values());
- }
-
@Override
public String toString()
{
return "PageNavigation[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
}
-
- @Override
- public NavigationData build()
- {
- List<NavigationNodeData> children = buildNavigationChildren();
- return new NavigationData(storageId, ownerType, ownerId, priority, children);
- }
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,82 +19,47 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.commons.utils.ExpressionUtil;
import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.pom.data.NavigationNodeData;
-import org.gatein.common.text.EntityEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import java.util.ResourceBundle;
public class PageNode extends PageNodeContainer
{
+ /** . */
private ArrayList<PageNode> children;
+ /** . */
private String uri;
+ /** . */
private String label;
+ /** . */
private String icon;
+ /** . */
private String name;
- private String resolvedLabel;
-
- private String encodedResolvedLabel;
-
+ /** . */
private Date startPublicationDate;
+ /** . */
private Date endPublicationDate;
+ /** . */
private Visibility visibility = Visibility.DISPLAYED;
+ /** . */
private String pageReference;
- private transient boolean modifiable;
-
- public PageNode(NavigationNodeData nav)
+ public PageNode()
{
- super(nav.getStorageId());
-
- //
- ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getNodes().size());
- for (NavigationNodeData child : nav.getNodes())
- {
- PageNode node = new PageNode(child);
- children.add(node);
- }
-
- //
- this.uri = nav.getURI();
- this.label = nav.getLabel();
- this.resolvedLabel = nav.getLabel();
- this.encodedResolvedLabel = null;
- this.icon = nav.getIcon();
- this.name = nav.getName();
- this.startPublicationDate = nav.getStartPublicationDate();
- this.endPublicationDate = nav.getEndPublicationDate();
- this.visibility = nav.getVisibility();
- this.pageReference = nav.getPageReference();
- this.children = children;
- }
-
- public PageNode(String storageId)
- {
- super(storageId);
-
- //
this.children = new ArrayList<PageNode>();
}
- public PageNode()
- {
- this((String)null);
- }
-
public String getUri()
{
return uri;
@@ -113,8 +78,6 @@
public void setLabel(String s)
{
label = s;
- resolvedLabel = s;
- encodedResolvedLabel = null;
}
public String getIcon()
@@ -147,35 +110,6 @@
this.name = name;
}
- public String getResolvedLabel()
- {
- return resolvedLabel;
- }
-
- public String getEncodedResolvedLabel()
- {
- EntityEncoder encoder = EntityEncoder.FULL;
- if (encodedResolvedLabel == null)
- {
- encodedResolvedLabel = encoder.encode(resolvedLabel);
- }
- return encodedResolvedLabel;
- }
-
- public void setResolvedLabel(String res)
- {
- resolvedLabel = res;
- encodedResolvedLabel = null;
- }
-
- public void setResolvedLabel(ResourceBundle res)
- {
- resolvedLabel = ExpressionUtil.getExpressionValue(res, label);
- if (resolvedLabel == null)
- resolvedLabel = getName();
- encodedResolvedLabel = null;
- }
-
public List<PageNode> getChildren()
{
return children;
@@ -186,16 +120,6 @@
children = list;
}
- public boolean isModifiable()
- {
- return modifiable;
- }
-
- public void setModifiable(boolean b)
- {
- modifiable = b;
- }
-
public Date getStartPublicationDate()
{
return startPublicationDate;
@@ -216,67 +140,6 @@
endPublicationDate = endDate;
}
- public boolean isDisplay()
- {
- switch (visibility)
- {
- case DISPLAYED:
- return true;
- case HIDDEN:
- return false;
- case TEMPORAL:
- return isInPublicationDate();
- case SYSTEM:
- return false;
- default:
- throw new AssertionError();
- }
- }
-
- public boolean isVisible()
- {
- switch (visibility)
- {
- case DISPLAYED:
- case TEMPORAL:
- return true;
- case SYSTEM:
- case HIDDEN:
- return false;
- default:
- throw new AssertionError();
- }
- }
-
- public boolean isSystem() {
- switch(visibility) {
- case SYSTEM:
- return true;
- case TEMPORAL:
- case HIDDEN:
- case DISPLAYED:
- return false;
- default:
- throw new AssertionError();
- }
- }
- public void setVisible(Boolean b)
- {
- if (b != null)
- {
- switch (visibility)
- {
- case SYSTEM:
- break;
- case HIDDEN:
- case DISPLAYED:
- case TEMPORAL:
- visibility = b ? Visibility.DISPLAYED : Visibility.HIDDEN;
- break;
- }
- }
- }
-
public void setVisibility(Visibility visibility)
{
this.visibility = visibility;
@@ -287,47 +150,6 @@
return this.visibility;
}
- private boolean isInPublicationDate()
- {
- Date currentDate = new Date();
-
- // Case 1: start date, end date are not null and current date is between start and end date
- boolean case1 = (startPublicationDate != null) && (endPublicationDate != null) && (currentDate.compareTo(startPublicationDate) >= 0 && currentDate.compareTo(endPublicationDate) <= 0);
-
- // Case 2: start date is null, end date is not null and current date is before end date
- boolean case2 = (startPublicationDate == null) && (endPublicationDate != null) && (currentDate.compareTo(endPublicationDate) <= 0);
-
- // Case 3: start date is not null, end date is null and current date is after start date
- boolean case3 = (startPublicationDate != null) && (endPublicationDate == null) && (currentDate.compareTo(startPublicationDate) >= 0);
-
- // Case 4: start date and end date are null both
- boolean case4 = (startPublicationDate == null) && (endPublicationDate == null);
-
- return case1 || case2 || case3 || case4;
- }
-
- public void setShowPublicationDate(Boolean show)
- {
- if (show != null)
- {
- switch (visibility)
- {
- case SYSTEM:
- case HIDDEN:
- break;
- case TEMPORAL:
- case DISPLAYED:
- visibility = show ? Visibility.TEMPORAL : Visibility.DISPLAYED;
- break;
- }
- }
- }
-
- public boolean isShowPublicationDate()
- {
- return visibility == Visibility.TEMPORAL;
- }
-
public PageNode getChild(String name)
{
if (children == null)
@@ -345,43 +167,9 @@
return children;
}
- public PageNode clone()
- {
- PageNode newNode = new PageNode();
- newNode.setUri(uri);
- newNode.setLabel(label);
- newNode.setIcon(icon);
- newNode.setName(name);
- newNode.setResolvedLabel(resolvedLabel);
- newNode.setPageReference(pageReference);
- newNode.setModifiable(modifiable);
- newNode.setStartPublicationDate(startPublicationDate);
- newNode.setEndPublicationDate(endPublicationDate);
- newNode.setVisibility(visibility);
- if (children == null || children.size() < 1)
- return newNode;
- for (PageNode ele : children)
- {
- newNode.getChildren().add(ele.clone());
- }
- return newNode;
- }
-
@Override
- public NavigationNodeData build()
+ public String toString()
{
- List<NavigationNodeData> children = buildNavigationChildren();
- return new NavigationNodeData(
- storageId,
- uri,
- label,
- icon,
- name,
- startPublicationDate,
- endPublicationDate,
- visibility,
- pageReference,
- children
- );
+ return "PageNode[" + name + "]";
}
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,51 +19,28 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.pom.data.NavigationNodeContainerData;
-import org.exoplatform.portal.pom.data.NavigationNodeData;
-
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public abstract class PageNodeContainer extends ModelObject
+public abstract class PageNodeContainer
{
- public PageNodeContainer(String storageId)
- {
- super(storageId);
- }
-
public PageNodeContainer()
{
}
public abstract List<PageNode> getNodes();
- protected List<NavigationNodeData> buildNavigationChildren()
+ public PageNode getNode(String name)
{
- List<PageNode> nodes = getNodes();
- if (nodes != null)
+ for (PageNode node : getNodes())
{
- ArrayList<NavigationNodeData> children = new ArrayList<NavigationNodeData>();
- for (int i = 0;i < nodes.size();i++)
- {
- PageNode node = nodes.get(i);
- NavigationNodeData child = node.build();
- children.add(child);
- }
- return Collections.unmodifiableList(children);
+ if (node.getName().equals(name))
+ return node;
}
- else
- {
- return Collections.emptyList();
- }
+ return null;
}
-
- public abstract NavigationNodeContainerData build();
-
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.pom.data.PortalData;
@@ -35,11 +36,11 @@
public class PortalConfig extends ModelObject
{
- final public static String USER_TYPE = "user";
+ final public static String USER_TYPE = SiteType.USER.getName();
- final public static String GROUP_TYPE = "group";
+ final public static String GROUP_TYPE = SiteType.GROUP.getName();
- final public static String PORTAL_TYPE = "portal";
+ final public static String PORTAL_TYPE = SiteType.PORTAL.getName();
final public static Container DEFAULT_LAYOUT = initDefaultLayout();
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteConfig.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteConfig.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteConfig.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -20,9 +20,7 @@
private String ownerType;
private String ownerId;
-
- private PageNavigation navigation;
-
+
/** Access permissions on UI */
private String[] accessPermissions;
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/EventType.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/EventType.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/EventType.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/EventType.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop;
+
+/**
+ * Group various event types.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class EventType
+{
+ /** . */
+ public final static String NAVIGATION_CREATED = "org.exoplatform.portal.mop.navigation.navigation_created";
+
+ /** . */
+ public final static String NAVIGATION_DESTROYED = "org.exoplatform.portal.mop.navigation.navigation_destroyed";
+
+ /** . */
+ public final static String NAVIGATION_UPDATED = "org.exoplatform.portal.mop.navigation.navigation_updated";
+
+}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteKey.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/SiteKey.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteKey.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteKey.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop;
+
+import org.exoplatform.portal.config.model.PortalConfig;
+
+import java.io.Serializable;
+
+/**
+* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+* @version $Revision$
+*/
+public final class SiteKey implements Serializable
+{
+
+ public static SiteKey portal(String name)
+ {
+ return new SiteKey(SiteType.PORTAL, name);
+ }
+
+ public static SiteKey group(String name)
+ {
+ return new SiteKey(SiteType.GROUP, name);
+ }
+
+ public static SiteKey user(String name)
+ {
+ return new SiteKey(SiteType.USER, name);
+ }
+
+ /** . */
+ private final SiteType type;
+
+ /** . */
+ private final String name;
+
+ public SiteKey(SiteType type, String name)
+ {
+ if (type == null)
+ {
+ throw new NullPointerException("No null type can be provided");
+ }
+ if (name == null)
+ {
+ throw new NullPointerException("No null name can be provided");
+ }
+
+ //
+ this.type = type;
+ this.name = name;
+ }
+
+ // This will be used for transition in usage from PortalKey and SiteKey
+ public SiteKey(String type, String name)
+ {
+ if (PortalConfig.PORTAL_TYPE.equals(type))
+ {
+ this.type = SiteType.PORTAL;
+ }
+ else if (PortalConfig.GROUP_TYPE.equals(type))
+ {
+ this.type = SiteType.GROUP;
+ }
+ else if (PortalConfig.USER_TYPE.equals(type))
+ {
+ this.type = SiteType.USER;
+ }
+ else
+ {
+ throw new NullPointerException("No null name can be provided");
+ }
+
+ this.name = name;
+ }
+
+ public SiteType getType()
+ {
+ return type;
+ }
+
+ public String getTypeName()
+ {
+ return type.getName();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return name.hashCode() ^ type.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ // We need to use class equality here
+ if (obj != null && getClass().equals(obj.getClass()))
+ {
+ SiteKey that = (SiteKey)obj;
+ return type.equals(that.type) && name.equals(that.name);
+ }
+
+ //
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "SiteKey[type=" + type.toString() + ",name=" + name + "]";
+ }
+}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteType.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/SiteType.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteType.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/SiteType.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum SiteType
+{
+
+ PORTAL, GROUP, USER ;
+
+ /** ; */
+ final String name;
+
+ SiteType()
+ {
+ this.name = name().toLowerCase();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-
-import java.util.Collection;
-
-import static org.exoplatform.portal.mop.navigation.Utils.objectType;
-
-/**
- * todo : see if it makes sense to use a bloom filter for not found site black list
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-abstract class DataCache
-{
-
- protected abstract void removeNodes(Collection<String> keys);
-
- protected abstract NodeData getNode(POMSession session, String key);
-
- protected abstract NavigationData getNavigation(POMSession session, SiteKey key);
-
- protected abstract void removeNavigation(SiteKey key);
-
- protected abstract void clear();
-
- final NodeData getNodeData(POMSession session, String nodeId)
- {
- NodeData data;
- if (session.isModified())
- {
- data = loadNode(session, nodeId);
- }
- else
- {
- data = getNode(session, nodeId);
- }
- return data;
- }
-
- final NavigationData getNavigationData(POMSession session, SiteKey key)
- {
- NavigationData data;
- if (session.isModified())
- {
- data = loadNavigation(session, key);
- }
- else
- {
- data = getNavigation(session, key);
- }
-
- //
- return data;
- }
-
- final void removeNodeData(POMSession session, Collection<String> ids)
- {
- removeNodes(ids);
- }
-
- final void removeNavigationData(POMSession session, SiteKey key)
- {
- removeNavigation(key);
- }
-
- protected final NodeData loadNode(POMSession session, String nodeId)
- {
- Navigation navigation = session.findObjectById(ObjectType.NAVIGATION, nodeId);
- if (navigation != null)
- {
- return new NodeData(navigation);
- }
- else
- {
- return null;
- }
- }
-
-
- protected final NavigationData loadNavigation(POMSession session, SiteKey key)
- {
- Workspace workspace = session.getWorkspace();
- ObjectType<Site> objectType = objectType(key.getType());
- Site site = workspace.getSite(objectType, key.getName());
- if (site != null)
- {
- Navigation defaultNavigation = site.getRootNavigation().getChild("default");
- if (defaultNavigation != null)
- {
- return new NavigationData(key, defaultNavigation);
- }
- else
- {
- return NavigationData.EMPTY;
- }
- }
- else
- {
- return NavigationData.EMPTY;
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/DataCache.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+
+import java.util.Collection;
+
+import static org.exoplatform.portal.mop.navigation.Utils.objectType;
+
+/**
+ * todo : see if it makes sense to use a bloom filter for not found site black list
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+abstract class DataCache
+{
+
+ protected abstract void removeNodes(Collection<String> keys);
+
+ protected abstract NodeData getNode(POMSession session, String key);
+
+ protected abstract NavigationData getNavigation(POMSession session, SiteKey key);
+
+ protected abstract void removeNavigation(SiteKey key);
+
+ protected abstract void clear();
+
+ final NodeData getNodeData(POMSession session, String nodeId)
+ {
+ NodeData data;
+ if (session.isModified())
+ {
+ data = loadNode(session, nodeId);
+ }
+ else
+ {
+ data = getNode(session, nodeId);
+ }
+ return data;
+ }
+
+ final NavigationData getNavigationData(POMSession session, SiteKey key)
+ {
+ NavigationData data;
+ if (session.isModified())
+ {
+ data = loadNavigation(session, key);
+ }
+ else
+ {
+ data = getNavigation(session, key);
+ }
+
+ //
+ return data;
+ }
+
+ final void removeNodeData(POMSession session, Collection<String> ids)
+ {
+ removeNodes(ids);
+ }
+
+ final void removeNavigationData(POMSession session, SiteKey key)
+ {
+ removeNavigation(key);
+ }
+
+ protected final NodeData loadNode(POMSession session, String nodeId)
+ {
+ Navigation navigation = session.findObjectById(ObjectType.NAVIGATION, nodeId);
+ if (navigation != null)
+ {
+ return new NodeData(navigation);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ protected final NavigationData loadNavigation(POMSession session, SiteKey key)
+ {
+ Workspace workspace = session.getWorkspace();
+ ObjectType<Site> objectType = objectType(key.getType());
+ Site site = workspace.getSite(objectType, key.getName());
+ if (site != null)
+ {
+ Navigation defaultNavigation = site.getRootNavigation().getChild("default");
+ if (defaultNavigation != null)
+ {
+ return new NavigationData(key, defaultNavigation);
+ }
+ else
+ {
+ return NavigationData.EMPTY;
+ }
+ }
+ else
+ {
+ return NavigationData.EMPTY;
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.commons.cache.future.FutureExoCache;
-import org.exoplatform.commons.cache.future.Loader;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.cache.ExoCache;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-/**
- * An implementation using the cache service.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class ExoDataCache extends DataCache
-{
-
- /** . */
- protected ExoCache<Serializable, Serializable> cache;
-
- /** . */
- protected FutureExoCache<Serializable, Serializable, POMSession> objects;
-
- /** . */
- private Loader<Serializable, Serializable, POMSession> navigationLoader = new Loader<Serializable, Serializable, POMSession>()
- {
- public Serializable retrieve(POMSession session, Serializable key) throws Exception
- {
- if (key instanceof SiteKey)
- {
- return loadNavigation(session, (SiteKey)key);
- }
- else
- {
- return loadNode(session, (String)key);
- }
- }
- };
-
- public ExoDataCache(CacheService cacheService)
- {
- this.cache = cacheService.getCacheInstance("NavigationService");
- this.objects = new FutureExoCache<Serializable, Serializable, POMSession>(navigationLoader, cache);
- }
-
- @Override
- protected void removeNodes(Collection<String> keys)
- {
- for (String key : keys)
- {
- cache.remove(key);
- }
- }
-
- @Override
- protected NodeData getNode(POMSession session, String key)
- {
- return (NodeData)objects.get(session, key);
- }
-
- @Override
- protected void removeNavigation(SiteKey key)
- {
- cache.remove(key);
- }
-
- @Override
- protected NavigationData getNavigation(POMSession session, SiteKey key)
- {
- return (NavigationData)objects.get(session, key);
- }
-
- @Override
- protected void clear()
- {
- cache.clearCache();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.commons.cache.future.FutureExoCache;
+import org.exoplatform.commons.cache.future.Loader;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.ExoCache;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * An implementation using the cache service.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class ExoDataCache extends DataCache
+{
+
+ /** . */
+ protected ExoCache<Serializable, Serializable> cache;
+
+ /** . */
+ protected FutureExoCache<Serializable, Serializable, POMSession> objects;
+
+ /** . */
+ private Loader<Serializable, Serializable, POMSession> navigationLoader = new Loader<Serializable, Serializable, POMSession>()
+ {
+ public Serializable retrieve(POMSession session, Serializable key) throws Exception
+ {
+ if (key instanceof SiteKey)
+ {
+ return loadNavigation(session, (SiteKey)key);
+ }
+ else
+ {
+ return loadNode(session, (String)key);
+ }
+ }
+ };
+
+ public ExoDataCache(CacheService cacheService)
+ {
+ this.cache = cacheService.getCacheInstance("NavigationService");
+ this.objects = new FutureExoCache<Serializable, Serializable, POMSession>(navigationLoader, cache);
+ }
+
+ @Override
+ protected void removeNodes(Collection<String> keys)
+ {
+ for (String key : keys)
+ {
+ cache.remove(key);
+ }
+ }
+
+ @Override
+ protected NodeData getNode(POMSession session, String key)
+ {
+ return (NodeData)objects.get(session, key);
+ }
+
+ @Override
+ protected void removeNavigation(SiteKey key)
+ {
+ cache.remove(key);
+ }
+
+ @Override
+ protected NavigationData getNavigation(POMSession session, SiteKey key)
+ {
+ return (NavigationData)objects.get(session, key);
+ }
+
+ @Override
+ protected void clear()
+ {
+ cache.clearCache();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * A visitor implementation that federates a scope along with a federation root.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-class FederatingVisitor<N> implements Scope.Visitor
-{
-
- /** . */
- private final Scope.Visitor visitor;
-
- /** . */
- private final NodeContext<N> federationRoot;
-
- /** . */
- private final int federationDepth;
-
- /** . */
- private final Scope federatedScope;
-
- /** . */
- private Scope.Visitor federated;
-
- FederatingVisitor(Scope.Visitor visitor, NodeContext<N> federationRoot, Scope federatedScope)
- {
- this.visitor = visitor;
- this.federationRoot = federationRoot;
- this.federatedScope = federatedScope;
- this.federated = null;
- this.federationDepth = federationRoot.getDepth(federationRoot.tree.root);
- }
-
- public VisitMode enter(int depth, String id, String name, NodeState state)
- {
- if (federationRoot.handle.equals(id))
- {
- federated = federatedScope.get();
- }
-
- //
- VisitMode visit;
- if (federated != null)
- {
- visit = federated.enter(depth - federationDepth, id, name, state);
- }
- else
- {
- visit = VisitMode.NO_CHILDREN;
- }
-
- // Override
- VisitMode override = visitor.enter(depth, id, name, state);
- if (override == VisitMode.ALL_CHILDREN)
- {
- visit = VisitMode.ALL_CHILDREN;
- }
-
- //
- return visit;
- }
-
- public void leave(int depth, String id, String name, NodeState state)
- {
- if (federationRoot.handle.equals(id))
- {
- federated = null;
- }
-
- //
- if (federated != null)
- {
- federated.leave(depth - federationDepth, id, name, state);
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/FederatingVisitor.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * A visitor implementation that federates a scope along with a federation root.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class FederatingVisitor<N> implements Scope.Visitor
+{
+
+ /** . */
+ private final Scope.Visitor visitor;
+
+ /** . */
+ private final NodeContext<N> federationRoot;
+
+ /** . */
+ private final int federationDepth;
+
+ /** . */
+ private final Scope federatedScope;
+
+ /** . */
+ private Scope.Visitor federated;
+
+ FederatingVisitor(Scope.Visitor visitor, NodeContext<N> federationRoot, Scope federatedScope)
+ {
+ this.visitor = visitor;
+ this.federationRoot = federationRoot;
+ this.federatedScope = federatedScope;
+ this.federated = null;
+ this.federationDepth = federationRoot.getDepth(federationRoot.tree.root);
+ }
+
+ public VisitMode enter(int depth, String id, String name, NodeState state)
+ {
+ if (federationRoot.handle.equals(id))
+ {
+ federated = federatedScope.get();
+ }
+
+ //
+ VisitMode visit;
+ if (federated != null)
+ {
+ visit = federated.enter(depth - federationDepth, id, name, state);
+ }
+ else
+ {
+ visit = VisitMode.NO_CHILDREN;
+ }
+
+ // Override
+ VisitMode override = visitor.enter(depth, id, name, state);
+ if (override == VisitMode.ALL_CHILDREN)
+ {
+ visit = VisitMode.ALL_CHILDREN;
+ }
+
+ //
+ return visit;
+ }
+
+ public void leave(int depth, String id, String name, NodeState state)
+ {
+ if (federationRoot.handle.equals(id))
+ {
+ federated = null;
+ }
+
+ //
+ if (federated != null)
+ {
+ federated.leave(depth - federationDepth, id, name, state);
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
-* A flexible scope implementation.
-*/
-public class GenericScope implements Scope
-{
-
- public static Scope branchShape(String[] path)
- {
- return branchShape(Arrays.asList(path), Scope.CHILDREN);
- }
-
- public static Scope branchShape(List<String> path)
- {
- return branchShape(path, Scope.CHILDREN);
- }
-
- public static Scope branchShape(String[] path, Scope federated)
- {
- return branchShape(Arrays.asList(path), federated);
- }
-
- /**
- * <p>A scope with the shape of a tree branch following the rules:
- * <ul>
- * <li>the first node with depth 0 will have all of its children visited</li>
- * <li>any node above the root node that fits in the <code>path</code> array will be matched
- * only if the node name matches the corresponding value in the <code>path</code> array. The last
- * node whose depth is equals to the <code>path</code> list size will have its visit mode value delegated
- * to the <code>federated</code> scope argument with a depth of 0 and the same other arguments, any other node
- * will have all of its children visited.</li>
- * <li>any other node will have its visit mode delegated to the <code>federated</code> scope argument
- * with the same arguments except the depth that will be subtracted the <code>path</code> list argument size.</li>
- * </ul></p>
- *
- * @param path the names that describing the tree path
- * @param federated the federated scope
- * @return the branch shape scope
- * @throws NullPointerException if any argument is null
- */
- public static Scope branchShape(final List<String> path, final Scope federated) throws NullPointerException
- {
- if (path == null)
- {
- throw new NullPointerException("no null path accepted");
- }
- if (federated == null)
- {
- throw new NullPointerException("no null federated scope accepted");
- }
- return new Scope()
- {
- public Visitor get()
- {
- return new Visitor()
- {
- public VisitMode enter(int depth, String id, String name, NodeState state)
- {
- if (depth == 0)
- {
- return VisitMode.ALL_CHILDREN;
- }
- else if (depth > 0)
- {
- if (depth < path.size())
- {
- if ((name.equals(path.get(depth - 1))))
- {
- return VisitMode.ALL_CHILDREN;
- }
- else
- {
- return VisitMode.NO_CHILDREN;
- }
- }
- else if (depth == path.size())
- {
- if ((name.equals(path.get(path.size() - 1))))
- {
- return federated.get().enter(0, id, name, state);
- }
- else
- {
- return VisitMode.NO_CHILDREN;
- }
- }
- else
- {
- return federated.get().enter(depth - path.size(), id, name, state);
- }
- }
- throw new AssertionError();
- }
-
- public void leave(int depth, String id, String name, NodeState state)
- {
- }
- };
- }
- };
- }
-
-
- /** . */
- private final Visitor visitor;
-
- /**
- * Creates a new navigation scope. When the height is positive or null, the tree will be pruned to the specified
- * height, when the height is negative no pruning will occur.
- *
- * @param height the max height of the pruned tree
- */
- public GenericScope(final int height)
- {
- this.visitor = new Visitor()
- {
- public VisitMode enter(int depth, String id, String name, NodeState state)
- {
- if (height < 0 || depth < height)
- {
- return VisitMode.ALL_CHILDREN;
- }
- else
- {
- return VisitMode.NO_CHILDREN;
- }
- }
-
- public void leave(int depth, String id, String name, NodeState state)
- {
- }
- };
- }
-
- public Visitor get()
- {
- return visitor;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/GenericScope.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+* A flexible scope implementation.
+*/
+public class GenericScope implements Scope
+{
+
+ public static Scope branchShape(String[] path)
+ {
+ return branchShape(Arrays.asList(path), Scope.CHILDREN);
+ }
+
+ public static Scope branchShape(List<String> path)
+ {
+ return branchShape(path, Scope.CHILDREN);
+ }
+
+ public static Scope branchShape(String[] path, Scope federated)
+ {
+ return branchShape(Arrays.asList(path), federated);
+ }
+
+ /**
+ * <p>A scope with the shape of a tree branch following the rules:
+ * <ul>
+ * <li>the first node with depth 0 will have all of its children visited</li>
+ * <li>any node above the root node that fits in the <code>path</code> array will be matched
+ * only if the node name matches the corresponding value in the <code>path</code> array. The last
+ * node whose depth is equals to the <code>path</code> list size will have its visit mode value delegated
+ * to the <code>federated</code> scope argument with a depth of 0 and the same other arguments, any other node
+ * will have all of its children visited.</li>
+ * <li>any other node will have its visit mode delegated to the <code>federated</code> scope argument
+ * with the same arguments except the depth that will be subtracted the <code>path</code> list argument size.</li>
+ * </ul></p>
+ *
+ * @param path the names that describing the tree path
+ * @param federated the federated scope
+ * @return the branch shape scope
+ * @throws NullPointerException if any argument is null
+ */
+ public static Scope branchShape(final List<String> path, final Scope federated) throws NullPointerException
+ {
+ if (path == null)
+ {
+ throw new NullPointerException("no null path accepted");
+ }
+ if (federated == null)
+ {
+ throw new NullPointerException("no null federated scope accepted");
+ }
+ return new Scope()
+ {
+ public Visitor get()
+ {
+ return new Visitor()
+ {
+ public VisitMode enter(int depth, String id, String name, NodeState state)
+ {
+ if (depth == 0)
+ {
+ return VisitMode.ALL_CHILDREN;
+ }
+ else if (depth > 0)
+ {
+ if (depth < path.size())
+ {
+ if ((name.equals(path.get(depth - 1))))
+ {
+ return VisitMode.ALL_CHILDREN;
+ }
+ else
+ {
+ return VisitMode.NO_CHILDREN;
+ }
+ }
+ else if (depth == path.size())
+ {
+ if ((name.equals(path.get(path.size() - 1))))
+ {
+ return federated.get().enter(0, id, name, state);
+ }
+ else
+ {
+ return VisitMode.NO_CHILDREN;
+ }
+ }
+ else
+ {
+ return federated.get().enter(depth - path.size(), id, name, state);
+ }
+ }
+ throw new AssertionError();
+ }
+
+ public void leave(int depth, String id, String name, NodeState state)
+ {
+ }
+ };
+ }
+ };
+ }
+
+
+ /** . */
+ private final Visitor visitor;
+
+ /**
+ * Creates a new navigation scope. When the height is positive or null, the tree will be pruned to the specified
+ * height, when the height is negative no pruning will occur.
+ *
+ * @param height the max height of the pruned tree
+ */
+ public GenericScope(final int height)
+ {
+ this.visitor = new Visitor()
+ {
+ public VisitMode enter(int depth, String id, String name, NodeState state)
+ {
+ if (height < 0 || depth < height)
+ {
+ return VisitMode.ALL_CHILDREN;
+ }
+ else
+ {
+ return VisitMode.NO_CHILDREN;
+ }
+ }
+
+ public void leave(int depth, String id, String name, NodeState state)
+ {
+ }
+ };
+ }
+
+ public Visitor get()
+ {
+ return visitor;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteType;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-import javax.jcr.observation.ObservationManager;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-class InvalidationBridge
-{
-
- /** . */
- private final DataCache cache;
-
- /** . */
- private ObservationManager mgr;
-
- /** . */
- private final EventListenerImpl portalBridge;
-
- /** . */
- private final EventListenerImpl groupBridge;
-
- /** . */
- private final EventListenerImpl userBridge;
-
- public InvalidationBridge(DataCache cache)
- {
- this.cache = cache;
- this.portalBridge = new EventListenerImpl("mop:portalsites", SiteType.PORTAL);
- this.groupBridge = new EventListenerImpl("mop:groupsites", SiteType.GROUP);
- this.userBridge = new EventListenerImpl("mop:usersites", SiteType.USER);
- }
-
- void start(Session session) throws RepositoryException
- {
- mgr = session.getWorkspace().getObservationManager();
-
- //
- portalBridge.register(mgr);
- groupBridge.register(mgr);
- userBridge.register(mgr);
- }
-
- void stop()
- {
- portalBridge.unregister();
- groupBridge.unregister();
- userBridge.unregister();
- }
-
- private class EventListenerImpl implements EventListener
- {
-
- /** . */
- private final String nodeType;
-
- /** . */
- private final SiteType type;
-
- /** . */
- private ObservationManager mgr;
-
- private EventListenerImpl(String nodeType, SiteType type)
- {
- this.nodeType = nodeType;
- this.type = type;
- }
-
- void register(ObservationManager mgr) throws RepositoryException
- {
- mgr.addEventListener(this, Event.NODE_REMOVED, "/", true, null, new String[]{nodeType}, false);
-
- //
- this.mgr = mgr;
- }
-
- void unregister()
- {
- if (mgr != null)
- {
- try
- {
- mgr.removeEventListener(this);
- }
- catch (RepositoryException ignore)
- {
- }
- }
- }
-
- public void onEvent(EventIterator events)
- {
- // We clear the cache when a site is removed in order to remove all the related navigations
- cache.clear();
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/InvalidationBridge.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteType;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.observation.Event;
+import javax.jcr.observation.EventIterator;
+import javax.jcr.observation.EventListener;
+import javax.jcr.observation.ObservationManager;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class InvalidationBridge
+{
+
+ /** . */
+ private final DataCache cache;
+
+ /** . */
+ private ObservationManager mgr;
+
+ /** . */
+ private final EventListenerImpl portalBridge;
+
+ /** . */
+ private final EventListenerImpl groupBridge;
+
+ /** . */
+ private final EventListenerImpl userBridge;
+
+ public InvalidationBridge(DataCache cache)
+ {
+ this.cache = cache;
+ this.portalBridge = new EventListenerImpl("mop:portalsites", SiteType.PORTAL);
+ this.groupBridge = new EventListenerImpl("mop:groupsites", SiteType.GROUP);
+ this.userBridge = new EventListenerImpl("mop:usersites", SiteType.USER);
+ }
+
+ void start(Session session) throws RepositoryException
+ {
+ mgr = session.getWorkspace().getObservationManager();
+
+ //
+ portalBridge.register(mgr);
+ groupBridge.register(mgr);
+ userBridge.register(mgr);
+ }
+
+ void stop()
+ {
+ portalBridge.unregister();
+ groupBridge.unregister();
+ userBridge.unregister();
+ }
+
+ private class EventListenerImpl implements EventListener
+ {
+
+ /** . */
+ private final String nodeType;
+
+ /** . */
+ private final SiteType type;
+
+ /** . */
+ private ObservationManager mgr;
+
+ private EventListenerImpl(String nodeType, SiteType type)
+ {
+ this.nodeType = nodeType;
+ this.type = type;
+ }
+
+ void register(ObservationManager mgr) throws RepositoryException
+ {
+ mgr.addEventListener(this, Event.NODE_REMOVED, "/", true, null, new String[]{nodeType}, false);
+
+ //
+ this.mgr = mgr;
+ }
+
+ void unregister()
+ {
+ if (mgr != null)
+ {
+ try
+ {
+ mgr.removeEventListener(this);
+ }
+ catch (RepositoryException ignore)
+ {
+ }
+ }
+ }
+
+ public void onEvent(EventIterator events)
+ {
+ // We clear the cache when a site is removed in order to remove all the related navigations
+ cache.clear();
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationContext
-{
-
- /** . */
- SiteKey key;
-
- /** . */
- NavigationState state;
-
- /** . */
- NavigationData data;
-
- NavigationContext(NavigationData data)
- {
- if (data == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.key = data.key;
- this.data = data;
- }
-
- public NavigationContext(SiteKey key, NavigationState state)
- {
- if (key == null)
- {
- throw new NullPointerException();
- }
- if (state == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.key = key;
- this.state = state;
- }
-
- /**
- * Returns the navigation key.
- *
- * @return the navigation key
- */
- public SiteKey getKey()
- {
- return data.key;
- }
-
- /**
- * Returns the navigation state.
- *
- * @return the navigation state
- */
- public NavigationState getState()
- {
- if (state != null)
- {
- return state;
- }
- else if (data != null)
- {
- return data.state;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Updates the navigation state the behavior is not the same wether or not the navigation is persistent:
- * <ul>
- * <li>When the navigation is persistent, any state is allowed:
- * <li>A non null state overrides the current persistent state.</li>
- * <li>The null state means to reset the state to the persistent state.</li>
- * </li>
- * <li>When the navigation is transient, only a non null state is allowed as it will be used for creation
- * purpose.</li>
- * </ul>
- *
- * @param state the new state
- * @throws IllegalStateException when the state is cleared and the navigation is not persistent
- */
- public void setState(NavigationState state) throws IllegalStateException
- {
- if (data == null && state == null)
- {
- throw new IllegalStateException("Cannot clear state on a transient navigation");
- }
- this.state = state;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationContext
+{
+
+ /** . */
+ SiteKey key;
+
+ /** . */
+ NavigationState state;
+
+ /** . */
+ NavigationData data;
+
+ NavigationContext(NavigationData data)
+ {
+ if (data == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.key = data.key;
+ this.data = data;
+ }
+
+ public NavigationContext(SiteKey key, NavigationState state)
+ {
+ if (key == null)
+ {
+ throw new NullPointerException();
+ }
+ if (state == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.key = key;
+ this.state = state;
+ }
+
+ /**
+ * Returns the navigation key.
+ *
+ * @return the navigation key
+ */
+ public SiteKey getKey()
+ {
+ return data.key;
+ }
+
+ /**
+ * Returns the navigation state.
+ *
+ * @return the navigation state
+ */
+ public NavigationState getState()
+ {
+ if (state != null)
+ {
+ return state;
+ }
+ else if (data != null)
+ {
+ return data.state;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Updates the navigation state the behavior is not the same wether or not the navigation is persistent:
+ * <ul>
+ * <li>When the navigation is persistent, any state is allowed:
+ * <li>A non null state overrides the current persistent state.</li>
+ * <li>The null state means to reset the state to the persistent state.</li>
+ * </li>
+ * <li>When the navigation is transient, only a non null state is allowed as it will be used for creation
+ * purpose.</li>
+ * </ul>
+ *
+ * @param state the new state
+ * @throws IllegalStateException when the state is cleared and the navigation is not persistent
+ */
+ public void setState(NavigationState state) throws IllegalStateException
+ {
+ if (data == null && state == null)
+ {
+ throw new IllegalStateException("Cannot clear state on a transient navigation");
+ }
+ this.state = state;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.data.MappedAttributes;
-import org.gatein.mop.api.workspace.Navigation;
-
-import java.io.Serializable;
-
-/**
- * An immutable navigation data class.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class NavigationData implements Serializable
-{
-
- /** Useful. */
- static final NavigationData EMPTY = new NavigationData();
-
- /** . */
- final SiteKey key;
-
- /** . */
- final NavigationState state;
-
- /** . */
- final String rootId;
-
- private NavigationData()
- {
- this.key = null;
- this.state = null;
- this.rootId = null;
- }
-
- NavigationData(SiteKey key, Navigation node)
- {
- String rootId = node.getObjectId();
- NavigationState state = new NavigationState(node.getAttributes().getValue(MappedAttributes.PRIORITY, 1));
-
- //
- this.key = key;
- this.state = state;
- this.rootId = rootId;
- }
-
- NavigationData(SiteKey key, NavigationState state, String rootId)
- {
- this.key = key;
- this.state = state;
- this.rootId = rootId;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.data.MappedAttributes;
+import org.gatein.mop.api.workspace.Navigation;
+
+import java.io.Serializable;
+
+/**
+ * An immutable navigation data class.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class NavigationData implements Serializable
+{
+
+ /** Useful. */
+ static final NavigationData EMPTY = new NavigationData();
+
+ /** . */
+ final SiteKey key;
+
+ /** . */
+ final NavigationState state;
+
+ /** . */
+ final String rootId;
+
+ private NavigationData()
+ {
+ this.key = null;
+ this.state = null;
+ this.rootId = null;
+ }
+
+ NavigationData(SiteKey key, Navigation node)
+ {
+ String rootId = node.getObjectId();
+ NavigationState state = new NavigationState(node.getAttributes().getValue(MappedAttributes.PRIORITY, 1));
+
+ //
+ this.key = key;
+ this.state = state;
+ this.rootId = rootId;
+ }
+
+ NavigationData(SiteKey key, NavigationState state, String rootId)
+ {
+ this.key = key;
+ this.state = state;
+ this.rootId = rootId;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public enum NavigationError
-{
-
- MOVE_CONCURRENTLY_REMOVED_SRC_NODE,
-
- MOVE_CONCURRENTLY_REMOVED_DST_NODE,
-
- MOVE_CONCURRENTLY_REMOVED_MOVED_NODE,
-
- MOVE_CONCURRENTLY_CHANGED_SRC_NODE,
-
- MOVE_CONCURRENTLY_REMOVED_PREVIOUS_NODE,
-
- MOVE_CONCURRENTLY_DUPLICATE_NAME,
-
- ADD_CONCURRENTLY_REMOVED_PARENT_NODE,
-
- ADD_CONCURRENTLY_ADDED_NODE,
-
- ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE,
-
- UPDATE_CONCURRENTLY_REMOVED_NODE,
-
- RENAME_CONCURRENTLY_REMOVED_NODE,
-
- RENAME_CONCURRENTLY_DUPLICATE_NAME,
-
- NAVIGATION_NO_SITE,
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationError.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public enum NavigationError
+{
+
+ MOVE_CONCURRENTLY_REMOVED_SRC_NODE,
+
+ MOVE_CONCURRENTLY_REMOVED_DST_NODE,
+
+ MOVE_CONCURRENTLY_REMOVED_MOVED_NODE,
+
+ MOVE_CONCURRENTLY_CHANGED_SRC_NODE,
+
+ MOVE_CONCURRENTLY_REMOVED_PREVIOUS_NODE,
+
+ MOVE_CONCURRENTLY_DUPLICATE_NAME,
+
+ ADD_CONCURRENTLY_REMOVED_PARENT_NODE,
+
+ ADD_CONCURRENTLY_ADDED_NODE,
+
+ ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE,
+
+ UPDATE_CONCURRENTLY_REMOVED_NODE,
+
+ RENAME_CONCURRENTLY_REMOVED_NODE,
+
+ RENAME_CONCURRENTLY_DUPLICATE_NAME,
+
+ NAVIGATION_NO_SITE,
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-
-/**
- * <p>The navigation service takes care of managing the various portal navigations and their nodes. In order to manage
- * an efficient loading of the nodes, a {@link Scope} is used to describe the set of nodes that should be retrieved
- * when a loading operation is performed.</p>
- *
- * <p>The node operations does not provide a model per se, but instead use the {@link NodeModel} interface to plug
- * an API model. Various node operations are quite complex and any API in front of this service would need to perform
- * a manual, error prone and tedious synchronization. Instead the model interface allows the navigation service to
- * operate directly on an existing model.</p>
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface NavigationService
-{
-
- /**
- * Find and returns a navigation, if no such site exist, null is returned instead.
- *
- * @param key the navigation key
- * @return the matching navigation
- * @throws NullPointerException if the key is null
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- NavigationContext loadNavigation(SiteKey key) throws NullPointerException, NavigationServiceException;
-
- /**
- * Create, update a navigation. When the navigation state is not null, the navigation
- * will be created or updated depending on whether or not the navigation already exists.
- *
- * @param navigation the navigation
- * @throws NullPointerException if the key is null
- * @throws IllegalArgumentException if the navigation is already destroyed
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- void saveNavigation(NavigationContext navigation) throws NullPointerException, IllegalArgumentException, NavigationServiceException;
-
- /**
- * Destroy a navigation.
- *
- * @param navigation the navigation
- * @return true if the navigation was destroyed
- * @throws NullPointerException if the navigation is null
- * @throws IllegalArgumentException if the navigation is destroyed
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- boolean destroyNavigation(NavigationContext navigation) throws NullPointerException, IllegalArgumentException, NavigationServiceException;
-
- /**
- * Load a navigation node from a specified navigation. The returned context will be the root node of the navigation.
- *
- * @param model the node model
- * @param navigation the navigation
- * @param scope the scope
- * @param listener the optional listener
- * @param <N> the node generic type
- * @return the loaded node
- * @throws NullPointerException if any argument is null
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- <N> NodeContext<N> loadNode(NodeModel<N> model, NavigationContext navigation, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException;
-
- /**
- * <p>Save the specified context state to the persistent storage. The operation takes the pending changes done to
- * the tree and attempt to save them to the persistent storage. When conflicts happens, a merge will be attempted
- * however it can lead to a failure.</p>
- *
- * @param context the context to save
- * @param listener the optional listener
- * @throws NullPointerException if the context argument is null
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- <N> void saveNode(NodeContext<N> context, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException;
-
- /**
- * <p>Update the specified <code>context</code> argument with the most recent state. The update operation will
- * affect the entire tree even if the <code>context</code> argument is not the root of the tree. The <code>context</code>
- * argument determines the root from which the <code>scope</code> argument applies to.</p>
- *
- * <p>The update operation compares the actual tree and the most recent version of the same tree. When the
- * <code>scope</scope> argument is not null, it will be used to augment the tree with new nodes. During the
- * operation, any modification done to the tree wil be reported as a change to the optional <code>listener</code>
- * argument.</p>
- *
- * <p>The update operates recursively by doing a comparison of the node intrisic state (name or state) and its
- * structural state (the children). The comparison between the children of two nodes is done thanks to the
- * Longest Common Subsequence algorithm to minimize the number of changes to perform. The operation assumes
- * that no changes have been performed on the actual tree.</p>
- *
- * @param context the context to update
- * @param scope the optional scope
- * @param listener the optional node change listener
- * @param <N> the node generic type
- * @throws NullPointerException if the context argument is null
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- * @throws IllegalArgumentException if the context argument has pending changes
- */
- <N> void updateNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, IllegalArgumentException, NavigationServiceException;
-
- /**
- * <p>Rebase the specified <code>context</code> argument with the most recent state. The rebase operation will
- * affect the entire tree even if the <code>context</code> argument is not the root of the tree. The <code>context</code>
- * argument determines the root from which the <code>scope</code> argument applies to.</p>
- *
- * <p>The rebase operation compares the actual tree and the most recent version of the same tree. When the
- * <code>scope</scope> argument is not null, it will be used to augment the tree with new nodes. During the
- * operation, any modification done to the tree wil be reported as a change to the optional <code>listener</code>
- * argument.</p>
- *
- * <p>The rebase operates in a similar way of the update operation, however it assumes that it can have pending changes
- * done to the tree (i.e changes that have not been saved). Actually a rebase operation with no changes will do the
- * same than an update operation. The rebase operation attempts to bring the most recent changes to the tree, by
- * doing a rebase of the pending operations on the actual tree. When conflicting changes exist, a merge will be
- * attempted, however it could fail and lead to a non resolvable situation.</p>
- *
- * @param context the context to rebase
- * @param scope the optional scope
- * @param listener the option node change listener @throws NullPointerException if the context argument is null
- * @param <N> the node generic type
- * @throws NullPointerException if the context argument is null
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- <N> void rebaseNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException;
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+
+/**
+ * <p>The navigation service takes care of managing the various portal navigations and their nodes. In order to manage
+ * an efficient loading of the nodes, a {@link Scope} is used to describe the set of nodes that should be retrieved
+ * when a loading operation is performed.</p>
+ *
+ * <p>The node operations does not provide a model per se, but instead use the {@link NodeModel} interface to plug
+ * an API model. Various node operations are quite complex and any API in front of this service would need to perform
+ * a manual, error prone and tedious synchronization. Instead the model interface allows the navigation service to
+ * operate directly on an existing model.</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface NavigationService
+{
+
+ /**
+ * Find and returns a navigation, if no such site exist, null is returned instead.
+ *
+ * @param key the navigation key
+ * @return the matching navigation
+ * @throws NullPointerException if the key is null
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ NavigationContext loadNavigation(SiteKey key) throws NullPointerException, NavigationServiceException;
+
+ /**
+ * Create, update a navigation. When the navigation state is not null, the navigation
+ * will be created or updated depending on whether or not the navigation already exists.
+ *
+ * @param navigation the navigation
+ * @throws NullPointerException if the key is null
+ * @throws IllegalArgumentException if the navigation is already destroyed
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ void saveNavigation(NavigationContext navigation) throws NullPointerException, IllegalArgumentException, NavigationServiceException;
+
+ /**
+ * Destroy a navigation.
+ *
+ * @param navigation the navigation
+ * @return true if the navigation was destroyed
+ * @throws NullPointerException if the navigation is null
+ * @throws IllegalArgumentException if the navigation is destroyed
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ boolean destroyNavigation(NavigationContext navigation) throws NullPointerException, IllegalArgumentException, NavigationServiceException;
+
+ /**
+ * Load a navigation node from a specified navigation. The returned context will be the root node of the navigation.
+ *
+ * @param model the node model
+ * @param navigation the navigation
+ * @param scope the scope
+ * @param listener the optional listener
+ * @param <N> the node generic type
+ * @return the loaded node
+ * @throws NullPointerException if any argument is null
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ <N> NodeContext<N> loadNode(NodeModel<N> model, NavigationContext navigation, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException;
+
+ /**
+ * <p>Save the specified context state to the persistent storage. The operation takes the pending changes done to
+ * the tree and attempt to save them to the persistent storage. When conflicts happens, a merge will be attempted
+ * however it can lead to a failure.</p>
+ *
+ * @param context the context to save
+ * @param listener the optional listener
+ * @throws NullPointerException if the context argument is null
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ <N> void saveNode(NodeContext<N> context, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException;
+
+ /**
+ * <p>Update the specified <code>context</code> argument with the most recent state. The update operation will
+ * affect the entire tree even if the <code>context</code> argument is not the root of the tree. The <code>context</code>
+ * argument determines the root from which the <code>scope</code> argument applies to.</p>
+ *
+ * <p>The update operation compares the actual tree and the most recent version of the same tree. When the
+ * <code>scope</scope> argument is not null, it will be used to augment the tree with new nodes. During the
+ * operation, any modification done to the tree wil be reported as a change to the optional <code>listener</code>
+ * argument.</p>
+ *
+ * <p>The update operates recursively by doing a comparison of the node intrisic state (name or state) and its
+ * structural state (the children). The comparison between the children of two nodes is done thanks to the
+ * Longest Common Subsequence algorithm to minimize the number of changes to perform. The operation assumes
+ * that no changes have been performed on the actual tree.</p>
+ *
+ * @param context the context to update
+ * @param scope the optional scope
+ * @param listener the optional node change listener
+ * @param <N> the node generic type
+ * @throws NullPointerException if the context argument is null
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ * @throws IllegalArgumentException if the context argument has pending changes
+ */
+ <N> void updateNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, IllegalArgumentException, NavigationServiceException;
+
+ /**
+ * <p>Rebase the specified <code>context</code> argument with the most recent state. The rebase operation will
+ * affect the entire tree even if the <code>context</code> argument is not the root of the tree. The <code>context</code>
+ * argument determines the root from which the <code>scope</code> argument applies to.</p>
+ *
+ * <p>The rebase operation compares the actual tree and the most recent version of the same tree. When the
+ * <code>scope</scope> argument is not null, it will be used to augment the tree with new nodes. During the
+ * operation, any modification done to the tree wil be reported as a change to the optional <code>listener</code>
+ * argument.</p>
+ *
+ * <p>The rebase operates in a similar way of the update operation, however it assumes that it can have pending changes
+ * done to the tree (i.e changes that have not been saved). Actually a rebase operation with no changes will do the
+ * same than an update operation. The rebase operation attempts to bring the most recent changes to the tree, by
+ * doing a rebase of the pending operations on the actual tree. When conflicting changes exist, a merge will be
+ * attempted, however it could fail and lead to a non resolvable situation.</p>
+ *
+ * @param context the context to rebase
+ * @param scope the optional scope
+ * @param listener the option node change listener @throws NullPointerException if the context argument is null
+ * @param <N> the node generic type
+ * @throws NullPointerException if the context argument is null
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ <N> void rebaseNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException;
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationServiceException extends RuntimeException
-{
-
- /** . */
- private final NavigationError error;
-
- public NavigationServiceException(NavigationError error)
- {
- super(error.toString());
- this.error = error;
- }
-
- public NavigationServiceException(NavigationError error, String message)
- {
- super(message);
-
- //
- this.error = error;
- }
-
- public NavigationServiceException(NavigationError error, String message, Throwable cause)
- {
- super(message, cause);
-
- //
- this.error = error;
- }
-
- public NavigationServiceException(NavigationError error, Throwable cause)
- {
- super(cause);
-
- //
- this.error = error;
- }
-
- public NavigationError getError()
- {
- return error;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceException.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationServiceException extends RuntimeException
+{
+
+ /** . */
+ private final NavigationError error;
+
+ public NavigationServiceException(NavigationError error)
+ {
+ super(error.toString());
+ this.error = error;
+ }
+
+ public NavigationServiceException(NavigationError error, String message)
+ {
+ super(message);
+
+ //
+ this.error = error;
+ }
+
+ public NavigationServiceException(NavigationError error, String message, Throwable cause)
+ {
+ super(message, cause);
+
+ //
+ this.error = error;
+ }
+
+ public NavigationServiceException(NavigationError error, Throwable cause)
+ {
+ super(cause);
+
+ //
+ this.error = error;
+ }
+
+ public NavigationError getError()
+ {
+ return error;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,740 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.Visible;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.data.MappedAttributes;
-import static org.exoplatform.portal.mop.navigation.Utils.*;
-import static org.exoplatform.portal.pom.config.Utils.split;
-
-import org.exoplatform.portal.pom.data.Mapper;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.mop.api.Attributes;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-import org.gatein.mop.api.workspace.link.PageLink;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationServiceImpl implements NavigationService
-{
-
- /** . */
- final POMSessionManager manager;
-
- /** . */
- private final DataCache dataCache;
-
- /** . */
- final Logger log = LoggerFactory.getLogger(NavigationServiceImpl.class);
-
- public NavigationServiceImpl(POMSessionManager manager) throws NullPointerException
- {
- this(manager, new SimpleDataCache());
- }
-
- public NavigationServiceImpl(POMSessionManager manager, DataCache dataCache) throws NullPointerException
- {
- if (manager == null)
- {
- throw new NullPointerException("No null pom session manager allowed");
- }
- if (dataCache == null)
- {
- throw new NullPointerException("No null data cache allowed");
- }
- this.manager = manager;
- this.dataCache = dataCache;
- }
-
- public NavigationContext loadNavigation(SiteKey key)
- {
- if (key == null)
- {
- throw new NullPointerException();
- }
-
- //
- POMSession session = manager.getSession();
- NavigationData data = dataCache.getNavigationData(session, key);
- return data != null && data != NavigationData.EMPTY ? new NavigationContext(data) : null;
- }
-
- public void saveNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
- {
- if (navigation == null)
- {
- throw new NullPointerException();
- }
-
- //
- POMSession session = manager.getSession();
- ObjectType<Site> objectType = objectType(navigation.key.getType());
- Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(objectType, navigation.key.getName());
-
- //
- if (site == null)
- {
- throw new NavigationServiceException(NavigationError.NAVIGATION_NO_SITE);
- }
-
- //
- Navigation rootNode = site.getRootNavigation();
-
- //
- Navigation defaultNode = rootNode.getChild("default");
- if (defaultNode == null)
- {
- defaultNode = rootNode.addChild("default");
- }
-
- //
- NavigationState state = navigation.state;
- if (state != null)
- {
- Integer priority = state.getPriority();
- defaultNode.getAttributes().setValue(MappedAttributes.PRIORITY, priority);
- }
-
- //
- dataCache.removeNavigationData(session, navigation.key);
-
- // Update state
- navigation.data = dataCache.getNavigationData(session, navigation.key);
- navigation.state = null;
- }
-
- public boolean destroyNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
- {
- if (navigation == null)
- {
- throw new NullPointerException("No null navigation argument");
- }
- if (navigation.data == null)
- {
- throw new IllegalArgumentException("Already removed");
- }
-
- //
- POMSession session = manager.getSession();
- ObjectType<Site> objectType = objectType(navigation.key.getType());
- Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(objectType, navigation.key.getName());
-
- //
- if (site == null)
- {
- throw new NavigationServiceException(NavigationError.NAVIGATION_NO_SITE);
- }
-
- //
- Navigation rootNode = site.getRootNavigation();
- Navigation defaultNode = rootNode.getChild("default");
-
- //
- if (defaultNode != null)
- {
- // Invalidate cache
- dataCache.removeNavigation(navigation.key);
- String rootId = navigation.data.rootId;
- if (rootId != null)
- {
- dataCache.removeNodes(Collections.singleton(rootId));
- }
-
- // Destroy nav
- defaultNode.destroy();
-
- // Update state
- navigation.data = null;
-
- //
- return true;
- }
- else
- {
- return false;
- }
- }
-
- public <N> NodeContext<N> loadNode(NodeModel<N> model, NavigationContext navigation, Scope scope, NodeChangeListener<NodeContext<N>> listener)
- {
- if (model == null)
- {
- throw new NullPointerException();
- }
- if (navigation == null)
- {
- throw new NullPointerException();
- }
- if (scope == null)
- {
- throw new NullPointerException();
- }
- String nodeId = navigation.data.rootId;
- if (navigation.data.rootId != null)
- {
- POMSession session = manager.getSession();
- NodeData data = dataCache.getNodeData(session, nodeId);
- if (data != null)
- {
- NodeContext<N> context = new NodeContext<N>(model, data);
- updateNode(context, scope, listener);
- return context;
- }
- else
- {
- return null;
- }
- }
- else
- {
- return null;
- }
- }
-
- public <N> void updateNode(NodeContext<N> root, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, IllegalArgumentException, NavigationServiceException
- {
-
- Scope.Visitor visitor;
- if (scope != null)
- {
- visitor = new FederatingVisitor<N>(root.tree, root, scope);
- }
- else
- {
- visitor = root.tree;
- }
-
- //
- updateTree(root.tree, visitor, listener);
- }
-
- public <N> void saveNode(NodeContext<N> context, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
- {
- saveTree(context.tree, listener);
- }
-
-
- public <N> void rebaseNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NavigationServiceException
- {
- Scope.Visitor visitor;
- if (scope != null)
- {
- visitor = new FederatingVisitor<N>(context.tree.origin(), context, scope);
- }
- else
- {
- visitor = context.tree.origin();
- }
-
- //
- rebaseTree(context.tree, visitor, listener);
- }
-
- private <N> void updateTree(TreeContext<N> tree, Scope.Visitor visitor, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, IllegalArgumentException, NavigationServiceException
- {
- if (tree.hasChanges())
- {
- throw new IllegalArgumentException("For now we don't accept to update a context that has pending changes");
- }
-
- //
- POMSession session = manager.getSession();
- NodeData data = dataCache.getNodeData(session, tree.root.data.id);
- if (data == null)
- {
- throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
- }
-
- // Switch to edit mode
- tree.editMode = true;
-
- // Apply diff changes to the model
- try
- {
-
- TreeUpdate.perform(
- tree,
- NodeContextUpdateAdapter.<N>create(),
- data,
- NodeDataUpdateAdapter.create(dataCache, session),
- listener,
- visitor);
- }
- finally
- {
- // Disable edit mode
- tree.editMode = false;
- }
- }
-
- public void clearCache()
- {
- dataCache.clear();
- }
-
- private <N> void saveTree(TreeContext<N> tree, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
- {
- POMSession session = manager.getSession();
-
- //
- NodeData data = dataCache.getNodeData(session, tree.root.data.id);
- if (data == null)
- {
- throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
- }
-
- // Attempt to rebase
- TreeContext<N> rebased = rebase(tree, tree.origin());
-
- //
- NavigationPersister<N> persister = new NavigationPersister<N>(session);
-
- //
- NodeChangeQueue<NodeContext<N>> changes = rebased.getChanges();
- if (changes != null)
- {
- changes.broadcast(persister);
-
- // Update the tree handles to the persistent values
- for (Map.Entry<String, String> entry : persister.toPersist.entrySet())
- {
- NodeContext<N> a = tree.getNode(entry.getKey());
- a.handle = entry.getValue();
- }
-
- // Update data
- for (String ddd : persister.toUpdate)
- {
- NodeContext<N> a = tree.getNode(ddd);
- a.data = new NodeData(a);
- a.name = null;
- a.state = null;
- }
-
- // Clear changes
- changes.clear();
- tree.getChanges().clear();
- }
-
- // Update
- TreeUpdate.perform(
- tree,
- NodeContextUpdateAdapter.<N>create(),
- rebased.root,
- NodeContextUpdateAdapter.<N>create(),
- listener,
- rebased);
-
- //
- dataCache.removeNodeData(session, persister.toEvict);
- }
-
- private <N> void rebaseTree(TreeContext<N> tree, Scope.Visitor visitor, NodeChangeListener<NodeContext<N>> listener) throws NavigationServiceException
- {
- if (!tree.hasChanges())
- {
- updateTree(tree, visitor, listener);
- }
- else
- {
- TreeContext<N> rebased = rebase(tree, visitor);
-
- //
- TreeUpdate.perform(
- tree,
- NodeContextUpdateAdapter.<N>create(),
- rebased.root,
- NodeContextUpdateAdapter.<N>create(),
- listener,
- rebased);
- }
- }
-
- private <N> TreeContext<N> rebase(TreeContext<N> tree, Scope.Visitor visitor) throws NavigationServiceException
- {
- POMSession session = manager.getSession();
- NodeData data = dataCache.getNodeData(session, tree.root.getId());
- if (data == null)
- {
- throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
- }
-
- //
- TreeContext<N> rebased = new NodeContext<N>(tree.model, data).tree;
-
- //
- TreeUpdate.perform(
- rebased,
- NodeContextUpdateAdapter.<N>create(),
- data,
- NodeDataUpdateAdapter.create(dataCache, session),
- null,
- visitor);
-
- //
- NodeChangeQueue<NodeContext<N>> changes = tree.getChanges();
-
- //
- NodeChangeListener<NodeContext<N>> merger = new TreeMerge<N>(rebased, rebased);
-
- //
- if (changes != null)
- {
- changes.broadcast(merger);
- }
-
- //
- return rebased;
- }
-
- private static class NodeContextUpdateAdapter<N> implements TreeUpdateAdapter<NodeContext<N>>
- {
-
- /** . */
- private static final NodeContextUpdateAdapter<?> _instance = new NodeContextUpdateAdapter();
-
- static <N> NodeContextUpdateAdapter<N> create()
- {
- @SuppressWarnings("unchecked")
- NodeContextUpdateAdapter<N> instance = (NodeContextUpdateAdapter<N>)_instance;
- return instance;
- }
-
- public String getHandle(NodeContext<N> node)
- {
- return node.handle;
- }
-
- public String[] getChildren(NodeContext<N> node)
- {
- if (node.getFirst() != null)
- {
- ArrayList<String> tmp = new ArrayList<String>();
- for (NodeContext<N> current = node.getFirst(); current != null; current = current.getNext())
- {
- tmp.add(current.handle);
- }
- return tmp.toArray(new String[tmp.size()]);
- }
- else
- {
- return Utils.EMPTY_STRING_ARRAY;
- }
- }
-
- public NodeContext<N> getDescendant(NodeContext<N> node, String handle)
- {
- return node.getDescendant(handle);
- }
-
- public NodeData getData(NodeContext<N> node)
- {
- return node.data;
- }
-
- public NodeState getState(NodeContext<N> node)
- {
- return node.state;
- }
-
- public String getName(NodeContext<N> node)
- {
- return node.name;
- }
- }
-
- private static class NodeDataUpdateAdapter implements TreeUpdateAdapter<NodeData>
- {
-
- static NodeDataUpdateAdapter create(DataCache dataCache, POMSession session)
- {
- return new NodeDataUpdateAdapter(dataCache, session);
- }
-
- /** . */
- private final DataCache dataCache;
-
- /** . */
- private final POMSession session;
-
- private NodeDataUpdateAdapter(DataCache dataCache, POMSession session)
- {
- this.dataCache = dataCache;
- this.session = session;
- }
-
- public String getHandle(NodeData node)
- {
- return node.id;
- }
-
- public String[] getChildren(NodeData node)
- {
- return node.children;
- }
-
- public NodeData getDescendant(NodeData node, String handle)
- {
- NodeData data = dataCache.getNodeData(session, handle);
- NodeData current = data;
- while (current != null)
- {
- if (node.id.equals(current.id))
- {
- return data;
- }
- else
- {
- if (current.parentId != null)
- {
- current = dataCache.getNodeData(session, current.parentId);
- }
- else
- {
- current = null;
- }
- }
- }
- return null;
- }
-
- public NodeData getData(NodeData node)
- {
- return node;
- }
-
- public NodeState getState(NodeData node)
- {
- return null;
- }
-
- public String getName(NodeData node)
- {
- return null;
- }
- }
-
- private static class NavigationPersister<N> extends NodeChangeListener.Base<NodeContext<N>>
- {
-
- /** The persisted handles to assign. */
- private final Map<String, String> toPersist;
-
- /** The handles to update. */
- private final Set<String> toUpdate;
-
- /** The handles to evict. */
- private final Set<String> toEvict;
-
- /** . */
- private final POMSession session;
-
- private NavigationPersister(POMSession session)
- {
- this.toPersist = new HashMap<String, String>();
- this.toUpdate = new HashSet<String>();
- this.session = session;
- this.toEvict = new HashSet<String>();
- }
-
- @Override
- public void onCreate(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous, String name) throws NavigationServiceException
- {
- Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
- toEvict.add(parentNav.getObjectId());
- int index = 0;
- if (previous != null)
- {
- Navigation previousNav = session.findObjectById(ObjectType.NAVIGATION, previous.data.id);
- index = previousNav.getIndex() + 1;
- }
-
- //
- Navigation sourceNav = parentNav.addChild(index, name);
-
- //
- parent.data = new NodeData(parentNav);
-
- // Save the handle
- toPersist.put(target.handle, sourceNav.getObjectId());
-
- //
- target.data = new NodeData(sourceNav);
- target.handle = target.data.id;
- target.name = null;
- target.state = null;
-
- //
- toUpdate.add(parent.handle);
- toUpdate.add(target.handle);
- }
- @Override
- public void onDestroy(NodeContext<N> target, NodeContext<N> parent)
- {
- Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
- Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
-
- //
- String objectId = sourceNav.getObjectId();
-
- //
- toEvict.add(objectId);
- toEvict.add(parentNav.getObjectId());
- sourceNav.destroy();
-
- //
- parent.data = new NodeData(parentNav);
-
- //
- toUpdate.add(parent.handle);
-
- //
- if (toPersist.values().contains(objectId))
- {
- toPersist.values().remove(objectId);
- }
- toUpdate.remove(objectId);
- }
- @Override
- public void onUpdate(NodeContext<N> source, NodeState state) throws NavigationServiceException
- {
- Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, source.data.id);
-
- //
- toEvict.add(sourceNav.getObjectId());
- Workspace workspace = sourceNav.getSite().getWorkspace();
- String reference = state.getPageRef();
- if (reference != null)
- {
- String[] pageChunks = split("::", reference);
- ObjectType<? extends Site> siteType = Mapper.parseSiteType(pageChunks[0]);
- Site site = workspace.getSite(siteType, pageChunks[1]);
- org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
- PageLink link = sourceNav.linkTo(ObjectType.PAGE_LINK);
- link.setPage(target);
- }
- else
- {
- PageLink link = sourceNav.linkTo(ObjectType.PAGE_LINK);
- link.setPage(null);
- }
-
- //
- Described described = sourceNav.adapt(Described.class);
- described.setName(state.getLabel());
-
- //
- Visible visible = sourceNav.adapt(Visible.class);
- visible.setVisibility(state.getVisibility());
-
- //
- visible.setStartPublicationDate(state.getStartPublicationDate());
- visible.setEndPublicationDate(state.getEndPublicationDate());
-
- //
- Attributes attrs = sourceNav.getAttributes();
- attrs.setValue(MappedAttributes.ICON, state.getIcon());
-
- //
- source.data = new NodeData(sourceNav);
- source.state = null;
-
- //
- toUpdate.add(source.handle);
- }
- @Override
- public void onMove(NodeContext<N> target, NodeContext<N> from, NodeContext<N> to, NodeContext<N> previous) throws NavigationServiceException
- {
- Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
- Navigation fromNav = session.findObjectById(ObjectType.NAVIGATION, from.data.id);
- Navigation toNav = session.findObjectById(ObjectType.NAVIGATION, to.data.id);
-
- //
- toEvict.add(sourceNav.getObjectId());
- toEvict.add(fromNav.getObjectId());
- toEvict.add(toNav.getObjectId());
- int index;
- if (previous != null)
- {
- Navigation previousNav = session.findObjectById(ObjectType.NAVIGATION, previous.data.id);
- index = previousNav.getIndex() + 1;
- }
- else
- {
- index = 0;
- }
- toNav.getChildren().add(index, sourceNav);
-
- //
- from.data = new NodeData(fromNav);
-
- //
- to.data = new NodeData(toNav);
-
- //
- target.data = new NodeData(sourceNav);
-
- //
- toUpdate.add(target.handle);
- toUpdate.add(from.handle);
- toUpdate.add(to.handle);
- }
- public void onRename(NodeContext<N> target, NodeContext<N> parent, String name) throws NavigationServiceException
- {
- Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
- Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
-
- //
- toEvict.add(sourceNav.getObjectId());
- toEvict.add(parentNav.getObjectId());
- sourceNav.setName(name);
-
- //
- target.data = new NodeData(sourceNav);
- target.name = null;
-
- //
- parent.data = new NodeData(parentNav);
-
- //
- toUpdate.add(parent.handle);
- toUpdate.add(target.handle);
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,740 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visible;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.data.MappedAttributes;
+import static org.exoplatform.portal.mop.navigation.Utils.*;
+import static org.exoplatform.portal.pom.config.Utils.split;
+
+import org.exoplatform.portal.pom.data.Mapper;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.mop.api.Attributes;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.api.workspace.link.PageLink;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationServiceImpl implements NavigationService
+{
+
+ /** . */
+ final POMSessionManager manager;
+
+ /** . */
+ private final DataCache dataCache;
+
+ /** . */
+ final Logger log = LoggerFactory.getLogger(NavigationServiceImpl.class);
+
+ public NavigationServiceImpl(POMSessionManager manager) throws NullPointerException
+ {
+ this(manager, new SimpleDataCache());
+ }
+
+ public NavigationServiceImpl(POMSessionManager manager, DataCache dataCache) throws NullPointerException
+ {
+ if (manager == null)
+ {
+ throw new NullPointerException("No null pom session manager allowed");
+ }
+ if (dataCache == null)
+ {
+ throw new NullPointerException("No null data cache allowed");
+ }
+ this.manager = manager;
+ this.dataCache = dataCache;
+ }
+
+ public NavigationContext loadNavigation(SiteKey key)
+ {
+ if (key == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ POMSession session = manager.getSession();
+ NavigationData data = dataCache.getNavigationData(session, key);
+ return data != null && data != NavigationData.EMPTY ? new NavigationContext(data) : null;
+ }
+
+ public void saveNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
+ {
+ if (navigation == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ POMSession session = manager.getSession();
+ ObjectType<Site> objectType = objectType(navigation.key.getType());
+ Workspace workspace = session.getWorkspace();
+ Site site = workspace.getSite(objectType, navigation.key.getName());
+
+ //
+ if (site == null)
+ {
+ throw new NavigationServiceException(NavigationError.NAVIGATION_NO_SITE);
+ }
+
+ //
+ Navigation rootNode = site.getRootNavigation();
+
+ //
+ Navigation defaultNode = rootNode.getChild("default");
+ if (defaultNode == null)
+ {
+ defaultNode = rootNode.addChild("default");
+ }
+
+ //
+ NavigationState state = navigation.state;
+ if (state != null)
+ {
+ Integer priority = state.getPriority();
+ defaultNode.getAttributes().setValue(MappedAttributes.PRIORITY, priority);
+ }
+
+ //
+ dataCache.removeNavigationData(session, navigation.key);
+
+ // Update state
+ navigation.data = dataCache.getNavigationData(session, navigation.key);
+ navigation.state = null;
+ }
+
+ public boolean destroyNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
+ {
+ if (navigation == null)
+ {
+ throw new NullPointerException("No null navigation argument");
+ }
+ if (navigation.data == null)
+ {
+ throw new IllegalArgumentException("Already removed");
+ }
+
+ //
+ POMSession session = manager.getSession();
+ ObjectType<Site> objectType = objectType(navigation.key.getType());
+ Workspace workspace = session.getWorkspace();
+ Site site = workspace.getSite(objectType, navigation.key.getName());
+
+ //
+ if (site == null)
+ {
+ throw new NavigationServiceException(NavigationError.NAVIGATION_NO_SITE);
+ }
+
+ //
+ Navigation rootNode = site.getRootNavigation();
+ Navigation defaultNode = rootNode.getChild("default");
+
+ //
+ if (defaultNode != null)
+ {
+ // Invalidate cache
+ dataCache.removeNavigation(navigation.key);
+ String rootId = navigation.data.rootId;
+ if (rootId != null)
+ {
+ dataCache.removeNodes(Collections.singleton(rootId));
+ }
+
+ // Destroy nav
+ defaultNode.destroy();
+
+ // Update state
+ navigation.data = null;
+
+ //
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public <N> NodeContext<N> loadNode(NodeModel<N> model, NavigationContext navigation, Scope scope, NodeChangeListener<NodeContext<N>> listener)
+ {
+ if (model == null)
+ {
+ throw new NullPointerException();
+ }
+ if (navigation == null)
+ {
+ throw new NullPointerException();
+ }
+ if (scope == null)
+ {
+ throw new NullPointerException();
+ }
+ String nodeId = navigation.data.rootId;
+ if (navigation.data.rootId != null)
+ {
+ POMSession session = manager.getSession();
+ NodeData data = dataCache.getNodeData(session, nodeId);
+ if (data != null)
+ {
+ NodeContext<N> context = new NodeContext<N>(model, data);
+ updateNode(context, scope, listener);
+ return context;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <N> void updateNode(NodeContext<N> root, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, IllegalArgumentException, NavigationServiceException
+ {
+
+ Scope.Visitor visitor;
+ if (scope != null)
+ {
+ visitor = new FederatingVisitor<N>(root.tree, root, scope);
+ }
+ else
+ {
+ visitor = root.tree;
+ }
+
+ //
+ updateTree(root.tree, visitor, listener);
+ }
+
+ public <N> void saveNode(NodeContext<N> context, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
+ {
+ saveTree(context.tree, listener);
+ }
+
+
+ public <N> void rebaseNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NavigationServiceException
+ {
+ Scope.Visitor visitor;
+ if (scope != null)
+ {
+ visitor = new FederatingVisitor<N>(context.tree.origin(), context, scope);
+ }
+ else
+ {
+ visitor = context.tree.origin();
+ }
+
+ //
+ rebaseTree(context.tree, visitor, listener);
+ }
+
+ private <N> void updateTree(TreeContext<N> tree, Scope.Visitor visitor, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, IllegalArgumentException, NavigationServiceException
+ {
+ if (tree.hasChanges())
+ {
+ throw new IllegalArgumentException("For now we don't accept to update a context that has pending changes");
+ }
+
+ //
+ POMSession session = manager.getSession();
+ NodeData data = dataCache.getNodeData(session, tree.root.data.id);
+ if (data == null)
+ {
+ throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
+ }
+
+ // Switch to edit mode
+ tree.editMode = true;
+
+ // Apply diff changes to the model
+ try
+ {
+
+ TreeUpdate.perform(
+ tree,
+ NodeContextUpdateAdapter.<N>create(),
+ data,
+ NodeDataUpdateAdapter.create(dataCache, session),
+ listener,
+ visitor);
+ }
+ finally
+ {
+ // Disable edit mode
+ tree.editMode = false;
+ }
+ }
+
+ public void clearCache()
+ {
+ dataCache.clear();
+ }
+
+ private <N> void saveTree(TreeContext<N> tree, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
+ {
+ POMSession session = manager.getSession();
+
+ //
+ NodeData data = dataCache.getNodeData(session, tree.root.data.id);
+ if (data == null)
+ {
+ throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
+ }
+
+ // Attempt to rebase
+ TreeContext<N> rebased = rebase(tree, tree.origin());
+
+ //
+ NavigationPersister<N> persister = new NavigationPersister<N>(session);
+
+ //
+ NodeChangeQueue<NodeContext<N>> changes = rebased.getChanges();
+ if (changes != null)
+ {
+ changes.broadcast(persister);
+
+ // Update the tree handles to the persistent values
+ for (Map.Entry<String, String> entry : persister.toPersist.entrySet())
+ {
+ NodeContext<N> a = tree.getNode(entry.getKey());
+ a.handle = entry.getValue();
+ }
+
+ // Update data
+ for (String ddd : persister.toUpdate)
+ {
+ NodeContext<N> a = tree.getNode(ddd);
+ a.data = new NodeData(a);
+ a.name = null;
+ a.state = null;
+ }
+
+ // Clear changes
+ changes.clear();
+ tree.getChanges().clear();
+ }
+
+ // Update
+ TreeUpdate.perform(
+ tree,
+ NodeContextUpdateAdapter.<N>create(),
+ rebased.root,
+ NodeContextUpdateAdapter.<N>create(),
+ listener,
+ rebased);
+
+ //
+ dataCache.removeNodeData(session, persister.toEvict);
+ }
+
+ private <N> void rebaseTree(TreeContext<N> tree, Scope.Visitor visitor, NodeChangeListener<NodeContext<N>> listener) throws NavigationServiceException
+ {
+ if (!tree.hasChanges())
+ {
+ updateTree(tree, visitor, listener);
+ }
+ else
+ {
+ TreeContext<N> rebased = rebase(tree, visitor);
+
+ //
+ TreeUpdate.perform(
+ tree,
+ NodeContextUpdateAdapter.<N>create(),
+ rebased.root,
+ NodeContextUpdateAdapter.<N>create(),
+ listener,
+ rebased);
+ }
+ }
+
+ private <N> TreeContext<N> rebase(TreeContext<N> tree, Scope.Visitor visitor) throws NavigationServiceException
+ {
+ POMSession session = manager.getSession();
+ NodeData data = dataCache.getNodeData(session, tree.root.getId());
+ if (data == null)
+ {
+ throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
+ }
+
+ //
+ TreeContext<N> rebased = new NodeContext<N>(tree.model, data).tree;
+
+ //
+ TreeUpdate.perform(
+ rebased,
+ NodeContextUpdateAdapter.<N>create(),
+ data,
+ NodeDataUpdateAdapter.create(dataCache, session),
+ null,
+ visitor);
+
+ //
+ NodeChangeQueue<NodeContext<N>> changes = tree.getChanges();
+
+ //
+ NodeChangeListener<NodeContext<N>> merger = new TreeMerge<N>(rebased, rebased);
+
+ //
+ if (changes != null)
+ {
+ changes.broadcast(merger);
+ }
+
+ //
+ return rebased;
+ }
+
+ private static class NodeContextUpdateAdapter<N> implements TreeUpdateAdapter<NodeContext<N>>
+ {
+
+ /** . */
+ private static final NodeContextUpdateAdapter<?> _instance = new NodeContextUpdateAdapter();
+
+ static <N> NodeContextUpdateAdapter<N> create()
+ {
+ @SuppressWarnings("unchecked")
+ NodeContextUpdateAdapter<N> instance = (NodeContextUpdateAdapter<N>)_instance;
+ return instance;
+ }
+
+ public String getHandle(NodeContext<N> node)
+ {
+ return node.handle;
+ }
+
+ public String[] getChildren(NodeContext<N> node)
+ {
+ if (node.getFirst() != null)
+ {
+ ArrayList<String> tmp = new ArrayList<String>();
+ for (NodeContext<N> current = node.getFirst(); current != null; current = current.getNext())
+ {
+ tmp.add(current.handle);
+ }
+ return tmp.toArray(new String[tmp.size()]);
+ }
+ else
+ {
+ return Utils.EMPTY_STRING_ARRAY;
+ }
+ }
+
+ public NodeContext<N> getDescendant(NodeContext<N> node, String handle)
+ {
+ return node.getDescendant(handle);
+ }
+
+ public NodeData getData(NodeContext<N> node)
+ {
+ return node.data;
+ }
+
+ public NodeState getState(NodeContext<N> node)
+ {
+ return node.state;
+ }
+
+ public String getName(NodeContext<N> node)
+ {
+ return node.name;
+ }
+ }
+
+ private static class NodeDataUpdateAdapter implements TreeUpdateAdapter<NodeData>
+ {
+
+ static NodeDataUpdateAdapter create(DataCache dataCache, POMSession session)
+ {
+ return new NodeDataUpdateAdapter(dataCache, session);
+ }
+
+ /** . */
+ private final DataCache dataCache;
+
+ /** . */
+ private final POMSession session;
+
+ private NodeDataUpdateAdapter(DataCache dataCache, POMSession session)
+ {
+ this.dataCache = dataCache;
+ this.session = session;
+ }
+
+ public String getHandle(NodeData node)
+ {
+ return node.id;
+ }
+
+ public String[] getChildren(NodeData node)
+ {
+ return node.children;
+ }
+
+ public NodeData getDescendant(NodeData node, String handle)
+ {
+ NodeData data = dataCache.getNodeData(session, handle);
+ NodeData current = data;
+ while (current != null)
+ {
+ if (node.id.equals(current.id))
+ {
+ return data;
+ }
+ else
+ {
+ if (current.parentId != null)
+ {
+ current = dataCache.getNodeData(session, current.parentId);
+ }
+ else
+ {
+ current = null;
+ }
+ }
+ }
+ return null;
+ }
+
+ public NodeData getData(NodeData node)
+ {
+ return node;
+ }
+
+ public NodeState getState(NodeData node)
+ {
+ return null;
+ }
+
+ public String getName(NodeData node)
+ {
+ return null;
+ }
+ }
+
+ private static class NavigationPersister<N> extends NodeChangeListener.Base<NodeContext<N>>
+ {
+
+ /** The persisted handles to assign. */
+ private final Map<String, String> toPersist;
+
+ /** The handles to update. */
+ private final Set<String> toUpdate;
+
+ /** The handles to evict. */
+ private final Set<String> toEvict;
+
+ /** . */
+ private final POMSession session;
+
+ private NavigationPersister(POMSession session)
+ {
+ this.toPersist = new HashMap<String, String>();
+ this.toUpdate = new HashSet<String>();
+ this.session = session;
+ this.toEvict = new HashSet<String>();
+ }
+
+ @Override
+ public void onCreate(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous, String name) throws NavigationServiceException
+ {
+ Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
+ toEvict.add(parentNav.getObjectId());
+ int index = 0;
+ if (previous != null)
+ {
+ Navigation previousNav = session.findObjectById(ObjectType.NAVIGATION, previous.data.id);
+ index = previousNav.getIndex() + 1;
+ }
+
+ //
+ Navigation sourceNav = parentNav.addChild(index, name);
+
+ //
+ parent.data = new NodeData(parentNav);
+
+ // Save the handle
+ toPersist.put(target.handle, sourceNav.getObjectId());
+
+ //
+ target.data = new NodeData(sourceNav);
+ target.handle = target.data.id;
+ target.name = null;
+ target.state = null;
+
+ //
+ toUpdate.add(parent.handle);
+ toUpdate.add(target.handle);
+ }
+ @Override
+ public void onDestroy(NodeContext<N> target, NodeContext<N> parent)
+ {
+ Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
+ Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
+
+ //
+ String objectId = sourceNav.getObjectId();
+
+ //
+ toEvict.add(objectId);
+ toEvict.add(parentNav.getObjectId());
+ sourceNav.destroy();
+
+ //
+ parent.data = new NodeData(parentNav);
+
+ //
+ toUpdate.add(parent.handle);
+
+ //
+ if (toPersist.values().contains(objectId))
+ {
+ toPersist.values().remove(objectId);
+ }
+ toUpdate.remove(objectId);
+ }
+ @Override
+ public void onUpdate(NodeContext<N> source, NodeState state) throws NavigationServiceException
+ {
+ Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, source.data.id);
+
+ //
+ toEvict.add(sourceNav.getObjectId());
+ Workspace workspace = sourceNav.getSite().getWorkspace();
+ String reference = state.getPageRef();
+ if (reference != null)
+ {
+ String[] pageChunks = split("::", reference);
+ ObjectType<? extends Site> siteType = Mapper.parseSiteType(pageChunks[0]);
+ Site site = workspace.getSite(siteType, pageChunks[1]);
+ org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
+ PageLink link = sourceNav.linkTo(ObjectType.PAGE_LINK);
+ link.setPage(target);
+ }
+ else
+ {
+ PageLink link = sourceNav.linkTo(ObjectType.PAGE_LINK);
+ link.setPage(null);
+ }
+
+ //
+ Described described = sourceNav.adapt(Described.class);
+ described.setName(state.getLabel());
+
+ //
+ Visible visible = sourceNav.adapt(Visible.class);
+ visible.setVisibility(state.getVisibility());
+
+ //
+ visible.setStartPublicationDate(state.getStartPublicationDate());
+ visible.setEndPublicationDate(state.getEndPublicationDate());
+
+ //
+ Attributes attrs = sourceNav.getAttributes();
+ attrs.setValue(MappedAttributes.ICON, state.getIcon());
+
+ //
+ source.data = new NodeData(sourceNav);
+ source.state = null;
+
+ //
+ toUpdate.add(source.handle);
+ }
+ @Override
+ public void onMove(NodeContext<N> target, NodeContext<N> from, NodeContext<N> to, NodeContext<N> previous) throws NavigationServiceException
+ {
+ Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
+ Navigation fromNav = session.findObjectById(ObjectType.NAVIGATION, from.data.id);
+ Navigation toNav = session.findObjectById(ObjectType.NAVIGATION, to.data.id);
+
+ //
+ toEvict.add(sourceNav.getObjectId());
+ toEvict.add(fromNav.getObjectId());
+ toEvict.add(toNav.getObjectId());
+ int index;
+ if (previous != null)
+ {
+ Navigation previousNav = session.findObjectById(ObjectType.NAVIGATION, previous.data.id);
+ index = previousNav.getIndex() + 1;
+ }
+ else
+ {
+ index = 0;
+ }
+ toNav.getChildren().add(index, sourceNav);
+
+ //
+ from.data = new NodeData(fromNav);
+
+ //
+ to.data = new NodeData(toNav);
+
+ //
+ target.data = new NodeData(sourceNav);
+
+ //
+ toUpdate.add(target.handle);
+ toUpdate.add(from.handle);
+ toUpdate.add(to.handle);
+ }
+ public void onRename(NodeContext<N> target, NodeContext<N> parent, String name) throws NavigationServiceException
+ {
+ Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
+ Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
+
+ //
+ toEvict.add(sourceNav.getObjectId());
+ toEvict.add(parentNav.getObjectId());
+ sourceNav.setName(name);
+
+ //
+ target.data = new NodeData(sourceNav);
+ target.name = null;
+
+ //
+ parent.data = new NodeData(parentNav);
+
+ //
+ toUpdate.add(parent.handle);
+ toUpdate.add(target.handle);
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.chromattic.api.UndeclaredRepositoryException;
-import org.exoplatform.portal.mop.EventType;
-import org.exoplatform.portal.mop.SiteKey;
-import static org.exoplatform.portal.mop.navigation.Utils.*;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.jcr.RepositoryService;
-import org.exoplatform.services.jcr.core.ManageableRepository;
-import org.exoplatform.services.listener.ListenerService;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.picocontainer.Startable;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationServiceWrapper implements NavigationService, Startable
-{
-
- /** . */
- private static final Logger log = LoggerFactory.getLogger(NavigationServiceWrapper.class);
-
- /** . */
- private final NavigationServiceImpl service;
-
- /** . */
- private ListenerService listenerService;
-
- /** . */
- private final POMSessionManager manager;
-
- /** . */
- private Session session;
-
- /** . */
- private final RepositoryService repositoryService;
-
- /** . */
- private final InvalidationBridge bridge;
-
- public NavigationServiceWrapper(
- RepositoryService repositoryService,
- POMSessionManager manager,
- ListenerService listenerService)
- {
- SimpleDataCache cache = new SimpleDataCache();
-
- //
- this.repositoryService = repositoryService;
- this.manager = manager;
- this.service = new NavigationServiceImpl(manager, cache);
- this.listenerService = listenerService;
- this.bridge = new InvalidationBridge(cache);
- }
-
- public NavigationServiceWrapper(
- RepositoryService repositoryService,
- POMSessionManager manager,
- ListenerService listenerService,
- CacheService cacheService)
- {
- ExoDataCache cache = new ExoDataCache(cacheService);
-
- //
- this.repositoryService = repositoryService;
- this.manager = manager;
- this.service = new NavigationServiceImpl(manager, cache);
- this.listenerService = listenerService;
- this.bridge = new InvalidationBridge(cache);
- }
-
- public NavigationContext loadNavigation(SiteKey key)
- {
- return service.loadNavigation(key);
- }
-
- public void saveNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
- {
- boolean created = navigation.data == null;
-
- //
- service.saveNavigation(navigation);
-
- //
- if (created)
- {
- notify(EventType.NAVIGATION_CREATED, navigation.key);
- }
- else
- {
- notify(EventType.NAVIGATION_UPDATED, navigation.key);
- }
- }
-
- public boolean destroyNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
- {
- boolean destroyed = service.destroyNavigation(navigation);
-
- //
- if (destroyed)
- {
- notify(EventType.NAVIGATION_DESTROYED, navigation.key);
- }
-
- //
- return destroyed;
- }
-
- public <N> NodeContext<N> loadNode(NodeModel<N> model, NavigationContext navigation, Scope scope, NodeChangeListener<NodeContext<N>> listener)
- {
- return service.loadNode(model, navigation, scope, listener);
- }
-
- public <N> void saveNode(NodeContext<N> context, NodeChangeListener<NodeContext<N>> listener) throws NavigationServiceException
- {
- service.saveNode(context, listener);
- org.gatein.mop.api.workspace.Navigation nav = service.manager.getSession().findObjectById(ObjectType.NAVIGATION, context.data.id);
- Site site = nav.getSite();
- SiteKey key = new SiteKey(siteType(site.getObjectType()), site.getName());
- notify(EventType.NAVIGATION_UPDATED, key);
- }
-
- public <N> void updateNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
- {
- service.updateNode(context, scope, listener);
- }
-
- public <N> void rebaseNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
- {
- service.rebaseNode(context, scope, listener);
- }
-
- private void notify(String name, SiteKey key)
- {
- try
- {
- listenerService.broadcast(name, this, key);
- }
- catch (Exception e)
- {
- log.error("Error when delivering notification " + name + " for navigation " + key, e);
- }
- }
-
- public void start()
- {
- try
- {
- String workspaceName = manager.getLifeCycle().getWorkspaceName();
- ManageableRepository repo = repositoryService.getCurrentRepository();
- session = repo.getSystemSession(workspaceName);
- bridge.start(session);
- }
- catch (RepositoryException e)
- {
- throw new UndeclaredRepositoryException(e);
- }
- }
-
- public void stop()
- {
- bridge.stop();
-
- //
- if (session != null)
- {
- session.logout();
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.chromattic.api.UndeclaredRepositoryException;
+import org.exoplatform.portal.mop.EventType;
+import org.exoplatform.portal.mop.SiteKey;
+import static org.exoplatform.portal.mop.navigation.Utils.*;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.listener.ListenerService;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.picocontainer.Startable;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationServiceWrapper implements NavigationService, Startable
+{
+
+ /** . */
+ private static final Logger log = LoggerFactory.getLogger(NavigationServiceWrapper.class);
+
+ /** . */
+ private final NavigationServiceImpl service;
+
+ /** . */
+ private ListenerService listenerService;
+
+ /** . */
+ private final POMSessionManager manager;
+
+ /** . */
+ private Session session;
+
+ /** . */
+ private final RepositoryService repositoryService;
+
+ /** . */
+ private final InvalidationBridge bridge;
+
+ public NavigationServiceWrapper(
+ RepositoryService repositoryService,
+ POMSessionManager manager,
+ ListenerService listenerService)
+ {
+ SimpleDataCache cache = new SimpleDataCache();
+
+ //
+ this.repositoryService = repositoryService;
+ this.manager = manager;
+ this.service = new NavigationServiceImpl(manager, cache);
+ this.listenerService = listenerService;
+ this.bridge = new InvalidationBridge(cache);
+ }
+
+ public NavigationServiceWrapper(
+ RepositoryService repositoryService,
+ POMSessionManager manager,
+ ListenerService listenerService,
+ CacheService cacheService)
+ {
+ ExoDataCache cache = new ExoDataCache(cacheService);
+
+ //
+ this.repositoryService = repositoryService;
+ this.manager = manager;
+ this.service = new NavigationServiceImpl(manager, cache);
+ this.listenerService = listenerService;
+ this.bridge = new InvalidationBridge(cache);
+ }
+
+ public NavigationContext loadNavigation(SiteKey key)
+ {
+ return service.loadNavigation(key);
+ }
+
+ public void saveNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
+ {
+ boolean created = navigation.data == null;
+
+ //
+ service.saveNavigation(navigation);
+
+ //
+ if (created)
+ {
+ notify(EventType.NAVIGATION_CREATED, navigation.key);
+ }
+ else
+ {
+ notify(EventType.NAVIGATION_UPDATED, navigation.key);
+ }
+ }
+
+ public boolean destroyNavigation(NavigationContext navigation) throws NullPointerException, NavigationServiceException
+ {
+ boolean destroyed = service.destroyNavigation(navigation);
+
+ //
+ if (destroyed)
+ {
+ notify(EventType.NAVIGATION_DESTROYED, navigation.key);
+ }
+
+ //
+ return destroyed;
+ }
+
+ public <N> NodeContext<N> loadNode(NodeModel<N> model, NavigationContext navigation, Scope scope, NodeChangeListener<NodeContext<N>> listener)
+ {
+ return service.loadNode(model, navigation, scope, listener);
+ }
+
+ public <N> void saveNode(NodeContext<N> context, NodeChangeListener<NodeContext<N>> listener) throws NavigationServiceException
+ {
+ service.saveNode(context, listener);
+ org.gatein.mop.api.workspace.Navigation nav = service.manager.getSession().findObjectById(ObjectType.NAVIGATION, context.data.id);
+ Site site = nav.getSite();
+ SiteKey key = new SiteKey(siteType(site.getObjectType()), site.getName());
+ notify(EventType.NAVIGATION_UPDATED, key);
+ }
+
+ public <N> void updateNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
+ {
+ service.updateNode(context, scope, listener);
+ }
+
+ public <N> void rebaseNode(NodeContext<N> context, Scope scope, NodeChangeListener<NodeContext<N>> listener) throws NullPointerException, NavigationServiceException
+ {
+ service.rebaseNode(context, scope, listener);
+ }
+
+ private void notify(String name, SiteKey key)
+ {
+ try
+ {
+ listenerService.broadcast(name, this, key);
+ }
+ catch (Exception e)
+ {
+ log.error("Error when delivering notification " + name + " for navigation " + key, e);
+ }
+ }
+
+ public void start()
+ {
+ try
+ {
+ String workspaceName = manager.getLifeCycle().getWorkspaceName();
+ ManageableRepository repo = repositoryService.getCurrentRepository();
+ session = repo.getSystemSession(workspaceName);
+ bridge.start(session);
+ }
+ catch (RepositoryException e)
+ {
+ throw new UndeclaredRepositoryException(e);
+ }
+ }
+
+ public void stop()
+ {
+ bridge.stop();
+
+ //
+ if (session != null)
+ {
+ session.logout();
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import java.io.Serializable;
-
-/**
- * An immutable navigation state class.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationState implements Serializable
-{
-
- /** . */
- private final Integer priority;
-
- public NavigationState(Integer priority)
- {
- this.priority = priority;
- }
-
- /**
- * Returns the navigation priority.
- *
- * @return the navigation priority
- */
- public Integer getPriority()
- {
- return priority;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationState.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import java.io.Serializable;
+
+/**
+ * An immutable navigation state class.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationState implements Serializable
+{
+
+ /** . */
+ private final Integer priority;
+
+ public NavigationState(Integer priority)
+ {
+ this.priority = priority;
+ }
+
+ /**
+ * Returns the navigation priority.
+ *
+ * @return the navigation priority
+ */
+ public Integer getPriority()
+ {
+ return priority;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,391 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * Describe a change applied to a node.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public abstract class NodeChange<N>
-{
-
- /** The target. */
- final N target;
-
- private NodeChange(N target)
- {
- if (target == null)
- {
- throw new NullPointerException("No null target accepted");
- }
-
- //
- this.target = target;
- }
-
- public final N getTarget()
- {
- return target;
- }
-
- /**
- * Dispatch the change to the proper listener method:
- * <ul>
- * <li>{@link Created} dispatches to {@link NodeChangeListener#onCreate(Object, Object, Object, String)}</li>
- * <li>{@link Added} dispatches to {@link NodeChangeListener#onAdd(Object, Object, Object)}</li>
- * <li>{@link Destroyed} dispatches to {@link NodeChangeListener#onDestroy(Object, Object)}</li>
- * <li>{@link Moved} dispatches to {@link NodeChangeListener#onMove(Object, Object, Object, Object)}</li>
- * <li>{@link Removed} dispatches to {@link NodeChangeListener#onRemove(Object, Object)}</li>
- * <li>{@link Renamed} dispatches to {@link NodeChangeListener#onRename(Object, Object, String)}</li>
- * <li>{@link Updated} dispatches to {@link NodeChangeListener#onUpdate(Object, NodeState)}</li>
- * </ul>
- *
- * @param listener the listener
- */
- protected abstract void dispatch(NodeChangeListener<N> listener);
-
- public final static class Destroyed<N> extends NodeChange<N>
- {
-
- /** . */
- final N parent;
-
- Destroyed(N parent, N node)
- {
- super(node);
-
- //
- if (parent == null)
- {
- throw new NullPointerException("No null parent accepted");
- }
-
- //
- this.parent = parent;
- }
-
- public N getParent()
- {
- return parent;
- }
-
- @Override
- protected void dispatch(NodeChangeListener<N> listener)
- {
- listener.onDestroy(target, parent);
- }
-
- @Override
- public String toString()
- {
- return "NodeChange.Destroyed[target" + target + ",parent=" + parent + "]";
- }
- }
-
- public final static class Removed<N> extends NodeChange<N>
- {
-
- /** . */
- final N parent;
-
- Removed(N parent, N node)
- {
- super(node);
-
- //
- if (parent == null)
- {
- throw new NullPointerException("No null parent accepted");
- }
-
- //
- this.parent = parent;
- }
-
- public N getParent()
- {
- return parent;
- }
-
- @Override
- protected void dispatch(NodeChangeListener<N> listener)
- {
- listener.onRemove(target, parent);
- }
-
- @Override
- public String toString()
- {
- return "NodeChange.Removed[target" + target + ",parent=" + parent + "]";
- }
- }
-
- public final static class Created<N> extends NodeChange<N>
- {
-
- /** . */
- final N parent;
-
- /** . */
- final N previous;
-
- /** . */
- final String name;
-
- Created(N parent, N previous, N node, String name) throws NullPointerException
- {
- super(node);
-
- //
- if (parent == null)
- {
- throw new NullPointerException("No null parent accepted");
- }
- if (name == null)
- {
- throw new NullPointerException("No null name accepted");
- }
-
- //
- this.parent = parent;
- this.previous = previous;
- this.name = name;
- }
-
- public N getParent()
- {
- return parent;
- }
-
- public N getPrevious()
- {
- return previous;
- }
-
- public String getName()
- {
- return name;
- }
-
- @Override
- protected void dispatch(NodeChangeListener<N> listener)
- {
- listener.onCreate(target, parent, previous, name);
- }
-
- @Override
- public String toString()
- {
- return "NodeChange.Created[target" + target + ",previous" + previous + ",parent=" + parent + ",name=" + name + "]";
- }
- }
-
- public final static class Added<N> extends NodeChange<N>
- {
-
- /** . */
- final N parent;
-
- /** . */
- final N previous;
-
- Added(N parent, N previous, N node)
- {
- super(node);
-
- //
- if (parent == null)
- {
- throw new NullPointerException("No null parent accepted");
- }
-
- //
- this.parent = parent;
- this.previous = previous;
- }
-
- public N getParent()
- {
- return parent;
- }
-
- public N getPrevious()
- {
- return previous != null ? previous : null;
- }
-
- @Override
- protected void dispatch(NodeChangeListener<N> listener)
- {
- listener.onAdd(target, parent, previous);
- }
-
- @Override
- public String toString()
- {
- return "NodeChange.Added[target" + target + ",previous" + previous + ",parent=" + parent + "]";
- }
- }
-
- public final static class Moved<N> extends NodeChange<N>
- {
-
- /** . */
- final N from;
-
- /** . */
- final N to;
-
- /** . */
- final N previous;
-
- Moved(N from, N to, N previous, N node)
- {
- super(node);
-
- //
- if (from == null)
- {
- throw new NullPointerException("No null from accepted");
- }
- //
- if (to == null)
- {
- throw new NullPointerException("No null to accepted");
- }
-
- //
- this.from = from;
- this.to = to;
- this.previous = previous;
- }
-
- public N getFrom()
- {
- return from;
- }
-
- public N getTo()
- {
- return to;
- }
-
- public N getPrevious()
- {
- return previous != null ? previous : null;
- }
-
- @Override
- protected void dispatch(NodeChangeListener<N> listener)
- {
- listener.onMove(target, from, to, previous);
- }
-
- @Override
- public String toString()
- {
- return "NodeChange.Moved[target" + target + ",from=" + from + ",to=" + to + ",previous=" + previous + "]";
- }
- }
-
- public final static class Renamed<N> extends NodeChange<N>
- {
-
- /** . */
- final N parent;
-
- /** . */
- final String name;
-
- Renamed(N parent, N node, String name)
- {
- super(node);
-
- //
- if (parent == null)
- {
- throw new NullPointerException("No null parent accepted");
- }
- if (name == null)
- {
- throw new NullPointerException("No null name accepted");
- }
-
- //
- this.parent = parent;
- this.name = name;
- }
-
- public N getParent()
- {
- return parent;
- }
-
- public String getName()
- {
- return name;
- }
-
- @Override
- protected void dispatch(NodeChangeListener<N> listener)
- {
- listener.onRename(target, parent, name);
- }
-
- @Override
- public String toString()
- {
- return "NodeChange.Renamed[target" + target + ",name=" + name + "]";
- }
- }
-
- public final static class Updated<N> extends NodeChange<N>
- {
-
- /** . */
- final NodeState state;
-
- public Updated(N node, NodeState state)
- {
- super(node);
-
- //
- this.state = state;
- }
-
- public NodeState getState()
- {
- return state;
- }
-
- @Override
- protected void dispatch(NodeChangeListener<N> listener)
- {
- listener.onUpdate(target, state);
- }
-
- @Override
- public String toString()
- {
- return "NodeChange.Updated[target" + target + ",state=" + state + "]";
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChange.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,391 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * Describe a change applied to a node.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public abstract class NodeChange<N>
+{
+
+ /** The target. */
+ final N target;
+
+ private NodeChange(N target)
+ {
+ if (target == null)
+ {
+ throw new NullPointerException("No null target accepted");
+ }
+
+ //
+ this.target = target;
+ }
+
+ public final N getTarget()
+ {
+ return target;
+ }
+
+ /**
+ * Dispatch the change to the proper listener method:
+ * <ul>
+ * <li>{@link Created} dispatches to {@link NodeChangeListener#onCreate(Object, Object, Object, String)}</li>
+ * <li>{@link Added} dispatches to {@link NodeChangeListener#onAdd(Object, Object, Object)}</li>
+ * <li>{@link Destroyed} dispatches to {@link NodeChangeListener#onDestroy(Object, Object)}</li>
+ * <li>{@link Moved} dispatches to {@link NodeChangeListener#onMove(Object, Object, Object, Object)}</li>
+ * <li>{@link Removed} dispatches to {@link NodeChangeListener#onRemove(Object, Object)}</li>
+ * <li>{@link Renamed} dispatches to {@link NodeChangeListener#onRename(Object, Object, String)}</li>
+ * <li>{@link Updated} dispatches to {@link NodeChangeListener#onUpdate(Object, NodeState)}</li>
+ * </ul>
+ *
+ * @param listener the listener
+ */
+ protected abstract void dispatch(NodeChangeListener<N> listener);
+
+ public final static class Destroyed<N> extends NodeChange<N>
+ {
+
+ /** . */
+ final N parent;
+
+ Destroyed(N parent, N node)
+ {
+ super(node);
+
+ //
+ if (parent == null)
+ {
+ throw new NullPointerException("No null parent accepted");
+ }
+
+ //
+ this.parent = parent;
+ }
+
+ public N getParent()
+ {
+ return parent;
+ }
+
+ @Override
+ protected void dispatch(NodeChangeListener<N> listener)
+ {
+ listener.onDestroy(target, parent);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeChange.Destroyed[target" + target + ",parent=" + parent + "]";
+ }
+ }
+
+ public final static class Removed<N> extends NodeChange<N>
+ {
+
+ /** . */
+ final N parent;
+
+ Removed(N parent, N node)
+ {
+ super(node);
+
+ //
+ if (parent == null)
+ {
+ throw new NullPointerException("No null parent accepted");
+ }
+
+ //
+ this.parent = parent;
+ }
+
+ public N getParent()
+ {
+ return parent;
+ }
+
+ @Override
+ protected void dispatch(NodeChangeListener<N> listener)
+ {
+ listener.onRemove(target, parent);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeChange.Removed[target" + target + ",parent=" + parent + "]";
+ }
+ }
+
+ public final static class Created<N> extends NodeChange<N>
+ {
+
+ /** . */
+ final N parent;
+
+ /** . */
+ final N previous;
+
+ /** . */
+ final String name;
+
+ Created(N parent, N previous, N node, String name) throws NullPointerException
+ {
+ super(node);
+
+ //
+ if (parent == null)
+ {
+ throw new NullPointerException("No null parent accepted");
+ }
+ if (name == null)
+ {
+ throw new NullPointerException("No null name accepted");
+ }
+
+ //
+ this.parent = parent;
+ this.previous = previous;
+ this.name = name;
+ }
+
+ public N getParent()
+ {
+ return parent;
+ }
+
+ public N getPrevious()
+ {
+ return previous;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ protected void dispatch(NodeChangeListener<N> listener)
+ {
+ listener.onCreate(target, parent, previous, name);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeChange.Created[target" + target + ",previous" + previous + ",parent=" + parent + ",name=" + name + "]";
+ }
+ }
+
+ public final static class Added<N> extends NodeChange<N>
+ {
+
+ /** . */
+ final N parent;
+
+ /** . */
+ final N previous;
+
+ Added(N parent, N previous, N node)
+ {
+ super(node);
+
+ //
+ if (parent == null)
+ {
+ throw new NullPointerException("No null parent accepted");
+ }
+
+ //
+ this.parent = parent;
+ this.previous = previous;
+ }
+
+ public N getParent()
+ {
+ return parent;
+ }
+
+ public N getPrevious()
+ {
+ return previous != null ? previous : null;
+ }
+
+ @Override
+ protected void dispatch(NodeChangeListener<N> listener)
+ {
+ listener.onAdd(target, parent, previous);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeChange.Added[target" + target + ",previous" + previous + ",parent=" + parent + "]";
+ }
+ }
+
+ public final static class Moved<N> extends NodeChange<N>
+ {
+
+ /** . */
+ final N from;
+
+ /** . */
+ final N to;
+
+ /** . */
+ final N previous;
+
+ Moved(N from, N to, N previous, N node)
+ {
+ super(node);
+
+ //
+ if (from == null)
+ {
+ throw new NullPointerException("No null from accepted");
+ }
+ //
+ if (to == null)
+ {
+ throw new NullPointerException("No null to accepted");
+ }
+
+ //
+ this.from = from;
+ this.to = to;
+ this.previous = previous;
+ }
+
+ public N getFrom()
+ {
+ return from;
+ }
+
+ public N getTo()
+ {
+ return to;
+ }
+
+ public N getPrevious()
+ {
+ return previous != null ? previous : null;
+ }
+
+ @Override
+ protected void dispatch(NodeChangeListener<N> listener)
+ {
+ listener.onMove(target, from, to, previous);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeChange.Moved[target" + target + ",from=" + from + ",to=" + to + ",previous=" + previous + "]";
+ }
+ }
+
+ public final static class Renamed<N> extends NodeChange<N>
+ {
+
+ /** . */
+ final N parent;
+
+ /** . */
+ final String name;
+
+ Renamed(N parent, N node, String name)
+ {
+ super(node);
+
+ //
+ if (parent == null)
+ {
+ throw new NullPointerException("No null parent accepted");
+ }
+ if (name == null)
+ {
+ throw new NullPointerException("No null name accepted");
+ }
+
+ //
+ this.parent = parent;
+ this.name = name;
+ }
+
+ public N getParent()
+ {
+ return parent;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ protected void dispatch(NodeChangeListener<N> listener)
+ {
+ listener.onRename(target, parent, name);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeChange.Renamed[target" + target + ",name=" + name + "]";
+ }
+ }
+
+ public final static class Updated<N> extends NodeChange<N>
+ {
+
+ /** . */
+ final NodeState state;
+
+ public Updated(N node, NodeState state)
+ {
+ super(node);
+
+ //
+ this.state = state;
+ }
+
+ public NodeState getState()
+ {
+ return state;
+ }
+
+ @Override
+ protected void dispatch(NodeChangeListener<N> listener)
+ {
+ listener.onUpdate(target, state);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeChange.Updated[target" + target + ",state=" + state + "]";
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * A listener for node changes.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @param <N> the node generic type
- */
-public interface NodeChangeListener<N>
-{
-
- /**
- * A node was added.
- *
- * @param target the added node
- * @param parent the parent node
- * @param previous the optional previous node
- */
- void onAdd(N target, N parent, N previous);
-
- /**
- * A node was created.
- *
- * @param target the created node
- * @param parent the parent node
- * @param previous the optional previous node
- * @param name the name of the created node
- */
- void onCreate(N target, N parent, N previous, String name);
-
- /**
- * A node was removed.
- *
- * @param target the removed node
- * @param parent the parent node
- */
- void onRemove(N target, N parent);
-
- /**
- * A node was destroyed.
- *
- * @param target the destroyed node
- * @param parent the parent node
- */
- void onDestroy(N target, N parent);
-
- /**
- * A node was renamed.
- *
- * @param target the renamed node
- * @param parent the parent node
- * @param name the new node name
- */
- void onRename(N target, N parent, String name);
-
- /**
- * A node was updated.
- *
- * @param target the updated node
- * @param state the new state
- */
- void onUpdate(N target, NodeState state);
-
- /**
- * A node was moved.
- *
- * @param target the moved node.
- * @param from the previous parent
- * @param to the new parent
- * @param previous the optional previous node
- */
- void onMove(N target, N from, N to, N previous);
-
- /**
- * A base implementation that can be subclassed.
- *
- * @param <N> the node generic type
- */
- class Base<N> implements NodeChangeListener<N>
- {
-
- public void onAdd(N target, N parent, N previous)
- {
- }
-
- public void onCreate(N target, N parent, N previous, String name) throws NavigationServiceException
- {
- }
-
- public void onRemove(N target, N parent)
- {
- }
-
- public void onDestroy(N target, N parent)
- {
- }
-
- public void onRename(N target, N parent, String name) throws NavigationServiceException
- {
- }
-
- public void onUpdate(N target, NodeState state) throws NavigationServiceException
- {
- }
-
- public void onMove(N target, N from, N to, N previous) throws NavigationServiceException
- {
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeListener.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * A listener for node changes.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @param <N> the node generic type
+ */
+public interface NodeChangeListener<N>
+{
+
+ /**
+ * A node was added.
+ *
+ * @param target the added node
+ * @param parent the parent node
+ * @param previous the optional previous node
+ */
+ void onAdd(N target, N parent, N previous);
+
+ /**
+ * A node was created.
+ *
+ * @param target the created node
+ * @param parent the parent node
+ * @param previous the optional previous node
+ * @param name the name of the created node
+ */
+ void onCreate(N target, N parent, N previous, String name);
+
+ /**
+ * A node was removed.
+ *
+ * @param target the removed node
+ * @param parent the parent node
+ */
+ void onRemove(N target, N parent);
+
+ /**
+ * A node was destroyed.
+ *
+ * @param target the destroyed node
+ * @param parent the parent node
+ */
+ void onDestroy(N target, N parent);
+
+ /**
+ * A node was renamed.
+ *
+ * @param target the renamed node
+ * @param parent the parent node
+ * @param name the new node name
+ */
+ void onRename(N target, N parent, String name);
+
+ /**
+ * A node was updated.
+ *
+ * @param target the updated node
+ * @param state the new state
+ */
+ void onUpdate(N target, NodeState state);
+
+ /**
+ * A node was moved.
+ *
+ * @param target the moved node.
+ * @param from the previous parent
+ * @param to the new parent
+ * @param previous the optional previous node
+ */
+ void onMove(N target, N from, N to, N previous);
+
+ /**
+ * A base implementation that can be subclassed.
+ *
+ * @param <N> the node generic type
+ */
+ class Base<N> implements NodeChangeListener<N>
+ {
+
+ public void onAdd(N target, N parent, N previous)
+ {
+ }
+
+ public void onCreate(N target, N parent, N previous, String name) throws NavigationServiceException
+ {
+ }
+
+ public void onRemove(N target, N parent)
+ {
+ }
+
+ public void onDestroy(N target, N parent)
+ {
+ }
+
+ public void onRename(N target, N parent, String name) throws NavigationServiceException
+ {
+ }
+
+ public void onUpdate(N target, NodeState state) throws NavigationServiceException
+ {
+ }
+
+ public void onMove(N target, N from, N to, N previous) throws NavigationServiceException
+ {
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * A queuing implementation of the {@link NodeChangeListener} interface.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class NodeChangeQueue<N> extends LinkedList<NodeChange<N>> implements NodeChangeListener<N>
-{
-
- public NodeChangeQueue()
- {
- }
-
- public NodeChangeQueue(Collection<? extends NodeChange<N>> c)
- {
- super(c);
- }
-
- public void broadcast(NodeChangeListener<N> listener)
- {
- for (NodeChange<N> change : this)
- {
- change.dispatch(listener);
- }
- }
-
- public void onAdd(N target, N parent, N previous)
- {
- add(new NodeChange.Added<N>(parent, previous, target));
- }
-
- public void onCreate(N target, N parent, N previous, String name)
- {
- add(new NodeChange.Created<N>(parent, previous, target, name));
- }
-
- public void onRemove(N target, N parent)
- {
- add(new NodeChange.Removed<N>(parent, target));
- }
-
- public void onDestroy(N target, N parent)
- {
- add(new NodeChange.Destroyed<N>(parent, target));
- }
-
- public void onRename(N target, N parent, String name)
- {
- add(new NodeChange.Renamed<N>(parent, target, name));
- }
-
- public void onUpdate(N target, NodeState state)
- {
- add(new NodeChange.Updated<N>(target, state));
- }
-
- public void onMove(N target, N from, N to, N previous)
- {
- add(new NodeChange.Moved<N>(from, to, previous, target));
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeChangeQueue.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * A queuing implementation of the {@link NodeChangeListener} interface.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class NodeChangeQueue<N> extends LinkedList<NodeChange<N>> implements NodeChangeListener<N>
+{
+
+ public NodeChangeQueue()
+ {
+ }
+
+ public NodeChangeQueue(Collection<? extends NodeChange<N>> c)
+ {
+ super(c);
+ }
+
+ public void broadcast(NodeChangeListener<N> listener)
+ {
+ for (NodeChange<N> change : this)
+ {
+ change.dispatch(listener);
+ }
+ }
+
+ public void onAdd(N target, N parent, N previous)
+ {
+ add(new NodeChange.Added<N>(parent, previous, target));
+ }
+
+ public void onCreate(N target, N parent, N previous, String name)
+ {
+ add(new NodeChange.Created<N>(parent, previous, target, name));
+ }
+
+ public void onRemove(N target, N parent)
+ {
+ add(new NodeChange.Removed<N>(parent, target));
+ }
+
+ public void onDestroy(N target, N parent)
+ {
+ add(new NodeChange.Destroyed<N>(parent, target));
+ }
+
+ public void onRename(N target, N parent, String name)
+ {
+ add(new NodeChange.Renamed<N>(parent, target, name));
+ }
+
+ public void onUpdate(N target, NodeState state)
+ {
+ add(new NodeChange.Updated<N>(target, state));
+ }
+
+ public void onMove(N target, N from, N to, N previous)
+ {
+ add(new NodeChange.Moved<N>(from, to, previous, target));
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,817 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.tree.list.ListTree;
-
-import java.util.AbstractCollection;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * The context of a node.
- */
-public final class NodeContext<N> extends ListTree<NodeContext<N>>
-{
-
- /** The owner tree. */
- final TreeContext<N> tree;
-
- /** The related model node. */
- final N node;
-
- /** The handle: either the persistent id or a sequence id. */
- String handle;
-
- /** A data snapshot. */
- NodeData data;
-
- /** The new name if any. */
- String name;
-
- /** The new state if any. */
- NodeState state;
-
- /** Whether or not this node is hidden. */
- private boolean hidden;
-
- /** The number of hidden children. */
- private int hiddenCount;
-
- /** The expension value. */
- private boolean expanded;
-
- NodeContext(NodeModel<N> model, NodeData data)
- {
- if (data == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.handle = data.id;
- this.name = null;
- this.tree = new TreeContext<N>(model, this);
- this.node = tree.model.create(this);
- this.data = data;
- this.state = null;
- this.hidden = false;
- this.hiddenCount = 0;
- this.expanded = false;
- }
-
- private NodeContext(TreeContext<N> tree, NodeData data)
- {
- if (data == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.handle = data.id;
- this.name = null;
- this.tree = tree;
- this.node = tree.model.create(this);
- this.data = data;
- this.state = null;
- this.hidden = false;
- this.hiddenCount = 0;
- this.expanded = false;
- }
-
- NodeContext(TreeContext<N> tree, String handle, String name, NodeState state, boolean expanded)
- {
- if (handle == null)
- {
- throw new NullPointerException();
- }
- if (name == null)
- {
- throw new NullPointerException();
- }
- if (state == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.handle = handle;
- this.name = name;
- this.tree = tree;
- this.node = tree.model.create(this);
- this.data = null;
- this.state = state;
- this.hidden = false;
- this.hiddenCount = 0;
- this.expanded = expanded;
- }
-
- /**
- * Returns true if the tree containing this node has pending transient changes.
- *
- * @return true if there are uncommited changes
- */
- public boolean hasChanges()
- {
- return tree.hasChanges();
- }
-
- /**
- * Returns the relative depth of this node with respect to the ancestor argument.
- *
- * @param ancestor the ancestor
- * @return the depth
- * @throws IllegalArgumentException if the ancestor argument is not an ancestor
- * @throws NullPointerException if the ancestor argument is null
- */
- public int getDepth(NodeContext<N> ancestor) throws IllegalArgumentException, NullPointerException
- {
- if (ancestor == null)
- {
- throw new NullPointerException();
- }
- int depth = 0;
- for (NodeContext<N> current = this;current != null;current = current.getParent())
- {
- if (current == ancestor)
- {
- return depth;
- }
- else
- {
- depth++;
- }
- }
- throw new IllegalArgumentException("Context " + ancestor + " is not an ancestor of " + this);
- }
-
- public NodeContext<N> getDescendant(String handle) throws NullPointerException
- {
- if (handle == null)
- {
- throw new NullPointerException();
- }
-
- //
- NodeContext<N> found = null;
- if (this.handle.equals(handle))
- {
- found = this;
- }
- else
- {
- if (expanded)
- {
- for (NodeContext<N> current = getFirst();current != null;current = current.getNext())
- {
- found = current.getDescendant(handle);
- if (found != null)
- {
- break;
- }
- }
- }
- }
- return found;
- }
-
- /**
- * Returns true if the context is currently hidden.
- *
- * @return the hidden value
- */
- public boolean isHidden()
- {
- return hidden;
- }
-
- /**
- * Updates the hiddent value.
- *
- * @param hidden the hidden value
- */
- public void setHidden(boolean hidden)
- {
- if (this.hidden != hidden)
- {
- NodeContext<N> parent = getParent();
- if (parent != null)
- {
- if (hidden)
- {
- parent.hiddenCount++;
- }
- else
- {
- parent.hiddenCount--;
- }
- }
- this.hidden = hidden;
- }
- }
-
- /**
- * Applies a filter recursively, the filter will update the hiddent status of the
- * fragment.
- *
- * @param filter the filter to apply
- */
- public void filter(NodeFilter filter)
- {
- doFilter(0, filter);
- }
-
- private void doFilter(int depth, NodeFilter filter)
- {
- boolean accept = filter.accept(depth, getId(), name, getState());
- setHidden(!accept);
- if (expanded)
- {
- for (NodeContext<N> node = getFirst();node != null;node = node.getNext())
- {
- node.doFilter(depth + 1, filter);
- }
- }
- }
-
- /**
- * Returns the associated node with this context
- *
- * @return the node
- */
- public N getNode()
- {
- return node;
- }
-
- /**
- * Reutrns the context id or null if the context is not associated with a persistent navigation node.
- *
- * @return the id
- */
- public String getId()
- {
- return data != null ? data.getId() : null;
- }
-
- /**
- * Returns the context index among its parent.
- *
- * @return the index value
- */
- public int getIndex()
- {
- int count = 0;
- for (NodeContext<N> node = getPrevious();node != null;node = node.getPrevious())
- {
- count++;
- }
- return count;
- }
-
- public String getName()
- {
- return name != null ? name : data.name;
- }
-
- /**
- * Rename this context.
- *
- * @param name the new name
- * @throws NullPointerException if the name is null
- * @throws IllegalStateException if the parent is null
- * @throws IllegalArgumentException if the parent already have a child with the specified name
- */
- public void setName(String name) throws NullPointerException, IllegalStateException, IllegalArgumentException
- {
- NodeContext<N> parent = getParent();
- if (parent == null)
- {
- throw new IllegalStateException("Cannot rename a node when its parent is not visible");
- }
- else
- {
- NodeContext<N> blah = parent.get(name);
- if (blah != null)
- {
- if (blah == this)
- {
- // We do nothing
- }
- else
- {
- throw new IllegalArgumentException("the node " + name + " already exist");
- }
- }
- else
- {
- tree.addChange(new NodeChange.Renamed<NodeContext<N>>(getParent(), this, name));
- }
- }
- }
-
- public NodeContext<N> get(String name) throws NullPointerException, IllegalStateException
- {
- if (name == null)
- {
- throw new NullPointerException();
- }
- if (!expanded)
- {
- throw new IllegalStateException("No children relationship");
- }
-
- //
- for (NodeContext<N> node = getFirst();node != null;node = node.getNext())
- {
- if (node.getName().equals(name))
- {
- return node;
- }
- }
-
- //
- return null;
- }
-
- /**
- * Returns the total number of nodes.
- *
- * @return the total number of nodes
- */
- public int getNodeSize()
- {
- if (expanded)
- {
- return getSize();
- }
- else
- {
- return data.children.length;
- }
- }
-
- /**
- * Returns the node count defined by:
- * <ul>
- * <li>when the node has a children relationship, the number of non hidden nodes</li>
- * <li>when the node has not a children relationship, the total number of nodes</li>
- * </ul>
- *
- * @return the node count
- */
- public int getNodeCount()
- {
- if (expanded)
- {
- return getSize() - hiddenCount;
- }
- else
- {
- return data.children.length;
- }
- }
-
- public NodeState getState()
- {
- if (state != null)
- {
- return state;
- }
- else
- {
- return data.getState();
- }
- }
-
- /**
- * Update the context state
- *
- * @param state the new state
- * @throws NullPointerException if the state is null
- */
- public void setState(NodeState state) throws NullPointerException
- {
- if (state == null)
- {
- throw new NullPointerException("No null state accepted");
- }
-
- //
- tree.addChange(new NodeChange.Updated<NodeContext<N>>(this, state));
- }
-
- public N getParentNode()
- {
- NodeContext<N> parent = getParent();
- return parent != null ? parent.node : null;
- }
-
- public N getNode(String name) throws NullPointerException
- {
- NodeContext<N> child = get(name);
- return child != null && !child.hidden ? child.node: null;
- }
-
- public N getNode(int index)
- {
- if (index < 0)
- {
- throw new IndexOutOfBoundsException("Index " + index + " cannot be negative");
- }
- if (!expanded)
- {
- throw new IllegalStateException("No children relationship");
- }
- NodeContext<N> context = getFirst();
- while (context != null && (context.hidden || index-- > 0))
- {
- context = context.getNext();
- }
- if (context == null)
- {
- throw new IndexOutOfBoundsException("Index " + index + " is out of bounds");
- }
- else
- {
- return context.node;
- }
- }
-
- public final Iterator<N> iterator()
- {
- return new Iterator<N>()
- {
- NodeContext<N> next = getFirst();
- {
- while (next != null && next.isHidden())
- {
- next = next.getNext();
- }
- }
- public boolean hasNext()
- {
- return next != null;
- }
- public N next()
- {
- if (next != null)
- {
- NodeContext<N> tmp = next;
- do
- {
- next = next.getNext();
- }
- while (next != null && next.isHidden());
- return tmp.getNode();
- }
- else
- {
- throw new NoSuchElementException();
- }
- }
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- /** . */
- private Collection<N> nodes;
-
- public Collection<N> getNodes()
- {
- if (expanded)
- {
- if (nodes == null)
- {
- nodes = new AbstractCollection<N>()
- {
- public Iterator<N> iterator()
- {
- return NodeContext.this.iterator();
- }
- public int size()
- {
- return getNodeCount();
- }
- };
- }
- return nodes;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Add a child node at the specified index with the specified name. If the index argument
- * is null then the node is added at the last position among the children otherwise
- * the node is added at the specified index.
- *
- * @param index the index
- * @param name the node name
- * @return the created node
- * @throws NullPointerException if the model or the name is null
- * @throws IndexOutOfBoundsException if the index is negative or greater than the children size
- * @throws IllegalStateException if the children relationship does not exist
- */
- public NodeContext<N> add(Integer index, String name) throws NullPointerException, IndexOutOfBoundsException, IllegalStateException
- {
- if (name == null)
- {
- throw new NullPointerException("No null name accepted");
- }
-
- //
- NodeContext<N> nodeContext = new NodeContext<N>(tree, "" + tree.sequence++, name, NodeState.INITIAL, true);
- _add(index, nodeContext);
- return nodeContext;
- }
-
- /**
- * Move a context as a child context of this context at the specified index. If the index argument
- * is null then the context is added at the last position among the children otherwise
- * the context is added at the specified index.
- *
- * @param index the index
- * @param context the context to move
- * @throws NullPointerException if the model or the context is null
- * @throws IndexOutOfBoundsException if the index is negative or greater than the children size
- * @throws IllegalStateException if the children relationship does not exist
- */
- public void add(Integer index, NodeContext<N> context) throws NullPointerException, IndexOutOfBoundsException, IllegalStateException
- {
- if (context == null)
- {
- throw new NullPointerException("No null context argument accepted");
- }
-
- //
- _add(index, context);
- }
-
- public NodeContext<N> insertLast(NodeData data)
- {
- if (data == null)
- {
- throw new NullPointerException("No null data argument accepted");
- }
-
- //
- NodeContext<N> context = new NodeContext<N>(tree, data);
- insertLast(context);
- return context;
- }
-
- public NodeContext<N> insertAt(Integer index, NodeData data)
- {
- if (data == null)
- {
- throw new NullPointerException("No null data argument accepted");
- }
-
- //
- NodeContext<N> context = new NodeContext<N>(tree, data);
- insertAt(index, context);
- return context;
- }
-
- public NodeContext<N> insertAfter(NodeData data)
- {
- if (data == null)
- {
- throw new NullPointerException("No null data argument accepted");
- }
-
- //
- NodeContext<N> context = new NodeContext<N>(tree, data);
- insertAfter(context);
- return context;
- }
-
- private void _add(final Integer index, NodeContext<N> child)
- {
- NodeContext<N> previousParent = child.getParent();
-
- //
- NodeContext<N> previous;
- if (index == null)
- {
- NodeContext<N> before = getLast();
- while (before != null && before.isHidden())
- {
- before = before.getPrevious();
- }
- if (before == null)
- {
- previous = null;
- }
- else
- {
- previous = before;
- }
- }
- else if (index < 0)
- {
- throw new IndexOutOfBoundsException("No negative index accepted");
- }
- else if (index == 0)
- {
- previous = null;
- }
- else
- {
- NodeContext<N> before = getFirst();
- if (before == null)
- {
- throw new IndexOutOfBoundsException("Index " + index + " is greater than 0");
- }
- for (int count = index;count > 1;count -= before.isHidden() ? 0 : 1)
- {
- before = before.getNext();
- if (before == null)
- {
- throw new IndexOutOfBoundsException("Index " + index + " is greater than the number of children " + (index - count));
- }
- }
- previous = before;
- }
-
- //
- if (previousParent != null)
- {
- tree.addChange(new NodeChange.Moved<NodeContext<N>>(previousParent, this, previous, child));
- }
- else
- {
- // The name should never be null as it's a newly created node
- tree.addChange(new NodeChange.Created<NodeContext<N>>(this, previous, child, child.name));
- }
- }
-
- /**
- * Remove a specified context.
- *
- * @param name the name of the context to remove
- * @return true if the context was removed
- * @throws NullPointerException if the name argument is null
- * @throws IllegalArgumentException if the named context does not exist
- * @throws IllegalStateException if the children relationship does not exist
- */
- public boolean removeNode(String name) throws NullPointerException, IllegalArgumentException, IllegalStateException
- {
- NodeContext<N> node = get(name);
- if (node == null)
- {
- throw new IllegalArgumentException("Cannot remove non existent " + name + " child");
- }
-
- //
- if (node.hidden)
- {
- return false;
- }
- else
- {
- tree.addChange(new NodeChange.Destroyed<NodeContext<N>>(this, node));
-
- //
- return true;
- }
- }
-
- public boolean isExpanded()
- {
- return expanded;
- }
-
- void expand()
- {
- if (!expanded)
- {
- this.expanded = true;
- }
- else
- {
- throw new IllegalStateException("Context is already expanded");
- }
- }
-
- Iterable<NodeContext<N>> getContexts()
- {
- if (expanded)
- {
- return new Iterable<NodeContext<N>>()
- {
- public Iterator<NodeContext<N>> iterator()
- {
- return listIterator();
- }
- };
- }
- else
- {
- return null;
- }
- }
-
- protected void beforeRemove(NodeContext<N> context)
- {
- if (!expanded)
- {
- throw new IllegalStateException();
- }
- }
-
- protected void beforeInsert(NodeContext<N> context)
- {
- if (!expanded)
- {
- throw new IllegalStateException("No children relationship");
- }
-
- //
- if (!tree.editMode)
- {
- NodeContext<N> existing = get(context.getName());
- if (existing != null && existing != context)
- {
- throw new IllegalArgumentException("Tree " + context.getName() + " already in the map");
- }
- }
- }
-
- protected void afterInsert(NodeContext<N> context)
- {
- super.afterInsert(context);
-
- //
- if (context.hidden)
- {
- hiddenCount++;
- }
- }
-
- protected void afterRemove(NodeContext<N> context)
- {
- if (context.hidden)
- {
- hiddenCount--;
- }
-
- //
- super.afterRemove(context);
- }
-
- @Override
- public String toString()
- {
- return toString(1, new StringBuilder()).toString();
- }
-
- public StringBuilder toString(int depth, StringBuilder sb)
- {
- if (sb == null)
- {
- throw new NullPointerException();
- }
- if (depth < 0) {
- throw new IllegalArgumentException("Depth cannot be negative " + depth);
- }
- sb.append("NodeContext[id=").append(getId()).append(",name=").append(getName());
- if (expanded && depth > 0) {
- sb.append(",children={");
- for (NodeContext<N> current = getFirst();current != null;current = current.getNext()) {
- if (current.getPrevious() != null) {
- sb.append(',');
- }
- current.toString(depth - 1, sb);
- }
- sb.append("}");
- } else {
- sb.append("]");
- }
- return sb;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,817 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.tree.list.ListTree;
+
+import java.util.AbstractCollection;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * The context of a node.
+ */
+public final class NodeContext<N> extends ListTree<NodeContext<N>>
+{
+
+ /** The owner tree. */
+ final TreeContext<N> tree;
+
+ /** The related model node. */
+ final N node;
+
+ /** The handle: either the persistent id or a sequence id. */
+ String handle;
+
+ /** A data snapshot. */
+ NodeData data;
+
+ /** The new name if any. */
+ String name;
+
+ /** The new state if any. */
+ NodeState state;
+
+ /** Whether or not this node is hidden. */
+ private boolean hidden;
+
+ /** The number of hidden children. */
+ private int hiddenCount;
+
+ /** The expension value. */
+ private boolean expanded;
+
+ NodeContext(NodeModel<N> model, NodeData data)
+ {
+ if (data == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.handle = data.id;
+ this.name = null;
+ this.tree = new TreeContext<N>(model, this);
+ this.node = tree.model.create(this);
+ this.data = data;
+ this.state = null;
+ this.hidden = false;
+ this.hiddenCount = 0;
+ this.expanded = false;
+ }
+
+ private NodeContext(TreeContext<N> tree, NodeData data)
+ {
+ if (data == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.handle = data.id;
+ this.name = null;
+ this.tree = tree;
+ this.node = tree.model.create(this);
+ this.data = data;
+ this.state = null;
+ this.hidden = false;
+ this.hiddenCount = 0;
+ this.expanded = false;
+ }
+
+ NodeContext(TreeContext<N> tree, String handle, String name, NodeState state, boolean expanded)
+ {
+ if (handle == null)
+ {
+ throw new NullPointerException();
+ }
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+ if (state == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.handle = handle;
+ this.name = name;
+ this.tree = tree;
+ this.node = tree.model.create(this);
+ this.data = null;
+ this.state = state;
+ this.hidden = false;
+ this.hiddenCount = 0;
+ this.expanded = expanded;
+ }
+
+ /**
+ * Returns true if the tree containing this node has pending transient changes.
+ *
+ * @return true if there are uncommited changes
+ */
+ public boolean hasChanges()
+ {
+ return tree.hasChanges();
+ }
+
+ /**
+ * Returns the relative depth of this node with respect to the ancestor argument.
+ *
+ * @param ancestor the ancestor
+ * @return the depth
+ * @throws IllegalArgumentException if the ancestor argument is not an ancestor
+ * @throws NullPointerException if the ancestor argument is null
+ */
+ public int getDepth(NodeContext<N> ancestor) throws IllegalArgumentException, NullPointerException
+ {
+ if (ancestor == null)
+ {
+ throw new NullPointerException();
+ }
+ int depth = 0;
+ for (NodeContext<N> current = this;current != null;current = current.getParent())
+ {
+ if (current == ancestor)
+ {
+ return depth;
+ }
+ else
+ {
+ depth++;
+ }
+ }
+ throw new IllegalArgumentException("Context " + ancestor + " is not an ancestor of " + this);
+ }
+
+ public NodeContext<N> getDescendant(String handle) throws NullPointerException
+ {
+ if (handle == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ NodeContext<N> found = null;
+ if (this.handle.equals(handle))
+ {
+ found = this;
+ }
+ else
+ {
+ if (expanded)
+ {
+ for (NodeContext<N> current = getFirst();current != null;current = current.getNext())
+ {
+ found = current.getDescendant(handle);
+ if (found != null)
+ {
+ break;
+ }
+ }
+ }
+ }
+ return found;
+ }
+
+ /**
+ * Returns true if the context is currently hidden.
+ *
+ * @return the hidden value
+ */
+ public boolean isHidden()
+ {
+ return hidden;
+ }
+
+ /**
+ * Updates the hiddent value.
+ *
+ * @param hidden the hidden value
+ */
+ public void setHidden(boolean hidden)
+ {
+ if (this.hidden != hidden)
+ {
+ NodeContext<N> parent = getParent();
+ if (parent != null)
+ {
+ if (hidden)
+ {
+ parent.hiddenCount++;
+ }
+ else
+ {
+ parent.hiddenCount--;
+ }
+ }
+ this.hidden = hidden;
+ }
+ }
+
+ /**
+ * Applies a filter recursively, the filter will update the hiddent status of the
+ * fragment.
+ *
+ * @param filter the filter to apply
+ */
+ public void filter(NodeFilter filter)
+ {
+ doFilter(0, filter);
+ }
+
+ private void doFilter(int depth, NodeFilter filter)
+ {
+ boolean accept = filter.accept(depth, getId(), name, getState());
+ setHidden(!accept);
+ if (expanded)
+ {
+ for (NodeContext<N> node = getFirst();node != null;node = node.getNext())
+ {
+ node.doFilter(depth + 1, filter);
+ }
+ }
+ }
+
+ /**
+ * Returns the associated node with this context
+ *
+ * @return the node
+ */
+ public N getNode()
+ {
+ return node;
+ }
+
+ /**
+ * Reutrns the context id or null if the context is not associated with a persistent navigation node.
+ *
+ * @return the id
+ */
+ public String getId()
+ {
+ return data != null ? data.getId() : null;
+ }
+
+ /**
+ * Returns the context index among its parent.
+ *
+ * @return the index value
+ */
+ public int getIndex()
+ {
+ int count = 0;
+ for (NodeContext<N> node = getPrevious();node != null;node = node.getPrevious())
+ {
+ count++;
+ }
+ return count;
+ }
+
+ public String getName()
+ {
+ return name != null ? name : data.name;
+ }
+
+ /**
+ * Rename this context.
+ *
+ * @param name the new name
+ * @throws NullPointerException if the name is null
+ * @throws IllegalStateException if the parent is null
+ * @throws IllegalArgumentException if the parent already have a child with the specified name
+ */
+ public void setName(String name) throws NullPointerException, IllegalStateException, IllegalArgumentException
+ {
+ NodeContext<N> parent = getParent();
+ if (parent == null)
+ {
+ throw new IllegalStateException("Cannot rename a node when its parent is not visible");
+ }
+ else
+ {
+ NodeContext<N> blah = parent.get(name);
+ if (blah != null)
+ {
+ if (blah == this)
+ {
+ // We do nothing
+ }
+ else
+ {
+ throw new IllegalArgumentException("the node " + name + " already exist");
+ }
+ }
+ else
+ {
+ tree.addChange(new NodeChange.Renamed<NodeContext<N>>(getParent(), this, name));
+ }
+ }
+ }
+
+ public NodeContext<N> get(String name) throws NullPointerException, IllegalStateException
+ {
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+ if (!expanded)
+ {
+ throw new IllegalStateException("No children relationship");
+ }
+
+ //
+ for (NodeContext<N> node = getFirst();node != null;node = node.getNext())
+ {
+ if (node.getName().equals(name))
+ {
+ return node;
+ }
+ }
+
+ //
+ return null;
+ }
+
+ /**
+ * Returns the total number of nodes.
+ *
+ * @return the total number of nodes
+ */
+ public int getNodeSize()
+ {
+ if (expanded)
+ {
+ return getSize();
+ }
+ else
+ {
+ return data.children.length;
+ }
+ }
+
+ /**
+ * Returns the node count defined by:
+ * <ul>
+ * <li>when the node has a children relationship, the number of non hidden nodes</li>
+ * <li>when the node has not a children relationship, the total number of nodes</li>
+ * </ul>
+ *
+ * @return the node count
+ */
+ public int getNodeCount()
+ {
+ if (expanded)
+ {
+ return getSize() - hiddenCount;
+ }
+ else
+ {
+ return data.children.length;
+ }
+ }
+
+ public NodeState getState()
+ {
+ if (state != null)
+ {
+ return state;
+ }
+ else
+ {
+ return data.getState();
+ }
+ }
+
+ /**
+ * Update the context state
+ *
+ * @param state the new state
+ * @throws NullPointerException if the state is null
+ */
+ public void setState(NodeState state) throws NullPointerException
+ {
+ if (state == null)
+ {
+ throw new NullPointerException("No null state accepted");
+ }
+
+ //
+ tree.addChange(new NodeChange.Updated<NodeContext<N>>(this, state));
+ }
+
+ public N getParentNode()
+ {
+ NodeContext<N> parent = getParent();
+ return parent != null ? parent.node : null;
+ }
+
+ public N getNode(String name) throws NullPointerException
+ {
+ NodeContext<N> child = get(name);
+ return child != null && !child.hidden ? child.node: null;
+ }
+
+ public N getNode(int index)
+ {
+ if (index < 0)
+ {
+ throw new IndexOutOfBoundsException("Index " + index + " cannot be negative");
+ }
+ if (!expanded)
+ {
+ throw new IllegalStateException("No children relationship");
+ }
+ NodeContext<N> context = getFirst();
+ while (context != null && (context.hidden || index-- > 0))
+ {
+ context = context.getNext();
+ }
+ if (context == null)
+ {
+ throw new IndexOutOfBoundsException("Index " + index + " is out of bounds");
+ }
+ else
+ {
+ return context.node;
+ }
+ }
+
+ public final Iterator<N> iterator()
+ {
+ return new Iterator<N>()
+ {
+ NodeContext<N> next = getFirst();
+ {
+ while (next != null && next.isHidden())
+ {
+ next = next.getNext();
+ }
+ }
+ public boolean hasNext()
+ {
+ return next != null;
+ }
+ public N next()
+ {
+ if (next != null)
+ {
+ NodeContext<N> tmp = next;
+ do
+ {
+ next = next.getNext();
+ }
+ while (next != null && next.isHidden());
+ return tmp.getNode();
+ }
+ else
+ {
+ throw new NoSuchElementException();
+ }
+ }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ /** . */
+ private Collection<N> nodes;
+
+ public Collection<N> getNodes()
+ {
+ if (expanded)
+ {
+ if (nodes == null)
+ {
+ nodes = new AbstractCollection<N>()
+ {
+ public Iterator<N> iterator()
+ {
+ return NodeContext.this.iterator();
+ }
+ public int size()
+ {
+ return getNodeCount();
+ }
+ };
+ }
+ return nodes;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Add a child node at the specified index with the specified name. If the index argument
+ * is null then the node is added at the last position among the children otherwise
+ * the node is added at the specified index.
+ *
+ * @param index the index
+ * @param name the node name
+ * @return the created node
+ * @throws NullPointerException if the model or the name is null
+ * @throws IndexOutOfBoundsException if the index is negative or greater than the children size
+ * @throws IllegalStateException if the children relationship does not exist
+ */
+ public NodeContext<N> add(Integer index, String name) throws NullPointerException, IndexOutOfBoundsException, IllegalStateException
+ {
+ if (name == null)
+ {
+ throw new NullPointerException("No null name accepted");
+ }
+
+ //
+ NodeContext<N> nodeContext = new NodeContext<N>(tree, "" + tree.sequence++, name, NodeState.INITIAL, true);
+ _add(index, nodeContext);
+ return nodeContext;
+ }
+
+ /**
+ * Move a context as a child context of this context at the specified index. If the index argument
+ * is null then the context is added at the last position among the children otherwise
+ * the context is added at the specified index.
+ *
+ * @param index the index
+ * @param context the context to move
+ * @throws NullPointerException if the model or the context is null
+ * @throws IndexOutOfBoundsException if the index is negative or greater than the children size
+ * @throws IllegalStateException if the children relationship does not exist
+ */
+ public void add(Integer index, NodeContext<N> context) throws NullPointerException, IndexOutOfBoundsException, IllegalStateException
+ {
+ if (context == null)
+ {
+ throw new NullPointerException("No null context argument accepted");
+ }
+
+ //
+ _add(index, context);
+ }
+
+ public NodeContext<N> insertLast(NodeData data)
+ {
+ if (data == null)
+ {
+ throw new NullPointerException("No null data argument accepted");
+ }
+
+ //
+ NodeContext<N> context = new NodeContext<N>(tree, data);
+ insertLast(context);
+ return context;
+ }
+
+ public NodeContext<N> insertAt(Integer index, NodeData data)
+ {
+ if (data == null)
+ {
+ throw new NullPointerException("No null data argument accepted");
+ }
+
+ //
+ NodeContext<N> context = new NodeContext<N>(tree, data);
+ insertAt(index, context);
+ return context;
+ }
+
+ public NodeContext<N> insertAfter(NodeData data)
+ {
+ if (data == null)
+ {
+ throw new NullPointerException("No null data argument accepted");
+ }
+
+ //
+ NodeContext<N> context = new NodeContext<N>(tree, data);
+ insertAfter(context);
+ return context;
+ }
+
+ private void _add(final Integer index, NodeContext<N> child)
+ {
+ NodeContext<N> previousParent = child.getParent();
+
+ //
+ NodeContext<N> previous;
+ if (index == null)
+ {
+ NodeContext<N> before = getLast();
+ while (before != null && before.isHidden())
+ {
+ before = before.getPrevious();
+ }
+ if (before == null)
+ {
+ previous = null;
+ }
+ else
+ {
+ previous = before;
+ }
+ }
+ else if (index < 0)
+ {
+ throw new IndexOutOfBoundsException("No negative index accepted");
+ }
+ else if (index == 0)
+ {
+ previous = null;
+ }
+ else
+ {
+ NodeContext<N> before = getFirst();
+ if (before == null)
+ {
+ throw new IndexOutOfBoundsException("Index " + index + " is greater than 0");
+ }
+ for (int count = index;count > 1;count -= before.isHidden() ? 0 : 1)
+ {
+ before = before.getNext();
+ if (before == null)
+ {
+ throw new IndexOutOfBoundsException("Index " + index + " is greater than the number of children " + (index - count));
+ }
+ }
+ previous = before;
+ }
+
+ //
+ if (previousParent != null)
+ {
+ tree.addChange(new NodeChange.Moved<NodeContext<N>>(previousParent, this, previous, child));
+ }
+ else
+ {
+ // The name should never be null as it's a newly created node
+ tree.addChange(new NodeChange.Created<NodeContext<N>>(this, previous, child, child.name));
+ }
+ }
+
+ /**
+ * Remove a specified context.
+ *
+ * @param name the name of the context to remove
+ * @return true if the context was removed
+ * @throws NullPointerException if the name argument is null
+ * @throws IllegalArgumentException if the named context does not exist
+ * @throws IllegalStateException if the children relationship does not exist
+ */
+ public boolean removeNode(String name) throws NullPointerException, IllegalArgumentException, IllegalStateException
+ {
+ NodeContext<N> node = get(name);
+ if (node == null)
+ {
+ throw new IllegalArgumentException("Cannot remove non existent " + name + " child");
+ }
+
+ //
+ if (node.hidden)
+ {
+ return false;
+ }
+ else
+ {
+ tree.addChange(new NodeChange.Destroyed<NodeContext<N>>(this, node));
+
+ //
+ return true;
+ }
+ }
+
+ public boolean isExpanded()
+ {
+ return expanded;
+ }
+
+ void expand()
+ {
+ if (!expanded)
+ {
+ this.expanded = true;
+ }
+ else
+ {
+ throw new IllegalStateException("Context is already expanded");
+ }
+ }
+
+ Iterable<NodeContext<N>> getContexts()
+ {
+ if (expanded)
+ {
+ return new Iterable<NodeContext<N>>()
+ {
+ public Iterator<NodeContext<N>> iterator()
+ {
+ return listIterator();
+ }
+ };
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected void beforeRemove(NodeContext<N> context)
+ {
+ if (!expanded)
+ {
+ throw new IllegalStateException();
+ }
+ }
+
+ protected void beforeInsert(NodeContext<N> context)
+ {
+ if (!expanded)
+ {
+ throw new IllegalStateException("No children relationship");
+ }
+
+ //
+ if (!tree.editMode)
+ {
+ NodeContext<N> existing = get(context.getName());
+ if (existing != null && existing != context)
+ {
+ throw new IllegalArgumentException("Tree " + context.getName() + " already in the map");
+ }
+ }
+ }
+
+ protected void afterInsert(NodeContext<N> context)
+ {
+ super.afterInsert(context);
+
+ //
+ if (context.hidden)
+ {
+ hiddenCount++;
+ }
+ }
+
+ protected void afterRemove(NodeContext<N> context)
+ {
+ if (context.hidden)
+ {
+ hiddenCount--;
+ }
+
+ //
+ super.afterRemove(context);
+ }
+
+ @Override
+ public String toString()
+ {
+ return toString(1, new StringBuilder()).toString();
+ }
+
+ public StringBuilder toString(int depth, StringBuilder sb)
+ {
+ if (sb == null)
+ {
+ throw new NullPointerException();
+ }
+ if (depth < 0) {
+ throw new IllegalArgumentException("Depth cannot be negative " + depth);
+ }
+ sb.append("NodeContext[id=").append(getId()).append(",name=").append(getName());
+ if (expanded && depth > 0) {
+ sb.append(",children={");
+ for (NodeContext<N> current = getFirst();current != null;current = current.getNext()) {
+ if (current.getPrevious() != null) {
+ sb.append(',');
+ }
+ current.toString(depth - 1, sb);
+ }
+ sb.append("}");
+ } else {
+ sb.append("]");
+ }
+ return sb;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
-* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
-*/
-public class NodeContextChangeAdapter<N> implements NodeChangeListener<NodeContext<N>>
-{
-
- public static <N> NodeChangeListener<NodeContext<N>> safeWrap(NodeChangeListener<N> wrapped)
- {
- if (wrapped == null)
- {
- return null;
- }
- else
- {
- return new NodeContextChangeAdapter<N>(wrapped);
- }
- }
-
- /** . */
- private final NodeChangeListener<N> wrapped;
-
- public NodeContextChangeAdapter(NodeChangeListener<N> wrapped)
- {
- if (wrapped == null)
- {
- throw new NullPointerException();
- }
- this.wrapped = wrapped;
- }
-
- public void onAdd(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous)
- {
- wrapped.onAdd(unwrap(target), unwrap(parent), unwrap(previous));
- }
-
- public void onCreate(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous, String name)
- {
- wrapped.onCreate(unwrap(target), unwrap(parent), unwrap(previous), name);
- }
-
- public void onRemove(NodeContext<N> target, NodeContext<N> parent)
- {
- wrapped.onRemove(unwrap(target), unwrap(parent));
- }
-
- public void onDestroy(NodeContext<N> target, NodeContext<N> parent)
- {
- wrapped.onDestroy(unwrap(target), unwrap(parent));
- }
-
- public void onRename(NodeContext<N> target, NodeContext<N> parent, String name)
- {
- wrapped.onRename(unwrap(target), unwrap(parent), name);
- }
-
- public void onUpdate(NodeContext<N> target, NodeState state)
- {
- wrapped.onUpdate(unwrap(target), state);
- }
-
- public void onMove(NodeContext<N> target, NodeContext<N> from, NodeContext<N> to, NodeContext<N> previous)
- {
- wrapped.onMove(unwrap(target), unwrap(from), unwrap(to), unwrap(previous));
- }
-
- private N unwrap(NodeContext<N> context)
- {
- return context != null ? context.getNode() : null;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeContextChangeAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+*/
+public class NodeContextChangeAdapter<N> implements NodeChangeListener<NodeContext<N>>
+{
+
+ public static <N> NodeChangeListener<NodeContext<N>> safeWrap(NodeChangeListener<N> wrapped)
+ {
+ if (wrapped == null)
+ {
+ return null;
+ }
+ else
+ {
+ return new NodeContextChangeAdapter<N>(wrapped);
+ }
+ }
+
+ /** . */
+ private final NodeChangeListener<N> wrapped;
+
+ public NodeContextChangeAdapter(NodeChangeListener<N> wrapped)
+ {
+ if (wrapped == null)
+ {
+ throw new NullPointerException();
+ }
+ this.wrapped = wrapped;
+ }
+
+ public void onAdd(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous)
+ {
+ wrapped.onAdd(unwrap(target), unwrap(parent), unwrap(previous));
+ }
+
+ public void onCreate(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous, String name)
+ {
+ wrapped.onCreate(unwrap(target), unwrap(parent), unwrap(previous), name);
+ }
+
+ public void onRemove(NodeContext<N> target, NodeContext<N> parent)
+ {
+ wrapped.onRemove(unwrap(target), unwrap(parent));
+ }
+
+ public void onDestroy(NodeContext<N> target, NodeContext<N> parent)
+ {
+ wrapped.onDestroy(unwrap(target), unwrap(parent));
+ }
+
+ public void onRename(NodeContext<N> target, NodeContext<N> parent, String name)
+ {
+ wrapped.onRename(unwrap(target), unwrap(parent), name);
+ }
+
+ public void onUpdate(NodeContext<N> target, NodeState state)
+ {
+ wrapped.onUpdate(unwrap(target), state);
+ }
+
+ public void onMove(NodeContext<N> target, NodeContext<N> from, NodeContext<N> to, NodeContext<N> previous)
+ {
+ wrapped.onMove(unwrap(target), unwrap(from), unwrap(to), unwrap(previous));
+ }
+
+ private N unwrap(NodeContext<N> context)
+ {
+ return context != null ? context.getNode() : null;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.mop.Visible;
-import org.exoplatform.portal.pom.data.MappedAttributes;
-import org.exoplatform.portal.pom.data.Mapper;
-import org.gatein.mop.api.Attributes;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.link.Link;
-import org.gatein.mop.api.workspace.link.PageLink;
-
-import java.io.Serializable;
-import java.util.*;
-
-/**
- * An immutable node data class.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-class NodeData implements Serializable
-{
-
- /** . */
- final String parentId;
-
- /** . */
- final String id;
-
- /** . */
- final String name;
-
- /** . */
- final NodeState state;
-
- /** . */
- final String[] children;
-
- NodeData(Navigation navigation)
- {
- String[] children;
- List<Navigation> _children = navigation.getChildren();
- if (_children == null)
- {
- children = Utils.EMPTY_STRING_ARRAY;
- }
- else
- {
- children = new String[_children.size()];
- int index = 0;
- for (Navigation child : _children)
- {
- children[index++] = child.getObjectId();
- }
- }
-
- //
- String label = null;
- if (navigation.isAdapted(Described.class))
- {
- Described described = navigation.adapt(Described.class);
- label = described.getName();
- }
-
- //
- Visibility visibility = Visibility.DISPLAYED;
- Date startPublicationDate = null;
- Date endPublicationDate = null;
- if (navigation.isAdapted(Visible.class))
- {
- Visible visible = navigation.adapt(Visible.class);
- visibility = visible.getVisibility();
- startPublicationDate = visible.getStartPublicationDate();
- endPublicationDate = visible.getEndPublicationDate();
- }
-
- //
- String pageRef = null;
- Link link = navigation.getLink();
- if (link instanceof PageLink)
- {
- PageLink pageLink = (PageLink)link;
- org.gatein.mop.api.workspace.Page target = pageLink.getPage();
- if (target != null)
- {
- Site site = target.getSite();
- ObjectType<? extends Site> siteType = site.getObjectType();
- pageRef = Mapper.getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
- }
- }
-
- //
- Attributes attrs = navigation.getAttributes();
-
- //
- NodeState state = new NodeState(
- label,
- attrs.getValue(MappedAttributes.ICON),
- startPublicationDate != null ? startPublicationDate.getTime() : -1,
- endPublicationDate != null ? endPublicationDate.getTime() : -1,
- visibility,
- pageRef
- );
-
- //
- String parentId;
- Navigation parent = navigation.getParent();
- if (parent != null)
- {
- parentId = parent.getObjectId();
- }
- else
- {
- parentId = null;
- }
-
- //
- this.parentId = parentId;
- this.id = navigation.getObjectId();
- this.name = navigation.getName();
- this.state = state;
- this.children = children;
- }
-
- NodeData(NodeContext<?> context)
- {
- int size = 0;
- for (NodeContext<?> current = context.getFirst();current != null;current = current.getNext())
- {
- size++;
- }
- String[] children = new String[size];
- for (NodeContext<?> current = context.getFirst();current != null;current = current.getNext())
- {
- children[children.length - size--] = current.handle;
- }
- String parentId = context.getParent() != null ? context.getParent().handle : null;
- String id = context.handle;
- String name = context.getName();
- NodeState state = context.getState();
-
- //
- this.parentId = parentId;
- this.id = id;
- this.name = name;
- this.state = state;
- this.children = children;
- }
-
- NodeData(String parentId, String id, String name, NodeState state, String[] children)
- {
- this.parentId = parentId;
- this.id = id;
- this.name = name;
- this.state = state;
- this.children = children;
- }
-
- public Iterator<String> iterator(boolean reverse)
- {
- if (reverse)
- {
- return new Iterator<String>()
- {
- int index = children.length;
- public boolean hasNext()
- {
- return index > 0;
- }
- public String next()
- {
- if (index > 0)
- {
- return children[--index];
- }
- else
- {
- throw new NoSuchElementException();
- }
- }
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- };
- }
- else
- {
- return new Iterator<String>()
- {
- int index = 0;
- public boolean hasNext()
- {
- return index < children.length;
- }
- public String next()
- {
- if (index < children.length)
- {
- return children[index++];
- }
- else
- {
- throw new NoSuchElementException();
- }
- }
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- };
- }
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public NodeState getState()
- {
- return state;
- }
-
- @Override
- public String toString()
- {
- return "NodeData[id=" + id + ",name=" + name + ",state=" + state + ",children=" + Arrays.asList(children) + "]";
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.Visible;
+import org.exoplatform.portal.pom.data.MappedAttributes;
+import org.exoplatform.portal.pom.data.Mapper;
+import org.gatein.mop.api.Attributes;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.link.Link;
+import org.gatein.mop.api.workspace.link.PageLink;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * An immutable node data class.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class NodeData implements Serializable
+{
+
+ /** . */
+ final String parentId;
+
+ /** . */
+ final String id;
+
+ /** . */
+ final String name;
+
+ /** . */
+ final NodeState state;
+
+ /** . */
+ final String[] children;
+
+ NodeData(Navigation navigation)
+ {
+ String[] children;
+ List<Navigation> _children = navigation.getChildren();
+ if (_children == null)
+ {
+ children = Utils.EMPTY_STRING_ARRAY;
+ }
+ else
+ {
+ children = new String[_children.size()];
+ int index = 0;
+ for (Navigation child : _children)
+ {
+ children[index++] = child.getObjectId();
+ }
+ }
+
+ //
+ String label = null;
+ if (navigation.isAdapted(Described.class))
+ {
+ Described described = navigation.adapt(Described.class);
+ label = described.getName();
+ }
+
+ //
+ Visibility visibility = Visibility.DISPLAYED;
+ Date startPublicationDate = null;
+ Date endPublicationDate = null;
+ if (navigation.isAdapted(Visible.class))
+ {
+ Visible visible = navigation.adapt(Visible.class);
+ visibility = visible.getVisibility();
+ startPublicationDate = visible.getStartPublicationDate();
+ endPublicationDate = visible.getEndPublicationDate();
+ }
+
+ //
+ String pageRef = null;
+ Link link = navigation.getLink();
+ if (link instanceof PageLink)
+ {
+ PageLink pageLink = (PageLink)link;
+ org.gatein.mop.api.workspace.Page target = pageLink.getPage();
+ if (target != null)
+ {
+ Site site = target.getSite();
+ ObjectType<? extends Site> siteType = site.getObjectType();
+ pageRef = Mapper.getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
+ }
+ }
+
+ //
+ Attributes attrs = navigation.getAttributes();
+
+ //
+ NodeState state = new NodeState(
+ label,
+ attrs.getValue(MappedAttributes.ICON),
+ startPublicationDate != null ? startPublicationDate.getTime() : -1,
+ endPublicationDate != null ? endPublicationDate.getTime() : -1,
+ visibility,
+ pageRef
+ );
+
+ //
+ String parentId;
+ Navigation parent = navigation.getParent();
+ if (parent != null)
+ {
+ parentId = parent.getObjectId();
+ }
+ else
+ {
+ parentId = null;
+ }
+
+ //
+ this.parentId = parentId;
+ this.id = navigation.getObjectId();
+ this.name = navigation.getName();
+ this.state = state;
+ this.children = children;
+ }
+
+ NodeData(NodeContext<?> context)
+ {
+ int size = 0;
+ for (NodeContext<?> current = context.getFirst();current != null;current = current.getNext())
+ {
+ size++;
+ }
+ String[] children = new String[size];
+ for (NodeContext<?> current = context.getFirst();current != null;current = current.getNext())
+ {
+ children[children.length - size--] = current.handle;
+ }
+ String parentId = context.getParent() != null ? context.getParent().handle : null;
+ String id = context.handle;
+ String name = context.getName();
+ NodeState state = context.getState();
+
+ //
+ this.parentId = parentId;
+ this.id = id;
+ this.name = name;
+ this.state = state;
+ this.children = children;
+ }
+
+ NodeData(String parentId, String id, String name, NodeState state, String[] children)
+ {
+ this.parentId = parentId;
+ this.id = id;
+ this.name = name;
+ this.state = state;
+ this.children = children;
+ }
+
+ public Iterator<String> iterator(boolean reverse)
+ {
+ if (reverse)
+ {
+ return new Iterator<String>()
+ {
+ int index = children.length;
+ public boolean hasNext()
+ {
+ return index > 0;
+ }
+ public String next()
+ {
+ if (index > 0)
+ {
+ return children[--index];
+ }
+ else
+ {
+ throw new NoSuchElementException();
+ }
+ }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ else
+ {
+ return new Iterator<String>()
+ {
+ int index = 0;
+ public boolean hasNext()
+ {
+ return index < children.length;
+ }
+ public String next()
+ {
+ if (index < children.length)
+ {
+ return children[index++];
+ }
+ else
+ {
+ throw new NoSuchElementException();
+ }
+ }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public NodeState getState()
+ {
+ return state;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeData[id=" + id + ",name=" + name + ",state=" + state + ",children=" + Arrays.asList(children) + "]";
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * A filter for nodes, filtering occurs after node retrieval and is applied once nodes
- * are loaded.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface NodeFilter
-{
-
- /**
- * Returns a value indicating whether or not the node should be visible or not in the user interface.
- *
- * @param depth the node depth
- * @param id the node id
- * @param name the node name
- * @param state the node state
- * @return the accept value
- */
- boolean accept(int depth, String id, String name, NodeState state);
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeFilter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * A filter for nodes, filtering occurs after node retrieval and is applied once nodes
+ * are loaded.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface NodeFilter
+{
+
+ /**
+ * Returns a value indicating whether or not the node should be visible or not in the user interface.
+ *
+ * @param depth the node depth
+ * @param id the node id
+ * @param name the node name
+ * @param state the node state
+ * @return the accept value
+ */
+ boolean accept(int depth, String id, String name, NodeState state);
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface NodeModel<N>
-{
-
- /**
- * A model based on itself.
- */
- NodeModel<NodeContext<?>> SELF_MODEL = new NodeModel<NodeContext<?>>()
- {
- public NodeContext<NodeContext<?>> getContext(NodeContext<?> node)
- {
- throw new UnsupportedOperationException();
- }
- public NodeContext<?> create(NodeContext<NodeContext<?>> context)
- {
- return context;
- }
- };
-
- /**
- * Returns the context of a node.
- *
- * @param node the node
- * @return the node context
- */
- NodeContext<N> getContext(N node);
-
- /**
- * Create a node wrapping a context.
- *
- * @param context the node context
- * @return the node instance
- */
- N create(NodeContext<N> context);
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeModel.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface NodeModel<N>
+{
+
+ /**
+ * A model based on itself.
+ */
+ NodeModel<NodeContext<?>> SELF_MODEL = new NodeModel<NodeContext<?>>()
+ {
+ public NodeContext<NodeContext<?>> getContext(NodeContext<?> node)
+ {
+ throw new UnsupportedOperationException();
+ }
+ public NodeContext<?> create(NodeContext<NodeContext<?>> context)
+ {
+ return context;
+ }
+ };
+
+ /**
+ * Returns the context of a node.
+ *
+ * @param node the node
+ * @return the node context
+ */
+ NodeContext<N> getContext(N node);
+
+ /**
+ * Create a node wrapping a context.
+ *
+ * @param context the node context
+ * @return the node instance
+ */
+ N create(NodeContext<N> context);
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,248 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.commons.utils.Safe;
-import org.exoplatform.portal.mop.Visibility;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * An immutable node state class.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public final class NodeState implements Serializable
-{
-
- /** . */
- public static final NodeState INITIAL = new NodeState.Builder().build();
-
- /**
- * Builder class.
- */
- public static class Builder
- {
-
- /** . */
- private String label;
-
- /** . */
- private String icon;
-
- /** . */
- private long startPublicationTime;
-
- /** . */
- private long endPublicationTime;
-
- /** . */
- private Visibility visibility;
-
- /** . */
- private String pageRef;
-
- public Builder()
- {
- this.icon = null;
- this.label = null;
- this.startPublicationTime = -1;
- this.endPublicationTime = -1;
- this.visibility = Visibility.DISPLAYED;
- this.pageRef = null;
- }
-
- /**
- * Creates a builder from a specified state.
- *
- * @param state the state to copy
- * @throws NullPointerException if the stateis null
- */
- public Builder(NodeState state) throws NullPointerException
- {
- if (state == null)
- {
- throw new NullPointerException();
- }
- this.label = state.label;
- this.icon = state.icon;
- this.startPublicationTime = state.startPublicationTime;
- this.endPublicationTime = state.endPublicationTime;
- this.visibility = state.visibility;
- this.pageRef = state.pageRef;
- }
-
- public Builder label(String label)
- {
- this.label = label;
- return this;
- }
-
- public Builder icon(String icon)
- {
- this.icon = icon;
- return this;
- }
-
- public Builder startPublicationTime(long startPublicationTime)
- {
- this.startPublicationTime = startPublicationTime;
- return this;
- }
-
- public Builder endPublicationTime(long endPublicationTime)
- {
- this.endPublicationTime = endPublicationTime;
- return this;
- }
-
- public Builder visibility(Visibility visibility)
- {
- this.visibility = visibility;
- return this;
- }
-
- public Builder pageRef(String pageRef)
- {
- this.pageRef = pageRef;
- return this;
- }
-
- public NodeState build()
- {
- return new NodeState(
- label,
- icon,
- startPublicationTime,
- endPublicationTime,
- visibility,
- pageRef
- );
- }
- }
-
- /** . */
- private final String label;
-
- /** . */
- private final String icon;
-
- /** . */
- private final long startPublicationTime;
-
- /** . */
- private final long endPublicationTime;
-
- /** . */
- private final Visibility visibility;
-
- /** . */
- private final String pageRef;
-
- public NodeState(
- String label,
- String icon,
- long startPublicationTime,
- long endPublicationTime,
- Visibility visibility,
- String pageRef)
- {
- this.label = label;
- this.icon = icon;
- this.startPublicationTime = startPublicationTime;
- this.endPublicationTime = endPublicationTime;
- this.visibility = visibility;
- this.pageRef = pageRef;
- }
-
- public String getLabel()
- {
- return label;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public long getStartPublicationTime()
- {
- return startPublicationTime;
- }
-
- Date getStartPublicationDate()
- {
- return startPublicationTime != -1 ? new Date(startPublicationTime) : null;
- }
-
- public long getEndPublicationTime()
- {
- return endPublicationTime;
- }
-
- Date getEndPublicationDate()
- {
- return endPublicationTime != -1 ? new Date(endPublicationTime) : null;
- }
-
- public Visibility getVisibility()
- {
- return visibility;
- }
-
- public String getPageRef()
- {
- return pageRef;
- }
-
- @Override
- public boolean equals(Object o)
- {
- if (o == this)
- {
- return true;
- }
- if (o instanceof NodeState)
- {
- NodeState that = (NodeState)o;
- return Safe.equals(label, that.label)
- && Safe.equals(icon, that.icon)
- && Safe.equals(startPublicationTime, that.startPublicationTime)
- && Safe.equals(endPublicationTime, that.endPublicationTime)
- && Safe.equals(visibility, that.visibility)
- && Safe.equals(pageRef, that.pageRef);
- }
- return false;
- }
-
- @Override
- public String toString()
- {
- return "NodeState[label=" + label + ",icon=" + icon + ",startPublicationTime=" + startPublicationTime +
- ",endPublicationTime=" + endPublicationTime + ",visibility=" + visibility + ",pageRef=" + pageRef + "]";
- }
-
- public Builder builder()
- {
- return new Builder(this);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NodeState.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.portal.mop.Visibility;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * An immutable node state class.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public final class NodeState implements Serializable
+{
+
+ /** . */
+ public static final NodeState INITIAL = new NodeState.Builder().build();
+
+ /**
+ * Builder class.
+ */
+ public static class Builder
+ {
+
+ /** . */
+ private String label;
+
+ /** . */
+ private String icon;
+
+ /** . */
+ private long startPublicationTime;
+
+ /** . */
+ private long endPublicationTime;
+
+ /** . */
+ private Visibility visibility;
+
+ /** . */
+ private String pageRef;
+
+ public Builder()
+ {
+ this.icon = null;
+ this.label = null;
+ this.startPublicationTime = -1;
+ this.endPublicationTime = -1;
+ this.visibility = Visibility.DISPLAYED;
+ this.pageRef = null;
+ }
+
+ /**
+ * Creates a builder from a specified state.
+ *
+ * @param state the state to copy
+ * @throws NullPointerException if the stateis null
+ */
+ public Builder(NodeState state) throws NullPointerException
+ {
+ if (state == null)
+ {
+ throw new NullPointerException();
+ }
+ this.label = state.label;
+ this.icon = state.icon;
+ this.startPublicationTime = state.startPublicationTime;
+ this.endPublicationTime = state.endPublicationTime;
+ this.visibility = state.visibility;
+ this.pageRef = state.pageRef;
+ }
+
+ public Builder label(String label)
+ {
+ this.label = label;
+ return this;
+ }
+
+ public Builder icon(String icon)
+ {
+ this.icon = icon;
+ return this;
+ }
+
+ public Builder startPublicationTime(long startPublicationTime)
+ {
+ this.startPublicationTime = startPublicationTime;
+ return this;
+ }
+
+ public Builder endPublicationTime(long endPublicationTime)
+ {
+ this.endPublicationTime = endPublicationTime;
+ return this;
+ }
+
+ public Builder visibility(Visibility visibility)
+ {
+ this.visibility = visibility;
+ return this;
+ }
+
+ public Builder pageRef(String pageRef)
+ {
+ this.pageRef = pageRef;
+ return this;
+ }
+
+ public NodeState build()
+ {
+ return new NodeState(
+ label,
+ icon,
+ startPublicationTime,
+ endPublicationTime,
+ visibility,
+ pageRef
+ );
+ }
+ }
+
+ /** . */
+ private final String label;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final long startPublicationTime;
+
+ /** . */
+ private final long endPublicationTime;
+
+ /** . */
+ private final Visibility visibility;
+
+ /** . */
+ private final String pageRef;
+
+ public NodeState(
+ String label,
+ String icon,
+ long startPublicationTime,
+ long endPublicationTime,
+ Visibility visibility,
+ String pageRef)
+ {
+ this.label = label;
+ this.icon = icon;
+ this.startPublicationTime = startPublicationTime;
+ this.endPublicationTime = endPublicationTime;
+ this.visibility = visibility;
+ this.pageRef = pageRef;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public long getStartPublicationTime()
+ {
+ return startPublicationTime;
+ }
+
+ Date getStartPublicationDate()
+ {
+ return startPublicationTime != -1 ? new Date(startPublicationTime) : null;
+ }
+
+ public long getEndPublicationTime()
+ {
+ return endPublicationTime;
+ }
+
+ Date getEndPublicationDate()
+ {
+ return endPublicationTime != -1 ? new Date(endPublicationTime) : null;
+ }
+
+ public Visibility getVisibility()
+ {
+ return visibility;
+ }
+
+ public String getPageRef()
+ {
+ return pageRef;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof NodeState)
+ {
+ NodeState that = (NodeState)o;
+ return Safe.equals(label, that.label)
+ && Safe.equals(icon, that.icon)
+ && Safe.equals(startPublicationTime, that.startPublicationTime)
+ && Safe.equals(endPublicationTime, that.endPublicationTime)
+ && Safe.equals(visibility, that.visibility)
+ && Safe.equals(pageRef, that.pageRef);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NodeState[label=" + label + ",icon=" + icon + ",startPublicationTime=" + startPublicationTime +
+ ",endPublicationTime=" + endPublicationTime + ",visibility=" + visibility + ",pageRef=" + pageRef + "]";
+ }
+
+ public Builder builder()
+ {
+ return new Builder(this);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * <p>The scope describes a set of nodes, the scope implementation should be stateless and should be shared
- * between many threads.</p>
- *
- * <p>A scope is responsible for providing a {@link Visitor} object that is used to determine which nodes are
- * loaded when a loading operation occurs. Visitors are not thread safe, as a consequence the {@link #get()} operation
- * should create a new visitor instance on each call, unless the visitor itself is stateless by nature.</p>
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface Scope
-{
-
- /**
- * The node without its children.
- */
- Scope SINGLE = new GenericScope(0);
-
- /**
- * A node and its chidren.
- */
- Scope CHILDREN = new GenericScope(1);
-
- /**
- * A node, its chidren and grandchildren.
- */
- Scope GRANDCHILDREN = new GenericScope(2);
-
- /**
- * The entire hierarchy, to use with care.
- */
- Scope ALL = new GenericScope(-1);
-
- Visitor get();
-
- /**
- * A scope visitor responsible for determining the loading of a node.
- */
- public interface Visitor
- {
- /**
- * Returns the visit mode for the specified node.
- *
- * @param depth the relative depth to the root of the loading
- * @param id the node persistent id
- * @param name the node name
- * @param state the node state
- * @return the visit mode
- */
- VisitMode enter(int depth, String id, String name, NodeState state);
-
- void leave(int depth, String id, String name, NodeState state);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Scope.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * <p>The scope describes a set of nodes, the scope implementation should be stateless and should be shared
+ * between many threads.</p>
+ *
+ * <p>A scope is responsible for providing a {@link Visitor} object that is used to determine which nodes are
+ * loaded when a loading operation occurs. Visitors are not thread safe, as a consequence the {@link #get()} operation
+ * should create a new visitor instance on each call, unless the visitor itself is stateless by nature.</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface Scope
+{
+
+ /**
+ * The node without its children.
+ */
+ Scope SINGLE = new GenericScope(0);
+
+ /**
+ * A node and its chidren.
+ */
+ Scope CHILDREN = new GenericScope(1);
+
+ /**
+ * A node, its chidren and grandchildren.
+ */
+ Scope GRANDCHILDREN = new GenericScope(2);
+
+ /**
+ * The entire hierarchy, to use with care.
+ */
+ Scope ALL = new GenericScope(-1);
+
+ Visitor get();
+
+ /**
+ * A scope visitor responsible for determining the loading of a node.
+ */
+ public interface Visitor
+ {
+ /**
+ * Returns the visit mode for the specified node.
+ *
+ * @param depth the relative depth to the root of the loading
+ * @param id the node persistent id
+ * @param name the node name
+ * @param state the node state
+ * @return the visit mode
+ */
+ VisitMode enter(int depth, String id, String name, NodeState state);
+
+ void leave(int depth, String id, String name, NodeState state);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSession;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * A simple implementation for unit testing purpose.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class SimpleDataCache extends DataCache
-{
-
- /** . */
- protected Map<SiteKey, NavigationData> navigations;
-
- /** . */
- protected Map<String, NodeData> nodes;
-
- public SimpleDataCache()
- {
- this.navigations = new ConcurrentHashMap<SiteKey, NavigationData>();
- this.nodes = new ConcurrentHashMap<String, NodeData>();
- }
-
- @Override
- protected void removeNodes(Collection<String> keys)
- {
- nodes.keySet().removeAll(keys);
- }
-
- @Override
- protected NodeData getNode(POMSession session, String key)
- {
- NodeData node = nodes.get(key);
- if (node == null)
- {
- node = loadNode(session, key);
- if (node != null)
- {
- nodes.put(key, node);
- }
- }
- return node;
- }
-
- @Override
- protected void removeNavigation(SiteKey key)
- {
- navigations.remove(key);
- }
-
- @Override
- protected NavigationData getNavigation(POMSession session, SiteKey key)
- {
- NavigationData navigation = navigations.get(key);
- if (navigation == null)
- {
- navigation = loadNavigation(session, key);
- if (navigation != null)
- {
- navigations.put(key, navigation);
- }
- }
- return navigations.get(key);
- }
-
- @Override
- protected void clear()
- {
- navigations.clear();
- nodes.clear();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/SimpleDataCache.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSession;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * A simple implementation for unit testing purpose.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class SimpleDataCache extends DataCache
+{
+
+ /** . */
+ protected Map<SiteKey, NavigationData> navigations;
+
+ /** . */
+ protected Map<String, NodeData> nodes;
+
+ public SimpleDataCache()
+ {
+ this.navigations = new ConcurrentHashMap<SiteKey, NavigationData>();
+ this.nodes = new ConcurrentHashMap<String, NodeData>();
+ }
+
+ @Override
+ protected void removeNodes(Collection<String> keys)
+ {
+ nodes.keySet().removeAll(keys);
+ }
+
+ @Override
+ protected NodeData getNode(POMSession session, String key)
+ {
+ NodeData node = nodes.get(key);
+ if (node == null)
+ {
+ node = loadNode(session, key);
+ if (node != null)
+ {
+ nodes.put(key, node);
+ }
+ }
+ return node;
+ }
+
+ @Override
+ protected void removeNavigation(SiteKey key)
+ {
+ navigations.remove(key);
+ }
+
+ @Override
+ protected NavigationData getNavigation(POMSession session, SiteKey key)
+ {
+ NavigationData navigation = navigations.get(key);
+ if (navigation == null)
+ {
+ navigation = loadNavigation(session, key);
+ if (navigation != null)
+ {
+ navigations.put(key, navigation);
+ }
+ }
+ return navigations.get(key);
+ }
+
+ @Override
+ protected void clear()
+ {
+ navigations.clear();
+ nodes.clear();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,287 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * <p>The context of a tree, that performs:
- * <ul>
- * <li>holding the list of pending changes</li>
- * <li>keep a reference to the {@link NodeModel}</li>
- * <li>hold a sequence for providing id for transient contexts</li>
- * <li>hold the root context</li>
- * </ul>
- * </p>
- *
- * <p>The class implements the {@link Scope.Visitor} and defines a scope describing the actual content
- * of the context tree.</p>
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-class TreeContext<N> implements Scope.Visitor, NodeChangeListener<NodeContext<N>>
-{
-
- /** . */
- private NodeChangeQueue<NodeContext<N>> changes;
-
- /** . */
- final NodeModel<N> model;
-
- /** . */
- boolean editMode;
-
- /** . */
- int sequence;
-
- /** . */
- final NodeContext<N> root;
-
- TreeContext(NodeModel<N> model, NodeContext<N> root)
- {
- this.model = model;
- this.editMode = false;
- this.sequence = 0;
- this.root = root;
- }
-
- public NodeChangeQueue<NodeContext<N>> getChanges()
- {
- return changes;
- }
-
- // Improve that method if we can
- Scope.Visitor origin()
- {
-
- final Map<String, Boolean> map = new HashMap<String, Boolean>();
-
- //
- populate(map, root);
-
- //
- if (changes != null)
- {
- ListIterator<NodeChange<NodeContext<N>>> it = changes.listIterator(changes.size());
- while (it.hasPrevious())
- {
- NodeChange<NodeContext<N>> change = it.previous();
- if (change instanceof NodeChange.Created<?>)
- {
- NodeChange.Created<NodeContext<N>> created = (NodeChange.Created<NodeContext<N>>)change;
- map.remove(created.target.handle);
- }
- else if (change instanceof NodeChange.Destroyed<?>)
- {
- NodeChange.Destroyed<NodeContext<N>> destroyed = (NodeChange.Destroyed<NodeContext<N>>)change;
- map.put(destroyed.target.handle, Boolean.TRUE);
- }
- }
- }
-
- //
- return new Scope.Visitor()
- {
- public VisitMode enter(int depth, String id, String name, NodeState state)
- {
- return map.containsKey(id) ? VisitMode.ALL_CHILDREN : VisitMode.NO_CHILDREN;
- }
- public void leave(int depth, String id, String name, NodeState state)
- {
- }
- };
- }
-
- private void populate(Map<String, Boolean> map, NodeContext<N> ctx)
- {
- if (ctx.isExpanded())
- {
- map.put(ctx.handle, Boolean.TRUE);
- for (NodeContext<N> current = ctx.getFirst();current != null;current = current.getNext())
- {
- populate(map, current);
- }
- }
- }
-
- void addChange(NodeChange<NodeContext<N>> change)
- {
- if (editMode)
- {
- throw new AssertionError();
- }
- if (changes == null)
- {
- changes = new NodeChangeQueue<NodeContext<N>>();
- }
-
- //
- if (change.target.tree != this)
- {
- // Normally should be done for all arguments depending on the change type
- throw new AssertionError("Ensure we are not mixing badly things");
- }
-
- // Perform state modification here
- if (change instanceof NodeChange.Renamed<?>)
- {
- NodeChange.Renamed<NodeContext<N>> renamed = (NodeChange.Renamed<NodeContext<N>>)change;
- renamed.target.name = renamed.name;
- }
- else if (change instanceof NodeChange.Created<?>)
- {
- NodeChange.Created<NodeContext<N>> added = (NodeChange.Created<NodeContext<N>>)change;
- if (added.previous != null)
- {
- added.previous.insertAfter(added.target);
- }
- else
- {
- added.parent.insertAt(0, added.target);
- }
- }
- else if (change instanceof NodeChange.Moved<?>)
- {
- NodeChange.Moved<NodeContext<N>> moved = (NodeChange.Moved<NodeContext<N>>)change;
- if (moved.previous != null)
- {
- moved.previous.insertAfter(moved.target);
- }
- else
- {
- moved.to.insertAt(0, moved.target);
- }
- }
- else if (change instanceof NodeChange.Destroyed<?>)
- {
- NodeChange.Destroyed<NodeContext<N>> removed = (NodeChange.Destroyed<NodeContext<N>>)change;
- removed.target.remove();
- }
- else if (change instanceof NodeChange.Updated<?>)
- {
- NodeChange.Updated<NodeContext<N>> updated = (NodeChange.Updated<NodeContext<N>>)change;
- updated.target.state = updated.state;
- }
-
- //
- changes.addLast(change);
- }
-
- boolean hasChanges() {
- return changes != null && changes.size() > 0;
- }
-
- List<NodeChange<NodeContext<N>>> peekChanges()
- {
- if (hasChanges())
- {
- return changes;
- }
- else
- {
- return Collections.emptyList();
- }
- }
-
- List<NodeChange<NodeContext<N>>> popChanges()
- {
- if (hasChanges())
- {
- LinkedList<NodeChange<NodeContext<N>>> tmp = changes;
- changes = null;
- return tmp;
- }
- else
- {
- return Collections.emptyList();
- }
- }
-
- NodeContext<N> getNode(String handle)
- {
- return root.getDescendant(handle);
- }
-
- NodeContext<N> create(String handle, String name, NodeState state)
- {
- return new NodeContext<N>(this, handle, name, state, true);
- }
- // Scope.Visitor implementation -------------------------------------------------------------------------------------
-
- public VisitMode enter(int depth, String id, String name, NodeState state)
- {
- NodeContext<N> descendant = root.getDescendant(id);
- if (descendant != null)
- {
- return descendant.isExpanded() ? VisitMode.ALL_CHILDREN : VisitMode.NO_CHILDREN;
- }
- else
- {
- return VisitMode.NO_CHILDREN;
- }
- }
-
- public void leave(int depth, String id, String name, NodeState state)
- {
- }
-
- //
-
-
- public void onCreate(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous, String name) throws NavigationServiceException
- {
- addChange(new NodeChange.Created<NodeContext<N>>(parent, previous, target, name));
- }
-
- public void onDestroy(NodeContext<N> target, NodeContext<N> parent)
- {
- addChange(new NodeChange.Destroyed<NodeContext<N>>(parent, target));
- }
-
- public void onRename(NodeContext<N> target, NodeContext<N> parent, String name) throws NavigationServiceException
- {
- addChange(new NodeChange.Renamed<NodeContext<N>>(parent, target, name));
- }
-
- public void onUpdate(NodeContext<N> target, NodeState state) throws NavigationServiceException
- {
- addChange(new NodeChange.Updated<NodeContext<N>>(target, state));
- }
-
- public void onMove(NodeContext<N> target, NodeContext<N> from, NodeContext<N> to, NodeContext<N> previous) throws NavigationServiceException
- {
- addChange(new NodeChange.Moved<NodeContext<N>>(from, to, previous, target));
- }
-
- public void onAdd(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous)
- {
- throw new UnsupportedOperationException();
- }
-
- public void onRemove(NodeContext<N> target, NodeContext<N> parent)
- {
- throw new UnsupportedOperationException();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,287 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * <p>The context of a tree, that performs:
+ * <ul>
+ * <li>holding the list of pending changes</li>
+ * <li>keep a reference to the {@link NodeModel}</li>
+ * <li>hold a sequence for providing id for transient contexts</li>
+ * <li>hold the root context</li>
+ * </ul>
+ * </p>
+ *
+ * <p>The class implements the {@link Scope.Visitor} and defines a scope describing the actual content
+ * of the context tree.</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class TreeContext<N> implements Scope.Visitor, NodeChangeListener<NodeContext<N>>
+{
+
+ /** . */
+ private NodeChangeQueue<NodeContext<N>> changes;
+
+ /** . */
+ final NodeModel<N> model;
+
+ /** . */
+ boolean editMode;
+
+ /** . */
+ int sequence;
+
+ /** . */
+ final NodeContext<N> root;
+
+ TreeContext(NodeModel<N> model, NodeContext<N> root)
+ {
+ this.model = model;
+ this.editMode = false;
+ this.sequence = 0;
+ this.root = root;
+ }
+
+ public NodeChangeQueue<NodeContext<N>> getChanges()
+ {
+ return changes;
+ }
+
+ // Improve that method if we can
+ Scope.Visitor origin()
+ {
+
+ final Map<String, Boolean> map = new HashMap<String, Boolean>();
+
+ //
+ populate(map, root);
+
+ //
+ if (changes != null)
+ {
+ ListIterator<NodeChange<NodeContext<N>>> it = changes.listIterator(changes.size());
+ while (it.hasPrevious())
+ {
+ NodeChange<NodeContext<N>> change = it.previous();
+ if (change instanceof NodeChange.Created<?>)
+ {
+ NodeChange.Created<NodeContext<N>> created = (NodeChange.Created<NodeContext<N>>)change;
+ map.remove(created.target.handle);
+ }
+ else if (change instanceof NodeChange.Destroyed<?>)
+ {
+ NodeChange.Destroyed<NodeContext<N>> destroyed = (NodeChange.Destroyed<NodeContext<N>>)change;
+ map.put(destroyed.target.handle, Boolean.TRUE);
+ }
+ }
+ }
+
+ //
+ return new Scope.Visitor()
+ {
+ public VisitMode enter(int depth, String id, String name, NodeState state)
+ {
+ return map.containsKey(id) ? VisitMode.ALL_CHILDREN : VisitMode.NO_CHILDREN;
+ }
+ public void leave(int depth, String id, String name, NodeState state)
+ {
+ }
+ };
+ }
+
+ private void populate(Map<String, Boolean> map, NodeContext<N> ctx)
+ {
+ if (ctx.isExpanded())
+ {
+ map.put(ctx.handle, Boolean.TRUE);
+ for (NodeContext<N> current = ctx.getFirst();current != null;current = current.getNext())
+ {
+ populate(map, current);
+ }
+ }
+ }
+
+ void addChange(NodeChange<NodeContext<N>> change)
+ {
+ if (editMode)
+ {
+ throw new AssertionError();
+ }
+ if (changes == null)
+ {
+ changes = new NodeChangeQueue<NodeContext<N>>();
+ }
+
+ //
+ if (change.target.tree != this)
+ {
+ // Normally should be done for all arguments depending on the change type
+ throw new AssertionError("Ensure we are not mixing badly things");
+ }
+
+ // Perform state modification here
+ if (change instanceof NodeChange.Renamed<?>)
+ {
+ NodeChange.Renamed<NodeContext<N>> renamed = (NodeChange.Renamed<NodeContext<N>>)change;
+ renamed.target.name = renamed.name;
+ }
+ else if (change instanceof NodeChange.Created<?>)
+ {
+ NodeChange.Created<NodeContext<N>> added = (NodeChange.Created<NodeContext<N>>)change;
+ if (added.previous != null)
+ {
+ added.previous.insertAfter(added.target);
+ }
+ else
+ {
+ added.parent.insertAt(0, added.target);
+ }
+ }
+ else if (change instanceof NodeChange.Moved<?>)
+ {
+ NodeChange.Moved<NodeContext<N>> moved = (NodeChange.Moved<NodeContext<N>>)change;
+ if (moved.previous != null)
+ {
+ moved.previous.insertAfter(moved.target);
+ }
+ else
+ {
+ moved.to.insertAt(0, moved.target);
+ }
+ }
+ else if (change instanceof NodeChange.Destroyed<?>)
+ {
+ NodeChange.Destroyed<NodeContext<N>> removed = (NodeChange.Destroyed<NodeContext<N>>)change;
+ removed.target.remove();
+ }
+ else if (change instanceof NodeChange.Updated<?>)
+ {
+ NodeChange.Updated<NodeContext<N>> updated = (NodeChange.Updated<NodeContext<N>>)change;
+ updated.target.state = updated.state;
+ }
+
+ //
+ changes.addLast(change);
+ }
+
+ boolean hasChanges() {
+ return changes != null && changes.size() > 0;
+ }
+
+ List<NodeChange<NodeContext<N>>> peekChanges()
+ {
+ if (hasChanges())
+ {
+ return changes;
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+
+ List<NodeChange<NodeContext<N>>> popChanges()
+ {
+ if (hasChanges())
+ {
+ LinkedList<NodeChange<NodeContext<N>>> tmp = changes;
+ changes = null;
+ return tmp;
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+
+ NodeContext<N> getNode(String handle)
+ {
+ return root.getDescendant(handle);
+ }
+
+ NodeContext<N> create(String handle, String name, NodeState state)
+ {
+ return new NodeContext<N>(this, handle, name, state, true);
+ }
+ // Scope.Visitor implementation -------------------------------------------------------------------------------------
+
+ public VisitMode enter(int depth, String id, String name, NodeState state)
+ {
+ NodeContext<N> descendant = root.getDescendant(id);
+ if (descendant != null)
+ {
+ return descendant.isExpanded() ? VisitMode.ALL_CHILDREN : VisitMode.NO_CHILDREN;
+ }
+ else
+ {
+ return VisitMode.NO_CHILDREN;
+ }
+ }
+
+ public void leave(int depth, String id, String name, NodeState state)
+ {
+ }
+
+ //
+
+
+ public void onCreate(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous, String name) throws NavigationServiceException
+ {
+ addChange(new NodeChange.Created<NodeContext<N>>(parent, previous, target, name));
+ }
+
+ public void onDestroy(NodeContext<N> target, NodeContext<N> parent)
+ {
+ addChange(new NodeChange.Destroyed<NodeContext<N>>(parent, target));
+ }
+
+ public void onRename(NodeContext<N> target, NodeContext<N> parent, String name) throws NavigationServiceException
+ {
+ addChange(new NodeChange.Renamed<NodeContext<N>>(parent, target, name));
+ }
+
+ public void onUpdate(NodeContext<N> target, NodeState state) throws NavigationServiceException
+ {
+ addChange(new NodeChange.Updated<NodeContext<N>>(target, state));
+ }
+
+ public void onMove(NodeContext<N> target, NodeContext<N> from, NodeContext<N> to, NodeContext<N> previous) throws NavigationServiceException
+ {
+ addChange(new NodeChange.Moved<NodeContext<N>>(from, to, previous, target));
+ }
+
+ public void onAdd(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void onRemove(NodeContext<N> target, NodeContext<N> parent)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-class TreeMerge<N> extends NodeChangeListener.Base<NodeContext<N>>
-{
-
- /** . */
- private final TreeContext<N> merged;
-
- /** . */
- private final NodeChangeListener<NodeContext<N>> next;
-
- TreeMerge(TreeContext<N> merged, NodeChangeListener<NodeContext<N>> next)
- {
- this.merged = merged;
- this.next = next;
- }
-
- public void onCreate(NodeContext<N> target, NodeContext<N> _parent, NodeContext<N> _previous, String name) throws NavigationServiceException
- {
- String parentHandle = _parent.handle;
- NodeContext<N> parent = merged.getNode(parentHandle);
- if (parent == null)
- {
- throw new NavigationServiceException(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE);
- }
-
- //
- NodeContext<N> previous;
- if (_previous != null)
- {
- previous = merged.getNode(_previous.handle);
- if (previous == null)
- {
- throw new NavigationServiceException(NavigationError.ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE);
- }
- }
- else
- {
- previous = null;
- }
-
- //
- NodeContext<N> added = parent.get(name);
- if (added != null)
- {
- throw new NavigationServiceException(NavigationError.ADD_CONCURRENTLY_ADDED_NODE);
- }
-
- //
- NodeContext<N> source = merged.create(target.handle, name, target.getState());
-
- //
- next.onCreate(source, parent, previous, name);
- }
-
- public void onDestroy(NodeContext<N> target, NodeContext<N> _parent)
- {
- NodeContext<N> removed = merged.getNode(target.handle);
-
- //
- if (removed != null)
- {
- NodeContext<N> parent = merged.getNode(_parent.handle);
- next.onDestroy(removed, parent);
- }
- }
-
- public void onRename(NodeContext<N> target, NodeContext<N> _parent, String _name) throws NavigationServiceException
- {
- //
- String renamedHandle = target.handle;
- NodeContext<N> renamed = merged.getNode(renamedHandle);
- if (renamed == null)
- {
- throw new NavigationServiceException(NavigationError.RENAME_CONCURRENTLY_REMOVED_NODE);
- }
-
- //
- NodeContext<N> parent = renamed.getParent();
- if (parent.get(_name) != null)
- {
- throw new NavigationServiceException(NavigationError.RENAME_CONCURRENTLY_DUPLICATE_NAME);
- }
-
- //
- next.onRename(renamed, parent, _name);
- }
-
- public void onUpdate(NodeContext<N> target, NodeState state) throws NavigationServiceException
- {
- String updatedHandle = target.handle;
- NodeContext<N> navigation = merged.getNode(updatedHandle);
- if (navigation == null)
- {
- throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
- }
-
- //
- next.onUpdate(navigation, state);
- }
-
- public void onMove(NodeContext<N> target, NodeContext<N> _from, NodeContext<N> _to, NodeContext<N> _previous) throws NavigationServiceException
- {
- String srcHandle = _from.handle;
- NodeContext<N> src = merged.getNode(srcHandle);
- if (src == null)
- {
- throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_SRC_NODE);
- }
-
- //
- String dstHandle = _to.handle;
- NodeContext<N> dst = merged.getNode(dstHandle);
- if (dst == null)
- {
- throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_DST_NODE);
- }
-
- //
- String movedHandle = target.handle;
- NodeContext<N> moved = merged.getNode(movedHandle);
- if (moved == null)
- {
- throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_MOVED_NODE);
- }
-
- //
- NodeContext<N> previous;
- if (_previous != null)
- {
- previous = merged.getNode(_previous.handle);
- if (previous == null)
- {
- throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_PREVIOUS_NODE);
- }
- }
- else
- {
- previous = null;
- }
-
- //
- if (src != moved.getParent())
- {
- throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_CHANGED_SRC_NODE);
- }
-
- //
- if (src != dst)
- {
- String name = moved.getName();
- NodeContext<N> existing = dst.get(name);
- if (existing != null)
- {
- throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_DUPLICATE_NAME);
- }
- }
-
- //
- next.onMove(moved, src, dst, previous);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeMerge.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class TreeMerge<N> extends NodeChangeListener.Base<NodeContext<N>>
+{
+
+ /** . */
+ private final TreeContext<N> merged;
+
+ /** . */
+ private final NodeChangeListener<NodeContext<N>> next;
+
+ TreeMerge(TreeContext<N> merged, NodeChangeListener<NodeContext<N>> next)
+ {
+ this.merged = merged;
+ this.next = next;
+ }
+
+ public void onCreate(NodeContext<N> target, NodeContext<N> _parent, NodeContext<N> _previous, String name) throws NavigationServiceException
+ {
+ String parentHandle = _parent.handle;
+ NodeContext<N> parent = merged.getNode(parentHandle);
+ if (parent == null)
+ {
+ throw new NavigationServiceException(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE);
+ }
+
+ //
+ NodeContext<N> previous;
+ if (_previous != null)
+ {
+ previous = merged.getNode(_previous.handle);
+ if (previous == null)
+ {
+ throw new NavigationServiceException(NavigationError.ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE);
+ }
+ }
+ else
+ {
+ previous = null;
+ }
+
+ //
+ NodeContext<N> added = parent.get(name);
+ if (added != null)
+ {
+ throw new NavigationServiceException(NavigationError.ADD_CONCURRENTLY_ADDED_NODE);
+ }
+
+ //
+ NodeContext<N> source = merged.create(target.handle, name, target.getState());
+
+ //
+ next.onCreate(source, parent, previous, name);
+ }
+
+ public void onDestroy(NodeContext<N> target, NodeContext<N> _parent)
+ {
+ NodeContext<N> removed = merged.getNode(target.handle);
+
+ //
+ if (removed != null)
+ {
+ NodeContext<N> parent = merged.getNode(_parent.handle);
+ next.onDestroy(removed, parent);
+ }
+ }
+
+ public void onRename(NodeContext<N> target, NodeContext<N> _parent, String _name) throws NavigationServiceException
+ {
+ //
+ String renamedHandle = target.handle;
+ NodeContext<N> renamed = merged.getNode(renamedHandle);
+ if (renamed == null)
+ {
+ throw new NavigationServiceException(NavigationError.RENAME_CONCURRENTLY_REMOVED_NODE);
+ }
+
+ //
+ NodeContext<N> parent = renamed.getParent();
+ if (parent.get(_name) != null)
+ {
+ throw new NavigationServiceException(NavigationError.RENAME_CONCURRENTLY_DUPLICATE_NAME);
+ }
+
+ //
+ next.onRename(renamed, parent, _name);
+ }
+
+ public void onUpdate(NodeContext<N> target, NodeState state) throws NavigationServiceException
+ {
+ String updatedHandle = target.handle;
+ NodeContext<N> navigation = merged.getNode(updatedHandle);
+ if (navigation == null)
+ {
+ throw new NavigationServiceException(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE);
+ }
+
+ //
+ next.onUpdate(navigation, state);
+ }
+
+ public void onMove(NodeContext<N> target, NodeContext<N> _from, NodeContext<N> _to, NodeContext<N> _previous) throws NavigationServiceException
+ {
+ String srcHandle = _from.handle;
+ NodeContext<N> src = merged.getNode(srcHandle);
+ if (src == null)
+ {
+ throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_SRC_NODE);
+ }
+
+ //
+ String dstHandle = _to.handle;
+ NodeContext<N> dst = merged.getNode(dstHandle);
+ if (dst == null)
+ {
+ throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_DST_NODE);
+ }
+
+ //
+ String movedHandle = target.handle;
+ NodeContext<N> moved = merged.getNode(movedHandle);
+ if (moved == null)
+ {
+ throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_MOVED_NODE);
+ }
+
+ //
+ NodeContext<N> previous;
+ if (_previous != null)
+ {
+ previous = merged.getNode(_previous.handle);
+ if (previous == null)
+ {
+ throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_REMOVED_PREVIOUS_NODE);
+ }
+ }
+ else
+ {
+ previous = null;
+ }
+
+ //
+ if (src != moved.getParent())
+ {
+ throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_CHANGED_SRC_NODE);
+ }
+
+ //
+ if (src != dst)
+ {
+ String name = moved.getName();
+ NodeContext<N> existing = dst.get(name);
+ if (existing != null)
+ {
+ throw new NavigationServiceException(NavigationError.MOVE_CONCURRENTLY_DUPLICATE_NAME);
+ }
+ }
+
+ //
+ next.onMove(moved, src, dst, previous);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.tree.diff.Adapters;
-import org.exoplatform.portal.tree.diff.HierarchyAdapter;
-import org.exoplatform.portal.tree.diff.HierarchyChangeIterator;
-import org.exoplatform.portal.tree.diff.HierarchyChangeType;
-import org.exoplatform.portal.tree.diff.HierarchyDiff;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-class TreeUpdate<N1, N2>
-{
-
- static <N1, N2> void perform(
- TreeContext<N1> src,
- HierarchyAdapter<String[], NodeContext<N1>, String> srcAdatper,
- N2 dst,
- TreeUpdateAdapter<N2> updateAdapter,
- NodeChangeListener<NodeContext<N1>> listener,
- Scope.Visitor visitor)
- {
-
- TreeUpdate<N1, N2> update = new TreeUpdate<N1, N2>(
- src,
- srcAdatper,
- dst,
- updateAdapter,
- listener,
- visitor
- );
-
- //
- update.perform();
- }
-
- private TreeUpdate(
- TreeContext<N1> src,
- HierarchyAdapter<String[], NodeContext<N1>, String> srcAdatper,
- N2 dst,
- TreeUpdateAdapter<N2> updateAdapter,
- NodeChangeListener<NodeContext<N1>> listener,
- Scope.Visitor visitor)
- {
-
- // We create the diff object
- HierarchyDiff<String[], NodeContext<N1>, String[], N2, String> diff = HierarchyDiff.create(
- Adapters.<String>list(),
- srcAdatper,
- Adapters.<String>list(),
- updateAdapter,
- Utils.<String>comparator());
-
- // We obtain the iterator
- HierarchyChangeIterator<String[], NodeContext<N1>, String[], N2, String> it = diff.iterator(src.root, dst);
-
- //
- this.it = it;
- this.updateAdapter = updateAdapter;
- this.visitor = visitor;
- this.depth = 0;
- this.last = null;
- this.listener = listener;
- }
-
- /** . */
- private final HierarchyChangeIterator<String[], NodeContext<N1>, String[], N2, String> it;
-
- /** . */
- private final TreeUpdateAdapter<N2> updateAdapter;
-
- /** . */
- private final Scope.Visitor visitor;
-
- /** . */
- private int depth;
-
- /** . */
- private NodeContext<N1> last;
-
- /** . */
- private NodeChangeListener<NodeContext<N1>> listener;
-
- private void perform()
- {
-
- // Consume the first ENTER that we won't skip
- HierarchyChangeType change = it.next();
-
- // Start recursion
- perform(it.getSource());
- }
-
- private void perform(NodeContext<N1> parent)
- {
- // Compute visit
- VisitMode visit = null;
- N2 d = it.getDestination();
- NodeData data = updateAdapter.getData(d);
-
- //
- if (data != null)
- {
- visit = visitor.enter(depth, data.id, data.name, data.state);
- }
-
- // Cut the recursion if necessary
- if (visit != VisitMode.ALL_CHILDREN)
- {
- it.skip();
-
- // Consume leave
- it.next();
- }
- else
- {
- depth++;
-
- // Expand if needed
- if (!parent.isExpanded())
- {
- parent.expand();
- }
-
- //
- while (true)
- {
- HierarchyChangeType change = it.next();
- if (change == HierarchyChangeType.LEAVE)
- {
- // End recursion here
- break;
- }
- else
- {
- if (change == HierarchyChangeType.KEEP)
- {
- // Consume ENTER
- it.next();
-
- // Recurse
- perform(it.getSource());
- }
- else if (change == HierarchyChangeType.ADDED)
- {
- // Consume ENTER
- it.next();
-
- //
- NodeContext<N1> previous;
- NodeContext<N1> added;
- NodeData addedData = updateAdapter.getData(it.getDestination());
- if (last == null || last.getParent() != parent)
- {
- previous = null;
- added = parent.insertAt(0, addedData);
- }
- else
- {
- previous = last;
- added = last.insertAfter(addedData);
- }
-
- //
- if (listener != null)
- {
- listener.onAdd(
- added,
- parent,
- previous);
- }
-
- // Recurse
- perform(added);
- }
- else if (change == HierarchyChangeType.MOVED_IN)
- {
- // Consume ENTER
- it.next();
-
-
- //
- NodeContext<N1> to = parent;
- NodeContext<N1> moved = it.getSource();
- NodeContext<N1> from = moved.getParent();
- NodeContext<N1> previous;
- if (last == null || last.getParent() != parent)
- {
- previous = null;
- to.insertAt(0, moved);
- }
- else
- {
- previous = last;
- last.insertAfter(moved);
- }
-
- //
- if (listener != null)
- {
- listener.onMove(
- moved,
- from,
- to,
- previous != null ? previous : null);
- }
-
- // Recurse
- perform(it.getSource());
- }
- else if (change == HierarchyChangeType.MOVED_OUT)
- {
- // Do nothing
- }
- else if (change == HierarchyChangeType.REMOVED)
- {
- NodeContext<N1> removed = it.getSource();
- NodeContext<N1> removedParent = removed.getParent();
-
- //
- removed.remove();
-
- //
- if (listener != null)
- {
- listener.onRemove(
- removed,
- removedParent);
- }
- }
- else
- {
- throw new UnsupportedOperationException("Not supported " + change);
- }
- }
- }
-
- //
- depth--;
- }
-
- //
- if (data != null)
- {
- if (!parent.data.state.equals(data.state))
- {
- if (listener != null)
- {
- listener.onUpdate(parent, data.state);
- }
- }
-
- //
- if (!parent.data.name.equals(data.name))
- {
- parent.name = data.name;
- if (listener != null)
- {
- listener.onRename(parent, parent.getParent(), data.name);
- }
- }
-
- //
- parent.state = updateAdapter.getState(d);
- parent.name = updateAdapter.getName(d);
- parent.data = data;
-
- //
- visitor.leave(depth, data.id, data.name, data.state);
- }
-
- //
- last = parent;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdate.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,294 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.tree.diff.Adapters;
+import org.exoplatform.portal.tree.diff.HierarchyAdapter;
+import org.exoplatform.portal.tree.diff.HierarchyChangeIterator;
+import org.exoplatform.portal.tree.diff.HierarchyChangeType;
+import org.exoplatform.portal.tree.diff.HierarchyDiff;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class TreeUpdate<N1, N2>
+{
+
+ static <N1, N2> void perform(
+ TreeContext<N1> src,
+ HierarchyAdapter<String[], NodeContext<N1>, String> srcAdatper,
+ N2 dst,
+ TreeUpdateAdapter<N2> updateAdapter,
+ NodeChangeListener<NodeContext<N1>> listener,
+ Scope.Visitor visitor)
+ {
+
+ TreeUpdate<N1, N2> update = new TreeUpdate<N1, N2>(
+ src,
+ srcAdatper,
+ dst,
+ updateAdapter,
+ listener,
+ visitor
+ );
+
+ //
+ update.perform();
+ }
+
+ private TreeUpdate(
+ TreeContext<N1> src,
+ HierarchyAdapter<String[], NodeContext<N1>, String> srcAdatper,
+ N2 dst,
+ TreeUpdateAdapter<N2> updateAdapter,
+ NodeChangeListener<NodeContext<N1>> listener,
+ Scope.Visitor visitor)
+ {
+
+ // We create the diff object
+ HierarchyDiff<String[], NodeContext<N1>, String[], N2, String> diff = HierarchyDiff.create(
+ Adapters.<String>list(),
+ srcAdatper,
+ Adapters.<String>list(),
+ updateAdapter,
+ Utils.<String>comparator());
+
+ // We obtain the iterator
+ HierarchyChangeIterator<String[], NodeContext<N1>, String[], N2, String> it = diff.iterator(src.root, dst);
+
+ //
+ this.it = it;
+ this.updateAdapter = updateAdapter;
+ this.visitor = visitor;
+ this.depth = 0;
+ this.last = null;
+ this.listener = listener;
+ }
+
+ /** . */
+ private final HierarchyChangeIterator<String[], NodeContext<N1>, String[], N2, String> it;
+
+ /** . */
+ private final TreeUpdateAdapter<N2> updateAdapter;
+
+ /** . */
+ private final Scope.Visitor visitor;
+
+ /** . */
+ private int depth;
+
+ /** . */
+ private NodeContext<N1> last;
+
+ /** . */
+ private NodeChangeListener<NodeContext<N1>> listener;
+
+ private void perform()
+ {
+
+ // Consume the first ENTER that we won't skip
+ HierarchyChangeType change = it.next();
+
+ // Start recursion
+ perform(it.getSource());
+ }
+
+ private void perform(NodeContext<N1> parent)
+ {
+ // Compute visit
+ VisitMode visit = null;
+ N2 d = it.getDestination();
+ NodeData data = updateAdapter.getData(d);
+
+ //
+ if (data != null)
+ {
+ visit = visitor.enter(depth, data.id, data.name, data.state);
+ }
+
+ // Cut the recursion if necessary
+ if (visit != VisitMode.ALL_CHILDREN)
+ {
+ it.skip();
+
+ // Consume leave
+ it.next();
+ }
+ else
+ {
+ depth++;
+
+ // Expand if needed
+ if (!parent.isExpanded())
+ {
+ parent.expand();
+ }
+
+ //
+ while (true)
+ {
+ HierarchyChangeType change = it.next();
+ if (change == HierarchyChangeType.LEAVE)
+ {
+ // End recursion here
+ break;
+ }
+ else
+ {
+ if (change == HierarchyChangeType.KEEP)
+ {
+ // Consume ENTER
+ it.next();
+
+ // Recurse
+ perform(it.getSource());
+ }
+ else if (change == HierarchyChangeType.ADDED)
+ {
+ // Consume ENTER
+ it.next();
+
+ //
+ NodeContext<N1> previous;
+ NodeContext<N1> added;
+ NodeData addedData = updateAdapter.getData(it.getDestination());
+ if (last == null || last.getParent() != parent)
+ {
+ previous = null;
+ added = parent.insertAt(0, addedData);
+ }
+ else
+ {
+ previous = last;
+ added = last.insertAfter(addedData);
+ }
+
+ //
+ if (listener != null)
+ {
+ listener.onAdd(
+ added,
+ parent,
+ previous);
+ }
+
+ // Recurse
+ perform(added);
+ }
+ else if (change == HierarchyChangeType.MOVED_IN)
+ {
+ // Consume ENTER
+ it.next();
+
+
+ //
+ NodeContext<N1> to = parent;
+ NodeContext<N1> moved = it.getSource();
+ NodeContext<N1> from = moved.getParent();
+ NodeContext<N1> previous;
+ if (last == null || last.getParent() != parent)
+ {
+ previous = null;
+ to.insertAt(0, moved);
+ }
+ else
+ {
+ previous = last;
+ last.insertAfter(moved);
+ }
+
+ //
+ if (listener != null)
+ {
+ listener.onMove(
+ moved,
+ from,
+ to,
+ previous != null ? previous : null);
+ }
+
+ // Recurse
+ perform(it.getSource());
+ }
+ else if (change == HierarchyChangeType.MOVED_OUT)
+ {
+ // Do nothing
+ }
+ else if (change == HierarchyChangeType.REMOVED)
+ {
+ NodeContext<N1> removed = it.getSource();
+ NodeContext<N1> removedParent = removed.getParent();
+
+ //
+ removed.remove();
+
+ //
+ if (listener != null)
+ {
+ listener.onRemove(
+ removed,
+ removedParent);
+ }
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Not supported " + change);
+ }
+ }
+ }
+
+ //
+ depth--;
+ }
+
+ //
+ if (data != null)
+ {
+ if (!parent.data.state.equals(data.state))
+ {
+ if (listener != null)
+ {
+ listener.onUpdate(parent, data.state);
+ }
+ }
+
+ //
+ if (!parent.data.name.equals(data.name))
+ {
+ parent.name = data.name;
+ if (listener != null)
+ {
+ listener.onRename(parent, parent.getParent(), data.name);
+ }
+ }
+
+ //
+ parent.state = updateAdapter.getState(d);
+ parent.name = updateAdapter.getName(d);
+ parent.data = data;
+
+ //
+ visitor.leave(depth, data.id, data.name, data.state);
+ }
+
+ //
+ last = parent;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.tree.diff.HierarchyAdapter;
-
-/**
- * Adapter for the update operation.
- *
- * @param <N> the node generic type
- */
-interface TreeUpdateAdapter<N> extends HierarchyAdapter<String[], N, String>
-{
-
- /**
- * Returns the persistent data associated with the node or null if such data does not exist.
- *
- * @param node the node
- * @return the node data
- */
- NodeData getData(N node);
-
- /**
- * Returns the transient state associated with the node.
- *
- * @param node the node
- * @return the transient state
- */
- NodeState getState(N node);
-
- /**
- * Returns the transient name associated with the node.
- *
- * @param node the node
- * @return the transient name
- */
- String getName(N node);
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/TreeUpdateAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.tree.diff.HierarchyAdapter;
+
+/**
+ * Adapter for the update operation.
+ *
+ * @param <N> the node generic type
+ */
+interface TreeUpdateAdapter<N> extends HierarchyAdapter<String[], N, String>
+{
+
+ /**
+ * Returns the persistent data associated with the node or null if such data does not exist.
+ *
+ * @param node the node
+ * @return the node data
+ */
+ NodeData getData(N node);
+
+ /**
+ * Returns the transient state associated with the node.
+ *
+ * @param node the node
+ * @return the transient state
+ */
+ NodeState getState(N node);
+
+ /**
+ * Returns the transient name associated with the node.
+ *
+ * @param node the node
+ * @return the transient name
+ */
+ String getName(N node);
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteType;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-
-import java.util.Comparator;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-class Utils
-{
-
- /** . */
- static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- /** . */
- private static final ComparableComparator INSTANCE = new ComparableComparator();
-
- /** . */
- private static final EnumMap<SiteType, ObjectType<Site>> a = new EnumMap<SiteType, ObjectType<Site>>(SiteType.class);
-
- /** . */
- private static final Map<ObjectType<Site>, SiteType> b = new HashMap<ObjectType<Site>, SiteType>(3);
-
- static
- {
- a.put(SiteType.PORTAL, ObjectType.PORTAL_SITE);
- a.put(SiteType.GROUP, ObjectType.GROUP_SITE);
- a.put(SiteType.USER, ObjectType.USER_SITE);
- b.put(ObjectType.PORTAL_SITE, SiteType.PORTAL);
- b.put(ObjectType.GROUP_SITE, SiteType.GROUP);
- b.put(ObjectType.USER_SITE, SiteType.USER);
- }
-
- static ObjectType<Site> objectType(SiteType siteType)
- {
- return a.get(siteType);
- }
-
- static SiteType siteType(ObjectType objectType)
- {
- return b.get(objectType);
- }
-
- static <T extends Comparable<T>> Comparator<T> comparator()
- {
- // Not totally good but well... should we pass the class to the caller ?
- @SuppressWarnings("unchecked")
- ComparableComparator instance = INSTANCE;
- return instance;
- }
-
- private static class ComparableComparator<T extends Comparable<T>> implements Comparator<T>
- {
- public int compare(T o1, T o2)
- {
- return o1.compareTo(o2);
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/Utils.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteType;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+
+import java.util.Comparator;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class Utils
+{
+
+ /** . */
+ static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+ /** . */
+ private static final ComparableComparator INSTANCE = new ComparableComparator();
+
+ /** . */
+ private static final EnumMap<SiteType, ObjectType<Site>> a = new EnumMap<SiteType, ObjectType<Site>>(SiteType.class);
+
+ /** . */
+ private static final Map<ObjectType<Site>, SiteType> b = new HashMap<ObjectType<Site>, SiteType>(3);
+
+ static
+ {
+ a.put(SiteType.PORTAL, ObjectType.PORTAL_SITE);
+ a.put(SiteType.GROUP, ObjectType.GROUP_SITE);
+ a.put(SiteType.USER, ObjectType.USER_SITE);
+ b.put(ObjectType.PORTAL_SITE, SiteType.PORTAL);
+ b.put(ObjectType.GROUP_SITE, SiteType.GROUP);
+ b.put(ObjectType.USER_SITE, SiteType.USER);
+ }
+
+ static ObjectType<Site> objectType(SiteType siteType)
+ {
+ return a.get(siteType);
+ }
+
+ static SiteType siteType(ObjectType objectType)
+ {
+ return b.get(objectType);
+ }
+
+ static <T extends Comparable<T>> Comparator<T> comparator()
+ {
+ // Not totally good but well... should we pass the class to the caller ?
+ @SuppressWarnings("unchecked")
+ ComparableComparator instance = INSTANCE;
+ return instance;
+ }
+
+ private static class ComparableComparator<T extends Comparable<T>> implements Comparator<T>
+ {
+ public int compare(T o1, T o2)
+ {
+ return o1.compareTo(o2);
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-/**
- * Describes how a node should be loaded by a loading operation.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class VisitMode
-{
-
- /**
- * Include node but its children should be left appart.
- */
- public static final VisitMode NO_CHILDREN = new VisitMode("NO_CHILDREN");
-
- /**
- * Include node and its children.
- */
- public static final VisitMode ALL_CHILDREN = new VisitMode("ALL_CHILDREN");
-
- /** . */
- private final String name;
-
- private VisitMode(String name)
- {
- this.name = name;
- }
-
- @Override
- public String toString()
- {
- return "VisitMode[" + name + "]";
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/VisitMode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+/**
+ * Describes how a node should be loaded by a loading operation.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class VisitMode
+{
+
+ /**
+ * Include node but its children should be left appart.
+ */
+ public static final VisitMode NO_CHILDREN = new VisitMode("NO_CHILDREN");
+
+ /**
+ * Include node and its children.
+ */
+ public static final VisitMode ALL_CHILDREN = new VisitMode("ALL_CHILDREN");
+
+ /** . */
+ private final String name;
+
+ private VisitMode(String name)
+ {
+ this.name = name;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "VisitMode[" + name + "]";
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.gatein.common.util.EmptyResourceBundle;
-
-import java.util.ResourceBundle;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class UserNavigation
-{
-
- /** . */
- final UserPortalImpl portal;
-
- /** . */
- final NavigationContext navigation;
-
- /** . */
- private final boolean modifiable;
-
- /** . */
- private ResourceBundle bundle;
-
- UserNavigation(UserPortalImpl portal, NavigationContext navigation, boolean modifiable)
- {
- if (navigation == null)
- {
- throw new NullPointerException();
- }
- if (navigation.getState() == null)
- {
- throw new IllegalArgumentException("No state for navigation " + navigation.getKey());
- }
-
- //
- this.portal = portal;
- this.navigation = navigation;
- this.modifiable = modifiable;
- }
-
- public ResourceBundle getBundle()
- {
- if (bundle == null)
- {
- bundle = portal.context.getBundle(this);
- if (bundle == null)
- {
- bundle = EmptyResourceBundle.INSTANCE;
- }
- }
- return bundle;
- }
-
- public SiteKey getKey()
- {
- return navigation.getKey();
- }
-
- public int getPriority()
- {
- Integer priority = navigation.getState().getPriority();
- return priority != null ? priority : 1;
- }
-
- public boolean isModifiable()
- {
- return modifiable;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNavigation.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.gatein.common.util.EmptyResourceBundle;
+
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class UserNavigation
+{
+
+ /** . */
+ final UserPortalImpl portal;
+
+ /** . */
+ final NavigationContext navigation;
+
+ /** . */
+ private final boolean modifiable;
+
+ /** . */
+ private ResourceBundle bundle;
+
+ UserNavigation(UserPortalImpl portal, NavigationContext navigation, boolean modifiable)
+ {
+ if (navigation == null)
+ {
+ throw new NullPointerException();
+ }
+ if (navigation.getState() == null)
+ {
+ throw new IllegalArgumentException("No state for navigation " + navigation.getKey());
+ }
+
+ //
+ this.portal = portal;
+ this.navigation = navigation;
+ this.modifiable = modifiable;
+ }
+
+ public ResourceBundle getBundle()
+ {
+ if (bundle == null)
+ {
+ bundle = portal.context.getBundle(this);
+ if (bundle == null)
+ {
+ bundle = EmptyResourceBundle.INSTANCE;
+ }
+ }
+ return bundle;
+ }
+
+ public SiteKey getKey()
+ {
+ return navigation.getKey();
+ }
+
+ public int getPriority()
+ {
+ Integer priority = navigation.getState().getPriority();
+ return priority != null ? priority : 1;
+ }
+
+ public boolean isModifiable()
+ {
+ return modifiable;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,329 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import org.exoplatform.commons.utils.ExpressionUtil;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.mop.navigation.NavigationServiceException;
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeFilter;
-import org.exoplatform.portal.mop.navigation.NodeState;
-import org.gatein.common.text.EntityEncoder;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.ResourceBundle;
-
-/**
- * A navigation node as seen by a user.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class UserNode
-{
-
- /** . */
- final UserNodeContext owner;
-
- /** . */
- final NodeContext<UserNode> context;
-
- /** . */
- private String resolvedLabel;
-
- /** . */
- private String encodedResolvedLabel;
-
- /** . */
- private String uri;
-
- UserNode(UserNodeContext owner, NodeContext<UserNode> context)
- {
- this.owner = owner;
- this.context = context;
- this.resolvedLabel = null;
- this.encodedResolvedLabel = null;
- this.uri = null;
- }
-
- public UserNavigation getNavigation()
- {
- return owner.navigation;
- }
-
- public String getId()
- {
- return context.getId();
- }
-
- UserNode filter()
- {
- owner.filter(this);
- return this;
- }
-
- public String getName()
- {
- return context.getName();
- }
-
- public void setName(String name)
- {
- context.setName(name);
- }
-
- public String getURI()
- {
- if (uri == null)
- {
- uri = buildURI().toString();
- }
- return uri;
- }
-
- private StringBuilder buildURI()
- {
- UserNode parent = context.getParentNode();
- if (parent != null)
- {
- StringBuilder builder = parent.buildURI();
- if (builder.length() > 0)
- {
- builder.append('/');
- }
- return builder.append(context.getName());
- }
- else
- {
- return new StringBuilder();
- }
- }
-
- public String getLabel()
- {
- return context.getState().getLabel();
- }
-
- public void setLabel(String label)
- {
- this.resolvedLabel = null;
- this.encodedResolvedLabel = null;
-
- //
- context.setState(new NodeState.Builder(context.getState()).label(label).build());
- }
-
- public String getIcon()
- {
- return context.getState().getIcon();
- }
-
- public void setIcon(String icon)
- {
- context.setState(new NodeState.Builder(context.getState()).icon(icon).build());
- }
-
- public long getStartPublicationTime()
- {
- return context.getState().getStartPublicationTime();
- }
-
- public void setStartPublicationTime(long startPublicationTime)
- {
- context.setState(new NodeState.Builder(context.getState()).startPublicationTime(startPublicationTime).build());
- }
-
- public long getEndPublicationTime()
- {
- return context.getState().getEndPublicationTime();
- }
-
- public void setEndPublicationTime(long endPublicationTime)
- {
- context.setState(new NodeState.Builder(context.getState()).endPublicationTime(endPublicationTime).build());
- }
-
- public Visibility getVisibility()
- {
- return context.getState().getVisibility();
- }
-
- public void setVisibility(Visibility visibility)
- {
- context.setState(new NodeState.Builder(context.getState()).visibility(visibility).build());
- }
-
- public String getPageRef()
- {
- return context.getState().getPageRef();
- }
-
- public void setPageRef(String pageRef)
- {
- context.setState(new NodeState.Builder(context.getState()).pageRef(pageRef).build());
- }
-
- public String getResolvedLabel()
- {
- if (resolvedLabel == null)
- {
- String resolvedLabel;
- if (context.getState().getLabel() != null)
- {
- ResourceBundle bundle = owner.navigation.getBundle();
- resolvedLabel = ExpressionUtil.getExpressionValue(bundle, context.getState().getLabel());
- }
- else
- {
- resolvedLabel = null;
- }
-
- //
- if (resolvedLabel == null)
- {
- resolvedLabel = getName();
- }
-
- //
- this.resolvedLabel = resolvedLabel;
- }
- return resolvedLabel;
- }
-
- public String getEncodedResolvedLabel()
- {
- if (encodedResolvedLabel == null)
- {
- encodedResolvedLabel = EntityEncoder.FULL.encode(getResolvedLabel());
- }
- return encodedResolvedLabel;
- }
-
- public UserNode getParent()
- {
- return context.getParentNode();
- }
-
- /**
- * Returns true if the children relationship determined.
- *
- * @return ture if node has children
- */
- public boolean hasChildrenRelationship()
- {
- return context.isExpanded();
- }
-
- /**
- * Returns the number of children.
- *
- * @return the number of children
- */
- public int getChildrenCount()
- {
- return context.getNodeCount();
- }
-
- public int getChildrenSize()
- {
- return context.getNodeSize();
- }
-
- public Collection<UserNode> getChildren()
- {
- return context.isExpanded() ? context.getNodes() : Collections.<UserNode>emptyList();
- }
-
- /**
- * Returns a child by its name or null if the child does not exist or the children relationship has not been loaded.
- *
- * @param childName the child name
- * @return the corresponding user node
- * @throws NullPointerException if the child name is null
- */
- public UserNode getChild(String childName) throws NullPointerException
- {
- if (context.isExpanded())
- {
- return context.getNode(childName);
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Returns a child by its index or null if the children relationship has not been loaded.
- *
- * @param childIndex the child index
- * @return the corresponding user node
- * @throws IndexOutOfBoundsException if the children relationship is loaded and the index is outside of its bounds
- */
- public UserNode getChild(int childIndex) throws IndexOutOfBoundsException
- {
- if (context.isExpanded())
- {
- return context.getNode(childIndex);
- }
- else
- {
- return null;
- }
- }
-
- public void addChild(UserNode child)
- {
- context.add(null, child.context);
- }
-
- public void addChild(int index, UserNode child)
- {
- context.add(index, child.context);
- }
-
- public UserNode addChild(String childName)
- {
- return context.add(null, childName).getNode();
- }
-
- public boolean removeChild(String childName)
- {
- return context.removeNode(childName);
- }
-
- // Keep this internal for now
- UserNode find(String nodeId)
- {
- NodeContext<UserNode> found = context.getDescendant(nodeId);
- return found != null ? found.getNode() : null;
- }
-
- public String toString()
- {
- return toString(1);
- }
-
- public String toString(int depth)
- {
- return context.toString(depth, new StringBuilder("UserNode[")).append("]").toString();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,329 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import org.exoplatform.commons.utils.ExpressionUtil;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.NodeState;
+import org.gatein.common.text.EntityEncoder;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ResourceBundle;
+
+/**
+ * A navigation node as seen by a user.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class UserNode
+{
+
+ /** . */
+ final UserNodeContext owner;
+
+ /** . */
+ final NodeContext<UserNode> context;
+
+ /** . */
+ private String resolvedLabel;
+
+ /** . */
+ private String encodedResolvedLabel;
+
+ /** . */
+ private String uri;
+
+ UserNode(UserNodeContext owner, NodeContext<UserNode> context)
+ {
+ this.owner = owner;
+ this.context = context;
+ this.resolvedLabel = null;
+ this.encodedResolvedLabel = null;
+ this.uri = null;
+ }
+
+ public UserNavigation getNavigation()
+ {
+ return owner.navigation;
+ }
+
+ public String getId()
+ {
+ return context.getId();
+ }
+
+ UserNode filter()
+ {
+ owner.filter(this);
+ return this;
+ }
+
+ public String getName()
+ {
+ return context.getName();
+ }
+
+ public void setName(String name)
+ {
+ context.setName(name);
+ }
+
+ public String getURI()
+ {
+ if (uri == null)
+ {
+ uri = buildURI().toString();
+ }
+ return uri;
+ }
+
+ private StringBuilder buildURI()
+ {
+ UserNode parent = context.getParentNode();
+ if (parent != null)
+ {
+ StringBuilder builder = parent.buildURI();
+ if (builder.length() > 0)
+ {
+ builder.append('/');
+ }
+ return builder.append(context.getName());
+ }
+ else
+ {
+ return new StringBuilder();
+ }
+ }
+
+ public String getLabel()
+ {
+ return context.getState().getLabel();
+ }
+
+ public void setLabel(String label)
+ {
+ this.resolvedLabel = null;
+ this.encodedResolvedLabel = null;
+
+ //
+ context.setState(new NodeState.Builder(context.getState()).label(label).build());
+ }
+
+ public String getIcon()
+ {
+ return context.getState().getIcon();
+ }
+
+ public void setIcon(String icon)
+ {
+ context.setState(new NodeState.Builder(context.getState()).icon(icon).build());
+ }
+
+ public long getStartPublicationTime()
+ {
+ return context.getState().getStartPublicationTime();
+ }
+
+ public void setStartPublicationTime(long startPublicationTime)
+ {
+ context.setState(new NodeState.Builder(context.getState()).startPublicationTime(startPublicationTime).build());
+ }
+
+ public long getEndPublicationTime()
+ {
+ return context.getState().getEndPublicationTime();
+ }
+
+ public void setEndPublicationTime(long endPublicationTime)
+ {
+ context.setState(new NodeState.Builder(context.getState()).endPublicationTime(endPublicationTime).build());
+ }
+
+ public Visibility getVisibility()
+ {
+ return context.getState().getVisibility();
+ }
+
+ public void setVisibility(Visibility visibility)
+ {
+ context.setState(new NodeState.Builder(context.getState()).visibility(visibility).build());
+ }
+
+ public String getPageRef()
+ {
+ return context.getState().getPageRef();
+ }
+
+ public void setPageRef(String pageRef)
+ {
+ context.setState(new NodeState.Builder(context.getState()).pageRef(pageRef).build());
+ }
+
+ public String getResolvedLabel()
+ {
+ if (resolvedLabel == null)
+ {
+ String resolvedLabel;
+ if (context.getState().getLabel() != null)
+ {
+ ResourceBundle bundle = owner.navigation.getBundle();
+ resolvedLabel = ExpressionUtil.getExpressionValue(bundle, context.getState().getLabel());
+ }
+ else
+ {
+ resolvedLabel = null;
+ }
+
+ //
+ if (resolvedLabel == null)
+ {
+ resolvedLabel = getName();
+ }
+
+ //
+ this.resolvedLabel = resolvedLabel;
+ }
+ return resolvedLabel;
+ }
+
+ public String getEncodedResolvedLabel()
+ {
+ if (encodedResolvedLabel == null)
+ {
+ encodedResolvedLabel = EntityEncoder.FULL.encode(getResolvedLabel());
+ }
+ return encodedResolvedLabel;
+ }
+
+ public UserNode getParent()
+ {
+ return context.getParentNode();
+ }
+
+ /**
+ * Returns true if the children relationship determined.
+ *
+ * @return ture if node has children
+ */
+ public boolean hasChildrenRelationship()
+ {
+ return context.isExpanded();
+ }
+
+ /**
+ * Returns the number of children.
+ *
+ * @return the number of children
+ */
+ public int getChildrenCount()
+ {
+ return context.getNodeCount();
+ }
+
+ public int getChildrenSize()
+ {
+ return context.getNodeSize();
+ }
+
+ public Collection<UserNode> getChildren()
+ {
+ return context.isExpanded() ? context.getNodes() : Collections.<UserNode>emptyList();
+ }
+
+ /**
+ * Returns a child by its name or null if the child does not exist or the children relationship has not been loaded.
+ *
+ * @param childName the child name
+ * @return the corresponding user node
+ * @throws NullPointerException if the child name is null
+ */
+ public UserNode getChild(String childName) throws NullPointerException
+ {
+ if (context.isExpanded())
+ {
+ return context.getNode(childName);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns a child by its index or null if the children relationship has not been loaded.
+ *
+ * @param childIndex the child index
+ * @return the corresponding user node
+ * @throws IndexOutOfBoundsException if the children relationship is loaded and the index is outside of its bounds
+ */
+ public UserNode getChild(int childIndex) throws IndexOutOfBoundsException
+ {
+ if (context.isExpanded())
+ {
+ return context.getNode(childIndex);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void addChild(UserNode child)
+ {
+ context.add(null, child.context);
+ }
+
+ public void addChild(int index, UserNode child)
+ {
+ context.add(index, child.context);
+ }
+
+ public UserNode addChild(String childName)
+ {
+ return context.add(null, childName).getNode();
+ }
+
+ public boolean removeChild(String childName)
+ {
+ return context.removeNode(childName);
+ }
+
+ // Keep this internal for now
+ UserNode find(String nodeId)
+ {
+ NodeContext<UserNode> found = context.getDescendant(nodeId);
+ return found != null ? found.getNode() : null;
+ }
+
+ public String toString()
+ {
+ return toString(1);
+ }
+
+ public String toString(int depth)
+ {
+ return context.toString(depth, new StringBuilder("UserNode[")).append("]").toString();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeModel;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-class UserNodeContext implements NodeModel<UserNode>
-{
-
- /** The related navigation. */
- final UserNavigation navigation;
-
- /** . */
- final UserNodeFilterConfig filterConfig;
-
- /** . */
- private UserNodeFilter filter;
-
- UserNodeContext(UserNavigation navigation, UserNodeFilterConfig filterConfig)
- {
- this.filterConfig = filterConfig;
- this.navigation = navigation;
- }
-
- public NodeContext<UserNode> getContext(UserNode node)
- {
- return node.context;
- }
-
- public UserNode create(NodeContext<UserNode> context)
- {
- return new UserNode(this, context);
- }
-
- void filter(UserNode userNode)
- {
- if (filterConfig != null)
- {
- if (filter == null)
- {
- filter = new UserNodeFilter(navigation.portal, filterConfig);
- }
- userNode.context.filter(filter);
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class UserNodeContext implements NodeModel<UserNode>
+{
+
+ /** The related navigation. */
+ final UserNavigation navigation;
+
+ /** . */
+ final UserNodeFilterConfig filterConfig;
+
+ /** . */
+ private UserNodeFilter filter;
+
+ UserNodeContext(UserNavigation navigation, UserNodeFilterConfig filterConfig)
+ {
+ this.filterConfig = filterConfig;
+ this.navigation = navigation;
+ }
+
+ public NodeContext<UserNode> getContext(UserNode node)
+ {
+ return node.context;
+ }
+
+ public UserNode create(NodeContext<UserNode> context)
+ {
+ return new UserNode(this, context);
+ }
+
+ void filter(UserNode userNode)
+ {
+ if (filterConfig != null)
+ {
+ if (filter == null)
+ {
+ filter = new UserNodeFilter(navigation.portal, filterConfig);
+ }
+ userNode.context.filter(filter);
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.mop.navigation.NodeFilter;
-import org.exoplatform.portal.mop.navigation.NodeState;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-class UserNodeFilter implements NodeFilter
-{
-
- /** . */
- private final UserPortalImpl userPortal;
-
- /** . */
- private final UserNodeFilterConfig config;
-
- public UserNodeFilter(UserPortalImpl userPortal, UserNodeFilterConfig config)
- {
- if (userPortal == null)
- {
- throw new NullPointerException();
- }
- if (config == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.userPortal = userPortal;
- this.config = config;
- }
-
- public boolean accept(int depth, String id, String name, NodeState state)
- {
- Visibility visibility = state.getVisibility();
-
- // Correct null -> displayed
- if (visibility == null)
- {
- visibility = Visibility.DISPLAYED;
- }
-
- // If a visibility is specified then we use it
- if (config.visibility != null && !config.visibility.contains(visibility))
- {
- return false;
- }
-
- //
- if (config.authorizationCheck)
- {
- if (visibility == Visibility.SYSTEM)
- {
- UserACL acl = userPortal.acl;
- String userName = userPortal.userName;
- if (!acl.getSuperUser().equals(userName))
- {
- return false;
- }
- }
- else
- {
- String pageRef = state.getPageRef();
- if (pageRef != null)
- {
- UserPortalConfigService upcs = userPortal.service;
- try
- {
- if (upcs.getPage(pageRef, userPortal.userName) == null)
- {
- return false;
- }
- }
- catch (Exception e)
- {
- // Log me
- return false;
- }
- }
- }
- }
-
- // Now make the custom checks
- switch (visibility)
- {
- case SYSTEM:
- break;
- case TEMPORAL:
- if (config.temporalCheck)
- {
- long now = System.currentTimeMillis();
- if (state.getStartPublicationTime() != -1 && now < state.getStartPublicationTime())
- {
- return false;
- }
- if (state.getEndPublicationTime() != -1 && now > state.getEndPublicationTime())
- {
- return false;
- }
- }
- break;
- }
-
- //
- return true;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.NodeState;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class UserNodeFilter implements NodeFilter
+{
+
+ /** . */
+ private final UserPortalImpl userPortal;
+
+ /** . */
+ private final UserNodeFilterConfig config;
+
+ public UserNodeFilter(UserPortalImpl userPortal, UserNodeFilterConfig config)
+ {
+ if (userPortal == null)
+ {
+ throw new NullPointerException();
+ }
+ if (config == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.userPortal = userPortal;
+ this.config = config;
+ }
+
+ public boolean accept(int depth, String id, String name, NodeState state)
+ {
+ Visibility visibility = state.getVisibility();
+
+ // Correct null -> displayed
+ if (visibility == null)
+ {
+ visibility = Visibility.DISPLAYED;
+ }
+
+ // If a visibility is specified then we use it
+ if (config.visibility != null && !config.visibility.contains(visibility))
+ {
+ return false;
+ }
+
+ //
+ if (config.authorizationCheck)
+ {
+ if (visibility == Visibility.SYSTEM)
+ {
+ UserACL acl = userPortal.acl;
+ String userName = userPortal.userName;
+ if (!acl.getSuperUser().equals(userName))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ String pageRef = state.getPageRef();
+ if (pageRef != null)
+ {
+ UserPortalConfigService upcs = userPortal.service;
+ try
+ {
+ if (upcs.getPage(pageRef, userPortal.userName) == null)
+ {
+ return false;
+ }
+ }
+ catch (Exception e)
+ {
+ // Log me
+ return false;
+ }
+ }
+ }
+ }
+
+ // Now make the custom checks
+ switch (visibility)
+ {
+ case SYSTEM:
+ break;
+ case TEMPORAL:
+ if (config.temporalCheck)
+ {
+ long now = System.currentTimeMillis();
+ if (state.getStartPublicationTime() != -1 && now < state.getStartPublicationTime())
+ {
+ return false;
+ }
+ if (state.getEndPublicationTime() != -1 && now > state.getEndPublicationTime())
+ {
+ return false;
+ }
+ }
+ break;
+ }
+
+ //
+ return true;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import org.exoplatform.commons.utils.Safe;
-import org.exoplatform.portal.mop.Visibility;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class UserNodeFilterConfig
-{
-
- /** . */
- final Set<Visibility> visibility;
-
- /** . */
- final boolean authorizationCheck;
-
- /** . */
- final boolean temporalCheck;
-
- public UserNodeFilterConfig(Builder builder)
- {
- if (builder == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.visibility = Safe.unmodifiableSet(builder.withVisibility);
- this.authorizationCheck = builder.withAuthorizationCheck;
- this.temporalCheck = builder.withTemporalCheck;
- }
-
- public Set<Visibility> getVisibility()
- {
- return visibility;
- }
-
- public boolean getAuthorizationCheck()
- {
- return authorizationCheck;
- }
-
- public boolean getTemporalCheck()
- {
- return temporalCheck;
- }
-
- public static Builder builder()
- {
- return new Builder();
- }
-
- public static Builder builder(UserNodeFilterConfig predicate)
- {
- return new Builder(predicate);
- }
-
- public static class Builder
- {
-
- /** . */
- private Set<Visibility> withVisibility = null;
-
- /** . */
- private boolean withAuthorizationCheck = false;
-
- /** . */
- private boolean withTemporalCheck = false;
-
- private Builder()
- {
- this.withVisibility = null;
- this.withAuthorizationCheck = false;
- this.withTemporalCheck = false;
- }
-
- private Builder(UserNodeFilterConfig predicate)
- {
- this.withVisibility = predicate.visibility;
- this.withAuthorizationCheck = predicate.authorizationCheck;
- this.withTemporalCheck = predicate.temporalCheck;
- }
-
- public Builder withVisibility(Visibility first, Visibility... rest)
- {
- withVisibility = EnumSet.of(first, rest);
- return this;
- }
-
- public Builder withVisibility(Visibility first)
- {
- withVisibility = EnumSet.of(first);
- return this;
- }
-
- public Builder withoutVisibility()
- {
- withVisibility = null;
- return this;
- }
-
- public Builder withTemporalCheck()
- {
- this.withTemporalCheck = true;
- return this;
- }
-
- public Builder withoutTemporalCheck()
- {
- this.withTemporalCheck = false;
- return this;
- }
-
- public Builder withAuthorizationCheck()
- {
- this.withAuthorizationCheck = true;
- return this;
- }
-
- public Builder withoutAuthorizationChek()
- {
- this.withAuthorizationCheck = false;
- return this;
- }
-
- public UserNodeFilterConfig build()
- {
- return new UserNodeFilterConfig(this);
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserNodeFilterConfig.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.portal.mop.Visibility;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class UserNodeFilterConfig
+{
+
+ /** . */
+ final Set<Visibility> visibility;
+
+ /** . */
+ final boolean authorizationCheck;
+
+ /** . */
+ final boolean temporalCheck;
+
+ public UserNodeFilterConfig(Builder builder)
+ {
+ if (builder == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.visibility = Safe.unmodifiableSet(builder.withVisibility);
+ this.authorizationCheck = builder.withAuthorizationCheck;
+ this.temporalCheck = builder.withTemporalCheck;
+ }
+
+ public Set<Visibility> getVisibility()
+ {
+ return visibility;
+ }
+
+ public boolean getAuthorizationCheck()
+ {
+ return authorizationCheck;
+ }
+
+ public boolean getTemporalCheck()
+ {
+ return temporalCheck;
+ }
+
+ public static Builder builder()
+ {
+ return new Builder();
+ }
+
+ public static Builder builder(UserNodeFilterConfig predicate)
+ {
+ return new Builder(predicate);
+ }
+
+ public static class Builder
+ {
+
+ /** . */
+ private Set<Visibility> withVisibility = null;
+
+ /** . */
+ private boolean withAuthorizationCheck = false;
+
+ /** . */
+ private boolean withTemporalCheck = false;
+
+ private Builder()
+ {
+ this.withVisibility = null;
+ this.withAuthorizationCheck = false;
+ this.withTemporalCheck = false;
+ }
+
+ private Builder(UserNodeFilterConfig predicate)
+ {
+ this.withVisibility = predicate.visibility;
+ this.withAuthorizationCheck = predicate.authorizationCheck;
+ this.withTemporalCheck = predicate.temporalCheck;
+ }
+
+ public Builder withVisibility(Visibility first, Visibility... rest)
+ {
+ withVisibility = EnumSet.of(first, rest);
+ return this;
+ }
+
+ public Builder withVisibility(Visibility first)
+ {
+ withVisibility = EnumSet.of(first);
+ return this;
+ }
+
+ public Builder withoutVisibility()
+ {
+ withVisibility = null;
+ return this;
+ }
+
+ public Builder withTemporalCheck()
+ {
+ this.withTemporalCheck = true;
+ return this;
+ }
+
+ public Builder withoutTemporalCheck()
+ {
+ this.withTemporalCheck = false;
+ return this;
+ }
+
+ public Builder withAuthorizationCheck()
+ {
+ this.withAuthorizationCheck = true;
+ return this;
+ }
+
+ public Builder withoutAuthorizationChek()
+ {
+ this.withAuthorizationCheck = false;
+ return this;
+ }
+
+ public UserNodeFilterConfig build()
+ {
+ return new UserNodeFilterConfig(this);
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import java.util.List;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.navigation.NavigationServiceException;
-import org.exoplatform.portal.mop.navigation.NodeChangeListener;
-import org.exoplatform.portal.mop.navigation.Scope;
-
-/**
- * The user portal establish the relationship between a user and the portal.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface UserPortal
-{
-
- /**
- * Returns the sorted list of current user navigations.
- *
- * @return the current user navigations
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException any navigation service exception
- */
- List<UserNavigation> getNavigations()
- throws UserPortalException, NavigationServiceException;
-
- /**
- * Returns a user navigation for a specified site key, null is returned when such navigation does not exist.
- *
- * @param key the site key
- * @return the corresponding user navigation
- * @throws NullPointerException when the provided key is null
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException any navigation service exception
- */
- UserNavigation getNavigation(SiteKey key)
- throws NullPointerException, UserPortalException, NavigationServiceException;
-
- /**
- * Load a user node from a specified user navigation with a custom scope.
- * The returned node is the root node of the navigation.
- *
- * @param navigation the user navigation
- * @param scope an optional scope
- * @param filterConfig an optional filter
- * @param listener an optional listener @return the user node
- * @return the user node
- * @throws NullPointerException if the navigation argument is null
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException any navigation service exception
- */
- UserNode getNode(UserNavigation navigation, Scope scope, UserNodeFilterConfig filterConfig, NodeChangeListener<UserNode> listener)
- throws NullPointerException, UserPortalException, NavigationServiceException;
-
- /**
- * Update the specified content with the most recent state.
- *
- * @param node the node to update
- * @param scope the optional scope
- * @param listener an optional listener
- * @throws NullPointerException if the context argument is null
- * @throws IllegalArgumentException if the node has pending changes
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- void updateNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
- throws NullPointerException, IllegalArgumentException, UserPortalException, NavigationServiceException;
-
- /**
- * Rebase the specified context with the most recent state.
- *
- * @param node the user node that will be rebased
- * @param scope the optional scope
- * @param listener the optional node change listener
- * @throws NullPointerException if the context argument is null
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- void rebaseNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
- throws NullPointerException, UserPortalException, NavigationServiceException;
-
- /**
- * Save the specified context to the persistent storage.
- *
- * @param node the user node that will be rebased
- * @param listener the optional node change listener
- * @throws NullPointerException if the node argument is null
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException anything that would prevent the operation to succeed
- */
- void saveNode(UserNode node, NodeChangeListener<UserNode> listener)
- throws NullPointerException, UserPortalException, NavigationServiceException;
-
- /**
- * Returns the user node for the default path.
- *
- * @param filterConfig an optional filter
- * @return the default navigation path
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException any navigation service exception
- */
- UserNode getDefaultPath(UserNodeFilterConfig filterConfig)
- throws UserPortalException, NavigationServiceException;
-
- /**
- * Resolves and returns a node among all user navigations for a specified path.
- *
- * @param filterConfig an optional filter
- * @param path the path
- * @return the navigation path
- * @throws NullPointerException if the navigation or path argument is null
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException any navigation service exception
- */
- UserNode resolvePath(UserNodeFilterConfig filterConfig, String path)
- throws NullPointerException, UserPortalException, NavigationServiceException;
-
- /**
- * Resolves and returns a node for the specified navigation and for a specified path.
- *
- * @param navigation the navigation
- * @param filterConfig an optional filter
- * @param path the path @return the navigation path
- * @return the navigation path
- * @throws NullPointerException if the navigation or path argument is null
- * @throws UserPortalException any user portal exception
- * @throws NavigationServiceException any navigation service exception
- */
- UserNode resolvePath(UserNavigation navigation, UserNodeFilterConfig filterConfig, String path)
- throws NullPointerException, UserPortalException, NavigationServiceException;
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortal.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import java.util.List;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.navigation.NodeChangeListener;
+import org.exoplatform.portal.mop.navigation.Scope;
+
+/**
+ * The user portal establish the relationship between a user and the portal.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface UserPortal
+{
+
+ /**
+ * Returns the sorted list of current user navigations.
+ *
+ * @return the current user navigations
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException any navigation service exception
+ */
+ List<UserNavigation> getNavigations()
+ throws UserPortalException, NavigationServiceException;
+
+ /**
+ * Returns a user navigation for a specified site key, null is returned when such navigation does not exist.
+ *
+ * @param key the site key
+ * @return the corresponding user navigation
+ * @throws NullPointerException when the provided key is null
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException any navigation service exception
+ */
+ UserNavigation getNavigation(SiteKey key)
+ throws NullPointerException, UserPortalException, NavigationServiceException;
+
+ /**
+ * Load a user node from a specified user navigation with a custom scope.
+ * The returned node is the root node of the navigation.
+ *
+ * @param navigation the user navigation
+ * @param scope an optional scope
+ * @param filterConfig an optional filter
+ * @param listener an optional listener @return the user node
+ * @return the user node
+ * @throws NullPointerException if the navigation argument is null
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException any navigation service exception
+ */
+ UserNode getNode(UserNavigation navigation, Scope scope, UserNodeFilterConfig filterConfig, NodeChangeListener<UserNode> listener)
+ throws NullPointerException, UserPortalException, NavigationServiceException;
+
+ /**
+ * Update the specified content with the most recent state.
+ *
+ * @param node the node to update
+ * @param scope the optional scope
+ * @param listener an optional listener
+ * @throws NullPointerException if the context argument is null
+ * @throws IllegalArgumentException if the node has pending changes
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ void updateNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
+ throws NullPointerException, IllegalArgumentException, UserPortalException, NavigationServiceException;
+
+ /**
+ * Rebase the specified context with the most recent state.
+ *
+ * @param node the user node that will be rebased
+ * @param scope the optional scope
+ * @param listener the optional node change listener
+ * @throws NullPointerException if the context argument is null
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ void rebaseNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
+ throws NullPointerException, UserPortalException, NavigationServiceException;
+
+ /**
+ * Save the specified context to the persistent storage.
+ *
+ * @param node the user node that will be rebased
+ * @param listener the optional node change listener
+ * @throws NullPointerException if the node argument is null
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException anything that would prevent the operation to succeed
+ */
+ void saveNode(UserNode node, NodeChangeListener<UserNode> listener)
+ throws NullPointerException, UserPortalException, NavigationServiceException;
+
+ /**
+ * Returns the user node for the default path.
+ *
+ * @param filterConfig an optional filter
+ * @return the default navigation path
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException any navigation service exception
+ */
+ UserNode getDefaultPath(UserNodeFilterConfig filterConfig)
+ throws UserPortalException, NavigationServiceException;
+
+ /**
+ * Resolves and returns a node among all user navigations for a specified path.
+ *
+ * @param filterConfig an optional filter
+ * @param path the path
+ * @return the navigation path
+ * @throws NullPointerException if the navigation or path argument is null
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException any navigation service exception
+ */
+ UserNode resolvePath(UserNodeFilterConfig filterConfig, String path)
+ throws NullPointerException, UserPortalException, NavigationServiceException;
+
+ /**
+ * Resolves and returns a node for the specified navigation and for a specified path.
+ *
+ * @param navigation the navigation
+ * @param filterConfig an optional filter
+ * @param path the path @return the navigation path
+ * @return the navigation path
+ * @throws NullPointerException if the navigation or path argument is null
+ * @throws UserPortalException any user portal exception
+ * @throws NavigationServiceException any navigation service exception
+ */
+ UserNode resolvePath(UserNavigation navigation, UserNodeFilterConfig filterConfig, String path)
+ throws NullPointerException, UserPortalException, NavigationServiceException;
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import java.util.ResourceBundle;
-
-/**
- * The context of a user within its portal.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface UserPortalContext
-{
-
- /**
- * Provide an opportunity to use a resource bundle for a specified navigation. It no such bundle can be found then null
- * can be returned.
- *
- * @param navigation the navigation that will be localized
- * @return the resource bundle to use
- */
- ResourceBundle getBundle(UserNavigation navigation);
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import java.util.ResourceBundle;
+
+/**
+ * The context of a user within its portal.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface UserPortalContext
+{
+
+ /**
+ * Provide an opportunity to use a resource bundle for a specified navigation. It no such bundle can be found then null
+ * can be returned.
+ *
+ * @param navigation the navigation that will be localized
+ * @return the resource bundle to use
+ */
+ ResourceBundle getBundle(UserNavigation navigation);
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class UserPortalException extends RuntimeException
-{
-
- public UserPortalException()
- {
- }
-
- public UserPortalException(String message)
- {
- super(message);
- }
-
- public UserPortalException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public UserPortalException(Throwable cause)
- {
- super(cause);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalException.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class UserPortalException extends RuntimeException
+{
+
+ public UserPortalException()
+ {
+ }
+
+ public UserPortalException(String message)
+ {
+ super(message);
+ }
+
+ public UserPortalException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public UserPortalException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,441 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.SiteType;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.NavigationServiceException;
-import org.exoplatform.portal.mop.navigation.NodeChangeListener;
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeContextChangeAdapter;
-import org.exoplatform.portal.mop.navigation.NodeState;
-import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.mop.navigation.VisitMode;
-import org.exoplatform.services.organization.Group;
-import org.exoplatform.services.organization.OrganizationService;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class UserPortalImpl implements UserPortal
-{
-
- /**
- * A context that always return null.
- */
- private static final UserPortalContext NULL_CONTEXT = new UserPortalContext()
- {
- public ResourceBundle getBundle(UserNavigation navigation)
- {
- return null;
- }
- };
-
- /** . */
- final UserPortalConfigService service;
-
- /** . */
- final NavigationService navigationService;
-
- /** . */
- private final OrganizationService organizationService;
-
- /** . */
- final UserACL acl;
-
- /** . */
- private final PortalConfig portal;
-
- /** . */
- final UserPortalContext context;
-
- /** . */
- final String userName;
-
- /** . */
- private List<UserNavigation> navigations;
-
- /** . */
- private final String portalName;
-
- public UserPortalImpl(
- UserPortalConfigService service,
- NavigationService navigationService,
- OrganizationService organizationService,
- UserACL acl,
- String portalName,
- PortalConfig portal,
- String userName,
- UserPortalContext context)
- {
- // So we don't care about testing nullity
- if (context == null)
- {
- context = NULL_CONTEXT;
- }
-
- //
- this.service = service;
- this.navigationService = navigationService;
- this.organizationService = organizationService;
- this.acl = acl;
- this.portalName = portalName;
- this.portal = portal;
- this.userName = userName;
- this.context = context;
- this.navigations = null;
- }
- /**
- * Returns an immutable sorted list of the valid navigations related to the user.
- *
- * @return the navigations
- * @throws UserPortalException any user portal exception
- */
- public List<UserNavigation> getNavigations() throws UserPortalException, NavigationServiceException
- {
- if (navigations == null)
- {
- List<UserNavigation> navigations = new ArrayList<UserNavigation>(userName == null ? 1 : 10);
- NavigationContext portalNav = navigationService.loadNavigation(new SiteKey(SiteType.PORTAL, portalName));
- if (portalNav != null && portalNav.getState() != null)
- {
- navigations.add(new UserNavigation(this, portalNav, acl.hasEditPermission(portal)));
- }
- //
- if (userName != null)
- {
- // Add user nav if any
- NavigationContext userNavigation = navigationService.loadNavigation(SiteKey.user(userName));
- if (userNavigation != null && userNavigation.getState() != null)
- {
- navigations.add(new UserNavigation(this, userNavigation, true));
- }
-
- //
- Collection<?> groups;
- try
- {
- if (acl.getSuperUser().equals(userName))
- {
- groups = organizationService.getGroupHandler().getAllGroups();
- }
- else
- {
- groups = organizationService.getGroupHandler().findGroupsOfUser(userName);
- }
- }
- catch (Exception e)
- {
- throw new UserPortalException("Could not retrieve groups", e);
- }
-
- //
- for (Object group : groups)
- {
- Group m = (Group)group;
- String groupId = m.getId().trim();
- if (!groupId.equals(acl.getGuestsGroup()))
- {
- NavigationContext groupNavigation = navigationService.loadNavigation(SiteKey.group(groupId));
- if (groupNavigation != null && groupNavigation.getState() != null)
- {
- navigations.add(new UserNavigation(
- this,
- groupNavigation,
- acl.hasEditPermissionOnNavigation(groupNavigation.getKey())));
- }
- }
- }
-
- // Sort the list finally
- Collections.sort(navigations, new Comparator<UserNavigation>()
- {
- public int compare(UserNavigation nav1, UserNavigation nav2)
- {
- return nav1.getPriority() - nav2.getPriority();
- }
- });
- }
-
- //
- this.navigations = Collections.unmodifiableList(navigations);
- }
- return navigations;
- }
-
- public UserNavigation getNavigation(SiteKey key) throws NullPointerException, UserPortalException, NavigationServiceException
- {
- if (key == null)
- {
- throw new NullPointerException("No null key accepted");
- }
- for (UserNavigation navigation : getNavigations())
- {
- if (navigation.getKey().equals(key))
- {
- return navigation;
- }
- }
-
- //
- return null;
- }
-
- public UserNode getNode(
- UserNavigation userNavigation,
- Scope scope,
- UserNodeFilterConfig filterConfig,
- NodeChangeListener<UserNode> listener) throws NullPointerException, UserPortalException, NavigationServiceException
- {
- UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
- NodeContext<UserNode> nodeContext = navigationService.loadNode(context, userNavigation.navigation, scope, NodeContextChangeAdapter.safeWrap(listener));
- if (nodeContext != null)
- {
- return nodeContext.getNode().filter();
- }
- else
- {
- return null;
- }
- }
-
- public void updateNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
- throws NullPointerException, IllegalArgumentException, UserPortalException, NavigationServiceException
- {
- if (node == null)
- {
- throw new NullPointerException("No null node accepted");
- }
- navigationService.updateNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
- node.filter();
- }
-
- public void rebaseNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
- throws NullPointerException, IllegalArgumentException, UserPortalException, NavigationServiceException
- {
- if (node == null)
- {
- throw new NullPointerException("No null node accepted");
- }
- navigationService.rebaseNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
- node.filter();
- }
-
- public void saveNode(UserNode node, NodeChangeListener<UserNode> listener) throws NullPointerException, UserPortalException, NavigationServiceException
- {
- if (node == null)
- {
- throw new NullPointerException("No null node accepted");
- }
- navigationService.saveNode(node.context, NodeContextChangeAdapter.safeWrap(listener));
- node.filter();
- }
-
- private class MatchingScope implements Scope
- {
- final UserNavigation userNavigation;
- final UserNodeFilterConfig filterConfig;
- final String[] match;
- int score;
- String id;
- UserNode userNode;
-
- MatchingScope(UserNavigation userNavigation, UserNodeFilterConfig filterConfig, String[] match)
- {
- this.userNavigation = userNavigation;
- this.filterConfig = filterConfig;
- this.match = match;
- }
-
- void resolve() throws NavigationServiceException
- {
- UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
- NodeContext<UserNode> nodeContext = navigationService.loadNode(context, userNavigation.navigation, this, null);
- if (context != null)
- {
- if (score > 0)
- {
- userNode = nodeContext.getNode().filter().find(id);
- }
- }
- }
-
- public Visitor get()
- {
- return new Visitor()
- {
- public VisitMode enter(int depth, String id, String name, NodeState state)
- {
- if (depth == 0 && "default".equals(name))
- {
- score = 0;
- MatchingScope.this.id = null;
- return VisitMode.ALL_CHILDREN;
- }
- else if (depth <= match.length && name.equals(match[depth - 1]))
- {
- score++;
- MatchingScope.this.id = id;
- return VisitMode.ALL_CHILDREN;
- }
- else
- {
- return VisitMode.NO_CHILDREN;
- }
- }
-
- public void leave(int depth, String id, String name, NodeState state)
- {
- }
- };
- }
- }
-
- public UserNode getDefaultPath(UserNodeFilterConfig filterConfig) throws UserPortalException, NavigationServiceException
- {
- for (UserNavigation userNavigation : getNavigations())
- {
- NavigationContext navigation = userNavigation.navigation;
- if (navigation.getState() != null)
- {
- UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
- NodeContext<UserNode> nodeContext = navigationService.loadNode(context, navigation, Scope.CHILDREN, null);
- if (nodeContext != null)
- {
- UserNode root = nodeContext.getNode().filter();
- for (UserNode node : root.getChildren())
- {
- return node;
- }
- }
- }
- }
-
- //
- return null;
- }
-
- public UserNode resolvePath(UserNodeFilterConfig filterConfig, String path)
- throws NullPointerException, UserPortalException, NavigationServiceException
- {
- if (path == null)
- {
- throw new NullPointerException("No null path accepted");
- }
-
- // Parse path
- String[] segments = Utils.parsePath(path);
-
- // Find the first navigation available or return null
- if (segments == null)
- {
- return getDefaultPath(null);
- }
-
- // Get navigations
- List<UserNavigation> navigations = getNavigations();
-
- //
- MatchingScope best = null;
- for (UserNavigation navigation : navigations)
- {
- MatchingScope scope = new MatchingScope(navigation, filterConfig, segments);
- scope.resolve();
- if (scope.score == segments.length)
- {
- best = scope;
- break;
- }
- else
- {
- if (best == null)
- {
- best = scope;
- }
- else
- {
- if (scope.score > best.score)
- {
- best = scope;
- }
- }
- }
- }
-
- //
- if (best != null && best.score > 0)
- {
- return best.userNode;
- }
- else
- {
- return getDefaultPath(null);
- }
- }
-
- public UserNode resolvePath(UserNavigation navigation, UserNodeFilterConfig filterConfig, String path)
- throws NullPointerException, UserPortalException, NavigationServiceException
- {
- if (navigation == null)
- {
- throw new NullPointerException("No null navigation accepted");
- }
- if (path == null)
- {
- throw new NullPointerException("No null path accepted");
- }
-
- //
- String[] segments = Utils.parsePath(path);
-
- //
- if (segments == null)
- {
- return null;
- }
-
- //
- MatchingScope scope = new MatchingScope(navigation, filterConfig, segments);
- scope.resolve();
-
- //
- if (scope.score > 0)
- {
- return scope.userNode;
- }
- else
- {
- return null;
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/UserPortalImpl.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,441 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.navigation.NodeChangeListener;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeContextChangeAdapter;
+import org.exoplatform.portal.mop.navigation.NodeState;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.navigation.VisitMode;
+import org.exoplatform.services.organization.Group;
+import org.exoplatform.services.organization.OrganizationService;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class UserPortalImpl implements UserPortal
+{
+
+ /**
+ * A context that always return null.
+ */
+ private static final UserPortalContext NULL_CONTEXT = new UserPortalContext()
+ {
+ public ResourceBundle getBundle(UserNavigation navigation)
+ {
+ return null;
+ }
+ };
+
+ /** . */
+ final UserPortalConfigService service;
+
+ /** . */
+ final NavigationService navigationService;
+
+ /** . */
+ private final OrganizationService organizationService;
+
+ /** . */
+ final UserACL acl;
+
+ /** . */
+ private final PortalConfig portal;
+
+ /** . */
+ final UserPortalContext context;
+
+ /** . */
+ final String userName;
+
+ /** . */
+ private List<UserNavigation> navigations;
+
+ /** . */
+ private final String portalName;
+
+ public UserPortalImpl(
+ UserPortalConfigService service,
+ NavigationService navigationService,
+ OrganizationService organizationService,
+ UserACL acl,
+ String portalName,
+ PortalConfig portal,
+ String userName,
+ UserPortalContext context)
+ {
+ // So we don't care about testing nullity
+ if (context == null)
+ {
+ context = NULL_CONTEXT;
+ }
+
+ //
+ this.service = service;
+ this.navigationService = navigationService;
+ this.organizationService = organizationService;
+ this.acl = acl;
+ this.portalName = portalName;
+ this.portal = portal;
+ this.userName = userName;
+ this.context = context;
+ this.navigations = null;
+ }
+ /**
+ * Returns an immutable sorted list of the valid navigations related to the user.
+ *
+ * @return the navigations
+ * @throws UserPortalException any user portal exception
+ */
+ public List<UserNavigation> getNavigations() throws UserPortalException, NavigationServiceException
+ {
+ if (navigations == null)
+ {
+ List<UserNavigation> navigations = new ArrayList<UserNavigation>(userName == null ? 1 : 10);
+ NavigationContext portalNav = navigationService.loadNavigation(new SiteKey(SiteType.PORTAL, portalName));
+ if (portalNav != null && portalNav.getState() != null)
+ {
+ navigations.add(new UserNavigation(this, portalNav, acl.hasEditPermission(portal)));
+ }
+ //
+ if (userName != null)
+ {
+ // Add user nav if any
+ NavigationContext userNavigation = navigationService.loadNavigation(SiteKey.user(userName));
+ if (userNavigation != null && userNavigation.getState() != null)
+ {
+ navigations.add(new UserNavigation(this, userNavigation, true));
+ }
+
+ //
+ Collection<?> groups;
+ try
+ {
+ if (acl.getSuperUser().equals(userName))
+ {
+ groups = organizationService.getGroupHandler().getAllGroups();
+ }
+ else
+ {
+ groups = organizationService.getGroupHandler().findGroupsOfUser(userName);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new UserPortalException("Could not retrieve groups", e);
+ }
+
+ //
+ for (Object group : groups)
+ {
+ Group m = (Group)group;
+ String groupId = m.getId().trim();
+ if (!groupId.equals(acl.getGuestsGroup()))
+ {
+ NavigationContext groupNavigation = navigationService.loadNavigation(SiteKey.group(groupId));
+ if (groupNavigation != null && groupNavigation.getState() != null)
+ {
+ navigations.add(new UserNavigation(
+ this,
+ groupNavigation,
+ acl.hasEditPermissionOnNavigation(groupNavigation.getKey())));
+ }
+ }
+ }
+
+ // Sort the list finally
+ Collections.sort(navigations, new Comparator<UserNavigation>()
+ {
+ public int compare(UserNavigation nav1, UserNavigation nav2)
+ {
+ return nav1.getPriority() - nav2.getPriority();
+ }
+ });
+ }
+
+ //
+ this.navigations = Collections.unmodifiableList(navigations);
+ }
+ return navigations;
+ }
+
+ public UserNavigation getNavigation(SiteKey key) throws NullPointerException, UserPortalException, NavigationServiceException
+ {
+ if (key == null)
+ {
+ throw new NullPointerException("No null key accepted");
+ }
+ for (UserNavigation navigation : getNavigations())
+ {
+ if (navigation.getKey().equals(key))
+ {
+ return navigation;
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public UserNode getNode(
+ UserNavigation userNavigation,
+ Scope scope,
+ UserNodeFilterConfig filterConfig,
+ NodeChangeListener<UserNode> listener) throws NullPointerException, UserPortalException, NavigationServiceException
+ {
+ UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
+ NodeContext<UserNode> nodeContext = navigationService.loadNode(context, userNavigation.navigation, scope, NodeContextChangeAdapter.safeWrap(listener));
+ if (nodeContext != null)
+ {
+ return nodeContext.getNode().filter();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void updateNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
+ throws NullPointerException, IllegalArgumentException, UserPortalException, NavigationServiceException
+ {
+ if (node == null)
+ {
+ throw new NullPointerException("No null node accepted");
+ }
+ navigationService.updateNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
+ node.filter();
+ }
+
+ public void rebaseNode(UserNode node, Scope scope, NodeChangeListener<UserNode> listener)
+ throws NullPointerException, IllegalArgumentException, UserPortalException, NavigationServiceException
+ {
+ if (node == null)
+ {
+ throw new NullPointerException("No null node accepted");
+ }
+ navigationService.rebaseNode(node.context, scope, NodeContextChangeAdapter.safeWrap(listener));
+ node.filter();
+ }
+
+ public void saveNode(UserNode node, NodeChangeListener<UserNode> listener) throws NullPointerException, UserPortalException, NavigationServiceException
+ {
+ if (node == null)
+ {
+ throw new NullPointerException("No null node accepted");
+ }
+ navigationService.saveNode(node.context, NodeContextChangeAdapter.safeWrap(listener));
+ node.filter();
+ }
+
+ private class MatchingScope implements Scope
+ {
+ final UserNavigation userNavigation;
+ final UserNodeFilterConfig filterConfig;
+ final String[] match;
+ int score;
+ String id;
+ UserNode userNode;
+
+ MatchingScope(UserNavigation userNavigation, UserNodeFilterConfig filterConfig, String[] match)
+ {
+ this.userNavigation = userNavigation;
+ this.filterConfig = filterConfig;
+ this.match = match;
+ }
+
+ void resolve() throws NavigationServiceException
+ {
+ UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
+ NodeContext<UserNode> nodeContext = navigationService.loadNode(context, userNavigation.navigation, this, null);
+ if (context != null)
+ {
+ if (score > 0)
+ {
+ userNode = nodeContext.getNode().filter().find(id);
+ }
+ }
+ }
+
+ public Visitor get()
+ {
+ return new Visitor()
+ {
+ public VisitMode enter(int depth, String id, String name, NodeState state)
+ {
+ if (depth == 0 && "default".equals(name))
+ {
+ score = 0;
+ MatchingScope.this.id = null;
+ return VisitMode.ALL_CHILDREN;
+ }
+ else if (depth <= match.length && name.equals(match[depth - 1]))
+ {
+ score++;
+ MatchingScope.this.id = id;
+ return VisitMode.ALL_CHILDREN;
+ }
+ else
+ {
+ return VisitMode.NO_CHILDREN;
+ }
+ }
+
+ public void leave(int depth, String id, String name, NodeState state)
+ {
+ }
+ };
+ }
+ }
+
+ public UserNode getDefaultPath(UserNodeFilterConfig filterConfig) throws UserPortalException, NavigationServiceException
+ {
+ for (UserNavigation userNavigation : getNavigations())
+ {
+ NavigationContext navigation = userNavigation.navigation;
+ if (navigation.getState() != null)
+ {
+ UserNodeContext context = new UserNodeContext(userNavigation, filterConfig);
+ NodeContext<UserNode> nodeContext = navigationService.loadNode(context, navigation, Scope.CHILDREN, null);
+ if (nodeContext != null)
+ {
+ UserNode root = nodeContext.getNode().filter();
+ for (UserNode node : root.getChildren())
+ {
+ return node;
+ }
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public UserNode resolvePath(UserNodeFilterConfig filterConfig, String path)
+ throws NullPointerException, UserPortalException, NavigationServiceException
+ {
+ if (path == null)
+ {
+ throw new NullPointerException("No null path accepted");
+ }
+
+ // Parse path
+ String[] segments = Utils.parsePath(path);
+
+ // Find the first navigation available or return null
+ if (segments == null)
+ {
+ return getDefaultPath(null);
+ }
+
+ // Get navigations
+ List<UserNavigation> navigations = getNavigations();
+
+ //
+ MatchingScope best = null;
+ for (UserNavigation navigation : navigations)
+ {
+ MatchingScope scope = new MatchingScope(navigation, filterConfig, segments);
+ scope.resolve();
+ if (scope.score == segments.length)
+ {
+ best = scope;
+ break;
+ }
+ else
+ {
+ if (best == null)
+ {
+ best = scope;
+ }
+ else
+ {
+ if (scope.score > best.score)
+ {
+ best = scope;
+ }
+ }
+ }
+ }
+
+ //
+ if (best != null && best.score > 0)
+ {
+ return best.userNode;
+ }
+ else
+ {
+ return getDefaultPath(null);
+ }
+ }
+
+ public UserNode resolvePath(UserNavigation navigation, UserNodeFilterConfig filterConfig, String path)
+ throws NullPointerException, UserPortalException, NavigationServiceException
+ {
+ if (navigation == null)
+ {
+ throw new NullPointerException("No null navigation accepted");
+ }
+ if (path == null)
+ {
+ throw new NullPointerException("No null path accepted");
+ }
+
+ //
+ String[] segments = Utils.parsePath(path);
+
+ //
+ if (segments == null)
+ {
+ return null;
+ }
+
+ //
+ MatchingScope scope = new MatchingScope(navigation, filterConfig, segments);
+ scope.resolve();
+
+ //
+ if (scope.score > 0)
+ {
+ return scope.userNode;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-/**
- * A set of utils for this package.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-class Utils
-{
-
- /**
- * Parse the path with the following algorithm:
- *
- * <ul>
- * <li>The one char <code>/</code> string returns the null array</li>
- * <li>Any leading <code>/<code> char is ommited</li>
- * <li>Any trailing </code>/</code> chars are ommited</li>
- * <li>All the substrings obtained by slicing the remaining string by the <code>/</code> char are returned
- * as an array, even the empty strings</li>
- * </ul>
- *
- * <p>Note that this is a reimplementation of a previous method that was using regex splitting, this reimplementation
- * was done in order to minimize the created object count in mind and attempt to create the minimum required.</p>
- *
- * @param path the path
- * @return the parse result
- * @throws NullPointerException if the path argument is null
- */
- static String[] parsePath(String path) throws NullPointerException
- {
- // Where we start
- final int start = 0 < path.length() && path.charAt(0) == '/' ? 1 : 0;
-
- //
- if (start == path.length())
- {
- return null;
- }
-
- // Where we end
- int end = path.length();
- while (end > start && path.charAt(end - 1) == '/')
- {
- end--;
- }
-
-
- // Count the number of slash
- int count = 0;
- int i = start;
- while (true)
- {
- int pos = path.indexOf('/', i);
- if (pos == -1)
- {
- pos = end;
- }
- if (pos == end)
- {
- if (pos > i)
- {
- count++;
- }
- break;
- }
- else
- {
- count++;
- i = pos + 1;
- }
- }
-
- // Now fill the array
- String[] names = new String[count];
- i = start;
- int index = 0;
- while (true)
- {
- int pos = path.indexOf('/', i);
- if (pos == -1)
- {
- pos = end;
- }
- if (pos == end)
- {
- if (pos > i)
- {
- names[index] = path.substring(i, end);
- }
- break;
- }
- else
- {
- if (i < pos)
- {
- names[index++] = path.substring(i, pos);
- }
- else
- {
- names[index++] = "";
- }
- i = pos + 1;
- }
- }
-
- //
- return names;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/mop/user/Utils.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+/**
+ * A set of utils for this package.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+class Utils
+{
+
+ /**
+ * Parse the path with the following algorithm:
+ *
+ * <ul>
+ * <li>The one char <code>/</code> string returns the null array</li>
+ * <li>Any leading <code>/<code> char is ommited</li>
+ * <li>Any trailing </code>/</code> chars are ommited</li>
+ * <li>All the substrings obtained by slicing the remaining string by the <code>/</code> char are returned
+ * as an array, even the empty strings</li>
+ * </ul>
+ *
+ * <p>Note that this is a reimplementation of a previous method that was using regex splitting, this reimplementation
+ * was done in order to minimize the created object count in mind and attempt to create the minimum required.</p>
+ *
+ * @param path the path
+ * @return the parse result
+ * @throws NullPointerException if the path argument is null
+ */
+ static String[] parsePath(String path) throws NullPointerException
+ {
+ // Where we start
+ final int start = 0 < path.length() && path.charAt(0) == '/' ? 1 : 0;
+
+ //
+ if (start == path.length())
+ {
+ return null;
+ }
+
+ // Where we end
+ int end = path.length();
+ while (end > start && path.charAt(end - 1) == '/')
+ {
+ end--;
+ }
+
+
+ // Count the number of slash
+ int count = 0;
+ int i = start;
+ while (true)
+ {
+ int pos = path.indexOf('/', i);
+ if (pos == -1)
+ {
+ pos = end;
+ }
+ if (pos == end)
+ {
+ if (pos > i)
+ {
+ count++;
+ }
+ break;
+ }
+ else
+ {
+ count++;
+ i = pos + 1;
+ }
+ }
+
+ // Now fill the array
+ String[] names = new String[count];
+ i = start;
+ int index = 0;
+ while (true)
+ {
+ int pos = path.indexOf('/', i);
+ if (pos == -1)
+ {
+ pos = end;
+ }
+ if (pos == end)
+ {
+ if (pos > i)
+ {
+ names[index] = path.substring(i, end);
+ }
+ break;
+ }
+ else
+ {
+ if (i < pos)
+ {
+ names[index++] = path.substring(i, pos);
+ }
+ else
+ {
+ names[index++] = "";
+ }
+ i = pos + 1;
+ }
+ }
+
+ //
+ return names;
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -36,20 +36,28 @@
public <V> V execute(POMSession session, POMTask<V> task) throws Exception
{
- String s = task.toString();
- long t0 = System.currentTimeMillis();
- V v = session.execute(task);
- long t1 = System.currentTimeMillis();
- String t = "" + (t1 - t0);
- if (t.length() < 4)
+ if (log.isDebugEnabled())
{
- t = padding[t.length()] + t;
- log.debug("Executed [" + t + "] " + s + "");
+ String s = task.toString();
+ log.debug("Executing " + s + "");
+ long t0 = System.currentTimeMillis();
+ V v = session.execute(task);
+ long t1 = System.currentTimeMillis();
+ String t = "" + (t1 - t0);
+ if (t.length() < 4)
+ {
+ t = padding[t.length()] + t;
+ log.debug("Executed [" + t + "] " + s + "");
+ }
+ else
+ {
+ log.debug("Executed in " + t + " " + s + "");
+ }
+ return v;
}
else
{
- log.debug("Executed in " + t + " " + s + "");
+ return session.execute(task);
}
- return v;
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -27,6 +27,7 @@
import org.chromattic.api.ChromatticSession;
import org.exoplatform.commons.utils.IOUtil;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
@@ -39,7 +40,7 @@
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.tasks.DashboardTask;
-import org.exoplatform.portal.pom.config.tasks.PageNavigationTask;
+import org.exoplatform.portal.pom.config.tasks.MOPAccess;
import org.exoplatform.portal.pom.config.tasks.PageTask;
import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
import org.exoplatform.portal.pom.config.tasks.PortletPreferencesTask;
@@ -49,8 +50,6 @@
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.data.ModelData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
-import org.exoplatform.portal.pom.data.NavigationData;
-import org.exoplatform.portal.pom.data.NavigationKey;
import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalData;
@@ -125,26 +124,6 @@
return task.getChanges();
}
- public NavigationData getPageNavigation(NavigationKey key) throws Exception
- {
- return pomMgr.execute(new PageNavigationTask.Load(key));
- }
-
- public void save(NavigationData navigation) throws Exception
- {
- pomMgr.execute(new PageNavigationTask.Save(navigation, true));
- }
-
- public void create(NavigationData navigation) throws Exception
- {
- pomMgr.execute(new PageNavigationTask.Save(navigation, false));
- }
-
- public void remove(NavigationData navigation) throws Exception
- {
- pomMgr.execute(new PageNavigationTask.Remove(navigation));
- }
-
public void save(PortletPreferences portletPreferences) throws Exception
{
pomMgr.execute(new PortletPreferencesTask.Save(portletPreferences));
@@ -237,12 +216,31 @@
Class<T> type = q.getClassType();
if (PageData.class.equals(type))
{
- return (LazyPageList<T>)pomMgr.execute(new SearchTask.FindPage((Query<PageData>)q));
+ ListAccess<PageData> pageAccess;
+ try
+ {
+ pageAccess = new MOPAccess.PageAccess(pomMgr, (Query<PageData>)q);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pageAccess = new ListAccess<PageData>()
+ {
+ @Override
+ public PageData[] load(int index, int length) throws Exception, IllegalArgumentException
+ {
+ return new PageData[0];
+ }
+
+ @Override
+ public int getSize() throws Exception
+ {
+ return 0;
+ }
+
+ };
+ }
+ return (LazyPageList<T>)new LazyPageList<PageData>(pageAccess, 10);
}
- else if (NavigationData.class.equals(type))
- {
- return (LazyPageList<T>)pomMgr.execute(new SearchTask.FindNavigation((Query<NavigationData>)q));
- }
else if (PortletPreferences.class.equals(type))
{
return (LazyPageList<T>)pomMgr.execute(new SearchTask.FindPortletPreferences((Query<PortletPreferences>)q));
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -22,6 +22,7 @@
import org.chromattic.api.ChromatticSession;
import org.chromattic.api.UndeclaredRepositoryException;
import org.chromattic.ext.format.BaseEncodingObjectFormatter;
+import org.chromattic.api.query.QueryResult;
import org.exoplatform.commons.chromattic.SessionContext;
import org.exoplatform.commons.chromattic.SynchronizationListener;
import org.exoplatform.commons.chromattic.SynchronizationStatus;
@@ -43,7 +44,6 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -249,8 +249,13 @@
private static final BaseEncodingObjectFormatter formatter = new BaseEncodingObjectFormatter();
- public <O extends WorkspaceObject> Iterator<O> findObjects(ObjectType<O> type, ObjectType<? extends Site> siteType,
- String ownerId, String title)
+ public <O extends WorkspaceObject> QueryResult<O> findObjects(
+ ObjectType<O> type,
+ ObjectType<Site> siteType,
+ String ownerId,
+ String title,
+ int offset,
+ int limit)
{
this.save();
//
@@ -292,37 +297,8 @@
//
String statement;
- if (siteType != null)
+ try
{
- try
- {
- if (type == ObjectType.PAGE)
- {
- statement =
- "jcr:path LIKE '" + workspaceChunk + "/" + ownerTypeChunk + "/" + ownerIdChunk
- + "/mop:rootpage/mop:children/mop:pages/mop:children/%'";
- }
- else
- {
- statement =
- "jcr:path LIKE '" + workspaceChunk + "/" + ownerTypeChunk + "/" + ownerIdChunk
- + "/mop:rootnavigation/mop:children/mop:default'";
- }
- }
- catch (IllegalArgumentException e)
- {
- if (type == ObjectType.PAGE)
- {
- statement = "jcr:path LIKE ''";
- }
- else
- {
- statement = "jcr:path LIKE ''";
- }
- }
- }
- else
- {
if (title != null)
{
title = Utils.queryEscape(title);
@@ -355,21 +331,22 @@
}
}
}
-
- // Temporary work around, to fix in MOP and then remove
- ChromatticSession session;
- try
+ catch (IllegalArgumentException e)
{
- Field f = ModelImpl.class.getDeclaredField("session");
- f.setAccessible(true);
- session = (ChromatticSession)f.get(model);
+ if (type == ObjectType.PAGE)
+ {
+ statement = "jcr:path LIKE ''";
+ }
+ else
+ {
+ statement = "jcr:path LIKE ''";
+ }
}
- catch (Exception e)
- {
- throw new Error(e);
- }
+
+ // Temporary work around, to fix in MOP and then remove
+ ChromatticSession session = context.getSession();
Class<O> mappedClass = (Class<O>)mapping.get(type);
- return session.createQueryBuilder(mappedClass).where(statement).get().objects();
+ return session.createQueryBuilder(mappedClass).where(statement).get().objects((long)offset, (long)limit);
}
private final SynchronizationListener listener = new SynchronizationListener()
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -77,6 +77,11 @@
this.executor = new PortalNamesCache(new DataCache(new ExecutorDispatcher()));
}
+ public ChromatticLifeCycle getLifeCycle()
+ {
+ return configurator;
+ }
+
public void cachePut(Serializable key, Object value)
{
GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.config.tasks;
+
+import org.chromattic.api.query.QueryResult;
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.POMTask;
+import org.exoplatform.portal.pom.data.Mapper;
+import org.exoplatform.portal.pom.data.PageData;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Page;
+import org.gatein.mop.api.workspace.Site;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class MOPAccess<E, I> implements ListAccess<E>
+{
+
+ /** . */
+ private final POMSessionManager mgr;
+
+ /** . */
+ private final ObjectType<Site> ownerType;
+
+ /** . */
+ private final String ownerId;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private Integer size;
+
+ MOPAccess(POMSessionManager mgr, Query<E> query)
+ {
+ String ownerType = query.getOwnerType();
+ ObjectType<Site> siteType = null;
+ if (ownerType != null)
+ {
+ siteType = Mapper.parseSiteType(ownerType);
+ }
+
+ //
+ this.mgr = mgr;
+ this.ownerType = siteType;
+ this.ownerId = query.getOwnerId();
+ this.title = query.getTitle();
+ this.size = null;
+ }
+
+ public E[] load(final int index, final int length) throws Exception, IllegalArgumentException
+ {
+ return mgr.execute(new POMTask<E[]>()
+ {
+ public E[] run(POMSession session) throws Exception
+ {
+ QueryResult<I> res = findW(session, ownerType, ownerId, title, index, length);
+ E[] elements = createT(length);
+ int index = 0;
+ while (res.hasNext() && index < length)
+ {
+ I internal = res.next();
+ E external = convert(session, internal);
+ elements[index++] = external;
+ }
+ return elements;
+ }
+ public String toString()
+ {
+ return MOPAccess.this.getClass().getSimpleName() + "[offset=" + index + ",limit=" + length + "]";
+ }
+ });
+ }
+
+ public int getSize() throws Exception
+ {
+ if (size == null)
+ {
+ size = mgr.execute(new POMTask<Integer>()
+ {
+ public Integer run(POMSession session) throws Exception
+ {
+ QueryResult res = findW(session, ownerType, ownerId, title, 0, 1);
+ return res.hits();
+ }
+ public String toString()
+ {
+ return MOPAccess.this.getClass().getSimpleName() + "[size]";
+ }
+ });
+ if (size == null)
+ {
+ size = 0;
+ }
+ }
+ return size;
+ }
+
+ protected abstract QueryResult<I> findW(
+ POMSession session,
+ ObjectType<Site> siteType,
+ String ownerId,
+ String title, int offset, int limit);
+
+ protected abstract E[] createT(int length);
+
+ protected abstract E convert(POMSession session, I internal);
+
+ public static class PageAccess extends MOPAccess<PageData, Page>
+ {
+
+ public PageAccess(POMSessionManager mgr, Query<PageData> pageDataQuery)
+ {
+ super(mgr, pageDataQuery);
+ }
+
+ @Override
+ protected QueryResult<Page> findW(POMSession session, ObjectType<Site> siteType, String ownerId, String title, int offset, int limit)
+ {
+ return session.findObjects(ObjectType.PAGE, siteType, ownerId, title, offset, limit);
+ }
+
+ @Override
+ protected PageData convert(POMSession session, Page internal)
+ {
+ return new Mapper(session).load(internal);
+ }
+
+ @Override
+ protected PageData[] createT(int length)
+ {
+ return new PageData[length];
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,231 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.pom.config.tasks;
-
-import org.exoplatform.portal.pom.config.cache.DataAccessMode;
-import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
-import org.exoplatform.portal.pom.data.Mapper;
-
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.data.NavigationData;
-import org.exoplatform.portal.pom.data.NavigationKey;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class PageNavigationTask
-{
-
- /** . */
- private static final Logger log = LoggerFactory.getLogger(PageNavigationTask.class);
-
- /** . */
- protected final ObjectType<? extends Site> siteType;
-
- /** . */
- protected final NavigationKey key;
-
- protected PageNavigationTask(NavigationKey key)
- {
- this.key = key;
- this.siteType = Mapper.parseSiteType(key.getType());
- }
-
- public static class Load extends PageNavigationTask implements CacheableDataTask<NavigationKey, NavigationData>
- {
-
- public Load(NavigationKey key)
- {
- super(key);
- }
-
- public DataAccessMode getAccessMode()
- {
- return DataAccessMode.READ;
- }
-
- public NavigationKey getKey()
- {
- return key;
- }
-
- public Class<NavigationData> getValueType()
- {
- return NavigationData.class;
- }
-
- public NavigationData run(POMSession session) throws Exception
- {
- Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(siteType, key.getId());
- if (site != null)
- {
- Navigation nav = site.getRootNavigation();
- Navigation defaultNav = nav.getChild("default");
- if (defaultNav != null)
- {
- return new Mapper(session).load(defaultNav);
- }
- }
- else
- {
- log.debug("Cannot load page navigation as the corresponding portal " + key.getId()
- + " with type " + siteType + " does not exist");
- }
-
- //
- return null;
- }
-
- @Override
- public String toString()
- {
- return "PageNavigation.Load[ownerType=" + key.getType() + ",ownerId=" + key.getId() + "]";
- }
- }
-
- public static class Save extends PageNavigationTask implements CacheableDataTask<NavigationKey, Void>
- {
-
- /** . */
- private final NavigationData pageNav;
-
- /** . */
- private final boolean overwrite;
-
- public Save(NavigationData pageNav, boolean overwrite)
- {
- super(pageNav.getKey());
-
- //
- this.pageNav = pageNav;
- this.overwrite = overwrite;
- }
-
- public Class<Void> getValueType()
- {
- return Void.class;
- }
-
- public DataAccessMode getAccessMode()
- {
- return pageNav.getStorageId() != null ? DataAccessMode.WRITE : DataAccessMode.CREATE;
- }
-
- public NavigationKey getKey()
- {
- return key;
- }
-
- public Void run(POMSession session) throws Exception
- {
- Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(siteType, key.getId());
- if (site == null)
- {
- throw new IllegalArgumentException("Cannot insert page navigation "
- + " as the corresponding portal " + key.getId() + " with type " + siteType + " does not exist");
- }
-
- // Delete node descendants first
- Navigation nav = site.getRootNavigation();
-
- //
- Navigation defaultNav = nav.getChild("default");
- if (defaultNav == null)
- {
- defaultNav = nav.addChild("default");
- }
-
- //
- new Mapper(session).save(pageNav, defaultNav);
-
- //
- return null;
- }
-
- @Override
- public String toString()
- {
- return "PageNavigation.Save[ownerType=" + key.getType() + ",ownerId=" + key.getId() + "]";
- }
- }
-
- public static class Remove extends PageNavigationTask implements CacheableDataTask<NavigationKey, Void>
- {
-
- public Remove(NavigationData pageNav)
- {
- super(pageNav.getKey());
- }
-
- public DataAccessMode getAccessMode()
- {
- return DataAccessMode.DESTROY;
- }
-
- public Class<Void> getValueType()
- {
- return Void.class;
- }
-
- public NavigationKey getKey()
- {
- return key;
- }
-
- public Void run(POMSession session) throws Exception
- {
- Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(siteType, key.getId());
- if (site == null)
- {
- throw new IllegalArgumentException("Cannot insert page navigation "
- + " as the corresponding portal " + key.getId() + " with type " + siteType + " does not exist");
- }
-
- // Delete descendants
- Navigation nav = site.getRootNavigation();
-
- //
- Navigation defaultNav = nav.getChild("default");
- if (defaultNav != null)
- {
- defaultNav.destroy();
- }
-
- //
- return null;
- }
-
- @Override
- public String toString()
- {
- return "PageNavigation.Remove[ownerType=" + key.getType() + ",ownerId=" + key.getId() + "]";
- }
- }
-}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -26,16 +26,15 @@
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.config.POMTask;
import org.exoplatform.portal.pom.data.Mapper;
-import org.exoplatform.portal.pom.data.NavigationData;
-import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
import org.exoplatform.portal.pom.config.POMSession;
-import org.gatein.mop.api.workspace.*;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
/**
@@ -53,128 +52,6 @@
this.q = query;
}
- public abstract static class FindSiteObject<W extends WorkspaceObject, T> extends SearchTask<T>
- {
-
- public FindSiteObject(Query<T> query)
- {
- super(query);
- }
-
- public final LazyPageList<T> run(final POMSession session) throws Exception
- {
- Iterator<W> ite;
- try
- {
- String ownerType = q.getOwnerType();
- ObjectType<? extends Site> siteType = null;
- if (ownerType != null)
- {
- siteType = Mapper.parseSiteType(ownerType);
- }
- ite = findW(session, siteType, q.getOwnerId(), q.getTitle());
-
- }
- catch (IllegalArgumentException e)
- {
- ite = Collections.<W>emptyList().iterator();
- }
-
- //
- final ArrayList<String> array = new ArrayList<String>();
- while (ite.hasNext())
- {
- array.add(ite.next().getObjectId());
- }
-
- //
- final POMSessionManager manager = session.getManager();
- final Iterator<String> it = array.iterator();
- ListAccess<T> la = new ListAccess<T>()
- {
- public T[] load(int index, int length) throws Exception, IllegalArgumentException
- {
- POMSession session = manager.getSession();
- T[] result = createT(length);
- for (int i = 0; i < length; i++)
- {
- T t = loadT(session, it.next());
- result[i] = t;
- }
- return result;
- }
-
- public int getSize() throws Exception
- {
- return array.size();
- }
- };
-
- //
- return new LazyPageList<T>(la, 10);
- }
-
- protected abstract Iterator<W> findW(POMSession session, ObjectType<? extends Site> siteType, String ownerId,
- String title);
-
- protected abstract T[] createT(int length);
-
- protected abstract T loadT(POMSession session, String id);
-
- }
-
- public static class FindPage extends FindSiteObject<org.gatein.mop.api.workspace.Page, PageData>
- {
-
- public FindPage(Query<PageData> pageQuery)
- {
- super(pageQuery);
- }
-
- protected Iterator<org.gatein.mop.api.workspace.Page> findW(POMSession session,
- ObjectType<? extends Site> siteType, String ownerId, String title)
- {
- return session.findObjects(ObjectType.PAGE, siteType, q.getOwnerId(), q.getTitle());
- }
-
- protected PageData[] createT(int length)
- {
- return new PageData[length];
- }
-
- protected PageData loadT(POMSession session, String id)
- {
- Page page = session.getManager().getPOMService().getModel().findObjectById(ObjectType.PAGE, id);
- return new Mapper(session).load(page);
- }
- }
-
- public static class FindNavigation extends FindSiteObject<Navigation, NavigationData>
- {
-
- public FindNavigation(Query<NavigationData> pageQuery)
- {
- super(pageQuery);
- }
-
- protected Iterator<Navigation> findW(POMSession session, ObjectType<? extends Site> siteType, String ownerId,
- String title)
- {
- return session.findObjects(ObjectType.NAVIGATION, siteType, q.getOwnerId(), q.getTitle());
- }
-
- protected NavigationData[] createT(int length)
- {
- return new NavigationData[length];
- }
-
- protected NavigationData loadT(POMSession session, String id)
- {
- Navigation nav = session.getManager().getPOMService().getModel().findObjectById(ObjectType.NAVIGATION, id);
- return new Mapper(session).load(nav);
- }
- }
-
public static class FindPortletPreferences extends SearchTask<PortletPreferences>
{
@@ -251,27 +128,36 @@
public LazyPageList<PortalKey> run(final POMSession session) throws Exception
{
Workspace workspace = session.getWorkspace();
- final Collection<? extends Site> portals = workspace.getSites(ObjectType.PORTAL_SITE);
+ Collection<Site> sites = workspace.getSites(ObjectType.PORTAL_SITE);
+ final ArrayList<PortalKey> keys = new ArrayList<PortalKey>(sites.size());
+ for (Site site : sites)
+ {
+ keys.add(new PortalKey("portal", site.getName()));
+ }
ListAccess<PortalKey> la = new ListAccess<PortalKey>()
{
public PortalKey[] load(int index, int length) throws Exception, IllegalArgumentException
{
- Iterator<? extends Site> iterator = portals.iterator();
PortalKey[] result = new PortalKey[length];
for (int i = 0; i < length; i++)
{
- Site site = iterator.next();
- result[i] = new PortalKey("portal", site.getName());
+ result[i] = keys.get(index++);
}
return result;
}
public int getSize() throws Exception
{
- return portals.size();
+ return keys.size();
}
};
return new LazyPageList<PortalKey>(la, 10);
}
}
+
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName() + "[query=" + q + "]";
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -30,7 +30,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-class MappedAttributes
+public class MappedAttributes
{
private MappedAttributes()
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -38,8 +38,6 @@
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.workspace.*;
-import org.gatein.mop.api.workspace.link.Link;
-import org.gatein.mop.api.workspace.link.PageLink;
import org.gatein.mop.api.workspace.ui.UIBody;
import org.gatein.mop.api.workspace.ui.UIComponent;
import org.gatein.mop.api.workspace.ui.UIContainer;
@@ -51,7 +49,6 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -98,198 +95,6 @@
this.session = session;
}
- public NavigationData load(Navigation src)
- {
- return load(src, NavigationData.class);
- }
-
- private <T extends NavigationNodeContainerData> T load(Navigation src, Class<T> type)
- {
-
- //
- ArrayList<NavigationNodeData> children = new ArrayList<NavigationNodeData>(src.getChildren().size());
- for (Navigation srcChild : src.getChildren())
- {
- NavigationNodeData dstChild = load(srcChild, NavigationNodeData.class);
- children.add(dstChild);
- }
-
- //
- T dst;
- if (type == NavigationData.class)
- {
- Site site = src.getSite();
- String ownerType = getOwnerType(site.getObjectType());
- String ownerId = site.getName();
- Attributes attrs = src.getAttributes();
- NavigationData dstNav = new NavigationData(
- src.getObjectId(),
- ownerType,
- ownerId,
- attrs.getValue(MappedAttributes.PRIORITY, 1),
- children);
- dst = (T)dstNav;
- }
- else if (type == NavigationNodeData.class)
- {
- Attributes attrs = src.getAttributes();
- String pageReference = null;
- Link link = src.getLink();
- if (link instanceof PageLink)
- {
- PageLink pageLink = (PageLink)link;
- org.gatein.mop.api.workspace.Page target = pageLink.getPage();
- if (target != null)
- {
- Site site = target.getSite();
- ObjectType<? extends Site> siteType = site.getObjectType();
- pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
- }
- }
-
- //
- Described described = src.adapt(Described.class);
-
- //
- Visible visible = src.adapt(Visible.class);
-
- //
- NavigationNodeData dstNode = new NavigationNodeData(
- src.getObjectId(),
- attrs.getValue(MappedAttributes.URI),
- described.getName(),
- attrs.getValue(MappedAttributes.ICON),
- src.getName(),
- visible.getStartPublicationDate(),
- visible.getEndPublicationDate(),
- visible.getVisibility() != null ? visible.getVisibility() : Visibility.DISPLAYED,
- pageReference,
- children
- );
-
- dst = (T)dstNode;
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- return dst;
- }
-
- public void save(NavigationData src, Navigation dst)
- {
- save((NavigationNodeContainerData)src, dst);
- }
-
- private void save(NavigationNodeContainerData src, Navigation dst)
- {
- if (src instanceof NavigationNodeData)
- {
- NavigationNodeData node = (NavigationNodeData)src;
- Workspace workspace = dst.getSite().getWorkspace();
- String reference = node.getPageReference();
- if (reference != null)
- {
- String[] pageChunks = split("::", reference);
- ObjectType<? extends Site> siteType = parseSiteType(pageChunks[0]);
- Site site = workspace.getSite(siteType, pageChunks[1]);
- org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
- PageLink link = dst.linkTo(ObjectType.PAGE_LINK);
- link.setPage(target);
- }
- else
- {
- PageLink link = dst.linkTo(ObjectType.PAGE_LINK);
- link.setPage(null);
- }
-
- //
- Described described = dst.adapt(Described.class);
- described.setName(node.getLabel());
- if(!dst.getName().equals(((NavigationNodeData) src).getName()))
- {
- dst.setName(((NavigationNodeData) src).getName());
- }
- //
- Visible visible = dst.adapt(Visible.class);
- visible.setVisibility(node.getVisibility());
- visible.setStartPublicationDate(node.getStartPublicationDate());
- visible.setEndPublicationDate(node.getEndPublicationDate());
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.URI, node.getURI());
- attrs.setValue(MappedAttributes.ICON, node.getIcon());
- }
- else if (src instanceof NavigationData)
- {
- NavigationData pageNav = (NavigationData)src;
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.PRIORITY, pageNav.getPriority());
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- final List<String> orders = new ArrayList<String>();
- Set<String> savedSet = new HashSet<String>();
- for (NavigationNodeData node : src.getNodes())
- {
- String srcId = node.getStorageId();
- Navigation dstChild;
- if (srcId != null)
- {
- dstChild = session.findObjectById(ObjectType.NAVIGATION, srcId);
- }
- else
- {
- dstChild = dst.getChild(node.getName());
- if (dstChild == null)
- {
- dstChild = dst.addChild(node.getName());
- }
- srcId = dstChild.getObjectId();
- }
- save(node, dstChild);
- savedSet.add(srcId);
- orders.add(dstChild.getObjectId());
- }
- for (Iterator<? extends Navigation> i = dst.getChildren().iterator(); i.hasNext();)
- {
- Navigation dstChild = i.next();
- if (!savedSet.contains(dstChild.getObjectId()))
- {
- Visible visible = dstChild.adapt(Visible.class);
- if (visible.getVisibility() != Visibility.SYSTEM)
- {
- i.remove();
- }
- }
- }
- // Now sort children according to the order provided by the container
- // need to replace that with Collections.sort once the set(int index, E element) is implemented in Chromattic lists
- Navigation[] a = dst.getChildren().toArray(new Navigation[dst.getChildren().size()]);
- Arrays.sort(a, new Comparator<Navigation>()
- {
- public int compare(Navigation o1, Navigation o2)
- {
- int i1 = orders.indexOf(o1.getObjectId());
- int i2 = orders.indexOf(o2.getObjectId());
- return i1 - i2;
- }
- });
- for (int j = 0; j < a.length; j++)
- {
- dst.getChildren().add(j, a[j]);
- }
- }
-
public PortalData load(Site src)
{
String type = Mapper.getOwnerType(src.getObjectType());
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,6 +19,9 @@
package org.exoplatform.portal.pom.data;
+import java.util.Comparator;
+import java.util.List;
+
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
@@ -29,9 +32,6 @@
import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PortalData;
-import java.util.Comparator;
-import java.util.List;
-
/**
* Created by The eXo Platform SAS
* Apr 19, 2007
@@ -80,14 +80,7 @@
*/
public List<ModelChange> save(PageData page) throws Exception;
- public NavigationData getPageNavigation(NavigationKey key) throws Exception;
- public void save(NavigationData navigation) throws Exception;
-
- public void create(NavigationData navigation) throws Exception;
-
- public void remove(NavigationData navigation) throws Exception;
-
public void save(PortletPreferences portletPreferences) throws Exception;
public <S> String getId(ApplicationState<S> state) throws Exception;
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,88 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.pom.data;
-
-import java.util.List;
-
-/**
-* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
-* @version $Revision$
-*/
-public class NavigationData extends NavigationNodeContainerData
-{
-
- /** . */
- private final NavigationKey key;
-
- /** . */
- private final int priority;
-
- public NavigationData(
- String ownerType,
- String ownerId,
- Integer priority,
- List<NavigationNodeData> children)
- {
- this(null, ownerType, ownerId, priority, children);
- }
-
- public NavigationData(
- String storageId,
- String ownerType,
- String ownerId,
- Integer priority,
- List<NavigationNodeData> children)
- {
- super(storageId, children);
-
- //
- if (ownerType == null)
- {
- throw new NullPointerException("No null owner type");
- }
- if (ownerId == null)
- {
- throw new NullPointerException("No null owner id");
- }
-
- //
- this.key = new NavigationKey(ownerType, ownerId);
- this.priority = priority != null ? priority : 1;
- }
-
- public NavigationKey getKey()
- {
- return key;
- }
-
- public String getOwnerType()
- {
- return key.getType();
- }
-
- public String getOwnerId()
- {
- return key.getId();
- }
-
- public int getPriority()
- {
- return priority;
- }
-}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,45 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.pom.data;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class NavigationNodeContainerData extends ModelData
-{
-
- /** . */
- private final List<NavigationNodeData> nodes;
-
- public NavigationNodeContainerData(String storageId, List<NavigationNodeData> nodes)
- {
- super(storageId, null);
-
- //
- this.nodes = nodes;
- }
-
- public List<NavigationNodeData> getNodes()
- {
- return nodes;
- }
-}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,134 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.pom.data;
-
-import org.exoplatform.portal.mop.Visibility;
-
-import java.util.Date;
-import java.util.List;
-
-/**
-* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
-* @version $Revision$
-*/
-public class NavigationNodeData extends NavigationNodeContainerData
-{
-
- /** . */
- private final String uri;
-
- /** . */
- private final String label;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String name;
-
- /** . */
- private final Date startPublicationDate;
-
- /** . */
- private final Date endPublicationDate;
-
- /** . */
- private final Visibility visibility;
-
- /** . */
- private final String pageReference;
-
- public NavigationNodeData(
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Visibility visibility,
- String pageReference,
- List<NavigationNodeData> children)
- {
- this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, visibility, pageReference, children);
- }
-
- public NavigationNodeData(
- String storageId,
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Visibility visibility,
- String pageReference,
- List<NavigationNodeData> children)
- {
- super(storageId, children);
-
- //
- this.uri = uri;
- this.label = label;
- this.icon = icon;
- this.name = name;
- this.startPublicationDate = startPublicationDate;
- this.endPublicationDate = endPublicationDate;
- this.visibility = visibility;
- this.pageReference = pageReference;
- }
- public String getURI()
- {
- return uri;
- }
-
- public String getLabel()
- {
- return label;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Date getStartPublicationDate()
- {
- return startPublicationDate;
- }
-
- public Date getEndPublicationDate()
- {
- return endPublicationDate;
- }
-
- public Visibility getVisibility()
- {
- return visibility;
- }
-
- public String getPageReference()
- {
- return pageReference;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NodeData.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/NodeData.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NodeData.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/NodeData.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,147 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.pom.data;
+
+import org.exoplatform.portal.mop.Visibility;
+
+import java.util.Date;
+
+/**
+* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+* @version $Revision$
+*/
+public class NodeData extends ModelData
+{
+
+ /** . */
+ private final String uri;
+
+ /** . */
+ private final String label;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Date startPublicationDate;
+
+ /** . */
+ private final Date endPublicationDate;
+
+ /** . */
+ private final Visibility visibility;
+
+ /** . */
+ private final String pageReference;
+
+ /** . */
+ private final String[] children;
+
+ public NodeData(
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Visibility visibility,
+ String pageReference,
+ String[] children)
+ {
+ this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, visibility, pageReference, children);
+ }
+
+ public NodeData(
+ String storageId,
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Visibility visibility,
+ String pageReference,
+ String[] children)
+ {
+ super(storageId, null);
+
+ //
+ this.uri = uri;
+ this.label = label;
+ this.icon = icon;
+ this.name = name;
+ this.startPublicationDate = startPublicationDate;
+ this.endPublicationDate = endPublicationDate;
+ this.visibility = visibility;
+ this.pageReference = pageReference;
+ this.children = children;
+ }
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Date getStartPublicationDate()
+ {
+ return startPublicationDate;
+ }
+
+ public Date getEndPublicationDate()
+ {
+ return endPublicationDate;
+ }
+
+ public Visibility getVisibility()
+ {
+ return visibility;
+ }
+
+ public String getPageReference()
+ {
+ return pageReference;
+ }
+
+ public int getChildrenCount()
+ {
+ return children.length;
+ }
+
+ public String getChildRef(int index)
+ {
+ return children[index];
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class Adapters
-{
-
- /** . */
- private static final ArrayAdapter ARRAY_INSTANCE = new ArrayAdapter();
-
- public static <E> ListAdapter<E[], E> list()
- {
- @SuppressWarnings("unchecked")
- ListAdapter<E[], E> adapter = (ListAdapter<E[], E>)ARRAY_INSTANCE;
- return adapter;
- }
-
- private static class ArrayAdapter<E> implements ListAdapter<E[], E>
- {
- public int size(E[] list)
- {
- return list.length;
- }
-
- public Iterator<E> iterator(final E[] list, final boolean reverse)
- {
- return new Iterator<E>()
- {
- /** . */
- int count = 0;
-
- public boolean hasNext()
- {
- return count < list.length;
- }
-
- public E next()
- {
- if (!hasNext())
- {
- throw new NoSuchElementException();
- }
- int index = count++;
- if (reverse)
- {
- index = list.length - index - 1;
- }
- return list[index];
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- };
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/Adapters.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class Adapters
+{
+
+ /** . */
+ private static final ArrayAdapter ARRAY_INSTANCE = new ArrayAdapter();
+
+ public static <E> ListAdapter<E[], E> list()
+ {
+ @SuppressWarnings("unchecked")
+ ListAdapter<E[], E> adapter = (ListAdapter<E[], E>)ARRAY_INSTANCE;
+ return adapter;
+ }
+
+ private static class ArrayAdapter<E> implements ListAdapter<E[], E>
+ {
+ public int size(E[] list)
+ {
+ return list.length;
+ }
+
+ public Iterator<E> iterator(final E[] list, final boolean reverse)
+ {
+ return new Iterator<E>()
+ {
+ /** . */
+ int count = 0;
+
+ public boolean hasNext()
+ {
+ return count < list.length;
+ }
+
+ public E next()
+ {
+ if (!hasNext())
+ {
+ throw new NoSuchElementException();
+ }
+ int index = count++;
+ if (reverse)
+ {
+ index = list.length - index - 1;
+ }
+ return list[index];
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public interface HierarchyAdapter<L, N, H> {
-
- H getHandle(N node);
-
- L getChildren(N node);
-
- N getDescendant(N node, H handle);
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public interface HierarchyAdapter<L, N, H> {
+
+ H getHandle(N node);
+
+ L getChildren(N node);
+
+ N getDescendant(N node, H handle);
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class HierarchyChangeIterator<L1, N1, L2, N2, H> implements Iterator<HierarchyChangeType> {
-
- /** . */
- private final HierarchyDiff<L1, N1, L2, N2, H> diff;
-
- /** . */
- private Frame frame;
-
- /** . */
- private final HierarchyContext<L1, N1, H> context1;
-
- /** . */
- private final HierarchyContext<L2, N2, H> context2;
-
- /** . */
- private final ListDiff<L1, L2, H> listDiff;
-
- HierarchyChangeIterator(HierarchyDiff<L1, N1, L2, N2, H> diff, HierarchyContext<L1, N1, H> context1, HierarchyContext<L2, N2, H> context2) {
- this.diff = diff;
- this.context1 = context1;
- this.context2 = context2;
- this.frame = new Frame(null, context1.getRoot(), context2.getRoot());
- this.listDiff = new ListDiff<L1, L2, H>(
- diff.listAdapter1,
- diff.listAdapter2,
- diff.comparator);
- }
-
- /**
- * The internal status.
- */
- private enum Status {
-
- INIT(null),
-
- ENTER(HierarchyChangeType.ENTER),
-
- KEEP(HierarchyChangeType.KEEP),
-
- ADDED(HierarchyChangeType.ADDED),
-
- REMOVED(HierarchyChangeType.REMOVED),
-
- MOVED_IN(HierarchyChangeType.MOVED_IN),
-
- MOVED_OUT(HierarchyChangeType.MOVED_OUT),
-
- LEAVE(HierarchyChangeType.LEAVE),
-
- ERROR(HierarchyChangeType.ERROR),
-
- RESUME(null);
-
- /** The associated change type. */
- final HierarchyChangeType changeType;
-
- private Status(HierarchyChangeType changeType) {
- this.changeType = changeType;
- }
- }
-
- private class Frame {
-
- /** . */
- private final Frame parent;
-
- /** . */
- private final N1 srcRoot;
-
- /** . */
- private final N2 dstRoot;
-
- /** . */
- private ListChangeIterator<L1, L2, H> it;
-
- /** . */
- private Status previous;
-
- /** . */
- private Status next;
-
- /** . */
- private Iterator<H> srcIt;
-
- /** . */
- private Iterator<H> dstIt;
-
- /** . */
- private N1 src;
-
- /** . */
- private N2 dst;
-
- private Frame(Frame parent, N1 srcRoot, N2 dstRoot) {
- this.parent = parent;
- this.srcRoot = srcRoot;
- this.dstRoot = dstRoot;
- this.previous = Status.INIT;
- }
- }
-
- public boolean hasNext() {
- if (frame != null && frame.next == null) {
- while (true) {
-
- if (frame.previous == Status.INIT) {
- H id2 = context2.getHierarchyAdapter().getHandle(frame.dstRoot);
- if (frame.srcRoot == null)
- {
- frame.next = Status.ENTER;
- frame.src = null;
- frame.dst = frame.dstRoot;
- }
- else
- {
- H id1 = context1.getHierarchyAdapter().getHandle(frame.srcRoot);
- if (diff.comparator.compare(id1, id2) != 0) {
- frame.next = Status.ERROR;
- frame.src = frame.srcRoot;
- frame.dst = frame.dstRoot;
- } else {
- frame.next = Status.ENTER;
- frame.src = frame.srcRoot;
- frame.dst = frame.dstRoot;
- }
- }
- break;
- } else if (frame.previous == Status.ERROR) {
- break;
- } else if (frame.previous == Status.LEAVE) {
- frame = frame.parent;
- if (frame != null) {
- frame.previous = Status.RESUME;
- continue;
- } else {
- break;
- }
- } else if (frame.previous == Status.KEEP) {
- frame = new Frame(frame, frame.src, frame.dst);
- continue;
- } else if (frame.previous == Status.MOVED_IN) {
- frame = new Frame(frame, frame.src, frame.dst);
- continue;
- } else if (frame.previous == Status.ADDED) {
- frame = new Frame(frame, frame.src, frame.dst);
- continue;
- } else if (frame.previous == Status.ENTER) {
- L1 children1;
- if (frame.src != null) {
- children1 = context1.getHierarchyAdapter().getChildren(frame.srcRoot);
- frame.srcIt = diff.listAdapter1.iterator(children1, false);
- }
- else {
- children1 = null;
- frame.srcIt = null;
- }
- L2 children2 = context2.getHierarchyAdapter().getChildren(frame.dstRoot);
- frame.dstIt = diff.listAdapter2.iterator(children2, false);
- frame.it = listDiff.iterator(children1, children2);
- } else {
- // Nothing
- }
-
- //
- if (frame.it.hasNext()) {
- switch (frame.it.next()) {
- case SAME:
- N1 next1 = context1.findByHandle(frame.srcIt.next());
- N2 next2 = context2.findByHandle(frame.dstIt.next());
- frame.next = Status.KEEP;
- frame.src = next1;
- frame.dst = next2;
- break;
- case ADD:
- frame.dstIt.next();
- H addedHandle = frame.it.getElement();
- N2 added = context2.findByHandle(addedHandle);
- H addedId = context2.getHierarchyAdapter().getHandle(added);
- N1 a = context1.findByHandle(addedId);
- if (a != null) {
- frame.next = Status.MOVED_IN;
- frame.src = a;
- frame.dst = added;
- } else {
- frame.next = Status.ADDED;
- frame.src = null;
- frame.dst = added;
- }
- break;
- case REMOVE:
- frame.srcIt.next();
- H removedHandle = frame.it.getElement();
- N1 removed = context1.findByHandle(removedHandle);
- H removedId = context1.getHierarchyAdapter().getHandle(removed);
- N2 b = context2.findByHandle(removedId);
- if (b != null) {
- frame.next = Status.MOVED_OUT;
- frame.src = removed;
- frame.dst = b;
- } else {
- frame.next = Status.REMOVED;
- frame.src = removed;
- frame.dst = null;
- }
- break;
- default:
- throw new AssertionError();
- }
- } else {
- frame.next = Status.LEAVE;
- frame.src = frame.srcRoot;
- frame.dst = frame.dstRoot;
- }
-
- //
- break;
- }
- }
- return frame != null && frame.next != null;
- }
-
- public HierarchyChangeType next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- } else {
- frame.previous = frame.next;
- frame.next = null;
- return frame.previous.changeType;
- }
- }
-
- public void skip() {
- if (frame.previous == HierarchyChangeIterator.Status.ENTER) {
-
- // A bit hackish as it bypass the main loop
- // the proper way to do it would be to introduce a SKIP status
- // and properly react to it to update the state machine
- // but for now it will do
-
- frame.next = Status.LEAVE;
- frame.src = frame.srcRoot;
- frame.dst = frame.dstRoot;
- } else {
- throw new IllegalStateException("Cannot skip when in state " + frame.previous);
- }
- }
-
- public N1 getSource() {
- return frame.src;
- }
-
- public N2 getDestination() {
- return frame.dst;
- }
-
- public N1 peekSourceRoot()
- {
- return frame.srcRoot;
- }
-
- public N2 peekDestinationRoot()
- {
- return frame.dstRoot;
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeIterator.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class HierarchyChangeIterator<L1, N1, L2, N2, H> implements Iterator<HierarchyChangeType> {
+
+ /** . */
+ private final HierarchyDiff<L1, N1, L2, N2, H> diff;
+
+ /** . */
+ private Frame frame;
+
+ /** . */
+ private final HierarchyContext<L1, N1, H> context1;
+
+ /** . */
+ private final HierarchyContext<L2, N2, H> context2;
+
+ /** . */
+ private final ListDiff<L1, L2, H> listDiff;
+
+ HierarchyChangeIterator(HierarchyDiff<L1, N1, L2, N2, H> diff, HierarchyContext<L1, N1, H> context1, HierarchyContext<L2, N2, H> context2) {
+ this.diff = diff;
+ this.context1 = context1;
+ this.context2 = context2;
+ this.frame = new Frame(null, context1.getRoot(), context2.getRoot());
+ this.listDiff = new ListDiff<L1, L2, H>(
+ diff.listAdapter1,
+ diff.listAdapter2,
+ diff.comparator);
+ }
+
+ /**
+ * The internal status.
+ */
+ private enum Status {
+
+ INIT(null),
+
+ ENTER(HierarchyChangeType.ENTER),
+
+ KEEP(HierarchyChangeType.KEEP),
+
+ ADDED(HierarchyChangeType.ADDED),
+
+ REMOVED(HierarchyChangeType.REMOVED),
+
+ MOVED_IN(HierarchyChangeType.MOVED_IN),
+
+ MOVED_OUT(HierarchyChangeType.MOVED_OUT),
+
+ LEAVE(HierarchyChangeType.LEAVE),
+
+ ERROR(HierarchyChangeType.ERROR),
+
+ RESUME(null);
+
+ /** The associated change type. */
+ final HierarchyChangeType changeType;
+
+ private Status(HierarchyChangeType changeType) {
+ this.changeType = changeType;
+ }
+ }
+
+ private class Frame {
+
+ /** . */
+ private final Frame parent;
+
+ /** . */
+ private final N1 srcRoot;
+
+ /** . */
+ private final N2 dstRoot;
+
+ /** . */
+ private ListChangeIterator<L1, L2, H> it;
+
+ /** . */
+ private Status previous;
+
+ /** . */
+ private Status next;
+
+ /** . */
+ private Iterator<H> srcIt;
+
+ /** . */
+ private Iterator<H> dstIt;
+
+ /** . */
+ private N1 src;
+
+ /** . */
+ private N2 dst;
+
+ private Frame(Frame parent, N1 srcRoot, N2 dstRoot) {
+ this.parent = parent;
+ this.srcRoot = srcRoot;
+ this.dstRoot = dstRoot;
+ this.previous = Status.INIT;
+ }
+ }
+
+ public boolean hasNext() {
+ if (frame != null && frame.next == null) {
+ while (true) {
+
+ if (frame.previous == Status.INIT) {
+ H id2 = context2.getHierarchyAdapter().getHandle(frame.dstRoot);
+ if (frame.srcRoot == null)
+ {
+ frame.next = Status.ENTER;
+ frame.src = null;
+ frame.dst = frame.dstRoot;
+ }
+ else
+ {
+ H id1 = context1.getHierarchyAdapter().getHandle(frame.srcRoot);
+ if (diff.comparator.compare(id1, id2) != 0) {
+ frame.next = Status.ERROR;
+ frame.src = frame.srcRoot;
+ frame.dst = frame.dstRoot;
+ } else {
+ frame.next = Status.ENTER;
+ frame.src = frame.srcRoot;
+ frame.dst = frame.dstRoot;
+ }
+ }
+ break;
+ } else if (frame.previous == Status.ERROR) {
+ break;
+ } else if (frame.previous == Status.LEAVE) {
+ frame = frame.parent;
+ if (frame != null) {
+ frame.previous = Status.RESUME;
+ continue;
+ } else {
+ break;
+ }
+ } else if (frame.previous == Status.KEEP) {
+ frame = new Frame(frame, frame.src, frame.dst);
+ continue;
+ } else if (frame.previous == Status.MOVED_IN) {
+ frame = new Frame(frame, frame.src, frame.dst);
+ continue;
+ } else if (frame.previous == Status.ADDED) {
+ frame = new Frame(frame, frame.src, frame.dst);
+ continue;
+ } else if (frame.previous == Status.ENTER) {
+ L1 children1;
+ if (frame.src != null) {
+ children1 = context1.getHierarchyAdapter().getChildren(frame.srcRoot);
+ frame.srcIt = diff.listAdapter1.iterator(children1, false);
+ }
+ else {
+ children1 = null;
+ frame.srcIt = null;
+ }
+ L2 children2 = context2.getHierarchyAdapter().getChildren(frame.dstRoot);
+ frame.dstIt = diff.listAdapter2.iterator(children2, false);
+ frame.it = listDiff.iterator(children1, children2);
+ } else {
+ // Nothing
+ }
+
+ //
+ if (frame.it.hasNext()) {
+ switch (frame.it.next()) {
+ case SAME:
+ N1 next1 = context1.findByHandle(frame.srcIt.next());
+ N2 next2 = context2.findByHandle(frame.dstIt.next());
+ frame.next = Status.KEEP;
+ frame.src = next1;
+ frame.dst = next2;
+ break;
+ case ADD:
+ frame.dstIt.next();
+ H addedHandle = frame.it.getElement();
+ N2 added = context2.findByHandle(addedHandle);
+ H addedId = context2.getHierarchyAdapter().getHandle(added);
+ N1 a = context1.findByHandle(addedId);
+ if (a != null) {
+ frame.next = Status.MOVED_IN;
+ frame.src = a;
+ frame.dst = added;
+ } else {
+ frame.next = Status.ADDED;
+ frame.src = null;
+ frame.dst = added;
+ }
+ break;
+ case REMOVE:
+ frame.srcIt.next();
+ H removedHandle = frame.it.getElement();
+ N1 removed = context1.findByHandle(removedHandle);
+ H removedId = context1.getHierarchyAdapter().getHandle(removed);
+ N2 b = context2.findByHandle(removedId);
+ if (b != null) {
+ frame.next = Status.MOVED_OUT;
+ frame.src = removed;
+ frame.dst = b;
+ } else {
+ frame.next = Status.REMOVED;
+ frame.src = removed;
+ frame.dst = null;
+ }
+ break;
+ default:
+ throw new AssertionError();
+ }
+ } else {
+ frame.next = Status.LEAVE;
+ frame.src = frame.srcRoot;
+ frame.dst = frame.dstRoot;
+ }
+
+ //
+ break;
+ }
+ }
+ return frame != null && frame.next != null;
+ }
+
+ public HierarchyChangeType next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ } else {
+ frame.previous = frame.next;
+ frame.next = null;
+ return frame.previous.changeType;
+ }
+ }
+
+ public void skip() {
+ if (frame.previous == HierarchyChangeIterator.Status.ENTER) {
+
+ // A bit hackish as it bypass the main loop
+ // the proper way to do it would be to introduce a SKIP status
+ // and properly react to it to update the state machine
+ // but for now it will do
+
+ frame.next = Status.LEAVE;
+ frame.src = frame.srcRoot;
+ frame.dst = frame.dstRoot;
+ } else {
+ throw new IllegalStateException("Cannot skip when in state " + frame.previous);
+ }
+ }
+
+ public N1 getSource() {
+ return frame.src;
+ }
+
+ public N2 getDestination() {
+ return frame.dst;
+ }
+
+ public N1 peekSourceRoot()
+ {
+ return frame.srcRoot;
+ }
+
+ public N2 peekDestinationRoot()
+ {
+ return frame.dstRoot;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public enum HierarchyChangeType {
-
- ENTER,
-
- KEEP,
-
- ADDED,
-
- REMOVED,
-
- MOVED_IN,
-
- MOVED_OUT,
-
- LEAVE,
-
- ERROR
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyChangeType.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public enum HierarchyChangeType {
+
+ ENTER,
+
+ KEEP,
+
+ ADDED,
+
+ REMOVED,
+
+ MOVED_IN,
+
+ MOVED_OUT,
+
+ LEAVE,
+
+ ERROR
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class HierarchyContext<L, N, H> {
-
- /** . */
- final ListAdapter<L, H> listAdapter;
-
- /** . */
- final HierarchyAdapter<L, N, H> hierarchyAdapter;
-
- /** . */
- final N root;
-
- public HierarchyContext(ListAdapter<L, H> listAdapter, HierarchyAdapter<L, N, H> hierarchyAdapter, N root) throws NullPointerException {
- if (listAdapter == null) {
- throw new NullPointerException();
- }
- if (hierarchyAdapter == null) {
- throw new NullPointerException();
- }
- if (root == null) {
- throw new NullPointerException();
- }
-
- //
- this.listAdapter = listAdapter;
- this.hierarchyAdapter = hierarchyAdapter;
- this.root = root;
- }
-
- public HierarchyAdapter<L, N, H> getHierarchyAdapter() {
- return hierarchyAdapter;
- }
-
- public N getRoot() {
- return root;
- }
-
- public N findByHandle(H handle) {
- return hierarchyAdapter.getDescendant(root, handle);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class HierarchyContext<L, N, H> {
+
+ /** . */
+ final ListAdapter<L, H> listAdapter;
+
+ /** . */
+ final HierarchyAdapter<L, N, H> hierarchyAdapter;
+
+ /** . */
+ final N root;
+
+ public HierarchyContext(ListAdapter<L, H> listAdapter, HierarchyAdapter<L, N, H> hierarchyAdapter, N root) throws NullPointerException {
+ if (listAdapter == null) {
+ throw new NullPointerException();
+ }
+ if (hierarchyAdapter == null) {
+ throw new NullPointerException();
+ }
+ if (root == null) {
+ throw new NullPointerException();
+ }
+
+ //
+ this.listAdapter = listAdapter;
+ this.hierarchyAdapter = hierarchyAdapter;
+ this.root = root;
+ }
+
+ public HierarchyAdapter<L, N, H> getHierarchyAdapter() {
+ return hierarchyAdapter;
+ }
+
+ public N getRoot() {
+ return root;
+ }
+
+ public N findByHandle(H handle) {
+ return hierarchyAdapter.getDescendant(root, handle);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-import java.util.Comparator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class HierarchyDiff<L1, N1, L2, N2, H> {
-
- public static <L1, N1, L2, N2, H> HierarchyDiff<L1, N1, L2, N2, H> create(
- ListAdapter<L1, H> listAdapter1,
- HierarchyAdapter<L1, N1, H> hierarchyAdapter1,
- ListAdapter<L2, H> listAdapter2,
- HierarchyAdapter<L2, N2, H> hierarchyAdapter2,
- Comparator<H> comparator)
- {
- return new HierarchyDiff<L1, N1, L2, N2, H>(listAdapter1, hierarchyAdapter1, listAdapter2, hierarchyAdapter2, comparator);
- }
-
- /** . */
- final ListAdapter<L1, H> listAdapter1;
-
- /** . */
- final HierarchyAdapter<L1, N1, H> hierarchyAdapter1;
-
- /** . */
- final ListAdapter<L2, H> listAdapter2;
-
- /** . */
- final HierarchyAdapter<L2, N2, H> hierarchyAdapter2;
-
- /** . */
- final Comparator<H> comparator;
-
- public HierarchyDiff(ListAdapter<L1, H> listAdapter1, HierarchyAdapter<L1, N1, H> hierarchyAdapter1, ListAdapter<L2, H> listAdapter2, HierarchyAdapter<L2, N2, H> hierarchyAdapter2, Comparator<H> comparator) {
- this.listAdapter1 = listAdapter1;
- this.hierarchyAdapter1 = hierarchyAdapter1;
- this.listAdapter2 = listAdapter2;
- this.hierarchyAdapter2 = hierarchyAdapter2;
- this.comparator = comparator;
- }
-
- public HierarchyChangeIterator<L1, N1, L2, N2, H> iterator(N1 node1, N2 node2) {
- return new HierarchyChangeIterator<L1, N1, L2, N2, H>(this, new HierarchyContext<L1, N1, H>(listAdapter1, hierarchyAdapter1, node1), new HierarchyContext<L2, N2, H>(listAdapter2, hierarchyAdapter2, node2));
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/HierarchyDiff.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+import java.util.Comparator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class HierarchyDiff<L1, N1, L2, N2, H> {
+
+ public static <L1, N1, L2, N2, H> HierarchyDiff<L1, N1, L2, N2, H> create(
+ ListAdapter<L1, H> listAdapter1,
+ HierarchyAdapter<L1, N1, H> hierarchyAdapter1,
+ ListAdapter<L2, H> listAdapter2,
+ HierarchyAdapter<L2, N2, H> hierarchyAdapter2,
+ Comparator<H> comparator)
+ {
+ return new HierarchyDiff<L1, N1, L2, N2, H>(listAdapter1, hierarchyAdapter1, listAdapter2, hierarchyAdapter2, comparator);
+ }
+
+ /** . */
+ final ListAdapter<L1, H> listAdapter1;
+
+ /** . */
+ final HierarchyAdapter<L1, N1, H> hierarchyAdapter1;
+
+ /** . */
+ final ListAdapter<L2, H> listAdapter2;
+
+ /** . */
+ final HierarchyAdapter<L2, N2, H> hierarchyAdapter2;
+
+ /** . */
+ final Comparator<H> comparator;
+
+ public HierarchyDiff(ListAdapter<L1, H> listAdapter1, HierarchyAdapter<L1, N1, H> hierarchyAdapter1, ListAdapter<L2, H> listAdapter2, HierarchyAdapter<L2, N2, H> hierarchyAdapter2, Comparator<H> comparator) {
+ this.listAdapter1 = listAdapter1;
+ this.hierarchyAdapter1 = hierarchyAdapter1;
+ this.listAdapter2 = listAdapter2;
+ this.hierarchyAdapter2 = hierarchyAdapter2;
+ this.comparator = comparator;
+ }
+
+ public HierarchyChangeIterator<L1, N1, L2, N2, H> iterator(N1 node1, N2 node2) {
+ return new HierarchyChangeIterator<L1, N1, L2, N2, H>(this, new HierarchyContext<L1, N1, H>(listAdapter1, hierarchyAdapter1, node1), new HierarchyContext<L2, N2, H>(listAdapter2, hierarchyAdapter2, node2));
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-import java.util.Iterator;
-
-/**
- * An adapter for a list of elements.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public interface ListAdapter<L, E> {
-
- /**
- * Returns the number of list elements.
- *
- * @param list the list
- * @return the list size
- */
- int size(L list);
-
- /**
- * Returns an iterator over the list elements.
- *
- *
- * @param list the list
- * @param reverse the iteration direction
- * @return the iterator
- */
- Iterator<E> iterator(L list, boolean reverse);
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListAdapter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+import java.util.Iterator;
+
+/**
+ * An adapter for a list of elements.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public interface ListAdapter<L, E> {
+
+ /**
+ * Returns the number of list elements.
+ *
+ * @param list the list
+ * @return the list size
+ */
+ int size(L list);
+
+ /**
+ * Returns an iterator over the list elements.
+ *
+ *
+ * @param list the list
+ * @param reverse the iteration direction
+ * @return the iterator
+ */
+ Iterator<E> iterator(L list, boolean reverse);
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * Iterates over a list of {@link ListChangeType} computed from two list of objects. The implementation
- * is optimized to use the LCS algorithm only when needed, for trivial list no LCS computation should be
- * required.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class ListChangeIterator<L1, L2, E> implements Iterator<ListChangeType>
-{
-
- /** . */
- private static final int[] EMPTY = new int[0];
-
- /** . */
- private static final int TRIVIAL_MODE = 0;
-
- /** . */
- private static final int LCS_MODE = 1;
-
- /** . */
- ListDiff<L1, L2, E> diff;
-
- /** . */
- private final L1 elements1;
-
- /** . */
- private final L2 elements2;
-
- /** . */
- private final Iterator<E> it1;
-
- /** . */
- private final Iterator<E> it2;
-
- /** . */
- private int index1;
-
- /** . */
- private int index2;
-
- /** . */
- private E next1;
-
- /** . */
- private E next2;
-
- /** . */
- private E element;
-
- /** . */
- private ListChangeType type;
-
- /** . */
- private int mode;
-
- /** . */
- private boolean buffered;
-
- // LCS state
-
- /** . */
- private int[] matrix;
-
- /** . */
- private int m;
-
- /** . */
- private int n;
-
- ListChangeIterator(ListDiff<L1, L2, E> diff, L1 elements1, L2 elements2) {
- this.diff = diff;
- this.elements1 = elements1;
- this.elements2 = elements2;
- this.it1 = elements1 != null ? diff.adapter1.iterator(elements1, false) : null;
- this.it2 = elements2 != null ? diff.adapter2.iterator(elements2, false) : null;
- this.mode = TRIVIAL_MODE;
-
- //
- this.index1 = 0;
- this.index2 = 0;
- this.buffered = false;
- this.next1 = null;
- this.next2 = null;
- this.type = null;
- this.element = null;
-
- //
- if (it1 != null && it1.hasNext()) {
- next1 = it1.next();
- }
- if (it2 != null && it2.hasNext()) {
- next2 = it2.next();
- }
-
- //
- this.m = 0;
- this.n = 0;
- this.matrix = EMPTY;
- }
-
- private void next1() {
- index1++;
- if (it1 != null && it1.hasNext()) {
- next1 = it1.next();
- } else {
- next1 = null;
- }
- }
-
- private void next2() {
- index2++;
- if (it2 != null && it2.hasNext()) {
- next2 = it2.next();
- } else {
- next2 = null;
- }
- }
-
- public boolean hasNext() {
-
- while (!buffered) {
- if (mode == TRIVIAL_MODE) {
- if (next1 != null) {
- if (next2 != null) {
- if (diff.equals(next1, next2)) {
- type = ListChangeType.SAME;
- element = next1;
- buffered = true;
- next1();
- next2();
- } else {
- lcs(index1, elements1, elements2);
- mode = LCS_MODE;
- }
- } else {
- type = ListChangeType.REMOVE;
- element = next1;
- buffered = true;
- next1();
- }
- } else {
- if (next2 != null) {
- type = ListChangeType.ADD;
- element = next2;
- buffered = true;
- next2();
- } else {
- // Force a break with buffered to false
- break;
- }
- }
- } else if (mode == LCS_MODE) {
- E elt1 = null;
- E elt2 = null;
- int i = diff.adapter1.size(elements1) - index1;
- int j = diff.adapter2.size(elements2) - index2;
- if (i > 0 && j > 0 && diff.equals(elt1 = next1, elt2 = next2)) {
- type = ListChangeType.SAME;
- element = elt1;
- next1();
- next2();
- buffered = true;
- } else {
- int index1 = i + (j - 1) * m;
- int index2 = i - 1 + j * m;
- if (j > 0 && (i == 0 || matrix[index1] >= matrix[index2])) {
- type = ListChangeType.ADD;
- element = elt2 == null ? next2 : elt2;
- next2();
- buffered = true;
- } else if (i > 0 && (j == 0 || matrix[index1] < matrix[index2])) {
- type = ListChangeType.REMOVE;
- element = elt1 == null ? next1 : elt1;
- next1();
- buffered = true;
- } else {
- // Force a break with buffered to false
- break;
- }
- }
- } else {
- throw new AssertionError();
- }
- }
-
- //
- return buffered;
- }
-
- public ListChangeType next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- } else {
- buffered = false;
- return type;
- }
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- public E getElement() {
- return element;
- }
-
- public int getIndex1() {
- return index1;
- }
-
- public int getIndex2() {
- return index2;
- }
-
- /**
- * Compute the LCS matrix from the specified offset. It updates the state of this object
- * with the relevant state. The LCS matrix is computed using the LCS algorithm
- * (see http://en.wikipedia.org/wiki/Longest_common_subsequence_problem).
- *
- * @param offset the offset
- * @param elements1 the elements 1
- * @param elements2 the elements 2
- */
- private void lcs(int offset, L1 elements1, L2 elements2) {
- m = 1 + diff.adapter1.size(elements1) - offset;
- n = 1 + diff.adapter2.size(elements2) - offset;
-
- //
- int s = m * n;
- matrix = new int[s];
-
- // Compute the lcs matrix
- Iterator<E> itI = diff.adapter1.iterator(elements1, true);
- for (int i = 1; i < m; i++) {
- E abc = itI.next();
- Iterator<E> itJ = diff.adapter2.iterator(elements2, true);
- for (int j = 1; j < n; j++) {
- int index = i + j * m;
- int v;
- E def = itJ.next();
- if (diff.equals(abc, def)) {
- v = matrix[index - m - 1] + 1;
- } else {
- int v1 = matrix[index - 1];
- int v2 = matrix[index - m];
- v = v1 < v2 ? v2 : v1;
- }
- matrix[index] = v;
- }
- }
- }
-
- // For unit testing purpose
- String getMatrix() {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < m; i++) {
- sb.append('[');
- for (int j = 0; j < n; j++) {
- if (j > 0) {
- sb.append(',');
- }
- sb.append(matrix[i + j * m]);
- }
- sb.append("]\n");
- }
- return sb.toString();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeIterator.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * Iterates over a list of {@link ListChangeType} computed from two list of objects. The implementation
+ * is optimized to use the LCS algorithm only when needed, for trivial list no LCS computation should be
+ * required.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class ListChangeIterator<L1, L2, E> implements Iterator<ListChangeType>
+{
+
+ /** . */
+ private static final int[] EMPTY = new int[0];
+
+ /** . */
+ private static final int TRIVIAL_MODE = 0;
+
+ /** . */
+ private static final int LCS_MODE = 1;
+
+ /** . */
+ ListDiff<L1, L2, E> diff;
+
+ /** . */
+ private final L1 elements1;
+
+ /** . */
+ private final L2 elements2;
+
+ /** . */
+ private final Iterator<E> it1;
+
+ /** . */
+ private final Iterator<E> it2;
+
+ /** . */
+ private int index1;
+
+ /** . */
+ private int index2;
+
+ /** . */
+ private E next1;
+
+ /** . */
+ private E next2;
+
+ /** . */
+ private E element;
+
+ /** . */
+ private ListChangeType type;
+
+ /** . */
+ private int mode;
+
+ /** . */
+ private boolean buffered;
+
+ // LCS state
+
+ /** . */
+ private int[] matrix;
+
+ /** . */
+ private int m;
+
+ /** . */
+ private int n;
+
+ ListChangeIterator(ListDiff<L1, L2, E> diff, L1 elements1, L2 elements2) {
+ this.diff = diff;
+ this.elements1 = elements1;
+ this.elements2 = elements2;
+ this.it1 = elements1 != null ? diff.adapter1.iterator(elements1, false) : null;
+ this.it2 = elements2 != null ? diff.adapter2.iterator(elements2, false) : null;
+ this.mode = TRIVIAL_MODE;
+
+ //
+ this.index1 = 0;
+ this.index2 = 0;
+ this.buffered = false;
+ this.next1 = null;
+ this.next2 = null;
+ this.type = null;
+ this.element = null;
+
+ //
+ if (it1 != null && it1.hasNext()) {
+ next1 = it1.next();
+ }
+ if (it2 != null && it2.hasNext()) {
+ next2 = it2.next();
+ }
+
+ //
+ this.m = 0;
+ this.n = 0;
+ this.matrix = EMPTY;
+ }
+
+ private void next1() {
+ index1++;
+ if (it1 != null && it1.hasNext()) {
+ next1 = it1.next();
+ } else {
+ next1 = null;
+ }
+ }
+
+ private void next2() {
+ index2++;
+ if (it2 != null && it2.hasNext()) {
+ next2 = it2.next();
+ } else {
+ next2 = null;
+ }
+ }
+
+ public boolean hasNext() {
+
+ while (!buffered) {
+ if (mode == TRIVIAL_MODE) {
+ if (next1 != null) {
+ if (next2 != null) {
+ if (diff.equals(next1, next2)) {
+ type = ListChangeType.SAME;
+ element = next1;
+ buffered = true;
+ next1();
+ next2();
+ } else {
+ lcs(index1, elements1, elements2);
+ mode = LCS_MODE;
+ }
+ } else {
+ type = ListChangeType.REMOVE;
+ element = next1;
+ buffered = true;
+ next1();
+ }
+ } else {
+ if (next2 != null) {
+ type = ListChangeType.ADD;
+ element = next2;
+ buffered = true;
+ next2();
+ } else {
+ // Force a break with buffered to false
+ break;
+ }
+ }
+ } else if (mode == LCS_MODE) {
+ E elt1 = null;
+ E elt2 = null;
+ int i = diff.adapter1.size(elements1) - index1;
+ int j = diff.adapter2.size(elements2) - index2;
+ if (i > 0 && j > 0 && diff.equals(elt1 = next1, elt2 = next2)) {
+ type = ListChangeType.SAME;
+ element = elt1;
+ next1();
+ next2();
+ buffered = true;
+ } else {
+ int index1 = i + (j - 1) * m;
+ int index2 = i - 1 + j * m;
+ if (j > 0 && (i == 0 || matrix[index1] >= matrix[index2])) {
+ type = ListChangeType.ADD;
+ element = elt2 == null ? next2 : elt2;
+ next2();
+ buffered = true;
+ } else if (i > 0 && (j == 0 || matrix[index1] < matrix[index2])) {
+ type = ListChangeType.REMOVE;
+ element = elt1 == null ? next1 : elt1;
+ next1();
+ buffered = true;
+ } else {
+ // Force a break with buffered to false
+ break;
+ }
+ }
+ } else {
+ throw new AssertionError();
+ }
+ }
+
+ //
+ return buffered;
+ }
+
+ public ListChangeType next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ } else {
+ buffered = false;
+ return type;
+ }
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public E getElement() {
+ return element;
+ }
+
+ public int getIndex1() {
+ return index1;
+ }
+
+ public int getIndex2() {
+ return index2;
+ }
+
+ /**
+ * Compute the LCS matrix from the specified offset. It updates the state of this object
+ * with the relevant state. The LCS matrix is computed using the LCS algorithm
+ * (see http://en.wikipedia.org/wiki/Longest_common_subsequence_problem).
+ *
+ * @param offset the offset
+ * @param elements1 the elements 1
+ * @param elements2 the elements 2
+ */
+ private void lcs(int offset, L1 elements1, L2 elements2) {
+ m = 1 + diff.adapter1.size(elements1) - offset;
+ n = 1 + diff.adapter2.size(elements2) - offset;
+
+ //
+ int s = m * n;
+ matrix = new int[s];
+
+ // Compute the lcs matrix
+ Iterator<E> itI = diff.adapter1.iterator(elements1, true);
+ for (int i = 1; i < m; i++) {
+ E abc = itI.next();
+ Iterator<E> itJ = diff.adapter2.iterator(elements2, true);
+ for (int j = 1; j < n; j++) {
+ int index = i + j * m;
+ int v;
+ E def = itJ.next();
+ if (diff.equals(abc, def)) {
+ v = matrix[index - m - 1] + 1;
+ } else {
+ int v1 = matrix[index - 1];
+ int v2 = matrix[index - m];
+ v = v1 < v2 ? v2 : v1;
+ }
+ matrix[index] = v;
+ }
+ }
+ }
+
+ // For unit testing purpose
+ String getMatrix() {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < m; i++) {
+ sb.append('[');
+ for (int j = 0; j < n; j++) {
+ if (j > 0) {
+ sb.append(',');
+ }
+ sb.append(matrix[i + j * m]);
+ }
+ sb.append("]\n");
+ }
+ return sb.toString();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public enum ListChangeType {
-
- REMOVE,
-
- SAME,
-
- ADD
-
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListChangeType.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public enum ListChangeType {
+
+ REMOVE,
+
+ SAME,
+
+ ADD
+
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.diff;
-
-import java.util.Comparator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class ListDiff<L1, L2, E> {
-
- /** . */
- final Comparator<E> comparator;
-
- /** . */
- final ListAdapter<L1, E> adapter1;
-
- /** . */
- final ListAdapter<L2, E> adapter2;
-
- public ListDiff(ListAdapter<L1, E> adapter1, ListAdapter<L2, E> adapter2, Comparator<E> comparator) {
- this.adapter1 = adapter1;
- this.adapter2 = adapter2;
- this.comparator = comparator;
- }
-
- public ListDiff(ListAdapter<L1, E> adapter1, ListAdapter<L2, E> adapter2) {
- this(adapter1, adapter2, null);
- }
-
- boolean equals(E e1, E e2) {
- if (comparator == null) {
- return e1.equals(e2);
- } else {
- return comparator.compare(e1, e2) == 0;
- }
- }
-
- public final ListChangeIterator<L1, L2, E> iterator(L1 elements1, L2 elements2) {
- return new ListChangeIterator<L1, L2, E>(this, elements1, elements2);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/diff/ListDiff.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.diff;
+
+import java.util.Comparator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class ListDiff<L1, L2, E> {
+
+ /** . */
+ final Comparator<E> comparator;
+
+ /** . */
+ final ListAdapter<L1, E> adapter1;
+
+ /** . */
+ final ListAdapter<L2, E> adapter2;
+
+ public ListDiff(ListAdapter<L1, E> adapter1, ListAdapter<L2, E> adapter2, Comparator<E> comparator) {
+ this.adapter1 = adapter1;
+ this.adapter2 = adapter2;
+ this.comparator = comparator;
+ }
+
+ public ListDiff(ListAdapter<L1, E> adapter1, ListAdapter<L2, E> adapter2) {
+ this(adapter1, adapter2, null);
+ }
+
+ boolean equals(E e1, E e2) {
+ if (comparator == null) {
+ return e1.equals(e2);
+ } else {
+ return comparator.compare(e1, e2) == 0;
+ }
+ }
+
+ public final ListChangeIterator<L1, L2, E> iterator(L1 elements1, L2 elements2) {
+ return new ListChangeIterator<L1, L2, E>(this, elements1, elements2);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,535 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.list;
-
-import java.util.ListIterator;
-import java.util.NoSuchElementException;
-
-/**
- * <p>A tree structure where the children in which the children are organized as a linked list. The children of a
- * tree is a linked list and can be iterated with an iterator or thanks to the {@link #getFirst()}, {@link #getLast()},
- * {@link #getNext()} and {@link #getPrevious()} methods.</p>
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- * @param <T> the self bounding tree type
- */
-public class ListTree<T extends ListTree<T>>
-{
-
- /** . */
- private T parent;
-
- /** . */
- private T next;
-
- /** . */
- private T previous;
-
- /** . */
- private T head;
-
- /** . */
- private T tail;
-
- /** . */
- private int size;
-
- public ListTree()
- {
- this.next = null;
- this.previous = null;
- this.head = null;
- this.tail = null;
- this.size = 0;
- }
-
- /**
- * Returns the tree.
- *
- * @return the tree
- */
- public final T getNext()
- {
- return next;
- }
-
- /**
- * Returns the previous.
- *
- * @return the previous
- */
- public final T getPrevious()
- {
- return previous;
- }
-
- /**
- * Returns the parent.
- *
- * @return the parent
- */
- public final T getParent()
- {
- return parent;
- }
-
- /**
- * Returns the size.
- *
- * @return the size
- */
- public final int getSize()
- {
- return size;
- }
-
- /**
- * Returns the first tree.
- *
- * @return the first tree
- */
- public final T getFirst()
- {
- return head;
- }
-
- /**
- * Returns the last tree.
- *
- * @return the last tree
- */
- public final T getLast()
- {
- return tail;
- }
-
- /**
- * Returns a tree specified by its index.
- *
- * @param index the index
- * @return the corresponding tree
- * @throws IndexOutOfBoundsException if the index is incorrect
- */
- public final T get(int index) throws IndexOutOfBoundsException
- {
- if (index < 0)
- {
- throw new IndexOutOfBoundsException("No negative index allowed");
- }
-
- //
- T current = head;
- while (true)
- {
- if (current == null)
- {
- throw new IndexOutOfBoundsException("index " + index + " is greater than the children size");
- }
- if (index == 0)
- {
- break;
- }
- else
- {
- current = current.next;
- index--;
- }
- }
- return current;
- }
-
- /**
- * Insert the specified tree.
- *
- * @param index the index
- * @param tree the tree
- * @throws NullPointerException if the context is null
- * @throws IllegalArgumentException if an existing child with the same name already exist
- * @throws IndexOutOfBoundsException if the index is negative or is greater than the children size
- */
- public final void insertAt(Integer index, T tree) throws NullPointerException, IllegalArgumentException, IndexOutOfBoundsException
- {
- if (tree == null)
- {
- throw new NullPointerException("No null tree accepted");
- }
- if (index != null && index < 0)
- {
- throw new IndexOutOfBoundsException("No negative index permitted");
- }
-
- //
- if (index != null)
- {
- T a = head;
- if (index == 0)
- {
- insertFirst(tree);
- }
- else
- {
- while (index > 0)
- {
- if (a == null)
- {
- throw new IndexOutOfBoundsException();
- }
- index--;
- a = a.next;
- }
-
- //
- if (a == null)
- {
- insertLast(tree);
- }
- else if (a != tree)
- {
- a.insertBefore(tree);
- }
- }
- }
- else
- {
- T a = tail;
- if (a == null)
- {
- insertFirst(tree);
- }
- else if (a != tree)
- {
- a.insertAfter(tree);
- }
- }
- }
-
- /**
- * Insert the specified context at the last position among the children of this context.
- *
- * @param tree the content to insert
- * @throws NullPointerException if the tree argument is null
- */
- public final void insertLast(T tree)
- {
- if (tail == null)
- {
- insertFirst(tree);
- }
- else
- {
- tail.insertAfter(tree);
- }
- }
-
- /**
- * Insert the specified context at the first position among the children of this context.
- *
- * @param tree the content to insert
- * @throws NullPointerException if the tree argument is null
- */
- public void insertFirst(T tree) throws NullPointerException
- {
- if (tree == null)
- {
- throw new NullPointerException();
- }
- if (head == null)
- {
- beforeInsert(tree);
- if (tree.parent != null)
- {
- tree.remove();
- }
- head = tail = tree;
- tree.parent = (T)this;
- size++;
- afterInsert(tree);
- }
- else
- {
- head.insertBefore(tree);
- }
- }
-
- /**
- * Insert the specified tree after this tree
- *
- * @param tree the tree to insert after
- * @throws NullPointerException if the specified tree argument is null
- * @throws IllegalStateException if this tree does not have a parent
- */
- public final void insertAfter(T tree)
- {
- if (tree == null)
- {
- throw new NullPointerException("No null tree argument accepted");
- }
- if (parent == null)
- {
- throw new IllegalStateException();
- }
- if (this != tree)
- {
- parent.beforeInsert(tree);
- if (tree.parent != null)
- {
- tree.remove();
- }
- tree.previous = (T)this;
- tree.next = next;
- if (next == null)
- {
- parent.tail = tree;
- }
- else
- {
- next.previous = tree;
- }
- next = tree;
- tree.parent = parent;
- parent.size++;
- parent.afterInsert(tree);
- }
- }
-
- /**
- * Insert the specified tree before this tree
- *
- * @param tree the tree to insert before
- * @throws NullPointerException if the specified tree argument is null
- * @throws IllegalStateException if this tree does not have a parent
- */
- public final void insertBefore(T tree) throws NullPointerException, IllegalStateException
- {
- if (tree == null)
- {
- throw new NullPointerException("No null tree argument accepted");
- }
- if (parent == null)
- {
- throw new IllegalStateException();
- }
- if (this != tree)
- {
- parent.beforeInsert(tree);
- if (tree.parent != null)
- {
- tree.remove();
- }
- tree.previous = previous;
- tree.next = (T)this;
- if (previous == null)
- {
- parent.head = tree;
- }
- else
- {
- previous.next = tree;
- }
- previous = tree;
- tree.parent = parent;
- parent.size++;
- parent.afterInsert(tree);
- }
- }
-
- /**
- * Removes this tree from its parent
- *
- * @throws IllegalStateException if this tree does not have a parent
- */
- public final void remove() throws IllegalStateException
- {
- if (parent == null)
- {
- throw new IllegalStateException();
- }
- parent.beforeRemove((T)this);
- if (previous == null)
- {
- parent.head = next;
- }
- else
- {
- previous.next = next;
- }
- if (next == null)
- {
- parent.tail = previous;
- }
- else
- {
- next.previous = previous;
- }
- T _parent = parent;
- parent = null;
- previous = null;
- next = null;
- _parent.size--;
- _parent.afterRemove((T)this);
- }
-
- public final ListIterator<T> listIterator()
- {
-/*
- if (map == null)
- {
- return null;
- }
-*/
- return new ListIterator<T>()
- {
- T next = head;
- T current = null;
- T previous = null;
- int index = 0;
-
- public boolean hasNext()
- {
- return next != null;
- }
-
- public T next()
- {
- if (next != null)
- {
- current = next;
-
- //
- previous = next;
- next = next.next;
- index++;
- return current;
- }
- else
- {
- throw new NoSuchElementException();
- }
- }
-
- public boolean hasPrevious()
- {
- return previous != null;
- }
-
- public T previous()
- {
- if (previous != null)
- {
- current = previous;
-
- //
- next = previous;
- previous = previous.previous;
- index--;
- return current;
- }
- else
- {
- throw new NoSuchElementException();
- }
- }
-
- public int nextIndex()
- {
- return index;
- }
-
- public int previousIndex()
- {
- return index - 1;
- }
-
- public void remove()
- {
- if (current == null)
- {
- throw new IllegalStateException("no element to remove");
- }
- if (current == previous)
- {
- index--;
- }
- next = current.next;
- previous = current.previous;
- current.remove();
- current = null;
- }
-
- public void set(T tree)
- {
- throw new UnsupportedOperationException();
- }
-
- public void add(T tree)
- {
- if (previous == null)
- {
- insertFirst(tree);
- }
- else
- {
- previous.insertAfter(tree);
- }
- index++;
- previous = tree;
- next = tree.next;
- }
- };
- }
-
- /**
- * Callback to signal insertion occured.
- *
- * @param tree the child inserted
- */
- protected void beforeInsert(T tree)
- {
- }
-
- /**
- * Callback to signal insertion occured.
- *
- * @param tree the child inserted
- */
- protected void afterInsert(T tree)
- {
- }
-
- /**
- * Callback to signal insertion occured.
- *
- * @param tree the child inserted
- */
- protected void beforeRemove(T tree)
- {
- }
-
- /**
- * Callback to signal insertion occured.
- *
- * @param tree the child inserted
- */
- protected void afterRemove(T tree)
- {
- }
-}
-
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java (from rev 6783, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/tree/list/ListTree.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,535 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.list;
+
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+/**
+ * <p>A tree structure where the children in which the children are organized as a linked list. The children of a
+ * tree is a linked list and can be iterated with an iterator or thanks to the {@link #getFirst()}, {@link #getLast()},
+ * {@link #getNext()} and {@link #getPrevious()} methods.</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ * @param <T> the self bounding tree type
+ */
+public class ListTree<T extends ListTree<T>>
+{
+
+ /** . */
+ private T parent;
+
+ /** . */
+ private T next;
+
+ /** . */
+ private T previous;
+
+ /** . */
+ private T head;
+
+ /** . */
+ private T tail;
+
+ /** . */
+ private int size;
+
+ public ListTree()
+ {
+ this.next = null;
+ this.previous = null;
+ this.head = null;
+ this.tail = null;
+ this.size = 0;
+ }
+
+ /**
+ * Returns the tree.
+ *
+ * @return the tree
+ */
+ public final T getNext()
+ {
+ return next;
+ }
+
+ /**
+ * Returns the previous.
+ *
+ * @return the previous
+ */
+ public final T getPrevious()
+ {
+ return previous;
+ }
+
+ /**
+ * Returns the parent.
+ *
+ * @return the parent
+ */
+ public final T getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * Returns the size.
+ *
+ * @return the size
+ */
+ public final int getSize()
+ {
+ return size;
+ }
+
+ /**
+ * Returns the first tree.
+ *
+ * @return the first tree
+ */
+ public final T getFirst()
+ {
+ return head;
+ }
+
+ /**
+ * Returns the last tree.
+ *
+ * @return the last tree
+ */
+ public final T getLast()
+ {
+ return tail;
+ }
+
+ /**
+ * Returns a tree specified by its index.
+ *
+ * @param index the index
+ * @return the corresponding tree
+ * @throws IndexOutOfBoundsException if the index is incorrect
+ */
+ public final T get(int index) throws IndexOutOfBoundsException
+ {
+ if (index < 0)
+ {
+ throw new IndexOutOfBoundsException("No negative index allowed");
+ }
+
+ //
+ T current = head;
+ while (true)
+ {
+ if (current == null)
+ {
+ throw new IndexOutOfBoundsException("index " + index + " is greater than the children size");
+ }
+ if (index == 0)
+ {
+ break;
+ }
+ else
+ {
+ current = current.next;
+ index--;
+ }
+ }
+ return current;
+ }
+
+ /**
+ * Insert the specified tree.
+ *
+ * @param index the index
+ * @param tree the tree
+ * @throws NullPointerException if the context is null
+ * @throws IllegalArgumentException if an existing child with the same name already exist
+ * @throws IndexOutOfBoundsException if the index is negative or is greater than the children size
+ */
+ public final void insertAt(Integer index, T tree) throws NullPointerException, IllegalArgumentException, IndexOutOfBoundsException
+ {
+ if (tree == null)
+ {
+ throw new NullPointerException("No null tree accepted");
+ }
+ if (index != null && index < 0)
+ {
+ throw new IndexOutOfBoundsException("No negative index permitted");
+ }
+
+ //
+ if (index != null)
+ {
+ T a = head;
+ if (index == 0)
+ {
+ insertFirst(tree);
+ }
+ else
+ {
+ while (index > 0)
+ {
+ if (a == null)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ index--;
+ a = a.next;
+ }
+
+ //
+ if (a == null)
+ {
+ insertLast(tree);
+ }
+ else if (a != tree)
+ {
+ a.insertBefore(tree);
+ }
+ }
+ }
+ else
+ {
+ T a = tail;
+ if (a == null)
+ {
+ insertFirst(tree);
+ }
+ else if (a != tree)
+ {
+ a.insertAfter(tree);
+ }
+ }
+ }
+
+ /**
+ * Insert the specified context at the last position among the children of this context.
+ *
+ * @param tree the content to insert
+ * @throws NullPointerException if the tree argument is null
+ */
+ public final void insertLast(T tree)
+ {
+ if (tail == null)
+ {
+ insertFirst(tree);
+ }
+ else
+ {
+ tail.insertAfter(tree);
+ }
+ }
+
+ /**
+ * Insert the specified context at the first position among the children of this context.
+ *
+ * @param tree the content to insert
+ * @throws NullPointerException if the tree argument is null
+ */
+ public void insertFirst(T tree) throws NullPointerException
+ {
+ if (tree == null)
+ {
+ throw new NullPointerException();
+ }
+ if (head == null)
+ {
+ beforeInsert(tree);
+ if (tree.parent != null)
+ {
+ tree.remove();
+ }
+ head = tail = tree;
+ tree.parent = (T)this;
+ size++;
+ afterInsert(tree);
+ }
+ else
+ {
+ head.insertBefore(tree);
+ }
+ }
+
+ /**
+ * Insert the specified tree after this tree
+ *
+ * @param tree the tree to insert after
+ * @throws NullPointerException if the specified tree argument is null
+ * @throws IllegalStateException if this tree does not have a parent
+ */
+ public final void insertAfter(T tree)
+ {
+ if (tree == null)
+ {
+ throw new NullPointerException("No null tree argument accepted");
+ }
+ if (parent == null)
+ {
+ throw new IllegalStateException();
+ }
+ if (this != tree)
+ {
+ parent.beforeInsert(tree);
+ if (tree.parent != null)
+ {
+ tree.remove();
+ }
+ tree.previous = (T)this;
+ tree.next = next;
+ if (next == null)
+ {
+ parent.tail = tree;
+ }
+ else
+ {
+ next.previous = tree;
+ }
+ next = tree;
+ tree.parent = parent;
+ parent.size++;
+ parent.afterInsert(tree);
+ }
+ }
+
+ /**
+ * Insert the specified tree before this tree
+ *
+ * @param tree the tree to insert before
+ * @throws NullPointerException if the specified tree argument is null
+ * @throws IllegalStateException if this tree does not have a parent
+ */
+ public final void insertBefore(T tree) throws NullPointerException, IllegalStateException
+ {
+ if (tree == null)
+ {
+ throw new NullPointerException("No null tree argument accepted");
+ }
+ if (parent == null)
+ {
+ throw new IllegalStateException();
+ }
+ if (this != tree)
+ {
+ parent.beforeInsert(tree);
+ if (tree.parent != null)
+ {
+ tree.remove();
+ }
+ tree.previous = previous;
+ tree.next = (T)this;
+ if (previous == null)
+ {
+ parent.head = tree;
+ }
+ else
+ {
+ previous.next = tree;
+ }
+ previous = tree;
+ tree.parent = parent;
+ parent.size++;
+ parent.afterInsert(tree);
+ }
+ }
+
+ /**
+ * Removes this tree from its parent
+ *
+ * @throws IllegalStateException if this tree does not have a parent
+ */
+ public final void remove() throws IllegalStateException
+ {
+ if (parent == null)
+ {
+ throw new IllegalStateException();
+ }
+ parent.beforeRemove((T)this);
+ if (previous == null)
+ {
+ parent.head = next;
+ }
+ else
+ {
+ previous.next = next;
+ }
+ if (next == null)
+ {
+ parent.tail = previous;
+ }
+ else
+ {
+ next.previous = previous;
+ }
+ T _parent = parent;
+ parent = null;
+ previous = null;
+ next = null;
+ _parent.size--;
+ _parent.afterRemove((T)this);
+ }
+
+ public final ListIterator<T> listIterator()
+ {
+/*
+ if (map == null)
+ {
+ return null;
+ }
+*/
+ return new ListIterator<T>()
+ {
+ T next = head;
+ T current = null;
+ T previous = null;
+ int index = 0;
+
+ public boolean hasNext()
+ {
+ return next != null;
+ }
+
+ public T next()
+ {
+ if (next != null)
+ {
+ current = next;
+
+ //
+ previous = next;
+ next = next.next;
+ index++;
+ return current;
+ }
+ else
+ {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public boolean hasPrevious()
+ {
+ return previous != null;
+ }
+
+ public T previous()
+ {
+ if (previous != null)
+ {
+ current = previous;
+
+ //
+ next = previous;
+ previous = previous.previous;
+ index--;
+ return current;
+ }
+ else
+ {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public int nextIndex()
+ {
+ return index;
+ }
+
+ public int previousIndex()
+ {
+ return index - 1;
+ }
+
+ public void remove()
+ {
+ if (current == null)
+ {
+ throw new IllegalStateException("no element to remove");
+ }
+ if (current == previous)
+ {
+ index--;
+ }
+ next = current.next;
+ previous = current.previous;
+ current.remove();
+ current = null;
+ }
+
+ public void set(T tree)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void add(T tree)
+ {
+ if (previous == null)
+ {
+ insertFirst(tree);
+ }
+ else
+ {
+ previous.insertAfter(tree);
+ }
+ index++;
+ previous = tree;
+ next = tree.next;
+ }
+ };
+ }
+
+ /**
+ * Callback to signal insertion occured.
+ *
+ * @param tree the child inserted
+ */
+ protected void beforeInsert(T tree)
+ {
+ }
+
+ /**
+ * Callback to signal insertion occured.
+ *
+ * @param tree the child inserted
+ */
+ protected void afterInsert(T tree)
+ {
+ }
+
+ /**
+ * Callback to signal insertion occured.
+ *
+ * @param tree the child inserted
+ */
+ protected void beforeRemove(T tree)
+ {
+ }
+
+ /**
+ * Callback to signal insertion occured.
+ *
+ * @param tree the child inserted
+ */
+ protected void afterRemove(T tree)
+ {
+ }
+}
+
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/resources/binding.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -90,7 +90,7 @@
</mapping>
<mapping name="node" label="node" class="org.exoplatform.portal.config.model.PageNode">
- <value name="uri" field="uri"/>
+ <value name="uri" field="uri" usage="optional"/>
<value name="name" field="name"/>
<value name="label" field="label" usage="optional" set-method="setLabel"/>
<value name="icon" field="icon" usage="optional"/>
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/TestXSDCorruption.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -59,6 +59,6 @@
{
assertHash("d0591b0a022a0c2929e1aed8979857cd", "gatein_objects_1_0.xsd");
assertHash("99ae24c9bbfe1b59e066756a29ab6c79", "gatein_objects_1_1.xsd");
- assertHash("9a031c15ce0e2b4dd1e283458f590581", "gatein_objects_1_2.xsd");
+ assertHash("a2d34899c8b645e32bfa7fc03b7cbe4d", "gatein_objects_1_2.xsd");
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -21,12 +21,27 @@
import static org.exoplatform.portal.pom.config.Utils.split;
-import org.exoplatform.commons.utils.LazyPageList;
+import junit.framework.AssertionFailedError;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.Preference;
-import org.exoplatform.portal.config.model.*;
-import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Dashboard;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.mop.EventType;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.Scope;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -36,12 +51,15 @@
import org.exoplatform.services.listener.Listener;
import org.exoplatform.services.listener.ListenerService;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
-import junit.framework.AssertionFailedError;
-
/**
* Created by The eXo Platform SARL Author : Tung Pham thanhtungty(a)gmail.com Nov
* 13, 2007
@@ -50,27 +68,22 @@
{
/** . */
- private static final String CLASSIC_HOME = "portal::classic::homepage";
+ private final String testPage = "portal::classic::testPage";
/** . */
- private static final String CLASSIC_TEST = "portal::classic::testPage";
-
- /** . */
private final String testPortletPreferences = "portal#classic:/web/BannerPortlet/testPortletPreferences";
/** . */
private DataStorage storage_;
/** . */
- private POMSessionManager mgr;
+ private NavigationService navService;
/** . */
- private POMSession session;
+ private POMSessionManager mgr;
- /** . */
- private EventQueue events;
+ private LinkedList<Event> events;
- /** . */
private ListenerService listenerService;
public TestDataStorage(String name)
@@ -80,37 +93,41 @@
public void setUp() throws Exception
{
+ Listener listener = new Listener()
+ {
+ @Override
+ public void onEvent(Event event) throws Exception
+ {
+ events.add(event);
+ }
+ };
+
+ //
super.setUp();
- begin();
PortalContainer container = PortalContainer.getInstance();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- session = mgr.openSession();
+ navService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
+ events = new LinkedList<Event>();
listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
//
- if (events == null)
- {
- events = new EventQueue();
- listenerService.addListener(DataStorage.PAGE_CREATED, events);
- listenerService.addListener(DataStorage.PAGE_REMOVED, events);
- listenerService.addListener(DataStorage.PAGE_UPDATED, events);
- listenerService.addListener(DataStorage.NAVIGATION_CREATED, events);
- listenerService.addListener(DataStorage.NAVIGATION_REMOVED, events);
- listenerService.addListener(DataStorage.NAVIGATION_UPDATED, events);
- listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, events);
- listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, events);
- listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, events);
- }
- else
- {
- events.clear();
- }
+ listenerService.addListener(DataStorage.PAGE_CREATED, listener);
+ listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
+ listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
+ listenerService.addListener(EventType.NAVIGATION_CREATED, listener);
+ listenerService.addListener(EventType.NAVIGATION_DESTROYED, listener);
+ listenerService.addListener(EventType.NAVIGATION_UPDATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, listener);
+
+ //
+ begin();
}
protected void tearDown() throws Exception
{
- session.close();
end();
super.tearDown();
}
@@ -128,9 +145,8 @@
portal.setAccessPermissions(new String[]{UserACL.EVERYONE});
//
- events.clear();
storage_.create(portal);
- events.assertSize(1);
+ assertEquals(1, events.size());
portal = storage_.getPortalConfig(portal.getName());
assertNotNull(portal);
assertEquals("portal", portal.getType());
@@ -145,11 +161,9 @@
assertNotNull(portal);
//
- events.clear();
portal.setLocale("vietnam");
storage_.save(portal);
- events.assertSize(1);
-
+ assertEquals(1, events.size());
//
portal = storage_.getPortalConfig("portal", "test");
assertNotNull(portal);
@@ -161,9 +175,8 @@
PortalConfig portal = storage_.getPortalConfig("portal", "test");
assertNotNull(portal);
- events.clear();
storage_.remove(portal);
- events.assertSize(1);
+ assertEquals(1, events.size());
assertNull(storage_.getPortalConfig("portal", "test"));
try
@@ -187,9 +200,8 @@
page.setName("foo");
//
- events.clear();
storage_.create(page);
- events.assertSize(1);
+ assertEquals(1, events.size());
//
Page page2 = storage_.getPage(page.getPageId());
@@ -214,17 +226,15 @@
page.setShowMaxWindow(false);
//
- events.clear();
storage_.create(page);
- events.assertSize(1);
+ assertEquals(1, events.size());
//
Page page2 = storage_.getPage(page.getPageId());
page2.setTitle("MyTitle2");
page2.setShowMaxWindow(true);
- events.clear();
storage_.save(page2);
- events.assertSize(1);
+ assertEquals(2, events.size());
page2 = storage_.getPage(page.getPageId());
assertNotNull(page2);
@@ -237,56 +247,6 @@
assertEquals(true, page2.isShowMaxWindow());
}
- public void testRenameNode() throws Exception
- {
- //Create node
- PageNode pageNode = new PageNode();
- String name = "MyPageNode";
- pageNode.setName(name);
- pageNode.setUri(name);
- pageNode.setLabel(name);
-
- //add node to page navigation
- String ownerId = "root";
- String ownerType = "user";
- PageNavigation nav = storage_.getPageNavigation(ownerType, ownerId);
- assertNotNull(nav);
- assertEquals(ownerId, nav.getOwnerId());
- assertEquals(ownerType, nav.getOwnerType());
- nav.addNode(pageNode);
- storage_.save(nav);
-
- //Rename node
- PageNavigation nav2 = storage_.getPageNavigation(ownerType, ownerId);
- assertNotNull(nav2);
- assertEquals(ownerId, nav2.getOwnerId());
- assertEquals(ownerType, nav2.getOwnerType());
-
- PageNode pageNode2 = nav2.getNode(name);
- assertNotNull(pageNode2);
- assertEquals(name, pageNode2.getName());
- assertEquals(name, pageNode2.getLabel());
- assertEquals(name, pageNode2.getUri());
-
- String newName = "NewMyPageNode";
- pageNode2.setName(newName);
- pageNode2.setUri(newName);
- pageNode2.setLabel(newName);
- storage_.save(nav2);
-
- //Get and compare
- PageNavigation nav3 = storage_.getPageNavigation(ownerType, ownerId);
- assertNotNull(nav3);
- assertEquals(ownerId, nav3.getOwnerId());
- assertEquals(ownerType, nav3.getOwnerType());
-
- PageNode pageNode3 = nav3.getNode(newName);
- assertNotNull(pageNode3);
- assertEquals(newName, pageNode3.getName());
- assertEquals(newName, pageNode3.getLabel());
- assertEquals(newName, pageNode3.getUri());
- }
-
public void testChangingPortletThemeInPage() throws Exception {
Page page;
Application<?> app;
@@ -314,12 +274,11 @@
assertNotNull(page);
//
- events.clear();
storage_.remove(page);
- events.assertSize(1);
-
+ assertEquals(1, events.size());
+
//
- page = storage_.getPage(CLASSIC_TEST);
+ page = storage_.getPage(testPage);
assertNull(page);
}
@@ -388,39 +347,6 @@
// Need to make window move 3 unit test
- public void testCreateNavigation() throws Exception
- {
- PortalConfig portal = new PortalConfig();
- portal.setName("foo");
- portal.setLocale("en");
- portal.setAccessPermissions(new String[]{UserACL.EVERYONE});
- events.clear();
- storage_.create(portal);
- events.assertSize(1);
-
- //
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerId("foo");
- navigation.setOwnerType("portal");
- events.clear();
- storage_.create(navigation);
- events.assertSize(1);
- }
-
- public void testSaveNavigation() throws Exception
- {
- PageNavigation pageNavi = storage_.getPageNavigation("portal", "test");
- assertNotNull(pageNavi);
-
- //
- events.clear();
- storage_.save(pageNavi);
- events.assertSize(1);
-
- //
- PageNavigation newPageNavi = storage_.getPageNavigation(pageNavi.getOwnerType(), pageNavi.getOwnerId());
- }
-
/**
* Test that setting a page reference to null will actually remove the page reference from the PageNode
* @throws Exception
@@ -440,92 +366,28 @@
page.setOwnerId("test");
page.setName("foo");
storage_.create(page);
-
- //create a page node and add page
- PageNode pageNode = new PageNode();
- pageNode.setName("testPage");
- pageNode.setPageReference(page.getPageId());
- pageNode.build();
-
+
// create a new page navigation and add node
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerId("foo");
- navigation.setOwnerType("portal");
- navigation.addNode(pageNode);
- storage_.create(navigation);
-
+ NavigationContext nav = new NavigationContext(SiteKey.portal("foo"), new NavigationState(0));
+ navService.saveNavigation(nav);
+ NodeContext<?> node = navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.CHILDREN, null);
+ NodeContext<?> test = node.add(null, "testPage");
+ test.setState(test.getState().builder().pageRef(page.getPageId()).build());
+ navService.saveNode(node, null);
+
// get the page reference from the created page and check that it exists
- PageNavigation pageNavigationWithPageReference = storage_.getPageNavigation("portal", navigation.getOwnerId());
- assertNotNull("Expected page reference should not be null.", pageNavigationWithPageReference.getNodes().get(0).getPageReference());
+ NodeContext<?> pageNavigationWithPageReference = navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.CHILDREN, null);
+ assertNotNull("Expected page reference should not be null.", pageNavigationWithPageReference.get(0).getState().getPageRef());
// set the page reference to null and save.
- ArrayList<PageNode> nodes = navigation.getNodes();
- nodes.get(0).setPageReference(null);
- navigation.setNodes(nodes);
- storage_.save(navigation);
-
+ test.setState(test.getState().builder().pageRef(null).build());
+ navService.saveNode(node, null);
+
// check that setting the page reference to null actually removes the page reference
- PageNavigation pageNavigationWithoutPageReference = storage_.getPageNavigation("portal", navigation.getOwnerId());
- assertNull("Expected page reference should be null.", pageNavigationWithoutPageReference.getNodes().get(0).getPageReference());
+ NodeContext<?> pageNavigationWithoutPageReference = navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.CHILDREN, null);
+ assertNull("Expected page reference should be null.", pageNavigationWithoutPageReference.get(0).getState().getPageRef());
}
- public void testRemoveNavigation() throws Exception
- {
- PageNavigation navigation = storage_.getPageNavigation("portal", "test");
- assertNotNull(navigation);
-
- //
- events.clear();
- storage_.remove(navigation);
- events.assertSize(1);
-
- //
- navigation = storage_.getPageNavigation("portal", "test");
- assertNull(navigation);
- }
-
- public void testNavigationOrder() throws Exception
- {
- PortalConfig portal = new PortalConfig("portal");
- portal.setName("test_nav");
- storage_.create(portal);
-
- //
- PageNavigation nav = new PageNavigation();
- nav.setOwnerType("portal");
- nav.setOwnerId("test_nav");
- PageNode node1 = new PageNode();
- node1.setName("n1");
- PageNode node2 = new PageNode();
- node2.setName("n2");
- PageNode node3 = new PageNode();
- node3.setName("n3");
- nav.addNode(node1);
- nav.addNode(node2);
- nav.addNode(node3);
-
- //
- storage_.save(nav);
-
- //
- nav = storage_.getPageNavigation("portal", "test_nav");
- assertEquals(3, nav.getNodes().size());
- assertEquals("n1", nav.getNodes().get(0).getName());
- assertEquals("n2", nav.getNodes().get(1).getName());
- assertEquals("n3", nav.getNodes().get(2).getName());
-
- //
- nav.getNodes().add(0, nav.getNodes().remove(1));
- storage_.save(nav);
-
- //
- nav = storage_.getPageNavigation("portal", "test_nav");
- assertEquals(3, nav.getNodes().size());
- assertEquals("n2", nav.getNodes().get(0).getName());
- assertEquals("n1", nav.getNodes().get(1).getName());
- assertEquals("n3", nav.getNodes().get(2).getName());
- }
-
public void testCreatePortletPreferences() throws Exception
{
ArrayList<Preference> prefs = new ArrayList<Preference>();
@@ -894,22 +756,7 @@
gadgetApp = (Application<Gadget>)row0.getChildren().get(0);
assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
-
- public void testRemoveAndFindPage() throws Exception
- {
- Page page = storage_.getPage(CLASSIC_HOME);
- assertNotNull(page);
- storage_.remove(page);
- // This will trigger a save
- Query<Page> query = new Query<Page>(null, null, null, null, Page.class);
- LazyPageList<Page> list = storage_.find(query);
- assertNotNull(list);
-
- // We check is now seen as removed
- assertNull(storage_.getPage(CLASSIC_HOME));
- }
-
public void testGetAllPortalNames() throws Exception
{
final List<String> names = storage_.getAllPortalNames();
@@ -959,12 +806,10 @@
}
// Now commit tx
- session.close(true);
end(true);
// We test we observe the change
begin();
- session = mgr.openSession();
List<String> afterNames = storage_.getAllPortalNames();
assertTrue(afterNames.containsAll(names));
afterNames.removeAll(names);
@@ -1015,12 +860,10 @@
}
//
- session.close(true);
end(true);
// Now test it is still removed
begin();
- session = mgr.openSession();
afterNames = storage_.getAllPortalNames();
assertEquals(new HashSet<String>(names), new HashSet<String>(afterNames));
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -28,6 +28,13 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.Scope;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
@@ -57,6 +64,9 @@
/** . */
private POMSession session;
+ /** . */
+ private NavigationService navService;
+
public TestLoadedPOM(String name)
{
super(name);
@@ -70,6 +80,7 @@
portalConfigService = (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ navService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
session = mgr.openSession();
}
@@ -82,11 +93,12 @@
public void testLegacyGroupWithNormalizedName() throws Exception
{
- PageNavigation nav = storage.getPageNavigation("group::/platform/test/legacy");
+ SiteKey key = SiteKey.group("/platform/test/legacy");
+ NavigationContext nav = navService.loadNavigation(key);
assertNotNull(nav);
- assertEquals("/platform/test/legacy", nav.getOwnerId());
- PageNode node = nav.getNodes().get(0);
- assertEquals("group::/platform/test/legacy::register", node.getPageReference());
+ NodeContext<?> root = navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.ALL, null);
+ NodeContext<?> node = root.get(0);
+ assertEquals("group::/platform/test/legacy::register", node.getState().getPageRef());
Page page = storage.getPage("group::/platform/test/legacy::register");
assertNotNull(page);
@@ -102,11 +114,12 @@
public void testGroupWithNormalizedName() throws Exception
{
- PageNavigation nav = storage.getPageNavigation("group::/platform/test/normalized");
+ SiteKey key = SiteKey.group("/platform/test/normalized");
+ NavigationContext nav = navService.loadNavigation(key);
assertNotNull(nav);
- assertEquals("/platform/test/normalized", nav.getOwnerId());
- PageNode node = nav.getNodes().get(0);
- assertEquals("group::/platform/test/normalized::register", node.getPageReference());
+ NodeContext<?> root = navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.ALL, null);
+ NodeContext<?> node = root.get(0);
+ assertEquals("group::/platform/test/normalized::register", node.getState().getPageRef());
Page page = storage.getPage("group::/platform/test/normalized::register");
assertNotNull(page);
@@ -123,30 +136,30 @@
public void testNavigation() throws Exception
{
- PageNavigation nav = storage.getPageNavigation("portal::test");
+ SiteKey key = SiteKey.portal("test");
+ NavigationContext nav = navService.loadNavigation(key);
assertNotNull(nav);
//
- assertEquals(1, nav.getPriority());
+ assertEquals(1, (int) nav.getState().getPriority());
//
- assertEquals(2, nav.getNodes().size());
+ NodeContext<?> root = navService.loadNode(NodeModel.SELF_MODEL, nav, Scope.ALL, null);
+ assertEquals(5, root.getNodeCount());
//
- PageNode nodeNavigation = nav.getNodes().get(0);
- assertEquals(0, nodeNavigation.getChildren().size());
+ NodeContext<?> nodeNavigation = root.get(0);
+ assertEquals(0, nodeNavigation.getNodeCount());
assertEquals("node_name", nodeNavigation.getName());
- assertEquals("node_uri", nodeNavigation.getUri());
- assertEquals("node_label", nodeNavigation.getLabel());
- assertEquals("node_icon", nodeNavigation.getIcon());
+ assertEquals("node_label", nodeNavigation.getState().getLabel());
+ assertEquals("node_icon", nodeNavigation.getState().getIcon());
GregorianCalendar start = new GregorianCalendar(2000, 2, 21, 1, 33, 0);
start.setTimeZone(TimeZone.getTimeZone("UTC"));
- assertEquals(start.getTime(), nodeNavigation.getStartPublicationDate());
+ assertEquals(start.getTime().getTime(), nodeNavigation.getState().getStartPublicationTime());
GregorianCalendar end = new GregorianCalendar(2009, 2, 21, 1, 33, 0);
end.setTimeZone(TimeZone.getTimeZone("UTC"));
- assertEquals(end.getTime(), nodeNavigation.getEndPublicationDate());
- assertEquals(true, nodeNavigation.isShowPublicationDate());
- assertEquals(true, nodeNavigation.isVisible());
+ assertEquals(end.getTime().getTime(), nodeNavigation.getState().getEndPublicationTime());
+ assertEquals(Visibility.TEMPORAL, nodeNavigation.getState().getVisibility());
}
public void testPortal() throws Exception
@@ -230,24 +243,6 @@
}
*/
- public void testFindNavigation() throws Exception
- {
- Query<PageNavigation> query = new Query<PageNavigation>("group", null, null, null, PageNavigation.class);
- List<PageNavigation> list = storage.find(query).getAll();
- assertEquals("Expected 6 results instead of " + list, 6, list.size());
- Set<String> names = new HashSet<String>();
- for (PageNavigation navigation : list)
- {
- assertEquals("group", navigation.getOwnerType());
- names.add(navigation.getOwnerId());
- }
- HashSet<String> expectedNames =
- new HashSet<String>(Arrays.asList("/platform/test/legacy", "/platform/test/normalized",
- "/platform/administrators", "/platform/guests", "/platform/users",
- "/organization/management/executive-board"));
- assertEquals(expectedNames, names);
- }
-
/*
public void testFindPageByName() throws Exception
{
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -22,6 +22,10 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.services.organization.Group;
@@ -48,6 +52,9 @@
/** . */
private POMSession session;
+ /** . */
+ private NavigationService navService;
+
public TestPortalConfig(String name)
{
super(name);
@@ -61,6 +68,7 @@
org = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ navService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
session = mgr.openSession();
}
@@ -127,30 +135,29 @@
group = groupHandler.findGroupById("/groupTest");
assertNull(group);
}
-
+
+
+
public void testGroupNavigation() throws Exception
{
+
+
GroupHandler groupHandler = org.getGroupHandler();
Group group = groupHandler.createGroupInstance();
group.setGroupName("testGroupNavigation");
group.setLabel("testGroupNavigation");
groupHandler.addChild(null, group, true);
-
- PageNavigation pageNavigation = new PageNavigation();
- pageNavigation.setOwnerId(group.getId());
- pageNavigation.setOwnerType(PortalConfig.GROUP_TYPE);
- storage.create(pageNavigation);
-
- pageNavigation = storage.getPageNavigation(PortalConfig.GROUP_TYPE, group.getId());
- assertNotNull(pageNavigation);
-
+
+ SiteKey key = SiteKey.group(group.getId());
+ navService.saveNavigation(new NavigationContext(key, new NavigationState(0)));
+ assertNotNull(navService.loadNavigation(key));
+
// Remove group
groupHandler.removeGroup(group, true);
// Group navigations is removed after remove group
- pageNavigation = storage.getPageNavigation(PortalConfig.GROUP_TYPE, group.getId());
- assertNull(pageNavigation);
+ assertNull(navService.loadNavigation(key));
}
public void testUserLayout() throws Exception
@@ -173,27 +180,4 @@
PortalConfig pConfig = storage.getPortalConfig(PortalConfig.USER_TYPE, "testing");
assertNotNull("the User's PortalConfig is not null", pConfig);
}
-
- public void testGetAllOrder() throws Exception
- {
- // Query with comparator to make sure returned list is ordered
- Query<PageNavigation> query = new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
- Comparator<PageNavigation> sortComparator = new Comparator<PageNavigation>()
- {
- public int compare(PageNavigation pconfig1, PageNavigation pconfig2)
- {
- return pconfig1.getOwnerId().compareTo(pconfig2.getOwnerId());
- }
- };
-
- // First query
- List<PageNavigation> navis = storage.find(query, sortComparator).getAll();
- storage.save(navis.get(0)); // Modify
- // Second query
- List<PageNavigation> navis2 = storage.find(query, sortComparator).getAll();
- for (int i = 0; i < navis.size(); i++)
- {
- assertEquals(true, navis.get(i).getOwnerId().equals(navis2.get(i).getOwnerId()));
- }
- }
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -97,7 +97,7 @@
//
Collection<? extends Navigation> childrenNavigations = defaultNav.getChildren();
assertNotNull(childrenNavigations);
- assertEquals(2, childrenNavigations.size());
+ assertEquals(5, childrenNavigations.size());
Iterator<? extends Navigation> i = childrenNavigations.iterator();
//
@@ -109,7 +109,6 @@
Described nodeDescribed = nodeNavigation.adapt(Described.class);
assertEquals("node_label", nodeDescribed.getName());
Attributes nodeAttrs = nodeNavigation.getAttributes();
- assertEquals("node_uri", nodeAttrs.getString("uri"));
assertEquals("node_icon", nodeAttrs.getString("icon"));
//
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -59,22 +59,20 @@
super.tearDown();
}
- private void assertFound(String searchTitle, String expectedPage) throws Exception
+ private void assertPageFound(Query<Page> q, String expectedPage) throws Exception
{
- Query<Page> q = new Query<Page>(null, null, null, searchTitle, Page.class);
List<Page> res = storage.find(q).getAll();
assertEquals(1, res.size());
assertEquals(expectedPage, res.get(0).getPageId());
}
- private void assertNotFound(String searchTitle) throws Exception
+ private void assertPageNotFound(Query<Page> q) throws Exception
{
- Query<Page> q = new Query<Page>(null, null, null, searchTitle, Page.class);
List<Page> res = storage.find(q).getAll();
assertEquals(0, res.size());
}
- public void testFoo() throws Exception
+ public void testSearchPage() throws Exception
{
Page page = new Page();
page.setPageId("portal::test::searchedpage");
@@ -83,19 +81,20 @@
session.save();
//
- assertFound("Juuu Ziii", "portal::test::searchedpage");
- assertFound("Juuu", "portal::test::searchedpage");
- assertFound("Ziii", "portal::test::searchedpage");
- assertFound("juuu ziii", "portal::test::searchedpage");
- assertFound("juuu", "portal::test::searchedpage");
- assertFound("ziii", "portal::test::searchedpage");
- assertFound("juu", "portal::test::searchedpage");
- assertFound("zii", "portal::test::searchedpage");
- assertFound("ju", "portal::test::searchedpage");
- assertFound("zi", "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "Juuu Ziii", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "Juuu", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "Ziii", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "juuu ziii", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "juuu", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "ziii", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "juu", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "zii", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "ju", Page.class), "portal::test::searchedpage");
+ assertPageFound(new Query<Page>(null, null, null, "zi", Page.class), "portal::test::searchedpage");
- assertNotFound("foo");
- assertNotFound("foo bar");
+ assertPageNotFound(new Query<Page>(null, null, null, "foo", Page.class));
+ assertPageNotFound(new Query<Page>(null, null, null, "foo bar", Page.class));
+ assertPageNotFound(new Query<Page>("test", null, null, null, Page.class));
}
public void testSearchPageByOwnerID() throws Exception
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -22,15 +22,12 @@
import org.exoplatform.component.test.AbstractGateInTest;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.mop.Visibility;
import org.exoplatform.portal.pom.data.*;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.gatein.common.io.IOTools;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Date;
import java.util.List;
/**
@@ -179,52 +176,6 @@
assertEquals(obj.getSkin(), clone.getSkin());
}
- public void testNavigationNode() throws Exception
- {
- Date a = new Date();
- Date b = new Date();
- NavigationNodeData obj = new NavigationNodeData(
- "foo01",
- "foo02",
- "foo03",
- "foo04",
- "foo05",
- a,
- b,
- Visibility.SYSTEM,
- "foo06",
- Collections.<NavigationNodeData>emptyList()
- );
- NavigationNodeData clone = IOTools.clone(obj);
- assertEquals(obj.getStorageId(), clone.getStorageId());
- assertEquals(obj.getStorageName(), clone.getStorageName());
- assertEquals(obj.getURI(), clone.getURI());
- assertEquals(obj.getLabel(), clone.getLabel());
- assertEquals(obj.getIcon(), clone.getIcon());
- assertEquals(obj.getName(), clone.getName());
- assertEquals(obj.getStartPublicationDate(), clone.getStartPublicationDate());
- assertEquals(obj.getEndPublicationDate(), clone.getEndPublicationDate());
- assertEquals(obj.getVisibility(), clone.getVisibility());
- assertEquals(obj.getPageReference(), clone.getPageReference());
- }
-
- public void testNavigationData() throws Exception
- {
- NavigationData obj = new NavigationData(
- "foo01",
- "foo02",
- "foo03",
- 3,
- Collections.<NavigationNodeData>emptyList()
- );
- NavigationData clone = IOTools.clone(obj);
- assertEquals(obj.getStorageId(), clone.getStorageId());
- assertEquals(obj.getStorageName(), clone.getStorageName());
- assertEquals(obj.getOwnerType(), clone.getOwnerType());
- assertEquals(obj.getOwnerId(), clone.getOwnerId());
- assertEquals(obj.getPriority(), clone.getPriority());
- }
-
public void testApplicationData() throws Exception
{
ApplicationData<?> obj = new ApplicationData<Gadget>(
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSystemNavigation.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.config;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestSystemNavigation extends AbstractPortalTest
-{
-
- /** . */
- private DataStorage storage_;
-
- /** . */
- private POMSessionManager mgr;
-
- /** . */
- private POMSession session;
-
- public void setUp() throws Exception
- {
- super.setUp();
- begin();
- PortalContainer container = PortalContainer.getInstance();
- storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- session = mgr.openSession();
- }
-
- protected void tearDown() throws Exception
- {
- session.close();
- end();
- super.tearDown();
- }
-
- public void testWeirdBug() throws Exception
- {
- PageNavigation nav = storage_.getPageNavigation("portal::system");
-
- //
- for (Iterator<PageNode> i = nav.getNodes().iterator();i.hasNext();)
- {
- PageNode node = i.next();
- if (node.getVisibility() != Visibility.SYSTEM)
- {
- i.remove();
- }
- }
-
- //
- storage_.save(nav);
-
- end(true);
- begin();
-
- //
- nav = storage_.getPageNavigation("portal::system");
-
- //
- PageNode b = new PageNode();
- b.setName("b");
- b.setUri("b");
- b.setVisibility(Visibility.DISPLAYED);
- b.setLabel("b");
-
- //
- System.out.println("nav.getNodes() = " + nav.getNodes());
-
- //
- nav.getNodes().clear();
- nav.addNode(b);
-
- // Need to uncomment to make it fail for now
-// storage_.save(nav);
- }
-}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -32,6 +32,10 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.EventType;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.pom.config.POMDataStorage;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
@@ -131,23 +135,23 @@
listenerService.addListener(DataStorage.PAGE_CREATED, listener);
listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
- listenerService.addListener(DataStorage.NAVIGATION_CREATED, listener);
- listenerService.addListener(DataStorage.NAVIGATION_REMOVED, listener);
- listenerService.addListener(DataStorage.NAVIGATION_UPDATED, listener);
+ listenerService.addListener(EventType.NAVIGATION_CREATED, listener);
+ listenerService.addListener(EventType.NAVIGATION_DESTROYED, listener);
+ listenerService.addListener(EventType.NAVIGATION_UPDATED, listener);
}
}
- private static Map<String, PageNavigation> toMap(UserPortalConfig cfg)
+ private static Map<String, UserNavigation> toMap(UserPortal cfg)
{
return toMap(cfg.getNavigations());
}
- private static Map<String, PageNavigation> toMap(List<PageNavigation> navigations)
+ private static Map<String, UserNavigation> toMap(List<UserNavigation> navigations)
{
- Map<String, PageNavigation> map = new HashMap<String, PageNavigation>();
- for (PageNavigation nav : navigations)
+ Map<String, UserNavigation> map = new HashMap<String, UserNavigation>();
+ for (UserNavigation nav : navigations)
{
- map.put(nav.getOwnerType() + "::" + nav.getOwnerId(), nav);
+ map.put(nav.getKey().getType().getName() + "::" + nav.getKey().getName(), nav);
}
return map;
}
@@ -188,8 +192,9 @@
assertNotNull(portalCfg);
assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
assertEquals("classic", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ assertNotNull(userPortal.getNavigations());
+ Map<String, UserNavigation> navigations = toMap(userPortal);
assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
assertTrue(navigations.containsKey("portal::classic"));
assertTrue(navigations.containsKey("group::/platform/administrators"));
@@ -212,8 +217,9 @@
assertNotNull(portalCfg);
assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
assertEquals("classic", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ assertNotNull(userPortal.getNavigations());
+ Map<String, UserNavigation> navigations = toMap(userPortal);
assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
assertTrue(navigations.containsKey("portal::classic"));
assertTrue(navigations.containsKey("group::/platform/administrators"));
@@ -236,8 +242,9 @@
assertNotNull(portalCfg);
assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
assertEquals("classic", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ assertNotNull(userPortal.getNavigations());
+ Map<String, UserNavigation> navigations = toMap(userPortal);
assertEquals(3, navigations.size());
assertTrue(navigations.containsKey("portal::classic"));
assertTrue(navigations.containsKey("group::/platform/users"));
@@ -258,8 +265,9 @@
assertNotNull(portalCfg);
assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
assertEquals("classic", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ assertNotNull(userPortal.getNavigations());
+ Map<String, UserNavigation> navigations = toMap(userPortal);
assertEquals("" + navigations, 1, navigations.size());
assertTrue(navigations.containsKey("portal::classic"));
}
@@ -273,13 +281,14 @@
public void execute() throws Exception
{
UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "root");
- List<PageNavigation> navigations = userPortalCfg.getNavigations();
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ List<UserNavigation> navigations = userPortal.getNavigations();
assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
- assertEquals("classic", navigations.get(0).getOwnerId()); // 1
- assertEquals("/platform/administrators", navigations.get(1).getOwnerId()); // 2
- assertEquals("root", navigations.get(2).getOwnerId()); // 3
- assertEquals("/organization/management/executive-board", navigations.get(3).getOwnerId()); // 5
- assertEquals("/platform/users", navigations.get(4).getOwnerId()); // 8
+ assertEquals("classic", navigations.get(0).getKey().getName()); // 1
+ assertEquals("/platform/administrators", navigations.get(1).getKey().getName()); // 2
+ assertEquals("root", navigations.get(2).getKey().getName()); // 3
+ assertEquals("/organization/management/executive-board", navigations.get(3).getKey().getName()); // 5
+ assertEquals("/platform/users", navigations.get(4).getKey().getName()); // 8
}
}.execute("root");
}
@@ -297,8 +306,9 @@
assertNotNull(portalCfg);
assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
assertEquals("jazz", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ assertNotNull(userPortal.getNavigations());
+ Map<String, UserNavigation> navigations = toMap(userPortal);
assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
assertTrue(navigations.containsKey("portal::jazz"));
assertTrue(navigations.containsKey("group::/platform/administrators"));
@@ -569,142 +579,6 @@
}
}.execute(null);
}
-
- public void testRemoveNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType("group");
- navigation.setOwnerId("/platform/administrators");
- assertTrue(events.isEmpty());
- storage_.remove(navigation);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.NAVIGATION_REMOVED, event.getEventName());
- PageNavigation n = ((PageNavigation)event.getData());
- assertEquals("group", n.getOwnerType());
- assertEquals("/platform/administrators", n.getOwnerId());
- assertEquals(null, storage_.getPageNavigation("group", "/platform/administrators"));
- }
- }.execute(null);
- }
-
- public void testCreateNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType("group");
- navigation.setOwnerId("/platform/administrators");
- storage_.remove(navigation);
- assertNotNull(events.removeLast());
- assertTrue(events.isEmpty());
- storage_.create(navigation);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.NAVIGATION_CREATED, event.getEventName());
- PageNavigation n = ((PageNavigation)event.getData());
- assertEquals("group", n.getOwnerType());
- assertEquals("/platform/administrators", n.getOwnerId());
- PageNavigation n2 = storage_.getPageNavigation("group", "/platform/administrators");
- assertEquals("group", n2.getOwnerType());
- assertEquals("/platform/administrators", n2.getOwnerId());
- }
- }.execute(null);
- }
-
- /*
- public void testCreateMultipleNavigations(){
- for(int i =0; i < 10; i++){
- createNavigation(null, "group", "/platform/administrators" + i);
- }
- }
-
- private void createNavigation(final String user, final String ownerType, final String ownerId)
- {
- new UnitTest()
- {
-
- public void execute() throws Exception
- {
- createNavigationInSeperatedThread();
- }
-
- private void createNavigationInSeperatedThread()
- {
- Thread task = new Thread()
- {
- public void run()
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType(ownerType);
- navigation.setOwnerId(ownerId);
- try
- {
- userPortalConfigSer_.create(navigation);
- Event event = events.removeFirst();
- assertEquals(DataStorage.CREATE_NAVIGATION_EVENT, event.getEventName());
- PageNavigation n1 = (PageNavigation)event.getSource();
- assertEquals(ownerType, n1.getOwnerType());
- assertEquals(ownerId, n1.getOwnerId());
- PageNavigation n2 = storage_.getPageNavigation(ownerType, ownerId);
- assertEquals(ownerType, n2.getOwnerType());
- assertEquals(ownerId, n2.getOwnerId());
- }
- catch (Exception ex)
- {
- assertTrue("Failed while create '" + ownerType + " ' navigation for owner: " + ownerId, false);
- ex.printStackTrace();
- }
- }
- };
-
- task.start();
- try
- {
- task.sleep(200);
- }
- catch (InterruptedException ex)
- {
- ex.printStackTrace();
- }
- }
- }.execute(user);
- }
- */
-
- public void testUpdateNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType("group");
- navigation.setOwnerId("/platform/administrators");
- navigation.setPriority(3);
- assertTrue(events.isEmpty());
- storage_.save(navigation);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.NAVIGATION_UPDATED, event.getEventName());
- PageNavigation n = ((PageNavigation)event.getData());
- assertEquals("group", n.getOwnerType());
- assertEquals("/platform/administrators", n.getOwnerId());
- assertEquals(3, n.getPriority());
- PageNavigation n2 = storage_.getPageNavigation("group", "/platform/administrators");
- assertEquals("group", n2.getOwnerType());
- assertEquals("/platform/administrators", n2.getOwnerId());
- assertEquals(3, n2.getPriority());
- }
- }.execute(null);
- }
-
public void testRenewPage()
{
new UnitTest()
@@ -887,25 +761,6 @@
}.execute(null);
}
- public void testCachePageNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- mgr.clearCache();
- DataCache cache = mgr.getDecorator(DataCache.class);
- long readCount0 = cache.getReadCount();
- storage_.getPageNavigation("portal", "test");
- long readCount1 = cache.getReadCount();
- assertTrue(readCount1 > readCount0);
- storage_.getPageNavigation("portal", "test");
- long readCount2 = cache.getReadCount();
- assertEquals(readCount1, readCount2);
- }
- }.execute(null);
- }
-
private abstract class UnitTest
{
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.config.importer;
-
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class Builder
-{
-
- /** . */
- private String value;
-
- /** . */
- private List<Builder> nodes;
-
- private Builder(String value)
- {
- this.value = value;
- this.nodes = new ArrayList<Builder>();
- }
-
- public static Builder navigation(String ownerId)
- {
- return new Builder(ownerId);
- }
-
- public static Builder node(String name)
- {
- return new Builder(name);
- }
-
- public Builder add(Builder... nodes)
- {
- for (Builder node : nodes)
- {
- this.nodes.add(node);
- }
- return this;
- }
-
- public Builder get(String value)
- {
- for (Builder node : nodes)
- {
- if (node.value.equals(value))
- {
- return node;
- }
- }
- return null;
- }
-
- private ArrayList<PageNode> buildNodes()
- {
- ArrayList<PageNode> nodes = new ArrayList<PageNode>();
- for (Builder node : this.nodes)
- {
- nodes.add(node.buildNode());
- }
- return nodes;
- }
-
- public PageNavigation build()
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType("portal");
- navigation.setOwnerId(value);
- navigation.setNodes(buildNodes());
- return navigation;
- }
-
- private PageNode buildNode()
- {
- PageNode node = new PageNode();
- node.setName(value);
- node.setLabel(value);
- node.setChildren(buildNodes());
- return node;
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/Builder.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.importer;
+
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class Builder
+{
+
+ /** . */
+ private String value;
+
+ /** . */
+ private List<Builder> nodes;
+
+ private Builder(String value)
+ {
+ this.value = value;
+ this.nodes = new ArrayList<Builder>();
+ }
+
+ public static Builder navigation(String ownerId)
+ {
+ return new Builder(ownerId);
+ }
+
+ public static Builder node(String name)
+ {
+ return new Builder(name);
+ }
+
+ public Builder add(Builder... nodes)
+ {
+ for (Builder node : nodes)
+ {
+ this.nodes.add(node);
+ }
+ return this;
+ }
+
+ public Builder get(String value)
+ {
+ for (Builder node : nodes)
+ {
+ if (node.value.equals(value))
+ {
+ return node;
+ }
+ }
+ return null;
+ }
+
+ private ArrayList<PageNode> buildNodes()
+ {
+ ArrayList<PageNode> nodes = new ArrayList<PageNode>();
+ for (Builder node : this.nodes)
+ {
+ nodes.add(node.buildNode());
+ }
+ return nodes;
+ }
+
+ public PageNavigation build()
+ {
+ PageNavigation navigation = new PageNavigation();
+ navigation.setOwnerType("portal");
+ navigation.setOwnerId(value);
+ navigation.setNodes(buildNodes());
+ return navigation;
+ }
+
+ private PageNode buildNode()
+ {
+ PageNode node = new PageNode();
+ node.setName(value);
+ node.setLabel(value);
+ node.setChildren(buildNodes());
+ return node;
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.config.importer;
-
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.navigation.*;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.core.api.MOPService;
-
-import static org.exoplatform.portal.config.importer.Builder.*;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class TestNavigationImporter extends AbstractTestNavigationService
-{
-
- public void testMergeCreateNavigation()
- {
- testCreate(ImportMode.MERGE);
- }
-
- public void testConserveCreateNavigation()
- {
- testCreate(ImportMode.CONSERVE);
- }
-
- public void testReimportCreateNavigation()
- {
- testCreate(ImportMode.REIMPORT);
- }
-
- private void testCreate(ImportMode mode)
- {
- String name = mode.name() + "_create_navigation";
-
- //
- MOPService mop = mgr.getPOMService();
- mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, name);
- sync(true);
-
- //
- assertNull(service.loadNavigation(SiteKey.portal(name)));
- PageNavigation src = navigation(name).build();
- src.setPriority(2);
- src.setOwnerId(name);
- NavigationImporter merge = new NavigationImporter(mode, src, service);
- merge.perform();
-
- //
- NavigationContext ctx = service.loadNavigation(SiteKey.portal(name));
- assertEquals(2, (int)ctx.getState().getPriority());
- }
-
- public void testMergeCreate()
- {
- MOPService mop = mgr.getPOMService();
- mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "merge_create");
- sync(true);
-
- //
- assertNull(service.loadNavigation(SiteKey.portal("merge_create")));
-
- //
- Builder builder = navigation("merge_create").add(node("a"));
-
- //
- PageNavigation src = builder.build();
- src.setOwnerId("merge_create");
- NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
- merge.perform();
-
- //
- NavigationContext ctx = service.loadNavigation(SiteKey.portal("merge_create"));
- NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
- NodeContext<?> a = node.get("a");
- assertNotNull(a);
- assertEquals("a", a.getName());
- assertEquals("a", a.getState().getLabel());
- assertEquals(0, a.getNodeCount());
- }
-
- public void testMergeNested()
- {
- MOPService mop = mgr.getPOMService();
- mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "merge_nested");
- sync(true);
-
- //
- assertNull(service.loadNavigation(SiteKey.portal("merge_nested")));
-
- //
- Builder builder = navigation("merge_nested").add(node("a").add(node("b")));
-
- //
- PageNavigation src = builder.build();
- src.setOwnerId("merge_nested");
- NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
- merge.perform();
-
- //
- NavigationContext ctx = service.loadNavigation(SiteKey.portal("merge_nested"));
- NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
- NodeContext<?> a = node.get("a");
- assertNotNull(a);
- assertEquals("a", a.getName());
- assertEquals("a", a.getState().getLabel());
- assertEquals(1, a.getNodeCount());
- }
-
- public void testCreateMerge()
- {
- testMerge(ImportMode.CONSERVE);
- }
-
- public void testMergeMerge()
- {
- testMerge(ImportMode.MERGE);
- }
-
- public void testReimportMerge()
- {
- testMerge(ImportMode.REIMPORT);
- }
-
- private void testMerge(ImportMode importMode)
- {
- String name = importMode.name() + "_merge_merge";
-
- //
- MOPService mop = mgr.getPOMService();
- mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, name);
- sync(true);
-
- //
- assertNull(service.loadNavigation(SiteKey.portal(name)));
-
- //
- Builder builder = navigation(name).add(node("a").add(node("b")));
-
- //
- PageNavigation src = builder.build();
- src.setOwnerId(name);
- NavigationImporter merge = new NavigationImporter(ImportMode.CONSERVE, src, service);
- merge.perform();
-
- //
- NavigationContext ctx = service.loadNavigation(SiteKey.portal(name));
- Node node = service.loadNode(Node.MODEL, ctx, Scope.ALL, null).getNode();
- Node a = node.getChild("a");
- assertNotNull(a);
- assertEquals("a", a.getName());
- assertEquals(1, a.getNodeCount());
- Node b = a.getChild("b");
- assertNotNull(b);
- assertEquals("b", b.getName());
- assertEquals(0, b.getNodeCount());
-
- //
- builder = navigation(name).add(node("a").add(node("d"))).add(node("c"));
- src = builder.build();
- src.setOwnerId(name);
- merge = new NavigationImporter(importMode, src, service);
- merge.perform();
-
- //
- ctx = service.loadNavigation(SiteKey.portal(name));
- node = service.loadNode(Node.MODEL, ctx, Scope.ALL, null).getNode();
- switch (importMode)
- {
- case MERGE:
- {
- assertEquals(2, node.getNodeCount());
- a = node.getChild("a");
- assertNotNull(a);
- assertEquals("a", a.getState().getLabel());
- assertEquals(2, a.getNodeCount());
- b = a.getChild("b");
- assertNotNull(b);
- assertEquals("b", b.getState().getLabel());
- assertEquals(0, b.getNodeCount());
- Node c = node.getChild("c");
- assertNotNull(c);
- assertEquals("c", c.getState().getLabel());
- assertEquals(0, c.getNodeCount());
- Node d = a.getChild("d");
- assertNotNull(d);
- assertEquals("d", d.getName());
- assertEquals(0, d.getNodeCount());
- break;
- }
- case CONSERVE:
- {
- assertEquals(1, node.getNodeCount());
- a = node.getChild("a");
- assertNotNull(a);
- assertEquals(1, a.getNodeCount());
- assertNotNull(b);
- assertEquals("b", b.getState().getLabel());
- assertEquals(0, b.getNodeCount());
- break;
- }
- case REIMPORT:
- {
- assertEquals(2, node.getNodeCount());
- a = node.getChild("a");
- assertNotNull(a);
- assertEquals("a", a.getState().getLabel());
- assertEquals(1, a.getNodeCount());
- Node c = node.getChild("c");
- assertNotNull(c);
- assertEquals("c", c.getState().getLabel());
- assertEquals(0, c.getNodeCount());
- Node d = a.getChild("d");
- assertNotNull(d);
- assertEquals("d", d.getName());
- assertEquals(0, d.getNodeCount());
- break;
- }
- }
- }
-
- public void testMergeOrder()
- {
- MOPService mop = mgr.getPOMService();
- mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "merge_order");
- sync(true);
-
- //
- assertNull(service.loadNavigation(SiteKey.portal("merge_order")));
-
- //
- PageNavigation src = navigation("merge_order").add(node("a"), node("b"), node("c")).build();
- src.setOwnerId("merge_order");
- NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
- merge.perform();
-
- //
- NavigationContext ctx = service.loadNavigation(SiteKey.portal("merge_order"));
- NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
- assertEquals(3, node.getNodeCount());
- assertEquals("a", node.get(0).getName());
- assertEquals("b", node.get(1).getName());
- assertEquals("c", node.get(2).getName());
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/importer/TestNavigationImporter.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.config.importer;
+
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.*;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.core.api.MOPService;
+
+import static org.exoplatform.portal.config.importer.Builder.*;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestNavigationImporter extends AbstractTestNavigationService
+{
+
+ public void testMergeCreateNavigation()
+ {
+ testCreate(ImportMode.MERGE);
+ }
+
+ public void testConserveCreateNavigation()
+ {
+ testCreate(ImportMode.CONSERVE);
+ }
+
+ public void testReimportCreateNavigation()
+ {
+ testCreate(ImportMode.REIMPORT);
+ }
+
+ private void testCreate(ImportMode mode)
+ {
+ String name = mode.name() + "_create_navigation";
+
+ //
+ MOPService mop = mgr.getPOMService();
+ mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, name);
+ sync(true);
+
+ //
+ assertNull(service.loadNavigation(SiteKey.portal(name)));
+ PageNavigation src = navigation(name).build();
+ src.setPriority(2);
+ src.setOwnerId(name);
+ NavigationImporter merge = new NavigationImporter(mode, src, service);
+ merge.perform();
+
+ //
+ NavigationContext ctx = service.loadNavigation(SiteKey.portal(name));
+ assertEquals(2, (int)ctx.getState().getPriority());
+ }
+
+ public void testMergeCreate()
+ {
+ MOPService mop = mgr.getPOMService();
+ mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "merge_create");
+ sync(true);
+
+ //
+ assertNull(service.loadNavigation(SiteKey.portal("merge_create")));
+
+ //
+ Builder builder = navigation("merge_create").add(node("a"));
+
+ //
+ PageNavigation src = builder.build();
+ src.setOwnerId("merge_create");
+ NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
+ merge.perform();
+
+ //
+ NavigationContext ctx = service.loadNavigation(SiteKey.portal("merge_create"));
+ NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
+ NodeContext<?> a = node.get("a");
+ assertNotNull(a);
+ assertEquals("a", a.getName());
+ assertEquals("a", a.getState().getLabel());
+ assertEquals(0, a.getNodeCount());
+ }
+
+ public void testMergeNested()
+ {
+ MOPService mop = mgr.getPOMService();
+ mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "merge_nested");
+ sync(true);
+
+ //
+ assertNull(service.loadNavigation(SiteKey.portal("merge_nested")));
+
+ //
+ Builder builder = navigation("merge_nested").add(node("a").add(node("b")));
+
+ //
+ PageNavigation src = builder.build();
+ src.setOwnerId("merge_nested");
+ NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
+ merge.perform();
+
+ //
+ NavigationContext ctx = service.loadNavigation(SiteKey.portal("merge_nested"));
+ NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
+ NodeContext<?> a = node.get("a");
+ assertNotNull(a);
+ assertEquals("a", a.getName());
+ assertEquals("a", a.getState().getLabel());
+ assertEquals(1, a.getNodeCount());
+ }
+
+ public void testCreateMerge()
+ {
+ testMerge(ImportMode.CONSERVE);
+ }
+
+ public void testMergeMerge()
+ {
+ testMerge(ImportMode.MERGE);
+ }
+
+ public void testReimportMerge()
+ {
+ testMerge(ImportMode.REIMPORT);
+ }
+
+ private void testMerge(ImportMode importMode)
+ {
+ String name = importMode.name() + "_merge_merge";
+
+ //
+ MOPService mop = mgr.getPOMService();
+ mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, name);
+ sync(true);
+
+ //
+ assertNull(service.loadNavigation(SiteKey.portal(name)));
+
+ //
+ Builder builder = navigation(name).add(node("a").add(node("b")));
+
+ //
+ PageNavigation src = builder.build();
+ src.setOwnerId(name);
+ NavigationImporter merge = new NavigationImporter(ImportMode.CONSERVE, src, service);
+ merge.perform();
+
+ //
+ NavigationContext ctx = service.loadNavigation(SiteKey.portal(name));
+ Node node = service.loadNode(Node.MODEL, ctx, Scope.ALL, null).getNode();
+ Node a = node.getChild("a");
+ assertNotNull(a);
+ assertEquals("a", a.getName());
+ assertEquals(1, a.getNodeCount());
+ Node b = a.getChild("b");
+ assertNotNull(b);
+ assertEquals("b", b.getName());
+ assertEquals(0, b.getNodeCount());
+
+ //
+ builder = navigation(name).add(node("a").add(node("d"))).add(node("c"));
+ src = builder.build();
+ src.setOwnerId(name);
+ merge = new NavigationImporter(importMode, src, service);
+ merge.perform();
+
+ //
+ ctx = service.loadNavigation(SiteKey.portal(name));
+ node = service.loadNode(Node.MODEL, ctx, Scope.ALL, null).getNode();
+ switch (importMode)
+ {
+ case MERGE:
+ {
+ assertEquals(2, node.getNodeCount());
+ a = node.getChild("a");
+ assertNotNull(a);
+ assertEquals("a", a.getState().getLabel());
+ assertEquals(2, a.getNodeCount());
+ b = a.getChild("b");
+ assertNotNull(b);
+ assertEquals("b", b.getState().getLabel());
+ assertEquals(0, b.getNodeCount());
+ Node c = node.getChild("c");
+ assertNotNull(c);
+ assertEquals("c", c.getState().getLabel());
+ assertEquals(0, c.getNodeCount());
+ Node d = a.getChild("d");
+ assertNotNull(d);
+ assertEquals("d", d.getName());
+ assertEquals(0, d.getNodeCount());
+ break;
+ }
+ case CONSERVE:
+ {
+ assertEquals(1, node.getNodeCount());
+ a = node.getChild("a");
+ assertNotNull(a);
+ assertEquals(1, a.getNodeCount());
+ assertNotNull(b);
+ assertEquals("b", b.getState().getLabel());
+ assertEquals(0, b.getNodeCount());
+ break;
+ }
+ case REIMPORT:
+ {
+ assertEquals(2, node.getNodeCount());
+ a = node.getChild("a");
+ assertNotNull(a);
+ assertEquals("a", a.getState().getLabel());
+ assertEquals(1, a.getNodeCount());
+ Node c = node.getChild("c");
+ assertNotNull(c);
+ assertEquals("c", c.getState().getLabel());
+ assertEquals(0, c.getNodeCount());
+ Node d = a.getChild("d");
+ assertNotNull(d);
+ assertEquals("d", d.getName());
+ assertEquals(0, d.getNodeCount());
+ break;
+ }
+ }
+ }
+
+ public void testMergeOrder()
+ {
+ MOPService mop = mgr.getPOMService();
+ mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "merge_order");
+ sync(true);
+
+ //
+ assertNull(service.loadNavigation(SiteKey.portal("merge_order")));
+
+ //
+ PageNavigation src = navigation("merge_order").add(node("a"), node("b"), node("c")).build();
+ src.setOwnerId("merge_order");
+ NavigationImporter merge = new NavigationImporter(ImportMode.MERGE, src, service);
+ merge.perform();
+
+ //
+ NavigationContext ctx = service.loadNavigation(SiteKey.portal("merge_order"));
+ NodeContext<?> node = service.loadNode(NodeModel.SELF_MODEL, ctx, Scope.ALL, null).getNode();
+ assertEquals(3, node.getNodeCount());
+ assertEquals("a", node.get(0).getName());
+ assertEquals("b", node.get(1).getName());
+ assertEquals("c", node.get(2).getName());
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestUserACL.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestUserACL.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestUserACL.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -25,6 +25,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.services.security.Identity;
import org.exoplatform.services.security.MembershipEntry;
@@ -139,12 +140,12 @@
}
}
- public boolean hasEditPermission(PageNavigation nav)
+ public boolean hasEditPermission(SiteKey nav)
{
ConversationState.setCurrent(new ConversationState(identity));
try
{
- return ua.hasEditPermission(nav);
+ return ua.hasEditPermissionOnNavigation(nav);
}
finally
{
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestGroupNavACL.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestGroupNavACL.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestGroupNavACL.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.config.security.nav;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.security.AbstractTestUserACL;
+import org.exoplatform.portal.mop.SiteKey;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -31,9 +31,7 @@
public void testNavEditByManager()
{
- PageNavigation nav = new PageNavigation();
- nav.setOwnerType("group");
- nav.setOwnerId("manageable");
+ SiteKey nav = SiteKey.group("manageable");
//
assertTrue(root.hasEditPermission(nav));
@@ -43,7 +41,7 @@
assertFalse(guest.hasEditPermission(nav));
//
- nav.setOwnerId("foo");
+ nav = SiteKey.group("foo");
//
assertTrue(root.hasEditPermission(nav));
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestPortalNavACL.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestPortalNavACL.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestPortalNavACL.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.config.security.nav;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.security.AbstractTestUserACL;
+import org.exoplatform.portal.mop.SiteKey;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -31,9 +31,7 @@
public void testNavEditByRoot()
{
- PageNavigation nav = new PageNavigation();
- nav.setOwnerType("portal");
- nav.setOwnerId("foo");
+ SiteKey nav = SiteKey.portal("foo");
//
assertTrue(root.hasEditPermission(nav));
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestUserNavACL.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestUserNavACL.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/security/nav/TestUserNavACL.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.config.security.nav;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.security.AbstractTestUserACL;
+import org.exoplatform.portal.mop.SiteKey;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -32,9 +32,7 @@
public void testNav()
{
- PageNavigation nav = new PageNavigation();
- nav.setOwnerType("user");
- nav.setOwnerId("user");
+ SiteKey nav = SiteKey.user("user");
assertTrue(root.hasEditPermission(nav));
assertFalse(administrator.hasEditPermission(nav));
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import junit.framework.AssertionFailedError;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.config.AbstractPortalTest;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public abstract class AbstractTestNavigationService extends AbstractPortalTest
-{
-
- /** . */
- protected POMSessionManager mgr;
-
- /** . */
- protected NavigationServiceImpl service;
-
- /** . */
- protected DataStorage dataStorage;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- //
- PortalContainer container = PortalContainer.getInstance();
- mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- service = new NavigationServiceImpl(mgr);
- dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-
- // Clear the cache for each test
- service.clearCache();
-
- //
- begin();
- }
-
- protected void sync()
- {
- end();
- begin();
- }
-
- protected void sync(boolean save)
- {
- end(save);
- begin();
- }
-
- @Override
- protected void end(boolean save)
- {
- if (save)
- {
- try
- {
- startService();
- super.end(save);
- }
- finally
- {
- stopService();
- }
- }
- else
- {
- super.end(save);
- }
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- end();
- super.tearDown();
- }
-
- private void startService()
- {
- try
- {
- begin();
- end();
- }
- catch (Exception e)
- {
- AssertionFailedError afe = new AssertionFailedError();
- afe.initCause(e);
- throw afe;
- }
- }
-
- private void stopService()
- {
- begin();
- end();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import junit.framework.AssertionFailedError;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.AbstractPortalTest;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public abstract class AbstractTestNavigationService extends AbstractPortalTest
+{
+
+ /** . */
+ protected POMSessionManager mgr;
+
+ /** . */
+ protected NavigationServiceImpl service;
+
+ /** . */
+ protected DataStorage dataStorage;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ //
+ PortalContainer container = PortalContainer.getInstance();
+ mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ service = new NavigationServiceImpl(mgr);
+ dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+
+ // Clear the cache for each test
+ service.clearCache();
+
+ //
+ begin();
+ }
+
+ protected void sync()
+ {
+ end();
+ begin();
+ }
+
+ protected void sync(boolean save)
+ {
+ end(save);
+ begin();
+ }
+
+ @Override
+ protected void end(boolean save)
+ {
+ if (save)
+ {
+ try
+ {
+ startService();
+ super.end(save);
+ }
+ finally
+ {
+ stopService();
+ }
+ }
+ else
+ {
+ super.end(save);
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ end();
+ super.tearDown();
+ }
+
+ private void startService()
+ {
+ try
+ {
+ begin();
+ end();
+ }
+ catch (Exception e)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(e);
+ throw afe;
+ }
+ }
+
+ private void stopService()
+ {
+ begin();
+ end();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import junit.framework.Assert;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Represents a navigation node.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class Node
-{
-
- /** . */
- public static final NodeModel<Node> MODEL = new NodeModel<Node>()
- {
- public NodeContext<Node> getContext(Node node)
- {
- return node.context;
- }
-
- public Node create(NodeContext<Node> context)
- {
- return new Node(context);
- }
- };
-
- /** . */
- final NodeContext<Node> context;
-
- Node(NodeContext<Node> context)
- {
- this.context = context;
- }
-
- public String getId()
- {
- return context.getId();
- }
-
- public String getName()
- {
- return context.getName();
- }
-
- public void setName(String name)
- {
- context.setName(name);
- }
-
- public NodeContext getContext()
- {
- return context;
- }
-
- public NodeState getState()
- {
- return context.getState();
- }
-
- public void setState(NodeState state)
- {
- context.setState(state);
- }
-
- public Node getParent()
- {
- return context.getParentNode();
- }
-
- public Collection<Node> getChildren()
- {
- return context.getNodes();
- }
-
- public Node getChild(String childName)
- {
- return context.getNode(childName);
- }
-
- public Node getChild(int childIndex)
- {
- return context.getNode(childIndex);
- }
-
- public void addChild(Node child)
- {
- context.add(null, child.context);
- }
-
- public void addChild(int index, Node child)
- {
- context.add(index, child.context);
- }
-
- public Node addChild(String childName)
- {
- return context.add(null, childName).node;
- }
-
- public Node addChild(int index, String childName)
- {
- return context.add(index, childName).node;
- }
-
- public boolean removeChild(String childName)
- {
- return context.removeNode(childName);
- }
-
- public int getNodeCount()
- {
- return context.getNodeCount();
- }
-
- public int getSize()
- {
- return context.getSize();
- }
-
- public void setHidden(boolean hidden)
- {
- context.setHidden(hidden);
- }
-
- public boolean isHidden()
- {
- return context.isHidden();
- }
-
- public void filter(NodeFilter filter)
- {
- context.filter(filter);
- }
-
- public void assertConsistent()
- {
- if (context.isExpanded())
- {
- List<String> a = new ArrayList<String>();
- for (NodeContext<Node> b = context.getFirst();b != null;b = b.getNext()) {
- Assert.assertNotNull(b.data);
- a.add(b.data.getId());
- }
- List<String> b = Arrays.asList(context.data.children);
- Assert.assertEquals(a, b);
- for (NodeContext<Node> c = context.getFirst();c != null;c = c.getNext()) {
- c.getNode().assertConsistent();
- }
- }
- }
-
- public void assertEquals(Node node) {
-
- // First check state
- if (context.data != null) {
- Assert.assertNotNull(node.context.data);
- Assert.assertEquals(context.data.id, node.context.data.id);
- Assert.assertEquals(context.data.name, node.context.data.name);
- Assert.assertEquals(context.data.state, node.context.data.state);
- Assert.assertEquals(context.state, node.context.state);
- } else {
- Assert.assertNull(node.context.data);
- Assert.assertEquals(context.getName(), node.context.getName());
- Assert.assertEquals(context.state, node.context.state);
- }
-
- //
- List<Node> nodes1 = new ArrayList<Node>();
- for (NodeContext<Node> current = context.getFirst();current != null;current = current.getNext()) {
- nodes1.add(current.getNode());
- }
-
- //
- List<Node> nodes2 = new ArrayList<Node>();
- for (NodeContext<Node> current = node.context.getFirst();current != null;current = current.getNext()) {
- nodes2.add(current.getNode());
- }
-
- //
- Assert.assertEquals("Was expecting to have the same children for node " + toString(1) + " " + node.toString(1), nodes1.size(), nodes2.size());
-
- //
- for (int i = 0;i < nodes1.size();i++) {
- nodes1.get(i).assertEquals(nodes2.get(i));
- }
- }
-
- public Iterator<NodeChange<Node>> update(NavigationService service, Scope scope) throws NavigationServiceException
- {
- NodeChangeQueue<Node> queue = new NodeChangeQueue<Node>();
- service.updateNode(context, scope, new NodeContextChangeAdapter<Node>(queue));
- return queue.iterator();
- }
-
- public Iterator<NodeChange<Node>> rebase(NavigationService service, Scope scope) throws NavigationServiceException
- {
- NodeChangeQueue<Node> queue = new NodeChangeQueue<Node>();
- service.rebaseNode(context, scope, new NodeContextChangeAdapter<Node>(queue));
- return queue.iterator();
- }
-
- public Iterator<NodeChange<Node>> save(NavigationService service) throws NavigationServiceException
- {
- NodeChangeQueue<Node> queue = new NodeChangeQueue<Node>();
- service.saveNode(context, new NodeContextChangeAdapter<Node>(queue));
- return queue.iterator();
- }
-
- @Override
- public String toString()
- {
- return toString(1);
- }
-
- public String toString(int depth)
- {
- return context.toString(depth, new StringBuilder("Node[")).append("]").toString();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/Node.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import junit.framework.Assert;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Represents a navigation node.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Node
+{
+
+ /** . */
+ public static final NodeModel<Node> MODEL = new NodeModel<Node>()
+ {
+ public NodeContext<Node> getContext(Node node)
+ {
+ return node.context;
+ }
+
+ public Node create(NodeContext<Node> context)
+ {
+ return new Node(context);
+ }
+ };
+
+ /** . */
+ final NodeContext<Node> context;
+
+ Node(NodeContext<Node> context)
+ {
+ this.context = context;
+ }
+
+ public String getId()
+ {
+ return context.getId();
+ }
+
+ public String getName()
+ {
+ return context.getName();
+ }
+
+ public void setName(String name)
+ {
+ context.setName(name);
+ }
+
+ public NodeContext getContext()
+ {
+ return context;
+ }
+
+ public NodeState getState()
+ {
+ return context.getState();
+ }
+
+ public void setState(NodeState state)
+ {
+ context.setState(state);
+ }
+
+ public Node getParent()
+ {
+ return context.getParentNode();
+ }
+
+ public Collection<Node> getChildren()
+ {
+ return context.getNodes();
+ }
+
+ public Node getChild(String childName)
+ {
+ return context.getNode(childName);
+ }
+
+ public Node getChild(int childIndex)
+ {
+ return context.getNode(childIndex);
+ }
+
+ public void addChild(Node child)
+ {
+ context.add(null, child.context);
+ }
+
+ public void addChild(int index, Node child)
+ {
+ context.add(index, child.context);
+ }
+
+ public Node addChild(String childName)
+ {
+ return context.add(null, childName).node;
+ }
+
+ public Node addChild(int index, String childName)
+ {
+ return context.add(index, childName).node;
+ }
+
+ public boolean removeChild(String childName)
+ {
+ return context.removeNode(childName);
+ }
+
+ public int getNodeCount()
+ {
+ return context.getNodeCount();
+ }
+
+ public int getSize()
+ {
+ return context.getSize();
+ }
+
+ public void setHidden(boolean hidden)
+ {
+ context.setHidden(hidden);
+ }
+
+ public boolean isHidden()
+ {
+ return context.isHidden();
+ }
+
+ public void filter(NodeFilter filter)
+ {
+ context.filter(filter);
+ }
+
+ public void assertConsistent()
+ {
+ if (context.isExpanded())
+ {
+ List<String> a = new ArrayList<String>();
+ for (NodeContext<Node> b = context.getFirst();b != null;b = b.getNext()) {
+ Assert.assertNotNull(b.data);
+ a.add(b.data.getId());
+ }
+ List<String> b = Arrays.asList(context.data.children);
+ Assert.assertEquals(a, b);
+ for (NodeContext<Node> c = context.getFirst();c != null;c = c.getNext()) {
+ c.getNode().assertConsistent();
+ }
+ }
+ }
+
+ public void assertEquals(Node node) {
+
+ // First check state
+ if (context.data != null) {
+ Assert.assertNotNull(node.context.data);
+ Assert.assertEquals(context.data.id, node.context.data.id);
+ Assert.assertEquals(context.data.name, node.context.data.name);
+ Assert.assertEquals(context.data.state, node.context.data.state);
+ Assert.assertEquals(context.state, node.context.state);
+ } else {
+ Assert.assertNull(node.context.data);
+ Assert.assertEquals(context.getName(), node.context.getName());
+ Assert.assertEquals(context.state, node.context.state);
+ }
+
+ //
+ List<Node> nodes1 = new ArrayList<Node>();
+ for (NodeContext<Node> current = context.getFirst();current != null;current = current.getNext()) {
+ nodes1.add(current.getNode());
+ }
+
+ //
+ List<Node> nodes2 = new ArrayList<Node>();
+ for (NodeContext<Node> current = node.context.getFirst();current != null;current = current.getNext()) {
+ nodes2.add(current.getNode());
+ }
+
+ //
+ Assert.assertEquals("Was expecting to have the same children for node " + toString(1) + " " + node.toString(1), nodes1.size(), nodes2.size());
+
+ //
+ for (int i = 0;i < nodes1.size();i++) {
+ nodes1.get(i).assertEquals(nodes2.get(i));
+ }
+ }
+
+ public Iterator<NodeChange<Node>> update(NavigationService service, Scope scope) throws NavigationServiceException
+ {
+ NodeChangeQueue<Node> queue = new NodeChangeQueue<Node>();
+ service.updateNode(context, scope, new NodeContextChangeAdapter<Node>(queue));
+ return queue.iterator();
+ }
+
+ public Iterator<NodeChange<Node>> rebase(NavigationService service, Scope scope) throws NavigationServiceException
+ {
+ NodeChangeQueue<Node> queue = new NodeChangeQueue<Node>();
+ service.rebaseNode(context, scope, new NodeContextChangeAdapter<Node>(queue));
+ return queue.iterator();
+ }
+
+ public Iterator<NodeChange<Node>> save(NavigationService service) throws NavigationServiceException
+ {
+ NodeChangeQueue<Node> queue = new NodeChangeQueue<Node>();
+ service.saveNode(context, new NodeContextChangeAdapter<Node>(queue));
+ return queue.iterator();
+ }
+
+ @Override
+ public String toString()
+ {
+ return toString(1);
+ }
+
+ public String toString(int depth)
+ {
+ return context.toString(depth, new StringBuilder("Node[")).append("]").toString();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,803 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.Described;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.pom.data.MappedAttributes;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.core.api.MOPService;
-
-import javax.jcr.NodeIterator;
-import javax.jcr.Session;
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestNavigationService extends AbstractTestNavigationService
-{
-
- public void testNonExistingSite() throws Exception
- {
- assertNull(service.loadNavigation(SiteKey.portal("non_existing")));
- }
-
- public void testLoadSingleScope() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("classic"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- assertNull(root.getChildren());
- assertEquals("default", root.getName());
- try
- {
- root.getChild(0);
- fail();
- }
- catch (IllegalStateException ignore)
- {
- }
- try
- {
- root.addChild("a");
- fail();
- }
- catch (IllegalStateException e)
- {
- }
- try
- {
- root.addChild(0, "a");
- fail();
- }
- catch (IllegalStateException e)
- {
- }
- try
- {
- root.removeChild("a");
- fail();
- }
- catch (IllegalStateException e)
- {
- }
- }
-
- public void testLoadChildrenScope() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("classic"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- assertEquals("default", root.getName());
- Iterator<? extends Node> i = root.getChildren().iterator();
- assertTrue(i.hasNext());
- Node home = i.next();
- assertSame(home, root.getChild(0));
- assertNull(home.getChildren());
- assertEquals("home", home.getName());
- assertTrue(i.hasNext());
- Node webexplorer = i.next();
-
- assertNull(webexplorer.getChildren());
-
- assertSame(webexplorer, root.getChild(1));
- assertEquals("webexplorer", webexplorer.getName());
- assertFalse(i.hasNext());
- }
-
- public void testLoadCustomScope() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("large"));
- Node root = service.loadNode(Node.MODEL, nav, new Scope()
- {
- public Visitor get()
- {
- return new Visitor()
- {
- public VisitMode enter(int depth, String id, String name, NodeState state)
- {
- boolean use = false;
- switch (depth)
- {
- case 0:
- use = "default".equals(name);
- break;
- case 1:
- use = "b".equals(name);
- break;
- case 2:
- use = "d".equals(name);
- break;
- }
- return use ? VisitMode.ALL_CHILDREN : VisitMode.NO_CHILDREN;
- }
- public void leave(int depth, String id, String name, NodeState state)
- {
- }
- };
- }
- }, null).getNode();
- assertNull(root.getChild("a").getChildren());
- Node b = root.getChild("b");
- Node d = b.getChild("d");
- assertNull(d.getChild("e").getChildren());
- }
-
- public void testUpdateNode() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("large"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node a = root.getChild("a");
- assertNotNull(a);
- assertNull(a.getChildren());
- a.update(service, Scope.CHILDREN);
- assertNotNull(a.getChildren());
- assertEquals(1, a.getChildren().size());
- Node c = a.getChild("c");
- assertEquals("c", c.getName());
- assertSame(a, c.getParent());
- service.updateNode(a.context, Scope.SINGLE, null);
- assertNotNull(a.getChildren());
- assertEquals(1, a.getChildren().size());
- assertSame(c, a.getChild("c"));
- assertNotNull(c.getParent());
- }
-
- public void testState() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("test"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- assertEquals(5, root.getNodeCount());
- Node child1 = root.getChild("node_name");
- Node child2 = root.getChild("node_name4");
- assertEquals("node_name", child1.getName());
- assertEquals("node_label", child1.getContext().getState().getLabel());
- assertEquals("portal::test::test1", child1.getContext().getState().getPageRef());
- assertEquals(Visibility.TEMPORAL, child1.getContext().getState().getVisibility());
- assertEquals(953602380000L, child1.getContext().getState().getStartPublicationTime());
- assertEquals(1237599180000L, child1.getContext().getState().getEndPublicationTime());
- assertEquals("node_name4", child2.getName());
- assertEquals("node_label4", child2.getContext().getState().getLabel());
- assertEquals("portal::test::test1", child2.getContext().getState().getPageRef());
- assertEquals(Visibility.DISPLAYED, child2.getContext().getState().getVisibility());
- }
-
- public void testDepth() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("test"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node child1 = root.getChild("node_name");
- assertEquals(0, child1.context.getDepth(child1.context));
- assertEquals(1, child1.context.getDepth(root.context));
- try
- {
- root.context.getDepth(child1.context);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- }
- }
-
- public void testHiddenNode() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_node");
- Navigation defaultNav = portal.getRootNavigation().addChild("default");
- defaultNav.addChild("a");
- defaultNav.addChild("b");
- defaultNav.addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_node"));
-
- //
- Node root;
- Node a;
- Node b;
- Node c;
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.GRANDCHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- a.setHidden(true);
- assertEquals(2, root.getChildren().size());
- assertNull(root.getChild("a"));
- assertEquals("b", root.getChild(0).getName());
- try
- {
- root.getChild(2);
- fail();
- }
- catch (IndexOutOfBoundsException ignore)
- {
- }
- assertFalse(root.removeChild("a"));
- try
- {
- b.setName("a");
- fail();
- }
- catch (IllegalArgumentException ignore)
- {
- }
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- b.setHidden(true);
- assertSame(a, root.getChild(0));
- assertSame(c, root.getChild(1));
- try
- {
- root.getChild(2);
- fail();
- }
- catch (IndexOutOfBoundsException e)
- {
- }
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- a.setHidden(true);
- c.setHidden(true);
- assertSame(b, root.getChild(0));
- try
- {
- root.getChild(1);
- fail();
- }
- catch (IndexOutOfBoundsException e)
- {
- }
- }
-
- public void testHiddenInsert1() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_insert_1");
- Navigation defaultNav = portal.getRootNavigation().addChild("default");
- defaultNav.addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_insert_1"));
-
- //
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node a = root.getChild("a");
- a.setHidden(true);
- Node b = root.addChild("b");
- assertEquals(1, root.getChildren().size());
- assertSame(b, root.getChildren().iterator().next());
- a.setHidden(false);
- assertEquals(2, root.getChildren().size());
- Iterator<Node> it = root.getChildren().iterator();
- assertSame(b, it.next());
- assertSame(a, it.next());
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- a.setHidden(true);
- b = root.addChild(0, "b");
- assertEquals(1, root.getChildren().size());
- assertSame(b, root.getChildren().iterator().next());
- a.setHidden(false);
- assertEquals(2, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(b, it.next());
- assertSame(a, it.next());
- }
-
- public void testHiddenInsert2() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_insert_2");
- Navigation defaultNav = portal.getRootNavigation().addChild("default");
- defaultNav.addChild("a");
- defaultNav.addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_insert_2"));
-
- //
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node a = root.getChild("a");
- Node b = root.getChild("b");
- b.setHidden(true);
- Node c = root.addChild(0, "c");
- assertEquals(2, root.getChildren().size());
- Iterator<Node> it = root.getChildren().iterator();
- assertSame(c, it.next());
- assertSame(a, it.next());
- b.setHidden(false);
- assertEquals(3, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(c, it.next());
- assertSame(a, it.next());
- assertSame(b, it.next());
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- b.setHidden(true);
- c = root.addChild(1, "c");
- assertEquals(2, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(c, it.next());
- b.setHidden(false);
- assertEquals(3, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(c, it.next());
- assertSame(b, it.next());
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- b.setHidden(true);
- c = root.addChild("c");
- assertEquals(2, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(c, it.next());
- b.setHidden(false);
- assertEquals(3, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(c, it.next());
- assertSame(b, it.next());
- }
-
- public void testHiddenInsert3() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_insert_3");
- Navigation defaultNav = portal.getRootNavigation().addChild("default");
- defaultNav.addChild("a");
- defaultNav.addChild("b");
- defaultNav.addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_insert_3"));
-
- //
- Node root,a,b,c,d;
- Iterator<Node> it;
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- b.setHidden(true);
- d = root.addChild(0, "d");
- assertEquals(3, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(d, it.next());
- assertSame(a, it.next());
- assertSame(c, it.next());
- b.setHidden(false);
- assertEquals(4, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(d, it.next());
- assertSame(a, it.next());
- assertSame(b, it.next());
- assertSame(c, it.next());
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- b.setHidden(true);
- d = root.addChild(1, "d");
- assertEquals(3, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(d, it.next());
- assertSame(c, it.next());
- b.setHidden(false);
- assertEquals(4, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(d, it.next());
- assertSame(b, it.next());
- assertSame(c, it.next());
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- b.setHidden(true);
- d = root.addChild(2, "d");
- assertEquals(3, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(c, it.next());
- assertSame(d, it.next());
- b.setHidden(false);
- assertEquals(4, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(b, it.next());
- assertSame(c, it.next());
- assertSame(d, it.next());
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- b.setHidden(true);
- d = root.addChild("d");
- assertEquals(3, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(c, it.next());
- assertSame(d, it.next());
- b.setHidden(false);
- assertEquals(4, root.getChildren().size());
- it = root.getChildren().iterator();
- assertSame(a, it.next());
- assertSame(b, it.next());
- assertSame(c, it.next());
- assertSame(d, it.next());
- }
-
- public void _testNodeInvalidationByRemoval() throws Exception
- {
- //
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_removal");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_removal"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- assertNotNull(root);
-
- //
- sync();
-
- //
- mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_removal").getRootNavigation().getChild("default").destroy();
-
- //
- sync(true);
-
- //
- NodeContext<Node> rootCtx = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null);
- assertNull(rootCtx);
- }
-
- public void _testNodeInvalidationByChild() throws Exception
- {
- // Create a navigation
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_child");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- // Put the navigation in the cache
- NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_child"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Iterator<? extends Node> iterator = root.getChildren().iterator();
- assertFalse(iterator.hasNext());
-
- //
- sync();
-
- //
- mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_child").getRootNavigation().getChild("default").addChild("new");
-
- //
- sync(true);
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- iterator = root.getChildren().iterator();
- iterator.next();
- assertFalse(iterator.hasNext());
-
- //
- sync();
-
- //
- mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_child").getRootNavigation().getChild("default").getChild("new").destroy();
-
- //
- sync(true);
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- iterator = root.getChildren().iterator();
- assertFalse(iterator.hasNext());
- }
-
- public void _testNodeInvalidationByProperty() throws Exception
- {
- // Create a navigation
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_propertychange"));
- Node defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- assertNull(defaultNode.getContext().getState().getLabel());
-
- //
- sync();
-
- //
- Described defaultDescribed = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange").getRootNavigation().getChild("default").adapt(Described.class);
- defaultDescribed.setName("bilto");
-
- //
- sync(true);
-
- //
- defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- assertEquals("bilto", defaultNode.getContext().getState().getLabel());
-
- //
- sync();
-
- //
- defaultDescribed = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange").getRootNavigation().getChild("default").adapt(Described.class);
- defaultDescribed.setName("bilta");
-
- //
- sync(true);
-
- //
- defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- assertEquals("bilta", defaultNode.getContext().getState().getLabel());
-
- //
- sync();
-
- //
- defaultDescribed = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange").getRootNavigation().getChild("default").adapt(Described.class);
- defaultDescribed.setName(null);
-
- //
- sync(true);
-
- //
- defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- assertNull(defaultNode.getContext().getState().getLabel());
- }
-
- public void _testNodeInvalidationByAttribute() throws Exception
- {
- //
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_attribute"));
- Node defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
-
- //
- sync();
-
- //
- mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute").getRootNavigation().getChild("default").getAttributes().setValue(MappedAttributes.URI, "foo_uri");
-
- //
- sync(true);
-
- //
- defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
-
- //
- sync();
-
- //
- mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute").getRootNavigation().getChild("default").getAttributes().setValue(MappedAttributes.URI, "bar_uri");
-
- //
- sync(true);
-
- //
- defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
-
- //
- sync();
-
- //
- mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute").getRootNavigation().getChild("default").getAttributes().setValue(MappedAttributes.URI, null);
-
- //
- sync(true);
-
- //
- defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- }
-
- public void _testWeirdBug() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("foo");
- rootNavigation.addChild("bar");
- rootNavigation.addChild("juu");
-
- //
- sync(true);
-
- //
- portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- rootNavigation = portal.getRootNavigation().getChild("default");
- rootNavigation.getChild("bar").destroy();
-
- //
- sync(true);
-
- //
- portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- rootNavigation = portal.getRootNavigation().getChild("default");
- rootNavigation.addChild("daa");
-
- //
- sync(true);
-
- //
- portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- rootNavigation = portal.getRootNavigation().getChild("default");
- Navigation daa = rootNavigation.getChildren().get(2);
- assertEquals("daa", daa.getName());
- }
-
- public void _testWeirdBug2() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Session session = mop.getModel().getSession().getJCRSession();
- javax.jcr.Node container = session.getRootNode().
- getNode("mop:workspace/mop:portalsites").
- addNode("mop:reorder_child_2").
- getNode("mop:rootnavigation/mop:children").
- addNode("mop:default").
- getNode("mop:children");
- container.addNode("mop:foo");
- container.addNode("mop:bar");
- container.addNode("mop:juu");
-
- //
- sync(true);
-
- //
- session = mop.getModel().getSession().getJCRSession();
- container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
- container.getNode("mop:bar").remove();
-
- //
- sync(true);
-
- //
- session = mop.getModel().getSession().getJCRSession();
- container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
- container.addNode("mop:daa");
- container.orderBefore("mop:daa", null);
-
- //
- sync(true);
-
- //
- container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
- NodeIterator it = container.getNodes();
- assertEquals("mop:foo", it.nextNode().getName());
- assertEquals("mop:juu", it.nextNode().getName());
- assertEquals("mop:daa", it.nextNode().getName());
- assertFalse(it.hasNext());
- }
-
- public void testCount()
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "count");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("count"));
- Node root;
-
- //
- root = service.loadNode(Node.MODEL, navigation, Scope.SINGLE, null).getNode();
- assertEquals(0, root.getNodeCount());
-// assertEquals(-1, root.getSize());
-
- //
- root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- assertEquals(0, root.getNodeCount());
- assertEquals(0, root.getSize());
- Node a = root.addChild("a");
- assertEquals(1, root.getNodeCount());
- assertEquals(1, root.getSize());
- a.setHidden(true);
- assertEquals(0, root.getNodeCount());
- assertEquals(1, root.getSize());
- }
-
- public void testInsertDuplicate()
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "insert_duplicate");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("insert_duplicate"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- try
- {
- root.addChild("a");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationService.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,803 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.Described;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.pom.data.MappedAttributes;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.core.api.MOPService;
+
+import javax.jcr.NodeIterator;
+import javax.jcr.Session;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestNavigationService extends AbstractTestNavigationService
+{
+
+ public void testNonExistingSite() throws Exception
+ {
+ assertNull(service.loadNavigation(SiteKey.portal("non_existing")));
+ }
+
+ public void testLoadSingleScope() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("classic"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ assertNull(root.getChildren());
+ assertEquals("default", root.getName());
+ try
+ {
+ root.getChild(0);
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ try
+ {
+ root.addChild("a");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ try
+ {
+ root.addChild(0, "a");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ try
+ {
+ root.removeChild("a");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+
+ public void testLoadChildrenScope() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("classic"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ assertEquals("default", root.getName());
+ Iterator<? extends Node> i = root.getChildren().iterator();
+ assertTrue(i.hasNext());
+ Node home = i.next();
+ assertSame(home, root.getChild(0));
+ assertNull(home.getChildren());
+ assertEquals("home", home.getName());
+ assertTrue(i.hasNext());
+ Node webexplorer = i.next();
+
+ assertNull(webexplorer.getChildren());
+
+ assertSame(webexplorer, root.getChild(1));
+ assertEquals("webexplorer", webexplorer.getName());
+ assertFalse(i.hasNext());
+ }
+
+ public void testLoadCustomScope() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("large"));
+ Node root = service.loadNode(Node.MODEL, nav, new Scope()
+ {
+ public Visitor get()
+ {
+ return new Visitor()
+ {
+ public VisitMode enter(int depth, String id, String name, NodeState state)
+ {
+ boolean use = false;
+ switch (depth)
+ {
+ case 0:
+ use = "default".equals(name);
+ break;
+ case 1:
+ use = "b".equals(name);
+ break;
+ case 2:
+ use = "d".equals(name);
+ break;
+ }
+ return use ? VisitMode.ALL_CHILDREN : VisitMode.NO_CHILDREN;
+ }
+ public void leave(int depth, String id, String name, NodeState state)
+ {
+ }
+ };
+ }
+ }, null).getNode();
+ assertNull(root.getChild("a").getChildren());
+ Node b = root.getChild("b");
+ Node d = b.getChild("d");
+ assertNull(d.getChild("e").getChildren());
+ }
+
+ public void testUpdateNode() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("large"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node a = root.getChild("a");
+ assertNotNull(a);
+ assertNull(a.getChildren());
+ a.update(service, Scope.CHILDREN);
+ assertNotNull(a.getChildren());
+ assertEquals(1, a.getChildren().size());
+ Node c = a.getChild("c");
+ assertEquals("c", c.getName());
+ assertSame(a, c.getParent());
+ service.updateNode(a.context, Scope.SINGLE, null);
+ assertNotNull(a.getChildren());
+ assertEquals(1, a.getChildren().size());
+ assertSame(c, a.getChild("c"));
+ assertNotNull(c.getParent());
+ }
+
+ public void testState() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("test"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ assertEquals(5, root.getNodeCount());
+ Node child1 = root.getChild("node_name");
+ Node child2 = root.getChild("node_name4");
+ assertEquals("node_name", child1.getName());
+ assertEquals("node_label", child1.getContext().getState().getLabel());
+ assertEquals("portal::test::test1", child1.getContext().getState().getPageRef());
+ assertEquals(Visibility.TEMPORAL, child1.getContext().getState().getVisibility());
+ assertEquals(953602380000L, child1.getContext().getState().getStartPublicationTime());
+ assertEquals(1237599180000L, child1.getContext().getState().getEndPublicationTime());
+ assertEquals("node_name4", child2.getName());
+ assertEquals("node_label4", child2.getContext().getState().getLabel());
+ assertEquals("portal::test::test1", child2.getContext().getState().getPageRef());
+ assertEquals(Visibility.DISPLAYED, child2.getContext().getState().getVisibility());
+ }
+
+ public void testDepth() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("test"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node child1 = root.getChild("node_name");
+ assertEquals(0, child1.context.getDepth(child1.context));
+ assertEquals(1, child1.context.getDepth(root.context));
+ try
+ {
+ root.context.getDepth(child1.context);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testHiddenNode() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_node");
+ Navigation defaultNav = portal.getRootNavigation().addChild("default");
+ defaultNav.addChild("a");
+ defaultNav.addChild("b");
+ defaultNav.addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_node"));
+
+ //
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.GRANDCHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ a.setHidden(true);
+ assertEquals(2, root.getChildren().size());
+ assertNull(root.getChild("a"));
+ assertEquals("b", root.getChild(0).getName());
+ try
+ {
+ root.getChild(2);
+ fail();
+ }
+ catch (IndexOutOfBoundsException ignore)
+ {
+ }
+ assertFalse(root.removeChild("a"));
+ try
+ {
+ b.setName("a");
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ b.setHidden(true);
+ assertSame(a, root.getChild(0));
+ assertSame(c, root.getChild(1));
+ try
+ {
+ root.getChild(2);
+ fail();
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ }
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ a.setHidden(true);
+ c.setHidden(true);
+ assertSame(b, root.getChild(0));
+ try
+ {
+ root.getChild(1);
+ fail();
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ }
+ }
+
+ public void testHiddenInsert1() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_insert_1");
+ Navigation defaultNav = portal.getRootNavigation().addChild("default");
+ defaultNav.addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_insert_1"));
+
+ //
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node a = root.getChild("a");
+ a.setHidden(true);
+ Node b = root.addChild("b");
+ assertEquals(1, root.getChildren().size());
+ assertSame(b, root.getChildren().iterator().next());
+ a.setHidden(false);
+ assertEquals(2, root.getChildren().size());
+ Iterator<Node> it = root.getChildren().iterator();
+ assertSame(b, it.next());
+ assertSame(a, it.next());
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ a.setHidden(true);
+ b = root.addChild(0, "b");
+ assertEquals(1, root.getChildren().size());
+ assertSame(b, root.getChildren().iterator().next());
+ a.setHidden(false);
+ assertEquals(2, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(b, it.next());
+ assertSame(a, it.next());
+ }
+
+ public void testHiddenInsert2() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_insert_2");
+ Navigation defaultNav = portal.getRootNavigation().addChild("default");
+ defaultNav.addChild("a");
+ defaultNav.addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_insert_2"));
+
+ //
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node a = root.getChild("a");
+ Node b = root.getChild("b");
+ b.setHidden(true);
+ Node c = root.addChild(0, "c");
+ assertEquals(2, root.getChildren().size());
+ Iterator<Node> it = root.getChildren().iterator();
+ assertSame(c, it.next());
+ assertSame(a, it.next());
+ b.setHidden(false);
+ assertEquals(3, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(c, it.next());
+ assertSame(a, it.next());
+ assertSame(b, it.next());
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ b.setHidden(true);
+ c = root.addChild(1, "c");
+ assertEquals(2, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(c, it.next());
+ b.setHidden(false);
+ assertEquals(3, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(c, it.next());
+ assertSame(b, it.next());
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ b.setHidden(true);
+ c = root.addChild("c");
+ assertEquals(2, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(c, it.next());
+ b.setHidden(false);
+ assertEquals(3, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(c, it.next());
+ assertSame(b, it.next());
+ }
+
+ public void testHiddenInsert3() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "hidden_insert_3");
+ Navigation defaultNav = portal.getRootNavigation().addChild("default");
+ defaultNav.addChild("a");
+ defaultNav.addChild("b");
+ defaultNav.addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("hidden_insert_3"));
+
+ //
+ Node root,a,b,c,d;
+ Iterator<Node> it;
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ b.setHidden(true);
+ d = root.addChild(0, "d");
+ assertEquals(3, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(d, it.next());
+ assertSame(a, it.next());
+ assertSame(c, it.next());
+ b.setHidden(false);
+ assertEquals(4, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(d, it.next());
+ assertSame(a, it.next());
+ assertSame(b, it.next());
+ assertSame(c, it.next());
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ b.setHidden(true);
+ d = root.addChild(1, "d");
+ assertEquals(3, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(d, it.next());
+ assertSame(c, it.next());
+ b.setHidden(false);
+ assertEquals(4, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(d, it.next());
+ assertSame(b, it.next());
+ assertSame(c, it.next());
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ b.setHidden(true);
+ d = root.addChild(2, "d");
+ assertEquals(3, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(c, it.next());
+ assertSame(d, it.next());
+ b.setHidden(false);
+ assertEquals(4, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(b, it.next());
+ assertSame(c, it.next());
+ assertSame(d, it.next());
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ b.setHidden(true);
+ d = root.addChild("d");
+ assertEquals(3, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(c, it.next());
+ assertSame(d, it.next());
+ b.setHidden(false);
+ assertEquals(4, root.getChildren().size());
+ it = root.getChildren().iterator();
+ assertSame(a, it.next());
+ assertSame(b, it.next());
+ assertSame(c, it.next());
+ assertSame(d, it.next());
+ }
+
+ public void _testNodeInvalidationByRemoval() throws Exception
+ {
+ //
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_removal");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_removal"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ assertNotNull(root);
+
+ //
+ sync();
+
+ //
+ mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_removal").getRootNavigation().getChild("default").destroy();
+
+ //
+ sync(true);
+
+ //
+ NodeContext<Node> rootCtx = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null);
+ assertNull(rootCtx);
+ }
+
+ public void _testNodeInvalidationByChild() throws Exception
+ {
+ // Create a navigation
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_child");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ // Put the navigation in the cache
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_child"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Iterator<? extends Node> iterator = root.getChildren().iterator();
+ assertFalse(iterator.hasNext());
+
+ //
+ sync();
+
+ //
+ mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_child").getRootNavigation().getChild("default").addChild("new");
+
+ //
+ sync(true);
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ iterator = root.getChildren().iterator();
+ iterator.next();
+ assertFalse(iterator.hasNext());
+
+ //
+ sync();
+
+ //
+ mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_child").getRootNavigation().getChild("default").getChild("new").destroy();
+
+ //
+ sync(true);
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ iterator = root.getChildren().iterator();
+ assertFalse(iterator.hasNext());
+ }
+
+ public void _testNodeInvalidationByProperty() throws Exception
+ {
+ // Create a navigation
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_propertychange"));
+ Node defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ assertNull(defaultNode.getContext().getState().getLabel());
+
+ //
+ sync();
+
+ //
+ Described defaultDescribed = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange").getRootNavigation().getChild("default").adapt(Described.class);
+ defaultDescribed.setName("bilto");
+
+ //
+ sync(true);
+
+ //
+ defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ assertEquals("bilto", defaultNode.getContext().getState().getLabel());
+
+ //
+ sync();
+
+ //
+ defaultDescribed = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange").getRootNavigation().getChild("default").adapt(Described.class);
+ defaultDescribed.setName("bilta");
+
+ //
+ sync(true);
+
+ //
+ defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ assertEquals("bilta", defaultNode.getContext().getState().getLabel());
+
+ //
+ sync();
+
+ //
+ defaultDescribed = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_propertychange").getRootNavigation().getChild("default").adapt(Described.class);
+ defaultDescribed.setName(null);
+
+ //
+ sync(true);
+
+ //
+ defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ assertNull(defaultNode.getContext().getState().getLabel());
+ }
+
+ public void _testNodeInvalidationByAttribute() throws Exception
+ {
+ //
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("invalidation_by_attribute"));
+ Node defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+
+ //
+ sync();
+
+ //
+ mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute").getRootNavigation().getChild("default").getAttributes().setValue(MappedAttributes.URI, "foo_uri");
+
+ //
+ sync(true);
+
+ //
+ defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+
+ //
+ sync();
+
+ //
+ mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute").getRootNavigation().getChild("default").getAttributes().setValue(MappedAttributes.URI, "bar_uri");
+
+ //
+ sync(true);
+
+ //
+ defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+
+ //
+ sync();
+
+ //
+ mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "invalidation_by_attribute").getRootNavigation().getChild("default").getAttributes().setValue(MappedAttributes.URI, null);
+
+ //
+ sync(true);
+
+ //
+ defaultNode = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ }
+
+ public void _testWeirdBug() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("foo");
+ rootNavigation.addChild("bar");
+ rootNavigation.addChild("juu");
+
+ //
+ sync(true);
+
+ //
+ portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ rootNavigation = portal.getRootNavigation().getChild("default");
+ rootNavigation.getChild("bar").destroy();
+
+ //
+ sync(true);
+
+ //
+ portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ rootNavigation = portal.getRootNavigation().getChild("default");
+ rootNavigation.addChild("daa");
+
+ //
+ sync(true);
+
+ //
+ portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ rootNavigation = portal.getRootNavigation().getChild("default");
+ Navigation daa = rootNavigation.getChildren().get(2);
+ assertEquals("daa", daa.getName());
+ }
+
+ public void _testWeirdBug2() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Session session = mop.getModel().getSession().getJCRSession();
+ javax.jcr.Node container = session.getRootNode().
+ getNode("mop:workspace/mop:portalsites").
+ addNode("mop:reorder_child_2").
+ getNode("mop:rootnavigation/mop:children").
+ addNode("mop:default").
+ getNode("mop:children");
+ container.addNode("mop:foo");
+ container.addNode("mop:bar");
+ container.addNode("mop:juu");
+
+ //
+ sync(true);
+
+ //
+ session = mop.getModel().getSession().getJCRSession();
+ container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
+ container.getNode("mop:bar").remove();
+
+ //
+ sync(true);
+
+ //
+ session = mop.getModel().getSession().getJCRSession();
+ container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
+ container.addNode("mop:daa");
+ container.orderBefore("mop:daa", null);
+
+ //
+ sync(true);
+
+ //
+ container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
+ NodeIterator it = container.getNodes();
+ assertEquals("mop:foo", it.nextNode().getName());
+ assertEquals("mop:juu", it.nextNode().getName());
+ assertEquals("mop:daa", it.nextNode().getName());
+ assertFalse(it.hasNext());
+ }
+
+ public void testCount()
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "count");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("count"));
+ Node root;
+
+ //
+ root = service.loadNode(Node.MODEL, navigation, Scope.SINGLE, null).getNode();
+ assertEquals(0, root.getNodeCount());
+// assertEquals(-1, root.getSize());
+
+ //
+ root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ assertEquals(0, root.getNodeCount());
+ assertEquals(0, root.getSize());
+ Node a = root.addChild("a");
+ assertEquals(1, root.getNodeCount());
+ assertEquals(1, root.getSize());
+ a.setHidden(true);
+ assertEquals(0, root.getNodeCount());
+ assertEquals(1, root.getSize());
+ }
+
+ public void testInsertDuplicate()
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "insert_duplicate");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("insert_duplicate"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ try
+ {
+ root.addChild("a");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.core.api.MOPService;
-
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class TestNavigationServiceRebase extends AbstractTestNavigationService
-{
-
- public void testRebase1() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase1");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
- def.addChild("d");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase1"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- Node a = root1.getChild("a");
- Node d = root1.getChild("d");
- Node b = root1.addChild(1, "b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- Node c2 = root2.addChild(1, "c");
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- service.rebaseNode(root1.context, null, null);
- assertEquals(4, root1.getNodeCount());
- assertSame(a, root1.getChild(0));
- assertSame(b, root1.getChild(1));
- Node c1 = root1.getChild(2);
- assertEquals("c", c1.getName());
- assertEquals(c2.getId(), c1.getId());
- assertSame(d, root1.getChild(3));
-
- }
-
- public void testRebase2() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase2");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
- def.addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase2"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- Node a = root1.getChild("a");
- Node b = root1.getChild("b");
- Node c = a.addChild("c");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root2.getChild("b").addChild(root2.getChild("a"));
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- service.rebaseNode(root1.context, null, null);
- assertEquals(null, root1.getChild("a"));
- assertSame(b, root1.getChild("b"));
- assertEquals(root1, b.getParent());
- assertSame(a, b.getChild("a"));
- assertEquals(b, a.getParent());
- assertSame(c, a.getChild("c"));
- assertEquals(a, c.getParent());
- }
-
- public void testRebase3() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase3");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
- def.addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase3"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root.getChild("a").addChild("foo");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root2.removeChild("a");
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- try
- {
- service.rebaseNode(root.context, null, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE, e.getError());
- }
-
- }
-
- /**
- * This test is quite important as it ensures that the copy tree during the rebase operation
- * is rebuild from the initial state. Indeed the move / destroy operations would fail otherwise
- * as the move operation would not find its source.
- */
- public void testRebase4()
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase4");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a").addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase4"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root.addChild(root.getChild("a").getChild("b"));
- root.removeChild("a");
-
- //
- service.rebaseNode(root.context, null, null);
- }
-
- public void testRebaseAddDuplicate() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_add_duplicate");
- Navigation def = portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_add_duplicate"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root.addChild("a");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root2.addChild("a");
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- try
- {
- service.rebaseNode(root.context, null, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.ADD_CONCURRENTLY_ADDED_NODE, e.getError());
- }
-
- }
-
- public void testRebaseMoveDuplicate() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_move_duplicate");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a").addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_move_duplicate"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root.addChild(root.getChild("a").getChild("b"));
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root2.addChild("b");
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- try
- {
- service.rebaseNode(root.context, null, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.MOVE_CONCURRENTLY_DUPLICATE_NAME, e.getError());
- }
-
- }
-
- public void testRebaseRenameDuplicate() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_rename_duplicate");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_rename_duplicate"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root.getChild("a").setName("b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root2.addChild("b");
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- try
- {
- service.rebaseNode(root.context, null, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.RENAME_CONCURRENTLY_DUPLICATE_NAME, e.getError());
- }
- }
-
- public void testFederation() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_federation");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a").addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_federation"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).node;
- final Node a = root1.getChild("a");
- final Node c = root1.addChild("c");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root2.addChild("d").addChild("e");
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = a.rebase(service, Scope.CHILDREN);
- Iterator<Node> children = root1.getChildren().iterator();
- assertSame(a, children.next());
- assertSame(c, children.next());
- Node d = children.next();
- assertEquals("d", d.getName());
- assertFalse(children.hasNext());
- assertFalse(d.context.isExpanded());
- children = a.getChildren().iterator();
- Node b = children.next();
- assertEquals("b", b.getName());
- assertFalse(children.hasNext());
- assertFalse(b.context.isExpanded());
- NodeChange.Added<Node> added1 = (NodeChange.Added<Node>)changes.next();
- assertSame(b, added1.getTarget());
- assertSame(null, added1.getPrevious());
- assertSame(a, added1.getParent());
- NodeChange.Added<Node> added2 = (NodeChange.Added<Node>)changes.next();
- assertSame(d, added2.getTarget());
- assertSame(c, added2.getPrevious());
- assertSame(root1, added2.getParent());
- assertFalse(changes.hasNext());
- }
-
- public void testTransientParent() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_transient_parent");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_transient_parent"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).node;
- Node a = root.addChild("a");
- Node b = root.addChild("b"); // It is only failed if we add more than one transient node
-
- //
- service.rebaseNode(a.context, Scope.CHILDREN, null);
- }
-
- public void testRemovedNavigation() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_removed_navigation");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_removed_navigation"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- service.destroyNavigation(navigation);
-
- //
- sync(true);
-
- //
- try
- {
- service.rebaseNode(root.context, null, null);
- }
- catch (NavigationServiceException e)
- {
- assertSame(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
- }
- }
-
- public void testStateRebase() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_state");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_state"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
-
- NodeState state = new NodeState.Builder().label("foo").build();
- root.getChild("a").setState(state);
- assertSame(state, root.getChild("a").getState());
-
- //
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root.rebase(service, null);
- assertFalse(changes.hasNext());
- assertSame(state, root.getChild("a").getState());
- }
-
- public void testNameRebase() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_name");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_name"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
-
- Node a = root.getChild("a");
- a.setName("b");
- assertSame("b", a.getName());
-
- //
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root.rebase(service, null);
- assertFalse(changes.hasNext());
- assertSame("b", a.getName());
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceRebase.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,414 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.core.api.MOPService;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestNavigationServiceRebase extends AbstractTestNavigationService
+{
+
+ public void testRebase1() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase1");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+ def.addChild("d");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase1"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ Node a = root1.getChild("a");
+ Node d = root1.getChild("d");
+ Node b = root1.addChild(1, "b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ Node c2 = root2.addChild(1, "c");
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ service.rebaseNode(root1.context, null, null);
+ assertEquals(4, root1.getNodeCount());
+ assertSame(a, root1.getChild(0));
+ assertSame(b, root1.getChild(1));
+ Node c1 = root1.getChild(2);
+ assertEquals("c", c1.getName());
+ assertEquals(c2.getId(), c1.getId());
+ assertSame(d, root1.getChild(3));
+
+ }
+
+ public void testRebase2() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase2");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+ def.addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase2"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ Node a = root1.getChild("a");
+ Node b = root1.getChild("b");
+ Node c = a.addChild("c");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root2.getChild("b").addChild(root2.getChild("a"));
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ service.rebaseNode(root1.context, null, null);
+ assertEquals(null, root1.getChild("a"));
+ assertSame(b, root1.getChild("b"));
+ assertEquals(root1, b.getParent());
+ assertSame(a, b.getChild("a"));
+ assertEquals(b, a.getParent());
+ assertSame(c, a.getChild("c"));
+ assertEquals(a, c.getParent());
+ }
+
+ public void testRebase3() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase3");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+ def.addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase3"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root.getChild("a").addChild("foo");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ try
+ {
+ service.rebaseNode(root.context, null, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE, e.getError());
+ }
+
+ }
+
+ /**
+ * This test is quite important as it ensures that the copy tree during the rebase operation
+ * is rebuild from the initial state. Indeed the move / destroy operations would fail otherwise
+ * as the move operation would not find its source.
+ */
+ public void testRebase4()
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase4");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a").addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase4"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root.addChild(root.getChild("a").getChild("b"));
+ root.removeChild("a");
+
+ //
+ service.rebaseNode(root.context, null, null);
+ }
+
+ public void testRebaseAddDuplicate() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_add_duplicate");
+ Navigation def = portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_add_duplicate"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root.addChild("a");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root2.addChild("a");
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ try
+ {
+ service.rebaseNode(root.context, null, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.ADD_CONCURRENTLY_ADDED_NODE, e.getError());
+ }
+
+ }
+
+ public void testRebaseMoveDuplicate() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_move_duplicate");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a").addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_move_duplicate"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root.addChild(root.getChild("a").getChild("b"));
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root2.addChild("b");
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ try
+ {
+ service.rebaseNode(root.context, null, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.MOVE_CONCURRENTLY_DUPLICATE_NAME, e.getError());
+ }
+
+ }
+
+ public void testRebaseRenameDuplicate() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_rename_duplicate");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_rename_duplicate"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root.getChild("a").setName("b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root2.addChild("b");
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ try
+ {
+ service.rebaseNode(root.context, null, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.RENAME_CONCURRENTLY_DUPLICATE_NAME, e.getError());
+ }
+ }
+
+ public void testFederation() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_federation");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a").addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_federation"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).node;
+ final Node a = root1.getChild("a");
+ final Node c = root1.addChild("c");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root2.addChild("d").addChild("e");
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = a.rebase(service, Scope.CHILDREN);
+ Iterator<Node> children = root1.getChildren().iterator();
+ assertSame(a, children.next());
+ assertSame(c, children.next());
+ Node d = children.next();
+ assertEquals("d", d.getName());
+ assertFalse(children.hasNext());
+ assertFalse(d.context.isExpanded());
+ children = a.getChildren().iterator();
+ Node b = children.next();
+ assertEquals("b", b.getName());
+ assertFalse(children.hasNext());
+ assertFalse(b.context.isExpanded());
+ NodeChange.Added<Node> added1 = (NodeChange.Added<Node>)changes.next();
+ assertSame(b, added1.getTarget());
+ assertSame(null, added1.getPrevious());
+ assertSame(a, added1.getParent());
+ NodeChange.Added<Node> added2 = (NodeChange.Added<Node>)changes.next();
+ assertSame(d, added2.getTarget());
+ assertSame(c, added2.getPrevious());
+ assertSame(root1, added2.getParent());
+ assertFalse(changes.hasNext());
+ }
+
+ public void testTransientParent() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_transient_parent");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_transient_parent"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).node;
+ Node a = root.addChild("a");
+ Node b = root.addChild("b"); // It is only failed if we add more than one transient node
+
+ //
+ service.rebaseNode(a.context, Scope.CHILDREN, null);
+ }
+
+ public void testRemovedNavigation() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_removed_navigation");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_removed_navigation"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ service.destroyNavigation(navigation);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.rebaseNode(root.context, null, null);
+ }
+ catch (NavigationServiceException e)
+ {
+ assertSame(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
+ }
+ }
+
+ public void testStateRebase() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_state");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_state"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+
+ NodeState state = new NodeState.Builder().label("foo").build();
+ root.getChild("a").setState(state);
+ assertSame(state, root.getChild("a").getState());
+
+ //
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root.rebase(service, null);
+ assertFalse(changes.hasNext());
+ assertSame(state, root.getChild("a").getState());
+ }
+
+ public void testNameRebase() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rebase_name");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("rebase_name"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+
+ Node a = root.getChild("a");
+ a.setName("b");
+ assertSame("b", a.getName());
+
+ //
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root.rebase(service, null);
+ assertFalse(changes.hasNext());
+ assertSame("b", a.getName());
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,1722 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.Visibility;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.core.api.MOPService;
-
-import javax.jcr.NodeIterator;
-import javax.jcr.Session;
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestNavigationServiceSave extends AbstractTestNavigationService
-{
-
- public void testNonExistingSite() throws Exception
- {
- assertNull(service.loadNavigation(SiteKey.portal("non_existing")));
- }
-
- public void testSaveNavigation() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_navigation"));
- assertNull(nav);
-
- //
- mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_navigation");
-
- //
- sync(true);
-
- //
- nav = service.loadNavigation(SiteKey.portal("save_navigation"));
- assertNull(nav);
-
- //
- nav = new NavigationContext(SiteKey.portal("save_navigation"), new NavigationState(5));
- assertNull(nav.data);
- assertNotNull(nav.state);
- service.saveNavigation(nav);
- assertNotNull(nav.data);
- assertNull(nav.state);
-
- //
- nav.setState(new NavigationState(5));
- service.saveNavigation(nav);
- nav = service.loadNavigation(SiteKey.portal("save_navigation"));
- assertNull(nav.state);
- assertNotNull(nav.data.state);
- assertEquals(5, nav.data.state.getPriority().intValue());
-
- //
- sync(true);
-
- //
- nav = service.loadNavigation(SiteKey.portal("save_navigation"));
- assertNotNull(nav);
- assertEquals(SiteKey.portal("save_navigation"), nav.getKey());
- NavigationState state = nav.data.state;
- Integer p = state.getPriority();
- assertEquals(5, (int) p);
- assertNotNull(nav.data.rootId);
- }
-
- public void testDestroyNavigation() throws Exception
- {
- NavigationContext nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
- assertNull(nav);
-
- //
- mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "destroy_navigation").getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
- service.clearCache();
-
- //
- nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
- assertNotNull(nav);
-
- //
- Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
-
- //
- assertTrue(service.destroyNavigation(nav));
- assertNull(nav.state);
- assertNull(nav.data);
-
- //
- try
- {
- service.destroyNavigation(nav);
- }
- catch (IllegalArgumentException e)
- {
- }
-
- //
- nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
- assertNull(nav);
-
- //
- sync(true);
-
- //
- nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
- assertNull(nav);
- }
-
- public void testAddChild() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "add_child");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("add_child"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- assertEquals(0, root1.getNodeCount());
-
- // Test what happens when null is added
- try
- {
- root1.addChild((String) null);
- fail();
- }
- catch (NullPointerException ignore)
- {
- }
-
- // Test what happens when an illegal index is added
- try
- {
- root1.addChild(-1, "foo");
- fail();
- }
- catch (IndexOutOfBoundsException ignore)
- {
- }
- try
- {
- root1.addChild(1, "foo");
- fail();
- }
- catch (IndexOutOfBoundsException ignore)
- {
- }
-
- //
- Node foo = root1.addChild("foo");
- assertNull(foo.getId());
- assertEquals("foo", foo.getName());
- assertSame(foo, root1.getChild("foo"));
- assertEquals(1, root1.getNodeCount());
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node foo2 = root2.getChild("foo");
- assertNotNull(foo2);
- assertEquals(1, root2.getNodeCount());
- assertEquals("foo", foo2.getName());
-
- //
- root1.assertEquals(root2);
- }
-
- public void testRemoveChild() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_child");
- portal.getRootNavigation().addChild("default").addChild("foo");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("remove_child"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
-
- //
- try
- {
- root1.removeChild(null);
- fail();
- }
- catch (NullPointerException e)
- {
- }
- try
- {
- root1.removeChild("bar");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- }
-
- //
- Node foo1 = root1.getChild("foo");
- assertNotNull(foo1.getId());
- assertEquals("foo", foo1.getName());
- assertSame(foo1, root1.getChild("foo"));
-
- //
- assertTrue(root1.removeChild("foo"));
- assertNull(root1.getChild("foo"));
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node foo2 = root2.getChild("foo");
- assertNull(foo2);
-
- //
- root1.assertEquals(root2);
- }
-
- public void testRemoveTransientChild() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_transient_child");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("remove_transient_child"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node foo1 = root1.addChild("foo");
- assertNull(foo1.getId());
- assertEquals("foo", foo1.getName());
- assertSame(foo1, root1.getChild("foo"));
-
- //
- assertTrue(root1.removeChild("foo"));
- assertNull(root1.getChild("foo"));
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node foo2 = root2.getChild("foo");
- assertNull(foo2);
-
- //
- root1.assertEquals(root2);
- }
-
- public void testRename() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rename");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
- def.addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("rename"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.GRANDCHILDREN, null).getNode();
- try
- {
- root1.setName("something");
- fail();
- }
- catch (IllegalStateException e)
- {
- }
-
- //
- Node a1 = root1.getChild("a");
- assertEquals(0, a1.context.getIndex());
- try
- {
- a1.setName(null);
- fail();
- }
- catch (NullPointerException e)
- {
- }
- try
- {
- a1.setName("b");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- }
-
- //
- a1.setName("c");
- assertEquals("c", a1.getName());
- assertEquals(0, a1.context.getIndex());
- service.saveNode(a1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- nav = service.loadNavigation(SiteKey.portal("rename"));
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Node a2 = root2.getChild("c");
- assertNotNull(a2);
- // assertEquals(0, a2.context.getIndex());
-
- // Does not pass randomly because of JCR bugs
- // root1.assertEquals(root2);
- }
-
- public void testReorderChild() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("foo");
- rootNavigation.addChild("bar");
- rootNavigation.addChild("juu");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("reorder_child"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- Iterator<Node> i = root1.getChildren().iterator();
- Node foo1 = i.next();
- assertEquals("foo", foo1.getName());
- Node bar1 = i.next();
- assertEquals("bar", bar1.getName());
- Node juu1 = i.next();
- assertEquals("juu", juu1.getName());
- assertFalse(i.hasNext());
-
- // Test what happens when null is added
- try
- {
- root1.addChild(1, (Node)null);
- fail();
- }
- catch (NullPointerException expected)
- {
- }
-
- // Test what happens when an illegal index is added
- try
- {
- root1.addChild(-1, juu1);
- fail();
- }
- catch (IndexOutOfBoundsException expected)
- {
- }
- try
- {
- root1.addChild(4, juu1);
- fail();
- }
- catch (IndexOutOfBoundsException expected)
- {
- }
-
- //
- root1.addChild(1, juu1);
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- i = root2.getChildren().iterator();
- Node foo2 = i.next();
- assertEquals("foo", foo2.getName());
- Node juu2 = i.next();
- assertEquals("juu", juu2.getName());
- Node bar2 = i.next();
- assertEquals("bar", bar2.getName());
- assertFalse(i.hasNext());
-
- //
- root1.assertEquals(root2);
-
- //
- root2.addChild(0, bar2);
-
- //
- service.saveNode(root2.context, null);
-
- //
- root2.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root3 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- i = root3.getChildren().iterator();
- Node bar3 = i.next();
- assertEquals("bar", bar3.getName());
- Node foo3 = i.next();
- assertEquals("foo", foo3.getName());
- Node juu3 = i.next();
- assertEquals("juu", juu3.getName());
- assertFalse(i.hasNext());
-
- //
- root2.assertEquals(root3);
- }
-
- public void _testReorderChild2() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("foo");
- rootNavigation.addChild("bar");
- rootNavigation.addChild("juu");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("reorder_child_2"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- assertEquals("bar", root.getChild(1).getName());
- assertTrue(root.removeChild("bar"));
- service.saveNode(root.context, null);
-
- //
- sync(true);
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- root.addChild("daa");
- Node tab3 = root.getChild(2);
- assertEquals("daa", tab3.getName());
- service.saveNode(root.context, null);
-
- //
- sync(true);
-
- //
- root = new NavigationServiceImpl(mgr).loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- for (Node child : root.getChildren())
- {
- System.out.println("child : " + child.getId());
- }
- tab3 = root.getChild(2);
- assertEquals("daa", tab3.getName());
-
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- for (Node child : root.getChildren())
- {
- System.out.println("child : " + child.getId());
- }
- tab3 = root.getChild(2);
- assertEquals("daa", tab3.getName());
- }
-
- public void _testWeirdBug() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("foo");
- rootNavigation.addChild("bar");
- rootNavigation.addChild("juu");
-
- //
- sync(true);
-
- //
- portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- rootNavigation = portal.getRootNavigation().getChild("default");
- rootNavigation.getChild("bar").destroy();
-
- //
- sync(true);
-
- //
- portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- rootNavigation = portal.getRootNavigation().getChild("default");
- rootNavigation.addChild("daa");
-
- //
- sync(true);
-
- //
- portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
- rootNavigation = portal.getRootNavigation().getChild("default");
- Navigation daa = rootNavigation.getChildren().get(2);
- assertEquals("daa", daa.getName());
- }
-
- public void _testWeirdBug2() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Session session = mop.getModel().getSession().getJCRSession();
- javax.jcr.Node container = session.getRootNode().
- getNode("mop:workspace/mop:portalsites").
- addNode("mop:reorder_child_2").
- getNode("mop:rootnavigation/mop:children").
- addNode("mop:default").
- getNode("mop:children");
- container.addNode("mop:foo");
- container.addNode("mop:bar");
- container.addNode("mop:juu");
-
- //
- sync(true);
-
- //
- session = mop.getModel().getSession().getJCRSession();
- container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
- container.getNode("mop:bar").remove();
-
- //
- sync(true);
-
- //
- session = mop.getModel().getSession().getJCRSession();
- container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
- container.addNode("mop:daa");
- container.orderBefore("mop:daa", null);
-
- //
- sync(true);
-
- //
- container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
- NodeIterator it = container.getNodes();
- assertEquals("mop:foo", it.nextNode().getName());
- assertEquals("mop:juu", it.nextNode().getName());
- assertEquals("mop:daa", it.nextNode().getName());
- assertFalse(it.hasNext());
- }
-
- public void testMoveChild() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_child");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("foo").addChild("juu");
- rootNavigation.addChild("bar");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("move_child"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node foo1 = root1.getChild("foo");
- Node bar1 = root1.getChild("bar");
- Node juu1 = foo1.getChild("juu");
- bar1.addChild(juu1);
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node foo2 = root2.getChild("foo");
- Node juu2 = foo2.getChild("juu");
- assertNull(juu2);
- Node bar2 = root2.getChild("bar");
- juu2 = bar2.getChild("juu");
- assertNotNull(juu2);
-
- //
- root1.assertEquals(root2);
- }
-
- public void testMoveAfter1() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_move_after_1");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("a");
- rootNavigation.addChild("b");
- rootNavigation.addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_move_after_1"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node a = root.getChild("a");
- Node b = root.getChild("b");
- Node c = root.getChild("c");
- root.addChild(1, a);
- assertSame(a, root.getChild(0));
- assertSame(b, root.getChild(1));
- assertSame(c, root.getChild(2));
- service.saveNode(root.context, null);
-
- //
- root.assertConsistent();
- assertSame(a, root.getChild(0));
- assertSame(b, root.getChild(1));
- assertSame(c, root.getChild(2));
-
- //
- sync(true);
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- assertSame(a, root.getChild(0));
- assertSame(b, root.getChild(1));
- assertSame(c, root.getChild(2));
- }
-
- public void testMoveAfter2() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_move_after_2");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("a");
- rootNavigation.addChild("b");
- rootNavigation.addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_move_after_2"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node a = root.getChild("a");
- Node b = root.getChild("b");
- Node c = root.getChild("c");
- root.addChild(2, a);
- assertSame(b, root.getChild(0));
- assertSame(a, root.getChild(1));
- assertSame(c, root.getChild(2));
- service.saveNode(root.context, null);
-
- //
- root.assertConsistent();
- assertSame(b, root.getChild(0));
- assertSame(a, root.getChild(1));
- assertSame(c, root.getChild(2));
-
- //
- sync(true);
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- a = root.getChild("a");
- b = root.getChild("b");
- c = root.getChild("c");
- assertSame(b, root.getChild(0));
- assertSame(a, root.getChild(1));
- assertSame(c, root.getChild(2));
- }
-
- public void testRenameNode() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rename_node");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("foo");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("rename_node"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node foo1 = root1.getChild("foo");
- foo1.setName("foo");
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- nav = service.loadNavigation(SiteKey.portal("rename_node"));
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
-
- //
- root1.assertEquals(root2);
-
- //
- Node foo2 = root2.getChild("foo");
- foo2.setName("bar");
- assertEquals("bar", foo2.getName());
- assertSame(foo2, root2.getChild("bar"));
- service.saveNode(root2.context, null);
- assertEquals("bar", foo2.getName());
- assertSame(foo2, root2.getChild("bar"));
-
- //
- root2.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root3 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node bar3 = root3.getChild("bar");
- assertNotNull(bar3);
- assertSame(bar3, root3.getChild("bar"));
-
- //
- root2.assertEquals(root3);
-
- //
- root3.addChild("foo");
- try
- {
- bar3.setName("foo");
- fail();
- }
- catch (IllegalArgumentException ignore)
- {
- }
- }
-
- public void testSaveChildren() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_children");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("1");
- rootNavigation.addChild("2");
- rootNavigation.addChild("3");
- rootNavigation.addChild("4");
- rootNavigation.addChild("5");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_children"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- root1.removeChild("5");
- root1.removeChild("2");
- root1.addChild(0, root1.getChild("3"));
- root1.addChild(1, root1.addChild("."));
- service.saveNode(root1.context, null);
- Iterator<Node> i = root1.getChildren().iterator();
- assertEquals("3", i.next().getName());
- assertEquals(".", i.next().getName());
- assertEquals("1", i.next().getName());
- assertEquals("4", i.next().getName());
- assertFalse(i.hasNext());
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- i = root2.getChildren().iterator();
- assertEquals("3", i.next().getName());
- assertEquals(".", i.next().getName());
- assertEquals("1", i.next().getName());
- assertEquals("4", i.next().getName());
- assertFalse(i.hasNext());
-
- //
- root1.assertEquals(root2);
- }
-
- public void testSaveRecursive() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_recursive");
- Navigation rootNavigation = portal.getRootNavigation().addChild("default");
- rootNavigation.addChild("foo");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_recursive"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node foo1 = root1.getChild("foo");
- Node bar1 = foo1.addChild("bar");
- bar1.addChild("juu");
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node foo2 = root2.getChild("foo");
- Node bar2 = foo2.getChild("bar");
- assertNotNull(bar2.getId());
- Node juu2 = bar2.getChild("juu");
- assertNotNull(juu2.getId());
-
- //
- root1.assertEquals(root2);
- }
-
- public void testSaveState() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_state");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_state"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
- NodeState state = root1.getState();
- assertNull(state.getLabel());
- assertEquals(-1, state.getStartPublicationTime());
- assertEquals(-1, state.getEndPublicationTime());
- long now = System.currentTimeMillis();
- root1.setState(new NodeState.Builder().endPublicationTime(now).label("bar").build());
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- state = root2.getState();
- assertEquals("bar", state.getLabel());
- assertEquals(-1, state.getStartPublicationTime());
- assertEquals(now, state.getEndPublicationTime());
- assertEquals(Visibility.DISPLAYED, state.getVisibility());
-
- //
- root1.assertEquals(root2);
- }
-
- public void _testSaveStateOverwrite() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_state_overwrite");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_state_overwrite"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- root.addChild("foo");
- service.saveNode(root.context, null);
-
- //
- sync(true);
-
- //
- root.addChild("bar");
- service.saveNode(root.context, null);
-
- //
- sync(true);
-
- //
- nav = service.loadNavigation(SiteKey.portal("save_state_overwrite"));
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- assertEquals(2, root.getChildren().size());
- }
-
- public void testRecreateNode() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "recreate_node");
- portal.getRootNavigation().addChild("default").addChild("foo");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("recreate_node"));
- Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- String fooId = root1.getChild("foo").getId();
- assertTrue(root1.removeChild("foo"));
- assertNull(root1.addChild("foo").getId());
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- assertNotNull(root2.getChild("foo").getId());
- assertNotSame(fooId, root2.getChild("foo").getId());
-
- //
- root1.assertEquals(root2);
- }
-
- public void testMoveToAdded() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_to_added");
- Navigation nav = portal.getRootNavigation().addChild("default");
- nav.addChild("a").addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_to_added"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
- Node a1 = root1.getChild("a");
- Node b1 = a1.getChild("b");
- Node c1 = root1.addChild("c");
- c1.addChild(b1);
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- navigation = service.loadNavigation(SiteKey.portal("move_to_added"));
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
- Node a2 = root2.getChild("a");
- assertNotNull(a2);
- Node c2 = root2.getChild("c");
- assertNotNull(c2);
- Node b2 = c2.getChild("b");
- assertNotNull(b2);
-
- //
- root1.assertEquals(root2);
- }
-
- public void testMoveFromRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "moved_from_removed");
- Navigation nav = portal.getRootNavigation().addChild("default");
- nav.addChild("a").addChild("c");
- nav.addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("moved_from_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
- Node a1 = root1.getChild("a");
- Node b1 = root1.getChild("b");
- Node c1 = a1.getChild("c");
- b1.addChild(c1);
- root1.removeChild("a");
- service.saveNode(root1.context, null);
-
- //
- root1.assertConsistent();
-
- //
- sync(true);
-
- //
- navigation = service.loadNavigation(SiteKey.portal("moved_from_removed"));
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
- assertNull(root2.getChild("a"));
- Node b2 = root2.getChild("b");
- assertNotNull(b2);
- Node c2 = b2.getChild("c");
- assertNotNull(c2);
-
- //
- root1.assertEquals(root2);
- }
-
- public void testRemoveAdded() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_added");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("remove_added"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
- root.addChild("foo");
- root.removeChild("foo");
- service.saveNode(root.context, null);
-
- //
- root.assertConsistent();
-
- //
- sync(true);
-
- //
- root = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
- assertEquals(0, root.getChildren().size());
- }
-
- public void testRenameCreatedNode() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_rename_created");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("save_rename_created"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
- Node temp = root.addChild("temp");
- temp.setName("bar");
- Iterator<NodeChange<Node>> changes = root.save(service);
- assertFalse(changes.hasNext());
- }
-
- public void testConcurrentAddToRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "add_to_removed");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("add_to_removed"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root.getChild("a").addChild("b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE, e.getError());
- }
- }
-
- public void testConcurrentMerge() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_merge");
- Navigation nav = portal.getRootNavigation().addChild("default");
- nav.addChild("a");
- nav.addChild("b");
- nav.addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_merge"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
-
- //
- sync();
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- root2.addChild(1, root2.addChild("2"));
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- service.saveNode(root1.context, null);
- root1.assertConsistent();
-
- //
- root1.addChild(1, root1.addChild("1"));
- service.saveNode(root1.context, null);
- root1.assertConsistent();
- }
-
- public void testConcurrentRemoveRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_removed");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("remove_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.removeChild("a");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- service.saveNode(root1.context, null);
-
- //
- root1.assertEquals(root2);
- }
-
- public void testConcurrentMoveRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_removed");
- portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.addChild(root1.getChild("a").getChild("b"));
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.getChild("a").removeChild("b");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_MOVED_NODE, e.getError());
- }
- }
-
- public void testConcurrentMoveToRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_to_removed");
- portal.getRootNavigation().addChild("default").addChild("a");
- portal.getRootNavigation().getChild("default").addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_to_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("b").addChild(root1.getChild("a"));
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("b");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_DST_NODE, e.getError());
- }
- }
-
- public void testConcurrentMoveMoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_moved");
- portal.getRootNavigation().addChild("default").addChild("a");
- portal.getRootNavigation().getChild("default").addChild("b");
- portal.getRootNavigation().getChild("default").addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_moved"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("b").addChild(root1.getChild("a"));
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.getChild("c").addChild(root2.getChild("a"));
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.MOVE_CONCURRENTLY_CHANGED_SRC_NODE, e.getError());
- }
- }
-
- public void testConcurrentAddDuplicate() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_add_duplicate");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_add_duplicate"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.addChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- root1.addChild("a");
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.ADD_CONCURRENTLY_ADDED_NODE, e.getError());
- }
- }
-
- public void testConcurrentAddAfterRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_add_after_removed");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_add_after_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.addChild(1, "b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE, e.getError());
- }
- }
-
- public void testConcurrentMoveAfterRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_move_after_removed");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a").addChild("b");
- def.addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_move_after_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.addChild(2, root1.getChild("a").getChild("b"));
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("c");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_PREVIOUS_NODE, e.getError());
- }
- }
-
- public void testConcurrentMoveFromRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_move_from_removed");
- portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
- portal.getRootNavigation().getChild("default").addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_move_from_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("c").addChild(root1.getChild("a").getChild("b"));
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_SRC_NODE, e.getError());
- }
- }
-
- public void testConcurrentRenameRemoved() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_rename_removed");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_rename_removed"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("a").setName("b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.RENAME_CONCURRENTLY_REMOVED_NODE, e.getError());
- }
- }
-
- public void testConcurrentDuplicateRename() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_duplicate_rename");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_duplicate_rename"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("a").setName("b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.addChild("b");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.RENAME_CONCURRENTLY_DUPLICATE_NAME, e.getError());
- }
- }
-
- public void testSavePhantomNode() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_save");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_save"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.addChild("a");
- service.saveNode(root1.context, null);
-
- //
- sync(true);
-
- // Reload the root node and modify it
- root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("a").setState(root1.getState().builder().label("foo").build());
-
- //
- sync(true);
-
- // Edit navigation in another browser
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- // Now click Save button in the first browser
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
- }
- }
-
- public void testConcurrentRemovalDoesNotPreventSave() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "removal_does_not_prevent_save");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("removal_does_not_prevent_save"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- service.saveNode(root1.context, null);
- }
-
- public void testConcurrentRename() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_concurrent_rename");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_concurrent_rename"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node a = root1.getChild("a");
- a.setName("b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node a2 = root2.getChild("a");
- a2.setName("c");
- service.saveNode(root2.context, null);
-
- //
- Iterator<NodeChange<Node>> changes = root1.save(service);
- assertFalse(changes.hasNext());
- }
-
- public void testRemovedNavigation() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_removed_navigation");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_removed_navigation"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- service.destroyNavigation(navigation);
-
- //
- sync(true);
-
- //
- try
- {
- service.saveNode(root.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertSame(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
- }
- }
-
- public void testPendingChangesBypassCache() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "pending_changes_bypass_cache");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext nav = service.loadNavigation(SiteKey.portal("pending_changes_bypass_cache"));
- Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- root.addChild("foo");
- service.saveNode(root.context, null);
-
- //
- root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
- assertNotNull(root.getChild("foo"));
- }
-
- public void testAtomic() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_atomic");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
- def.addChild("b");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_atomic"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("a").addChild("c");
- root1.getChild("b").addChild("d");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("b");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- assertFalse(mgr.getSession().isModified());
-
- //
- try
- {
- service.saveNode(root1.context, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertSame(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE, e.getError());
- }
-
- //
- assertFalse(mgr.getSession().isModified());
- }
-
- public void testRebase() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_rebase");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_rebase"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node a = root1.getChild("a");
- Node b = root1.addChild("b");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.addChild("c");
- service.saveNode(root2.context, null);
-
- //
- Iterator<NodeChange<Node>> changes = root1.save(service);
- NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
- Node c = added.getTarget();
- assertEquals("c", c.getName());
- assertFalse(changes.hasNext());
- assertSame(a, root1.getChild(0));
- assertSame(b, root1.getChild(1));
- assertSame(c, root1.getChild(2));
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceSave.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,1722 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.core.api.MOPService;
+
+import javax.jcr.NodeIterator;
+import javax.jcr.Session;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestNavigationServiceSave extends AbstractTestNavigationService
+{
+
+ public void testNonExistingSite() throws Exception
+ {
+ assertNull(service.loadNavigation(SiteKey.portal("non_existing")));
+ }
+
+ public void testSaveNavigation() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_navigation"));
+ assertNull(nav);
+
+ //
+ mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_navigation");
+
+ //
+ sync(true);
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("save_navigation"));
+ assertNull(nav);
+
+ //
+ nav = new NavigationContext(SiteKey.portal("save_navigation"), new NavigationState(5));
+ assertNull(nav.data);
+ assertNotNull(nav.state);
+ service.saveNavigation(nav);
+ assertNotNull(nav.data);
+ assertNull(nav.state);
+
+ //
+ nav.setState(new NavigationState(5));
+ service.saveNavigation(nav);
+ nav = service.loadNavigation(SiteKey.portal("save_navigation"));
+ assertNull(nav.state);
+ assertNotNull(nav.data.state);
+ assertEquals(5, nav.data.state.getPriority().intValue());
+
+ //
+ sync(true);
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("save_navigation"));
+ assertNotNull(nav);
+ assertEquals(SiteKey.portal("save_navigation"), nav.getKey());
+ NavigationState state = nav.data.state;
+ Integer p = state.getPriority();
+ assertEquals(5, (int) p);
+ assertNotNull(nav.data.rootId);
+ }
+
+ public void testDestroyNavigation() throws Exception
+ {
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
+ assertNull(nav);
+
+ //
+ mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "destroy_navigation").getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+ service.clearCache();
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
+ assertNotNull(nav);
+
+ //
+ Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+
+ //
+ assertTrue(service.destroyNavigation(nav));
+ assertNull(nav.state);
+ assertNull(nav.data);
+
+ //
+ try
+ {
+ service.destroyNavigation(nav);
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
+ assertNull(nav);
+
+ //
+ sync(true);
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("destroy_navigation"));
+ assertNull(nav);
+ }
+
+ public void testAddChild() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "add_child");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("add_child"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ assertEquals(0, root1.getNodeCount());
+
+ // Test what happens when null is added
+ try
+ {
+ root1.addChild((String) null);
+ fail();
+ }
+ catch (NullPointerException ignore)
+ {
+ }
+
+ // Test what happens when an illegal index is added
+ try
+ {
+ root1.addChild(-1, "foo");
+ fail();
+ }
+ catch (IndexOutOfBoundsException ignore)
+ {
+ }
+ try
+ {
+ root1.addChild(1, "foo");
+ fail();
+ }
+ catch (IndexOutOfBoundsException ignore)
+ {
+ }
+
+ //
+ Node foo = root1.addChild("foo");
+ assertNull(foo.getId());
+ assertEquals("foo", foo.getName());
+ assertSame(foo, root1.getChild("foo"));
+ assertEquals(1, root1.getNodeCount());
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node foo2 = root2.getChild("foo");
+ assertNotNull(foo2);
+ assertEquals(1, root2.getNodeCount());
+ assertEquals("foo", foo2.getName());
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testRemoveChild() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_child");
+ portal.getRootNavigation().addChild("default").addChild("foo");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("remove_child"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+
+ //
+ try
+ {
+ root1.removeChild(null);
+ fail();
+ }
+ catch (NullPointerException e)
+ {
+ }
+ try
+ {
+ root1.removeChild("bar");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ //
+ Node foo1 = root1.getChild("foo");
+ assertNotNull(foo1.getId());
+ assertEquals("foo", foo1.getName());
+ assertSame(foo1, root1.getChild("foo"));
+
+ //
+ assertTrue(root1.removeChild("foo"));
+ assertNull(root1.getChild("foo"));
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node foo2 = root2.getChild("foo");
+ assertNull(foo2);
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testRemoveTransientChild() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_transient_child");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("remove_transient_child"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node foo1 = root1.addChild("foo");
+ assertNull(foo1.getId());
+ assertEquals("foo", foo1.getName());
+ assertSame(foo1, root1.getChild("foo"));
+
+ //
+ assertTrue(root1.removeChild("foo"));
+ assertNull(root1.getChild("foo"));
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node foo2 = root2.getChild("foo");
+ assertNull(foo2);
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testRename() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rename");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+ def.addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("rename"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.GRANDCHILDREN, null).getNode();
+ try
+ {
+ root1.setName("something");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+
+ //
+ Node a1 = root1.getChild("a");
+ assertEquals(0, a1.context.getIndex());
+ try
+ {
+ a1.setName(null);
+ fail();
+ }
+ catch (NullPointerException e)
+ {
+ }
+ try
+ {
+ a1.setName("b");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ //
+ a1.setName("c");
+ assertEquals("c", a1.getName());
+ assertEquals(0, a1.context.getIndex());
+ service.saveNode(a1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("rename"));
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Node a2 = root2.getChild("c");
+ assertNotNull(a2);
+ // assertEquals(0, a2.context.getIndex());
+
+ // Does not pass randomly because of JCR bugs
+ // root1.assertEquals(root2);
+ }
+
+ public void testReorderChild() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("foo");
+ rootNavigation.addChild("bar");
+ rootNavigation.addChild("juu");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("reorder_child"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ Iterator<Node> i = root1.getChildren().iterator();
+ Node foo1 = i.next();
+ assertEquals("foo", foo1.getName());
+ Node bar1 = i.next();
+ assertEquals("bar", bar1.getName());
+ Node juu1 = i.next();
+ assertEquals("juu", juu1.getName());
+ assertFalse(i.hasNext());
+
+ // Test what happens when null is added
+ try
+ {
+ root1.addChild(1, (Node)null);
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+
+ // Test what happens when an illegal index is added
+ try
+ {
+ root1.addChild(-1, juu1);
+ fail();
+ }
+ catch (IndexOutOfBoundsException expected)
+ {
+ }
+ try
+ {
+ root1.addChild(4, juu1);
+ fail();
+ }
+ catch (IndexOutOfBoundsException expected)
+ {
+ }
+
+ //
+ root1.addChild(1, juu1);
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ i = root2.getChildren().iterator();
+ Node foo2 = i.next();
+ assertEquals("foo", foo2.getName());
+ Node juu2 = i.next();
+ assertEquals("juu", juu2.getName());
+ Node bar2 = i.next();
+ assertEquals("bar", bar2.getName());
+ assertFalse(i.hasNext());
+
+ //
+ root1.assertEquals(root2);
+
+ //
+ root2.addChild(0, bar2);
+
+ //
+ service.saveNode(root2.context, null);
+
+ //
+ root2.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root3 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ i = root3.getChildren().iterator();
+ Node bar3 = i.next();
+ assertEquals("bar", bar3.getName());
+ Node foo3 = i.next();
+ assertEquals("foo", foo3.getName());
+ Node juu3 = i.next();
+ assertEquals("juu", juu3.getName());
+ assertFalse(i.hasNext());
+
+ //
+ root2.assertEquals(root3);
+ }
+
+ public void _testReorderChild2() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("foo");
+ rootNavigation.addChild("bar");
+ rootNavigation.addChild("juu");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("reorder_child_2"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ assertEquals("bar", root.getChild(1).getName());
+ assertTrue(root.removeChild("bar"));
+ service.saveNode(root.context, null);
+
+ //
+ sync(true);
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ root.addChild("daa");
+ Node tab3 = root.getChild(2);
+ assertEquals("daa", tab3.getName());
+ service.saveNode(root.context, null);
+
+ //
+ sync(true);
+
+ //
+ root = new NavigationServiceImpl(mgr).loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ for (Node child : root.getChildren())
+ {
+ System.out.println("child : " + child.getId());
+ }
+ tab3 = root.getChild(2);
+ assertEquals("daa", tab3.getName());
+
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ for (Node child : root.getChildren())
+ {
+ System.out.println("child : " + child.getId());
+ }
+ tab3 = root.getChild(2);
+ assertEquals("daa", tab3.getName());
+ }
+
+ public void _testWeirdBug() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("foo");
+ rootNavigation.addChild("bar");
+ rootNavigation.addChild("juu");
+
+ //
+ sync(true);
+
+ //
+ portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ rootNavigation = portal.getRootNavigation().getChild("default");
+ rootNavigation.getChild("bar").destroy();
+
+ //
+ sync(true);
+
+ //
+ portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ rootNavigation = portal.getRootNavigation().getChild("default");
+ rootNavigation.addChild("daa");
+
+ //
+ sync(true);
+
+ //
+ portal = mop.getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "reorder_child_2");
+ rootNavigation = portal.getRootNavigation().getChild("default");
+ Navigation daa = rootNavigation.getChildren().get(2);
+ assertEquals("daa", daa.getName());
+ }
+
+ public void _testWeirdBug2() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Session session = mop.getModel().getSession().getJCRSession();
+ javax.jcr.Node container = session.getRootNode().
+ getNode("mop:workspace/mop:portalsites").
+ addNode("mop:reorder_child_2").
+ getNode("mop:rootnavigation/mop:children").
+ addNode("mop:default").
+ getNode("mop:children");
+ container.addNode("mop:foo");
+ container.addNode("mop:bar");
+ container.addNode("mop:juu");
+
+ //
+ sync(true);
+
+ //
+ session = mop.getModel().getSession().getJCRSession();
+ container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
+ container.getNode("mop:bar").remove();
+
+ //
+ sync(true);
+
+ //
+ session = mop.getModel().getSession().getJCRSession();
+ container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
+ container.addNode("mop:daa");
+ container.orderBefore("mop:daa", null);
+
+ //
+ sync(true);
+
+ //
+ container = session.getRootNode().getNode("mop:workspace/mop:portalsites/mop:reorder_child_2/mop:rootnavigation/mop:children/mop:default/mop:children");
+ NodeIterator it = container.getNodes();
+ assertEquals("mop:foo", it.nextNode().getName());
+ assertEquals("mop:juu", it.nextNode().getName());
+ assertEquals("mop:daa", it.nextNode().getName());
+ assertFalse(it.hasNext());
+ }
+
+ public void testMoveChild() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_child");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("foo").addChild("juu");
+ rootNavigation.addChild("bar");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("move_child"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node foo1 = root1.getChild("foo");
+ Node bar1 = root1.getChild("bar");
+ Node juu1 = foo1.getChild("juu");
+ bar1.addChild(juu1);
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node foo2 = root2.getChild("foo");
+ Node juu2 = foo2.getChild("juu");
+ assertNull(juu2);
+ Node bar2 = root2.getChild("bar");
+ juu2 = bar2.getChild("juu");
+ assertNotNull(juu2);
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testMoveAfter1() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_move_after_1");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("a");
+ rootNavigation.addChild("b");
+ rootNavigation.addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_move_after_1"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node a = root.getChild("a");
+ Node b = root.getChild("b");
+ Node c = root.getChild("c");
+ root.addChild(1, a);
+ assertSame(a, root.getChild(0));
+ assertSame(b, root.getChild(1));
+ assertSame(c, root.getChild(2));
+ service.saveNode(root.context, null);
+
+ //
+ root.assertConsistent();
+ assertSame(a, root.getChild(0));
+ assertSame(b, root.getChild(1));
+ assertSame(c, root.getChild(2));
+
+ //
+ sync(true);
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ assertSame(a, root.getChild(0));
+ assertSame(b, root.getChild(1));
+ assertSame(c, root.getChild(2));
+ }
+
+ public void testMoveAfter2() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_move_after_2");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("a");
+ rootNavigation.addChild("b");
+ rootNavigation.addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_move_after_2"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node a = root.getChild("a");
+ Node b = root.getChild("b");
+ Node c = root.getChild("c");
+ root.addChild(2, a);
+ assertSame(b, root.getChild(0));
+ assertSame(a, root.getChild(1));
+ assertSame(c, root.getChild(2));
+ service.saveNode(root.context, null);
+
+ //
+ root.assertConsistent();
+ assertSame(b, root.getChild(0));
+ assertSame(a, root.getChild(1));
+ assertSame(c, root.getChild(2));
+
+ //
+ sync(true);
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ a = root.getChild("a");
+ b = root.getChild("b");
+ c = root.getChild("c");
+ assertSame(b, root.getChild(0));
+ assertSame(a, root.getChild(1));
+ assertSame(c, root.getChild(2));
+ }
+
+ public void testRenameNode() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "rename_node");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("foo");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("rename_node"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node foo1 = root1.getChild("foo");
+ foo1.setName("foo");
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("rename_node"));
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+
+ //
+ root1.assertEquals(root2);
+
+ //
+ Node foo2 = root2.getChild("foo");
+ foo2.setName("bar");
+ assertEquals("bar", foo2.getName());
+ assertSame(foo2, root2.getChild("bar"));
+ service.saveNode(root2.context, null);
+ assertEquals("bar", foo2.getName());
+ assertSame(foo2, root2.getChild("bar"));
+
+ //
+ root2.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root3 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node bar3 = root3.getChild("bar");
+ assertNotNull(bar3);
+ assertSame(bar3, root3.getChild("bar"));
+
+ //
+ root2.assertEquals(root3);
+
+ //
+ root3.addChild("foo");
+ try
+ {
+ bar3.setName("foo");
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+ }
+
+ public void testSaveChildren() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_children");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("1");
+ rootNavigation.addChild("2");
+ rootNavigation.addChild("3");
+ rootNavigation.addChild("4");
+ rootNavigation.addChild("5");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_children"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ root1.removeChild("5");
+ root1.removeChild("2");
+ root1.addChild(0, root1.getChild("3"));
+ root1.addChild(1, root1.addChild("."));
+ service.saveNode(root1.context, null);
+ Iterator<Node> i = root1.getChildren().iterator();
+ assertEquals("3", i.next().getName());
+ assertEquals(".", i.next().getName());
+ assertEquals("1", i.next().getName());
+ assertEquals("4", i.next().getName());
+ assertFalse(i.hasNext());
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ i = root2.getChildren().iterator();
+ assertEquals("3", i.next().getName());
+ assertEquals(".", i.next().getName());
+ assertEquals("1", i.next().getName());
+ assertEquals("4", i.next().getName());
+ assertFalse(i.hasNext());
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testSaveRecursive() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_recursive");
+ Navigation rootNavigation = portal.getRootNavigation().addChild("default");
+ rootNavigation.addChild("foo");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_recursive"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node foo1 = root1.getChild("foo");
+ Node bar1 = foo1.addChild("bar");
+ bar1.addChild("juu");
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node foo2 = root2.getChild("foo");
+ Node bar2 = foo2.getChild("bar");
+ assertNotNull(bar2.getId());
+ Node juu2 = bar2.getChild("juu");
+ assertNotNull(juu2.getId());
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testSaveState() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_state");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_state"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.SINGLE, null).getNode();
+ NodeState state = root1.getState();
+ assertNull(state.getLabel());
+ assertEquals(-1, state.getStartPublicationTime());
+ assertEquals(-1, state.getEndPublicationTime());
+ long now = System.currentTimeMillis();
+ root1.setState(new NodeState.Builder().endPublicationTime(now).label("bar").build());
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ state = root2.getState();
+ assertEquals("bar", state.getLabel());
+ assertEquals(-1, state.getStartPublicationTime());
+ assertEquals(now, state.getEndPublicationTime());
+ assertEquals(Visibility.DISPLAYED, state.getVisibility());
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void _testSaveStateOverwrite() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_state_overwrite");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_state_overwrite"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ root.addChild("foo");
+ service.saveNode(root.context, null);
+
+ //
+ sync(true);
+
+ //
+ root.addChild("bar");
+ service.saveNode(root.context, null);
+
+ //
+ sync(true);
+
+ //
+ nav = service.loadNavigation(SiteKey.portal("save_state_overwrite"));
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ assertEquals(2, root.getChildren().size());
+ }
+
+ public void testRecreateNode() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "recreate_node");
+ portal.getRootNavigation().addChild("default").addChild("foo");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("recreate_node"));
+ Node root1 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ String fooId = root1.getChild("foo").getId();
+ assertTrue(root1.removeChild("foo"));
+ assertNull(root1.addChild("foo").getId());
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ assertNotNull(root2.getChild("foo").getId());
+ assertNotSame(fooId, root2.getChild("foo").getId());
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testMoveToAdded() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_to_added");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ nav.addChild("a").addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_to_added"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
+ Node a1 = root1.getChild("a");
+ Node b1 = a1.getChild("b");
+ Node c1 = root1.addChild("c");
+ c1.addChild(b1);
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ navigation = service.loadNavigation(SiteKey.portal("move_to_added"));
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
+ Node a2 = root2.getChild("a");
+ assertNotNull(a2);
+ Node c2 = root2.getChild("c");
+ assertNotNull(c2);
+ Node b2 = c2.getChild("b");
+ assertNotNull(b2);
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testMoveFromRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "moved_from_removed");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ nav.addChild("a").addChild("c");
+ nav.addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("moved_from_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
+ Node a1 = root1.getChild("a");
+ Node b1 = root1.getChild("b");
+ Node c1 = a1.getChild("c");
+ b1.addChild(c1);
+ root1.removeChild("a");
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ navigation = service.loadNavigation(SiteKey.portal("moved_from_removed"));
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
+ assertNull(root2.getChild("a"));
+ Node b2 = root2.getChild("b");
+ assertNotNull(b2);
+ Node c2 = b2.getChild("c");
+ assertNotNull(c2);
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testRemoveAdded() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_added");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("remove_added"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
+ root.addChild("foo");
+ root.removeChild("foo");
+ service.saveNode(root.context, null);
+
+ //
+ root.assertConsistent();
+
+ //
+ sync(true);
+
+ //
+ root = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
+ assertEquals(0, root.getChildren().size());
+ }
+
+ public void testRenameCreatedNode() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_rename_created");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("save_rename_created"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.ALL, null).getNode();
+ Node temp = root.addChild("temp");
+ temp.setName("bar");
+ Iterator<NodeChange<Node>> changes = root.save(service);
+ assertFalse(changes.hasNext());
+ }
+
+ public void testConcurrentAddToRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "add_to_removed");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("add_to_removed"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root.getChild("a").addChild("b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentMerge() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_merge");
+ Navigation nav = portal.getRootNavigation().addChild("default");
+ nav.addChild("a");
+ nav.addChild("b");
+ nav.addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_merge"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+
+ //
+ sync();
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ root2.addChild(1, root2.addChild("2"));
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ service.saveNode(root1.context, null);
+ root1.assertConsistent();
+
+ //
+ root1.addChild(1, root1.addChild("1"));
+ service.saveNode(root1.context, null);
+ root1.assertConsistent();
+ }
+
+ public void testConcurrentRemoveRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "remove_removed");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("remove_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.removeChild("a");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ service.saveNode(root1.context, null);
+
+ //
+ root1.assertEquals(root2);
+ }
+
+ public void testConcurrentMoveRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_removed");
+ portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.addChild(root1.getChild("a").getChild("b"));
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.getChild("a").removeChild("b");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_MOVED_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentMoveToRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_to_removed");
+ portal.getRootNavigation().addChild("default").addChild("a");
+ portal.getRootNavigation().getChild("default").addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_to_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("b").addChild(root1.getChild("a"));
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("b");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_DST_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentMoveMoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "move_moved");
+ portal.getRootNavigation().addChild("default").addChild("a");
+ portal.getRootNavigation().getChild("default").addChild("b");
+ portal.getRootNavigation().getChild("default").addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("move_moved"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("b").addChild(root1.getChild("a"));
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.getChild("c").addChild(root2.getChild("a"));
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.MOVE_CONCURRENTLY_CHANGED_SRC_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentAddDuplicate() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_add_duplicate");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_add_duplicate"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.addChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ root1.addChild("a");
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.ADD_CONCURRENTLY_ADDED_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentAddAfterRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_add_after_removed");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_add_after_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.addChild(1, "b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentMoveAfterRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_move_after_removed");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a").addChild("b");
+ def.addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_move_after_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.addChild(2, root1.getChild("a").getChild("b"));
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("c");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_PREVIOUS_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentMoveFromRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_move_from_removed");
+ portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
+ portal.getRootNavigation().getChild("default").addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_move_from_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("c").addChild(root1.getChild("a").getChild("b"));
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.MOVE_CONCURRENTLY_REMOVED_SRC_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentRenameRemoved() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_rename_removed");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_rename_removed"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("a").setName("b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.RENAME_CONCURRENTLY_REMOVED_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentDuplicateRename() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_duplicate_rename");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_duplicate_rename"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("a").setName("b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.addChild("b");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.RENAME_CONCURRENTLY_DUPLICATE_NAME, e.getError());
+ }
+ }
+
+ public void testSavePhantomNode() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "concurrent_save");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("concurrent_save"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.addChild("a");
+ service.saveNode(root1.context, null);
+
+ //
+ sync(true);
+
+ // Reload the root node and modify it
+ root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("a").setState(root1.getState().builder().label("foo").build());
+
+ //
+ sync(true);
+
+ // Edit navigation in another browser
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ // Now click Save button in the first browser
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
+ }
+ }
+
+ public void testConcurrentRemovalDoesNotPreventSave() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "removal_does_not_prevent_save");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("removal_does_not_prevent_save"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ service.saveNode(root1.context, null);
+ }
+
+ public void testConcurrentRename() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_concurrent_rename");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_concurrent_rename"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node a = root1.getChild("a");
+ a.setName("b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node a2 = root2.getChild("a");
+ a2.setName("c");
+ service.saveNode(root2.context, null);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.save(service);
+ assertFalse(changes.hasNext());
+ }
+
+ public void testRemovedNavigation() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_removed_navigation");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_removed_navigation"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ service.destroyNavigation(navigation);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.saveNode(root.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertSame(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
+ }
+ }
+
+ public void testPendingChangesBypassCache() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "pending_changes_bypass_cache");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext nav = service.loadNavigation(SiteKey.portal("pending_changes_bypass_cache"));
+ Node root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ root.addChild("foo");
+ service.saveNode(root.context, null);
+
+ //
+ root = service.loadNode(Node.MODEL, nav, Scope.CHILDREN, null).getNode();
+ assertNotNull(root.getChild("foo"));
+ }
+
+ public void testAtomic() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_atomic");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+ def.addChild("b");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_atomic"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("a").addChild("c");
+ root1.getChild("b").addChild("d");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("b");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ assertFalse(mgr.getSession().isModified());
+
+ //
+ try
+ {
+ service.saveNode(root1.context, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertSame(NavigationError.ADD_CONCURRENTLY_REMOVED_PARENT_NODE, e.getError());
+ }
+
+ //
+ assertFalse(mgr.getSession().isModified());
+ }
+
+ public void testRebase() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "save_rebase");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("save_rebase"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node a = root1.getChild("a");
+ Node b = root1.addChild("b");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.addChild("c");
+ service.saveNode(root2.context, null);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.save(service);
+ NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
+ Node c = added.getTarget();
+ assertEquals("c", c.getName());
+ assertFalse(changes.hasNext());
+ assertSame(a, root1.getChild(0));
+ assertSame(b, root1.getChild(1));
+ assertSame(c, root1.getChild(2));
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,699 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.core.api.MOPService;
-
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class TestNavigationServiceUpdate extends AbstractTestNavigationService
-{
-
- public void testNoop() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_no_op");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("a");
- def.addChild("b");
- def.addChild("c");
- def.addChild("d");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_no_op"));
- NodeContext<Node> root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
- Iterator<NodeChange<Node>> it = root.node.update(service, null);
- assertFalse(it.hasNext());
- }
-
- public void testHasChanges() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_cannot_save");
- Navigation def = portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_no_op"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
-
- //
- assertFalse(root.context.hasChanges());
- root.addChild("foo");
- assertTrue(root.context.hasChanges());
-
- //
- try
- {
- root.update(service, null);
- }
- catch (IllegalArgumentException expected)
- {
- }
-
- //
- assertTrue(root.context.hasChanges());
- service.saveNode(root.context, null);
- assertFalse(root.context.hasChanges());
-
- //
- Iterator<NodeChange<Node>> it = root.update(service, null);
- assertFalse(it.hasNext());
- }
-
- public void testAddFirst() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_add_first");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_add_first"));
- NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
- assertEquals(0, root1.getNodeSize());
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.addChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- root1.node.update(service, null);
- assertEquals(1, root1.getNodeSize());
- Node a = root1.getNode(0);
- assertEquals("a", a.getName());
-
- }
-
- public void testAddSecond() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_add_second");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_add_second"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node a = root1.getChild("a");
- assertEquals(1, root1.getSize());
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.addChild("b");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root1.update(service, null);
- NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
- assertSame(root1, added.getParent());
- assertSame(root1.getChild("b"), added.getTarget());
- assertSame(a, added.getPrevious());
- assertFalse(changes.hasNext());
- assertEquals(2, root1.getSize());
- assertEquals("a", root1.getChild(0).getName());
- assertEquals("b", root1.getChild(1).getName());
- }
-
- public void testRemove() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_remove");
- portal.getRootNavigation().addChild("default").addChild("a");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_remove"));
- NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
- assertEquals(1, root1.getNodeSize());
- Node a = root1.getNode("a");
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.removeChild("a");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root1.node.update(service, null);
- NodeChange.Removed<Node> removed = (NodeChange.Removed<Node>)changes.next();
- assertSame(root1.node, removed.getParent());
- assertSame(a, removed.getTarget());
- assertFalse(changes.hasNext());
- assertEquals(0, root1.getNodeSize());
- }
-
- public void testMove() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_move");
- portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
- portal.getRootNavigation().getChild("default").addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_move"));
- NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
- assertEquals(2, root1.getNodeSize());
- Node a = root1.getNode("a");
- Node b = a.getChild("b");
- Node c = root1.getNode("c");
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.getChild("c").addChild(root2.getChild("a").getChild("b"));
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root1.node.update(service, null);
- NodeChange.Moved<Node> moved = (NodeChange.Moved<Node>)changes.next();
- assertSame(a, moved.getFrom());
- assertSame(c, moved.getTo());
- assertSame(b, moved.getTarget());
- assertSame(null, moved.getPrevious());
- assertFalse(changes.hasNext());
- assertEquals(0, root1.getNode("a").getSize());
- assertEquals(1, root1.getNode("c").getSize());
- }
-
- public void testAddWithSameName() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_add_with_same_name");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_add_with_same_name"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.addChild("a").addChild("b");
- root1.addChild("c");
- service.saveNode(root1.context, null);
-
- //
- sync(true);
-
- //
- root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node a = root1.getChild("a");
- Node b = a.getChild("b");
- Node c = root1.getChild("c");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root2.getChild("c").addChild(root2.getChild("a").getChild("b"));
- Node b2 = root2.getChild("a").addChild("b");
- service.saveNode(root2.context, null);
-
- //
- Iterator<NodeChange<Node>> changes = root1.update(service, null);
- NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
- assertNull(added.getPrevious());
- assertSame(a, added.getParent());
- NodeChange.Moved<Node> moved = (NodeChange.Moved<Node>)changes.next();
- assertNull(moved.getPrevious());
- assertSame(a, moved.getFrom());
- assertSame(c, moved.getTo());
- assertSame(b, moved.getTarget());
- assertFalse(changes.hasNext());
-
- //
- assertSame(a, root1.getChild("a"));
- assertSame(c, root1.getChild("c"));
- assertSame(b, c.getChild("b"));
- assertEquals(b2.getId(), a.getChild("b").getId());
- assertSame(a.getChild("b"), added.getTarget());
- }
-
- public void testComplex() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_complex");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_complex"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node a1 = root1.addChild("a");
- a1.addChild("c");
- a1.addChild("d");
- a1.addChild("e");
- Node b1 = root1.addChild("b");
- b1.addChild("f");
- b1.addChild("g");
- b1.addChild("h");
- service.saveNode(root1.context, null);
-
- //
- sync(true);
-
- //
- root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- a1 = root1.getChild("a");
- Node c1 = a1.getChild("c");
- Node d1 = a1.getChild("d");
- Node e1 = a1.getChild("e");
- b1 = root1.getChild("b");
- Node f1 = b1.getChild("f");
- Node g1 = b1.getChild("g");
- Node h1 = b1.getChild("h");
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node a2 = root2.getChild("a");
- a2.removeChild("e");
- Node b2 = root2.getChild("b");
- b2.addChild(2, a2.getChild("d"));
- a2.addChild(1, "d");
- b2.removeChild("g");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root1.update(service, null);
- NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
- assertSame(a1, added.getParent());
- assertEquals("d", added.getTarget().getName());
- assertSame(c1, added.getPrevious());
- NodeChange.Removed<Node> removed1 = (NodeChange.Removed<Node>)changes.next();
- assertSame(a1 , removed1.getParent());
- assertSame(e1 , removed1.getTarget());
- NodeChange.Moved<Node> moved = (NodeChange.Moved<Node>)changes.next();
- assertSame(a1 , moved.getFrom());
- assertSame(b1 , moved.getTo());
- assertSame(d1 , moved.getTarget());
- assertSame(f1 , moved.getPrevious());
- NodeChange.Removed<Node> removed2 = (NodeChange.Removed<Node>)changes.next();
- assertSame(b1 , removed2.getParent());
- assertSame(g1 , removed2.getTarget());
- assertFalse(changes.hasNext());
-
- //
- assertSame(a1, root1.getChild("a"));
- assertSame(b1, root1.getChild("b"));
- assertEquals(2, a1.getSize());
- assertSame(c1, a1.getChild(0));
- assertNotNull(a1.getChild(1));
- assertEquals("d", a1.getChild(1).getName());
- assertFalse(d1.getId().equals(a1.getChild(1).getId()));
- assertEquals(3, b1.getSize());
- assertSame(f1, b1.getChild(0));
- assertSame(d1, b1.getChild(1));
- assertSame(h1, b1.getChild(2));
- }
-
- public void testReplaceChild() throws NullPointerException, NavigationServiceException
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_replace_child");
- portal.getRootNavigation().addChild("default").addChild("foo");
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_replace_child"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- String foo1Id = root1.getChild("foo").getId();
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- root2.removeChild("foo");
- Node foo = root2.addChild("foo");
- foo.setState(new NodeState.Builder().label("foo2").build());
- service.saveNode(root2.context, null);
- String foo2Id = foo.getId();
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root1.update(service, null);
- NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
- assertEquals(foo2Id, added.getTarget().getId());
- NodeChange.Removed<Node> removed = (NodeChange.Removed<Node>)changes.next();
- assertEquals(foo1Id, removed.getTarget().getId());
- assertFalse(changes.hasNext());
-
- //
- foo = root1.getChild("foo");
- assertEquals(foo2Id, foo.getId());
- assertEquals("foo2", root1.getChild("foo").getState().getLabel());
- }
-
- public void testRename() throws NullPointerException, NavigationServiceException
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_rename");
- portal.getRootNavigation().addChild("default").addChild("foo");
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_rename"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- root2.getChild("foo").setName("bar");
- service.saveNode(root2.context, null);
- sync(true);
-
- //
- Iterator<NodeChange<Node>> it = root1.update(service, null);
- Node bar = root1.getChild(0);
- assertEquals("bar", bar.getName());
- NodeChange.Renamed<Node> renamed = (NodeChange.Renamed<Node>)it.next();
- assertEquals("bar", renamed.getName());
- assertSame(bar, renamed.getTarget());
- }
-
- public void testState() throws NullPointerException, NavigationServiceException
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_state");
- portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_state"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- Node root3 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
-
- //
- Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- root.getChild("foo").setState(new NodeState.Builder().label("foo").build());
- service.saveNode(root.context, null);
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = root1.update(service, Scope.GRANDCHILDREN);
- Node foo = root1.getChild("foo");
- assertEquals("foo", foo.getState().getLabel());
- NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
- assertEquals("bar", added.getTarget().getName());
- assertEquals(null, added.previous);
- assertEquals("bar", added.target.getName());
- NodeChange.Updated<Node> updated = (NodeChange.Updated<Node>)changes.next();
- assertSame(foo, updated.getTarget());
- assertEquals(new NodeState.Builder().label("foo").build(), updated.getState());
- assertFalse(changes.hasNext());
-
- //
- changes = root2.update(service, null);
- foo = root2.getChild("foo");
- assertEquals("foo", foo.getState().getLabel());
- updated = (NodeChange.Updated<Node>)changes.next();
- assertSame(foo, updated.getTarget());
- assertEquals(new NodeState.Builder().label("foo").build(), updated.getState());
- assertFalse(changes.hasNext());
-
- //
- changes = root3.update(service, null);
- foo = root3.getChild("foo");
- assertEquals("foo", foo.getState().getLabel());
- updated = (NodeChange.Updated<Node>)changes.next();
- assertSame(foo, updated.getTarget());
- assertEquals(new NodeState.Builder().label("foo").build(), updated.getState());
- assertFalse(changes.hasNext());
- }
-
- public void testUseMostActualChildren() throws NullPointerException, NavigationServiceException
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_with_most_actual_children");
- portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_with_most_actual_children"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- Node foo = root.getChild("foo");
- sync(true);
-
- //
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("foo").removeChild("bar");
- service.saveNode(root1.context, null);
- sync(true);
-
- //
- foo.update(service, Scope.CHILDREN);
- assertNull(foo.getChild("bar"));
-
- // Update a second time (it actually test a previous bug)
- foo.update(service, Scope.CHILDREN);
- assertNull(foo.getChild("bar"));
- }
-
- public void testUpdateDeletedNode() throws NullPointerException, NavigationServiceException
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_deleted_node");
- portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_deleted_node"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- Node bar = root.getChild("foo").getChild("bar");
- sync(true);
-
- //
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("foo").removeChild("bar");
- service.saveNode(root1.context, null);
- sync(true);
-
- //
- Iterator<NodeChange<Node>> changes = bar.update(service, Scope.CHILDREN);
- NodeChange.Removed<Node> removed = (NodeChange.Removed<Node>)changes.next();
- assertSame(bar, removed.getTarget());
- assertFalse(changes.hasNext());
- }
-
- public void testLoadEvents() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_load_events");
- Navigation fooNav = portal.getRootNavigation().addChild("default").addChild("foo");
- fooNav.addChild("bar1");
- fooNav.addChild("bar2");
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_load_events"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.SINGLE, null).getNode();
-
- //
- Iterator<NodeChange<Node>> changes = root.update(service, Scope.ALL);
-
- //
- Node foo = root.getChild(0);
- assertEquals("foo", foo.getName());
- Node bar1 = foo.getChild(0);
- assertEquals("bar1", bar1.getName());
- Node bar2 = foo.getChild(1);
- assertEquals("bar2", bar2.getName());
-
- //
- NodeChange.Added<Node> added1 = (NodeChange.Added<Node>)changes.next();
- assertSame(foo, added1.getTarget());
- NodeChange.Added<Node> added2 = (NodeChange.Added<Node>)changes.next();
- assertSame(bar1, added2.getTarget());
- NodeChange.Added<Node> added3 = (NodeChange.Added<Node>)changes.next();
- assertSame(bar2, added3.getTarget());
- assertFalse(changes.hasNext());
- }
-
- public void testUpdateTwice2() throws NullPointerException, NavigationServiceException
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_twice2");
- portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
- sync(true);
-
- //Browser 1 : Expand the "foo" node
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_twice2"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- Node foo = root.getChild("foo");
- //If this line is commented, the test is passed
- service.updateNode(foo.context, Scope.CHILDREN, null);
- sync(true);
-
- //Browser 2: Change the "foo" node
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- root1.getChild("foo").removeChild("bar");
- service.saveNode(root1.context, null);
- sync(true);
-
- //Browser 1: Try to expand the "foo" node 2 times ---> NPE after the 2nd updateNode method
- service.updateNode(foo.context, Scope.CHILDREN, null);
- service.updateNode(foo.context, Scope.CHILDREN, null);
- }
-
- public void testMove2() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_move2");
- portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
- portal.getRootNavigation().getChild("default").addChild("c");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_move2"));
- NodeContext<Node> root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
- Node a = root.getNode("a");
- Node b = a.getChild("b");
- Node c = root.getNode("c");
-
- //Browser 2 : move the node "b" from "a" to "c"
- NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
- root1.getNode("c").addChild(root1.getNode("a").getChild("b"));
- service.saveNode(root1.getNode().context, null);
- //
- sync(true);
-
- //Browser 1: need NodeChange event to update UI
- NodeChangeQueue<NodeContext<Node>> queue = new NodeChangeQueue<NodeContext<Node>>();
- //If update "root1" --> NodeChange.Moved --> ok
- //If update "b" --> NodeChange.Add --> ok
- //update "a" --> no NodeChange, we need an event here (NodeChange.Remove) so UI can be updated
- service.updateNode(a.context, Scope.CHILDREN, queue);
- Iterator<NodeChange<NodeContext<Node>>> changes = queue.iterator();
- assertTrue(changes.hasNext());
- }
-
- public void testScope() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_scope");
- portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
- portal.getRootNavigation().getChild("default").addChild("c").addChild("d");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_scope"));
- Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).node;
- Node a = root1.getChild("a");
- Node c = root1.getChild("c");
- assertFalse(a.context.isExpanded());
- assertFalse(c.context.isExpanded());
-
- //
- Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
- root2.addChild("e");
- service.saveNode(root2.context, null);
-
- //
- sync(true);
-
- //
- service.updateNode(a.context, Scope.CHILDREN, null);
- assertSame(a, root1.getChild("a"));
- assertSame(c, root1.getChild("c"));
- assertNotNull(root1.getChild("e"));
- assertTrue(a.context.isExpanded());
- assertFalse(c.context.isExpanded());
- assertNotNull(a.getChild("b"));
- }
-
- public void _testPendingChange() throws NullPointerException, NavigationServiceException
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_pending_change");
- Navigation def = portal.getRootNavigation().addChild("default");
- def.addChild("foo");
- def.addChild("bar");
- sync(true);
-
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_pending_change"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- Node foo = root.getChild("foo");
- Node bar = root.getChild("bar");
-
- //Expand and change the "bar" node
- service.updateNode(bar.context, Scope.CHILDREN, null);
- bar.addChild("juu");
-
- //---> IllegalArgumentException
- //Can't expand the "foo" node, even it doesn't have any pending changes
- service.updateNode(foo.context, Scope.CHILDREN, null);
- }
-
- public void testRemovedNavigation() throws Exception
- {
- MOPService mop = mgr.getPOMService();
- Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_removed_navigation");
- portal.getRootNavigation().addChild("default");
-
- //
- sync(true);
-
- //
- NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_removed_navigation"));
- Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
- service.destroyNavigation(navigation);
-
- //
- sync(true);
-
- //
- try
- {
- service.updateNode(root.context, null, null);
- }
- catch (NavigationServiceException e)
- {
- assertSame(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceUpdate.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,699 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.core.api.MOPService;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestNavigationServiceUpdate extends AbstractTestNavigationService
+{
+
+ public void testNoop() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_no_op");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("a");
+ def.addChild("b");
+ def.addChild("c");
+ def.addChild("d");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_no_op"));
+ NodeContext<Node> root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
+ Iterator<NodeChange<Node>> it = root.node.update(service, null);
+ assertFalse(it.hasNext());
+ }
+
+ public void testHasChanges() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_cannot_save");
+ Navigation def = portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_no_op"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+
+ //
+ assertFalse(root.context.hasChanges());
+ root.addChild("foo");
+ assertTrue(root.context.hasChanges());
+
+ //
+ try
+ {
+ root.update(service, null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertTrue(root.context.hasChanges());
+ service.saveNode(root.context, null);
+ assertFalse(root.context.hasChanges());
+
+ //
+ Iterator<NodeChange<Node>> it = root.update(service, null);
+ assertFalse(it.hasNext());
+ }
+
+ public void testAddFirst() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_add_first");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_add_first"));
+ NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
+ assertEquals(0, root1.getNodeSize());
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.addChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ root1.node.update(service, null);
+ assertEquals(1, root1.getNodeSize());
+ Node a = root1.getNode(0);
+ assertEquals("a", a.getName());
+
+ }
+
+ public void testAddSecond() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_add_second");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_add_second"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node a = root1.getChild("a");
+ assertEquals(1, root1.getSize());
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.addChild("b");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.update(service, null);
+ NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
+ assertSame(root1, added.getParent());
+ assertSame(root1.getChild("b"), added.getTarget());
+ assertSame(a, added.getPrevious());
+ assertFalse(changes.hasNext());
+ assertEquals(2, root1.getSize());
+ assertEquals("a", root1.getChild(0).getName());
+ assertEquals("b", root1.getChild(1).getName());
+ }
+
+ public void testRemove() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_remove");
+ portal.getRootNavigation().addChild("default").addChild("a");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_remove"));
+ NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
+ assertEquals(1, root1.getNodeSize());
+ Node a = root1.getNode("a");
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.removeChild("a");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.node.update(service, null);
+ NodeChange.Removed<Node> removed = (NodeChange.Removed<Node>)changes.next();
+ assertSame(root1.node, removed.getParent());
+ assertSame(a, removed.getTarget());
+ assertFalse(changes.hasNext());
+ assertEquals(0, root1.getNodeSize());
+ }
+
+ public void testMove() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_move");
+ portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
+ portal.getRootNavigation().getChild("default").addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_move"));
+ NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
+ assertEquals(2, root1.getNodeSize());
+ Node a = root1.getNode("a");
+ Node b = a.getChild("b");
+ Node c = root1.getNode("c");
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.getChild("c").addChild(root2.getChild("a").getChild("b"));
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.node.update(service, null);
+ NodeChange.Moved<Node> moved = (NodeChange.Moved<Node>)changes.next();
+ assertSame(a, moved.getFrom());
+ assertSame(c, moved.getTo());
+ assertSame(b, moved.getTarget());
+ assertSame(null, moved.getPrevious());
+ assertFalse(changes.hasNext());
+ assertEquals(0, root1.getNode("a").getSize());
+ assertEquals(1, root1.getNode("c").getSize());
+ }
+
+ public void testAddWithSameName() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_add_with_same_name");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_add_with_same_name"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.addChild("a").addChild("b");
+ root1.addChild("c");
+ service.saveNode(root1.context, null);
+
+ //
+ sync(true);
+
+ //
+ root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node a = root1.getChild("a");
+ Node b = a.getChild("b");
+ Node c = root1.getChild("c");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root2.getChild("c").addChild(root2.getChild("a").getChild("b"));
+ Node b2 = root2.getChild("a").addChild("b");
+ service.saveNode(root2.context, null);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.update(service, null);
+ NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
+ assertNull(added.getPrevious());
+ assertSame(a, added.getParent());
+ NodeChange.Moved<Node> moved = (NodeChange.Moved<Node>)changes.next();
+ assertNull(moved.getPrevious());
+ assertSame(a, moved.getFrom());
+ assertSame(c, moved.getTo());
+ assertSame(b, moved.getTarget());
+ assertFalse(changes.hasNext());
+
+ //
+ assertSame(a, root1.getChild("a"));
+ assertSame(c, root1.getChild("c"));
+ assertSame(b, c.getChild("b"));
+ assertEquals(b2.getId(), a.getChild("b").getId());
+ assertSame(a.getChild("b"), added.getTarget());
+ }
+
+ public void testComplex() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_complex");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_complex"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node a1 = root1.addChild("a");
+ a1.addChild("c");
+ a1.addChild("d");
+ a1.addChild("e");
+ Node b1 = root1.addChild("b");
+ b1.addChild("f");
+ b1.addChild("g");
+ b1.addChild("h");
+ service.saveNode(root1.context, null);
+
+ //
+ sync(true);
+
+ //
+ root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ a1 = root1.getChild("a");
+ Node c1 = a1.getChild("c");
+ Node d1 = a1.getChild("d");
+ Node e1 = a1.getChild("e");
+ b1 = root1.getChild("b");
+ Node f1 = b1.getChild("f");
+ Node g1 = b1.getChild("g");
+ Node h1 = b1.getChild("h");
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node a2 = root2.getChild("a");
+ a2.removeChild("e");
+ Node b2 = root2.getChild("b");
+ b2.addChild(2, a2.getChild("d"));
+ a2.addChild(1, "d");
+ b2.removeChild("g");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.update(service, null);
+ NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
+ assertSame(a1, added.getParent());
+ assertEquals("d", added.getTarget().getName());
+ assertSame(c1, added.getPrevious());
+ NodeChange.Removed<Node> removed1 = (NodeChange.Removed<Node>)changes.next();
+ assertSame(a1 , removed1.getParent());
+ assertSame(e1 , removed1.getTarget());
+ NodeChange.Moved<Node> moved = (NodeChange.Moved<Node>)changes.next();
+ assertSame(a1 , moved.getFrom());
+ assertSame(b1 , moved.getTo());
+ assertSame(d1 , moved.getTarget());
+ assertSame(f1 , moved.getPrevious());
+ NodeChange.Removed<Node> removed2 = (NodeChange.Removed<Node>)changes.next();
+ assertSame(b1 , removed2.getParent());
+ assertSame(g1 , removed2.getTarget());
+ assertFalse(changes.hasNext());
+
+ //
+ assertSame(a1, root1.getChild("a"));
+ assertSame(b1, root1.getChild("b"));
+ assertEquals(2, a1.getSize());
+ assertSame(c1, a1.getChild(0));
+ assertNotNull(a1.getChild(1));
+ assertEquals("d", a1.getChild(1).getName());
+ assertFalse(d1.getId().equals(a1.getChild(1).getId()));
+ assertEquals(3, b1.getSize());
+ assertSame(f1, b1.getChild(0));
+ assertSame(d1, b1.getChild(1));
+ assertSame(h1, b1.getChild(2));
+ }
+
+ public void testReplaceChild() throws NullPointerException, NavigationServiceException
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_replace_child");
+ portal.getRootNavigation().addChild("default").addChild("foo");
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_replace_child"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ String foo1Id = root1.getChild("foo").getId();
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ root2.removeChild("foo");
+ Node foo = root2.addChild("foo");
+ foo.setState(new NodeState.Builder().label("foo2").build());
+ service.saveNode(root2.context, null);
+ String foo2Id = foo.getId();
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.update(service, null);
+ NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
+ assertEquals(foo2Id, added.getTarget().getId());
+ NodeChange.Removed<Node> removed = (NodeChange.Removed<Node>)changes.next();
+ assertEquals(foo1Id, removed.getTarget().getId());
+ assertFalse(changes.hasNext());
+
+ //
+ foo = root1.getChild("foo");
+ assertEquals(foo2Id, foo.getId());
+ assertEquals("foo2", root1.getChild("foo").getState().getLabel());
+ }
+
+ public void testRename() throws NullPointerException, NavigationServiceException
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_rename");
+ portal.getRootNavigation().addChild("default").addChild("foo");
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_rename"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ root2.getChild("foo").setName("bar");
+ service.saveNode(root2.context, null);
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> it = root1.update(service, null);
+ Node bar = root1.getChild(0);
+ assertEquals("bar", bar.getName());
+ NodeChange.Renamed<Node> renamed = (NodeChange.Renamed<Node>)it.next();
+ assertEquals("bar", renamed.getName());
+ assertSame(bar, renamed.getTarget());
+ }
+
+ public void testState() throws NullPointerException, NavigationServiceException
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_state");
+ portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_state"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ Node root3 = service.loadNode(Node.MODEL, navigation, Scope.GRANDCHILDREN, null).getNode();
+
+ //
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ root.getChild("foo").setState(new NodeState.Builder().label("foo").build());
+ service.saveNode(root.context, null);
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = root1.update(service, Scope.GRANDCHILDREN);
+ Node foo = root1.getChild("foo");
+ assertEquals("foo", foo.getState().getLabel());
+ NodeChange.Added<Node> added = (NodeChange.Added<Node>)changes.next();
+ assertEquals("bar", added.getTarget().getName());
+ assertEquals(null, added.previous);
+ assertEquals("bar", added.target.getName());
+ NodeChange.Updated<Node> updated = (NodeChange.Updated<Node>)changes.next();
+ assertSame(foo, updated.getTarget());
+ assertEquals(new NodeState.Builder().label("foo").build(), updated.getState());
+ assertFalse(changes.hasNext());
+
+ //
+ changes = root2.update(service, null);
+ foo = root2.getChild("foo");
+ assertEquals("foo", foo.getState().getLabel());
+ updated = (NodeChange.Updated<Node>)changes.next();
+ assertSame(foo, updated.getTarget());
+ assertEquals(new NodeState.Builder().label("foo").build(), updated.getState());
+ assertFalse(changes.hasNext());
+
+ //
+ changes = root3.update(service, null);
+ foo = root3.getChild("foo");
+ assertEquals("foo", foo.getState().getLabel());
+ updated = (NodeChange.Updated<Node>)changes.next();
+ assertSame(foo, updated.getTarget());
+ assertEquals(new NodeState.Builder().label("foo").build(), updated.getState());
+ assertFalse(changes.hasNext());
+ }
+
+ public void testUseMostActualChildren() throws NullPointerException, NavigationServiceException
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_with_most_actual_children");
+ portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_with_most_actual_children"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ Node foo = root.getChild("foo");
+ sync(true);
+
+ //
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("foo").removeChild("bar");
+ service.saveNode(root1.context, null);
+ sync(true);
+
+ //
+ foo.update(service, Scope.CHILDREN);
+ assertNull(foo.getChild("bar"));
+
+ // Update a second time (it actually test a previous bug)
+ foo.update(service, Scope.CHILDREN);
+ assertNull(foo.getChild("bar"));
+ }
+
+ public void testUpdateDeletedNode() throws NullPointerException, NavigationServiceException
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_deleted_node");
+ portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_deleted_node"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ Node bar = root.getChild("foo").getChild("bar");
+ sync(true);
+
+ //
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("foo").removeChild("bar");
+ service.saveNode(root1.context, null);
+ sync(true);
+
+ //
+ Iterator<NodeChange<Node>> changes = bar.update(service, Scope.CHILDREN);
+ NodeChange.Removed<Node> removed = (NodeChange.Removed<Node>)changes.next();
+ assertSame(bar, removed.getTarget());
+ assertFalse(changes.hasNext());
+ }
+
+ public void testLoadEvents() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_load_events");
+ Navigation fooNav = portal.getRootNavigation().addChild("default").addChild("foo");
+ fooNav.addChild("bar1");
+ fooNav.addChild("bar2");
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_load_events"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.SINGLE, null).getNode();
+
+ //
+ Iterator<NodeChange<Node>> changes = root.update(service, Scope.ALL);
+
+ //
+ Node foo = root.getChild(0);
+ assertEquals("foo", foo.getName());
+ Node bar1 = foo.getChild(0);
+ assertEquals("bar1", bar1.getName());
+ Node bar2 = foo.getChild(1);
+ assertEquals("bar2", bar2.getName());
+
+ //
+ NodeChange.Added<Node> added1 = (NodeChange.Added<Node>)changes.next();
+ assertSame(foo, added1.getTarget());
+ NodeChange.Added<Node> added2 = (NodeChange.Added<Node>)changes.next();
+ assertSame(bar1, added2.getTarget());
+ NodeChange.Added<Node> added3 = (NodeChange.Added<Node>)changes.next();
+ assertSame(bar2, added3.getTarget());
+ assertFalse(changes.hasNext());
+ }
+
+ public void testUpdateTwice2() throws NullPointerException, NavigationServiceException
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_twice2");
+ portal.getRootNavigation().addChild("default").addChild("foo").addChild("bar");
+ sync(true);
+
+ //Browser 1 : Expand the "foo" node
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_twice2"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ Node foo = root.getChild("foo");
+ //If this line is commented, the test is passed
+ service.updateNode(foo.context, Scope.CHILDREN, null);
+ sync(true);
+
+ //Browser 2: Change the "foo" node
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ root1.getChild("foo").removeChild("bar");
+ service.saveNode(root1.context, null);
+ sync(true);
+
+ //Browser 1: Try to expand the "foo" node 2 times ---> NPE after the 2nd updateNode method
+ service.updateNode(foo.context, Scope.CHILDREN, null);
+ service.updateNode(foo.context, Scope.CHILDREN, null);
+ }
+
+ public void testMove2() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_move2");
+ portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
+ portal.getRootNavigation().getChild("default").addChild("c");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_move2"));
+ NodeContext<Node> root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
+ Node a = root.getNode("a");
+ Node b = a.getChild("b");
+ Node c = root.getNode("c");
+
+ //Browser 2 : move the node "b" from "a" to "c"
+ NodeContext<Node> root1 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null);
+ root1.getNode("c").addChild(root1.getNode("a").getChild("b"));
+ service.saveNode(root1.getNode().context, null);
+ //
+ sync(true);
+
+ //Browser 1: need NodeChange event to update UI
+ NodeChangeQueue<NodeContext<Node>> queue = new NodeChangeQueue<NodeContext<Node>>();
+ //If update "root1" --> NodeChange.Moved --> ok
+ //If update "b" --> NodeChange.Add --> ok
+ //update "a" --> no NodeChange, we need an event here (NodeChange.Remove) so UI can be updated
+ service.updateNode(a.context, Scope.CHILDREN, queue);
+ Iterator<NodeChange<NodeContext<Node>>> changes = queue.iterator();
+ assertTrue(changes.hasNext());
+ }
+
+ public void testScope() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_scope");
+ portal.getRootNavigation().addChild("default").addChild("a").addChild("b");
+ portal.getRootNavigation().getChild("default").addChild("c").addChild("d");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_scope"));
+ Node root1 = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).node;
+ Node a = root1.getChild("a");
+ Node c = root1.getChild("c");
+ assertFalse(a.context.isExpanded());
+ assertFalse(c.context.isExpanded());
+
+ //
+ Node root2 = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).node;
+ root2.addChild("e");
+ service.saveNode(root2.context, null);
+
+ //
+ sync(true);
+
+ //
+ service.updateNode(a.context, Scope.CHILDREN, null);
+ assertSame(a, root1.getChild("a"));
+ assertSame(c, root1.getChild("c"));
+ assertNotNull(root1.getChild("e"));
+ assertTrue(a.context.isExpanded());
+ assertFalse(c.context.isExpanded());
+ assertNotNull(a.getChild("b"));
+ }
+
+ public void _testPendingChange() throws NullPointerException, NavigationServiceException
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_pending_change");
+ Navigation def = portal.getRootNavigation().addChild("default");
+ def.addChild("foo");
+ def.addChild("bar");
+ sync(true);
+
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_pending_change"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ Node foo = root.getChild("foo");
+ Node bar = root.getChild("bar");
+
+ //Expand and change the "bar" node
+ service.updateNode(bar.context, Scope.CHILDREN, null);
+ bar.addChild("juu");
+
+ //---> IllegalArgumentException
+ //Can't expand the "foo" node, even it doesn't have any pending changes
+ service.updateNode(foo.context, Scope.CHILDREN, null);
+ }
+
+ public void testRemovedNavigation() throws Exception
+ {
+ MOPService mop = mgr.getPOMService();
+ Site portal = mop.getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "update_removed_navigation");
+ portal.getRootNavigation().addChild("default");
+
+ //
+ sync(true);
+
+ //
+ NavigationContext navigation = service.loadNavigation(SiteKey.portal("update_removed_navigation"));
+ Node root = service.loadNode(Node.MODEL, navigation, Scope.ALL, null).getNode();
+ service.destroyNavigation(navigation);
+
+ //
+ sync(true);
+
+ //
+ try
+ {
+ service.updateNode(root.context, null, null);
+ }
+ catch (NavigationServiceException e)
+ {
+ assertSame(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
+ }
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.config.AbstractPortalTest;
-import org.exoplatform.portal.mop.EventType;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.services.listener.Event;
-import org.exoplatform.services.listener.Listener;
-import org.exoplatform.services.listener.ListenerService;
-import org.gatein.mop.api.workspace.ObjectType;
-
-import java.util.LinkedList;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestNavigationServiceWrapper extends AbstractPortalTest
-{
-
- /** . */
- private NavigationService navigationService;
-
- /** . */
- private ListenerService listenerService;
-
- /** . */
- private POMSessionManager mgr;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- //
- PortalContainer container = getContainer();
-
- //
- listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
- navigationService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
- mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- }
-
- public void testNotification() throws NavigationServiceException
- {
- class ListenerImpl extends Listener<NavigationService, SiteKey>
- {
-
- /** . */
- private final LinkedList<Event> events = new LinkedList<Event>();
-
- @Override
- public void onEvent(Event event) throws Exception
- {
- events.addLast(event);
- }
- }
-
- //
- ListenerImpl createListener = new ListenerImpl();
- ListenerImpl updateListener = new ListenerImpl();
- ListenerImpl destroyListener = new ListenerImpl();
-
- //
- listenerService.addListener(EventType.NAVIGATION_CREATED, createListener);
- listenerService.addListener(EventType.NAVIGATION_UPDATED, updateListener);
- listenerService.addListener(EventType.NAVIGATION_DESTROYED, destroyListener);
-
- //
- begin();
- mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "notification");
-
- // Create
- NavigationContext navigation = new NavigationContext(SiteKey.portal("notification"), new NavigationState(3));
- navigationService.saveNavigation(navigation);
- assertEquals(1, createListener.events.size());
- Event event = createListener.events.removeFirst();
- assertEquals(SiteKey.portal("notification"), event.getData());
- assertEquals(EventType.NAVIGATION_CREATED, event.getEventName());
- assertSame(navigationService, event.getSource());
- assertEquals(0, updateListener.events.size());
- assertEquals(0, destroyListener.events.size());
-
- //
-
- // Update
- navigation.setState(new NavigationState(1));
- navigationService.saveNavigation(navigation);
- assertEquals(0, createListener.events.size());
- assertEquals(1, updateListener.events.size());
- event = updateListener.events.removeFirst();
- assertEquals(SiteKey.portal("notification"), event.getData());
- assertEquals(EventType.NAVIGATION_UPDATED, event.getEventName());
- assertSame(navigationService, event.getSource());
- assertEquals(0, destroyListener.events.size());
-
- // Update
- navigation = navigationService.loadNavigation(SiteKey.portal("notification"));
- Node root = navigationService.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
- root.setState(new NodeState.Builder(root.getState()).label("foo").build());
- navigationService.saveNode(root.context, null);
- assertEquals(0, createListener.events.size());
- assertEquals(1, updateListener.events.size());
- event = updateListener.events.removeFirst();
- assertEquals(SiteKey.portal("notification"), event.getData());
- assertEquals(EventType.NAVIGATION_UPDATED, event.getEventName());
- assertSame(navigationService, event.getSource());
- assertEquals(0, destroyListener.events.size());
-
- // Destroy
- navigationService.destroyNavigation(navigation);
- assertEquals(0, createListener.events.size());
- assertEquals(0, updateListener.events.size());
- assertEquals(1, destroyListener.events.size());
- event = destroyListener.events.removeFirst();
- assertEquals(SiteKey.portal("notification"), event.getData());
- assertEquals(EventType.NAVIGATION_DESTROYED, event.getEventName());
- assertSame(navigationService, event.getSource());
-
- //
- end();
- }
-
- public void testCacheInvalidation() throws Exception
- {
- SiteKey key = SiteKey.portal("wrapper_cache_invalidation");
-
- //
- begin();
- mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "wrapper_cache_invalidation").getRootNavigation().addChild("default");
- end(true);
-
- //
- begin();
- navigationService.saveNavigation(new NavigationContext(key, new NavigationState(0)));
- end(true);
-
- //
- begin();
- NavigationContext nav = navigationService.loadNavigation(key);
- assertNotNull(nav);
- NodeContext<Node> root = navigationService.loadNode(Node.MODEL, nav, Scope.ALL, null);
- assertNotNull(root);
- end(true);
-
- //
- begin();
- mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "wrapper_cache_invalidation").destroy();
- end(true);
-
- //
- begin();
- assertNull(navigationService.loadNavigation(key));
- try
- {
- navigationService.rebaseNode(root, null, null);
- fail();
- }
- catch (NavigationServiceException e)
- {
- assertEquals(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
- }
- end();
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.AbstractPortalTest;
+import org.exoplatform.portal.mop.EventType;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.services.listener.Event;
+import org.exoplatform.services.listener.Listener;
+import org.exoplatform.services.listener.ListenerService;
+import org.gatein.mop.api.workspace.ObjectType;
+
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestNavigationServiceWrapper extends AbstractPortalTest
+{
+
+ /** . */
+ private NavigationService navigationService;
+
+ /** . */
+ private ListenerService listenerService;
+
+ /** . */
+ private POMSessionManager mgr;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ //
+ PortalContainer container = getContainer();
+
+ //
+ listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
+ navigationService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
+ mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ }
+
+ public void testNotification() throws NavigationServiceException
+ {
+ class ListenerImpl extends Listener<NavigationService, SiteKey>
+ {
+
+ /** . */
+ private final LinkedList<Event> events = new LinkedList<Event>();
+
+ @Override
+ public void onEvent(Event event) throws Exception
+ {
+ events.addLast(event);
+ }
+ }
+
+ //
+ ListenerImpl createListener = new ListenerImpl();
+ ListenerImpl updateListener = new ListenerImpl();
+ ListenerImpl destroyListener = new ListenerImpl();
+
+ //
+ listenerService.addListener(EventType.NAVIGATION_CREATED, createListener);
+ listenerService.addListener(EventType.NAVIGATION_UPDATED, updateListener);
+ listenerService.addListener(EventType.NAVIGATION_DESTROYED, destroyListener);
+
+ //
+ begin();
+ mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "notification");
+
+ // Create
+ NavigationContext navigation = new NavigationContext(SiteKey.portal("notification"), new NavigationState(3));
+ navigationService.saveNavigation(navigation);
+ assertEquals(1, createListener.events.size());
+ Event event = createListener.events.removeFirst();
+ assertEquals(SiteKey.portal("notification"), event.getData());
+ assertEquals(EventType.NAVIGATION_CREATED, event.getEventName());
+ assertSame(navigationService, event.getSource());
+ assertEquals(0, updateListener.events.size());
+ assertEquals(0, destroyListener.events.size());
+
+ //
+
+ // Update
+ navigation.setState(new NavigationState(1));
+ navigationService.saveNavigation(navigation);
+ assertEquals(0, createListener.events.size());
+ assertEquals(1, updateListener.events.size());
+ event = updateListener.events.removeFirst();
+ assertEquals(SiteKey.portal("notification"), event.getData());
+ assertEquals(EventType.NAVIGATION_UPDATED, event.getEventName());
+ assertSame(navigationService, event.getSource());
+ assertEquals(0, destroyListener.events.size());
+
+ // Update
+ navigation = navigationService.loadNavigation(SiteKey.portal("notification"));
+ Node root = navigationService.loadNode(Node.MODEL, navigation, Scope.CHILDREN, null).getNode();
+ root.setState(new NodeState.Builder(root.getState()).label("foo").build());
+ navigationService.saveNode(root.context, null);
+ assertEquals(0, createListener.events.size());
+ assertEquals(1, updateListener.events.size());
+ event = updateListener.events.removeFirst();
+ assertEquals(SiteKey.portal("notification"), event.getData());
+ assertEquals(EventType.NAVIGATION_UPDATED, event.getEventName());
+ assertSame(navigationService, event.getSource());
+ assertEquals(0, destroyListener.events.size());
+
+ // Destroy
+ navigationService.destroyNavigation(navigation);
+ assertEquals(0, createListener.events.size());
+ assertEquals(0, updateListener.events.size());
+ assertEquals(1, destroyListener.events.size());
+ event = destroyListener.events.removeFirst();
+ assertEquals(SiteKey.portal("notification"), event.getData());
+ assertEquals(EventType.NAVIGATION_DESTROYED, event.getEventName());
+ assertSame(navigationService, event.getSource());
+
+ //
+ end();
+ }
+
+ public void testCacheInvalidation() throws Exception
+ {
+ SiteKey key = SiteKey.portal("wrapper_cache_invalidation");
+
+ //
+ begin();
+ mgr.getPOMService().getModel().getWorkspace().addSite(ObjectType.PORTAL_SITE, "wrapper_cache_invalidation").getRootNavigation().addChild("default");
+ end(true);
+
+ //
+ begin();
+ navigationService.saveNavigation(new NavigationContext(key, new NavigationState(0)));
+ end(true);
+
+ //
+ begin();
+ NavigationContext nav = navigationService.loadNavigation(key);
+ assertNotNull(nav);
+ NodeContext<Node> root = navigationService.loadNode(Node.MODEL, nav, Scope.ALL, null);
+ assertNotNull(root);
+ end(true);
+
+ //
+ begin();
+ mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "wrapper_cache_invalidation").destroy();
+ end(true);
+
+ //
+ begin();
+ assertNull(navigationService.loadNavigation(key));
+ try
+ {
+ navigationService.rebaseNode(root, null, null);
+ fail();
+ }
+ catch (NavigationServiceException e)
+ {
+ assertEquals(NavigationError.UPDATE_CONCURRENTLY_REMOVED_NODE, e.getError());
+ }
+ end();
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.component.test.AbstractKernelTest;
-import org.exoplatform.portal.mop.Visibility;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestScope extends AbstractKernelTest
-{
-
- public void testBranchShape()
- {
- NodeState nodeState = new NodeState("", null, -1, -1, Visibility.DISPLAYED, "portal::classic::home");
-
- //
- Scope scope1 = GenericScope.branchShape(new String[]{"a"}, Scope.CHILDREN);
- Scope.Visitor visitor1 = scope1.get();
- assertEquals(VisitMode.ALL_CHILDREN, visitor1.enter(0, "0", "", nodeState));
- assertEquals(VisitMode.ALL_CHILDREN, visitor1.enter(1, "1", "a", nodeState));
- assertEquals(VisitMode.NO_CHILDREN, visitor1.enter(1, "2", "b", nodeState));
-
- //
- Scope scope2 = GenericScope.branchShape(new String[]{"a"}, Scope.SINGLE);
- Scope.Visitor visitor2 = scope2.get();
- assertEquals(VisitMode.ALL_CHILDREN, visitor2.enter(0, "0", "", nodeState));
- assertEquals(VisitMode.NO_CHILDREN, visitor2.enter(1, "1", "a", nodeState));
- assertEquals(VisitMode.NO_CHILDREN, visitor2.enter(1, "2", "b", nodeState));
-
- //
- Scope scope3 = GenericScope.branchShape(new String[]{"a","c"}, Scope.SINGLE);
- Scope.Visitor visitor3 = scope3.get();
- assertEquals(VisitMode.ALL_CHILDREN, visitor3.enter(0, "0", "", nodeState));
- assertEquals(VisitMode.ALL_CHILDREN, visitor3.enter(1, "1", "a", nodeState));
- assertEquals(VisitMode.NO_CHILDREN, visitor3.enter(1, "2", "b", nodeState));
- assertEquals(VisitMode.NO_CHILDREN, visitor3.enter(2, "3", "c", nodeState));
- assertEquals(VisitMode.NO_CHILDREN, visitor3.enter(2, "4", "d", nodeState));
-
- //
- Scope scope4 = GenericScope.branchShape(new String[]{"a"}, GenericScope.branchShape(new String[]{"b"}, Scope.CHILDREN));
- Scope.Visitor visitor4 = scope4.get();
- assertEquals(VisitMode.ALL_CHILDREN, visitor4.enter(0, "0", "", nodeState));
- assertEquals(VisitMode.ALL_CHILDREN, visitor4.enter(1, "1", "a", nodeState));
- assertEquals(VisitMode.ALL_CHILDREN, visitor4.enter(2, "2", "b", nodeState));
- assertEquals(VisitMode.NO_CHILDREN, visitor4.enter(2, "3", "c", nodeState));
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestScope.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.component.test.AbstractKernelTest;
+import org.exoplatform.portal.mop.Visibility;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestScope extends AbstractKernelTest
+{
+
+ public void testBranchShape()
+ {
+ NodeState nodeState = new NodeState("", null, -1, -1, Visibility.DISPLAYED, "portal::classic::home");
+
+ //
+ Scope scope1 = GenericScope.branchShape(new String[]{"a"}, Scope.CHILDREN);
+ Scope.Visitor visitor1 = scope1.get();
+ assertEquals(VisitMode.ALL_CHILDREN, visitor1.enter(0, "0", "", nodeState));
+ assertEquals(VisitMode.ALL_CHILDREN, visitor1.enter(1, "1", "a", nodeState));
+ assertEquals(VisitMode.NO_CHILDREN, visitor1.enter(1, "2", "b", nodeState));
+
+ //
+ Scope scope2 = GenericScope.branchShape(new String[]{"a"}, Scope.SINGLE);
+ Scope.Visitor visitor2 = scope2.get();
+ assertEquals(VisitMode.ALL_CHILDREN, visitor2.enter(0, "0", "", nodeState));
+ assertEquals(VisitMode.NO_CHILDREN, visitor2.enter(1, "1", "a", nodeState));
+ assertEquals(VisitMode.NO_CHILDREN, visitor2.enter(1, "2", "b", nodeState));
+
+ //
+ Scope scope3 = GenericScope.branchShape(new String[]{"a","c"}, Scope.SINGLE);
+ Scope.Visitor visitor3 = scope3.get();
+ assertEquals(VisitMode.ALL_CHILDREN, visitor3.enter(0, "0", "", nodeState));
+ assertEquals(VisitMode.ALL_CHILDREN, visitor3.enter(1, "1", "a", nodeState));
+ assertEquals(VisitMode.NO_CHILDREN, visitor3.enter(1, "2", "b", nodeState));
+ assertEquals(VisitMode.NO_CHILDREN, visitor3.enter(2, "3", "c", nodeState));
+ assertEquals(VisitMode.NO_CHILDREN, visitor3.enter(2, "4", "d", nodeState));
+
+ //
+ Scope scope4 = GenericScope.branchShape(new String[]{"a"}, GenericScope.branchShape(new String[]{"b"}, Scope.CHILDREN));
+ Scope.Visitor visitor4 = scope4.get();
+ assertEquals(VisitMode.ALL_CHILDREN, visitor4.enter(0, "0", "", nodeState));
+ assertEquals(VisitMode.ALL_CHILDREN, visitor4.enter(1, "1", "a", nodeState));
+ assertEquals(VisitMode.ALL_CHILDREN, visitor4.enter(2, "2", "b", nodeState));
+ assertEquals(VisitMode.NO_CHILDREN, visitor4.enter(2, "3", "c", nodeState));
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.navigation;
-
-import org.exoplatform.component.test.AbstractGateInTest;
-import org.exoplatform.portal.mop.SiteKey;
-import org.gatein.common.io.IOTools;
-
-import java.util.Arrays;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class TestSerialization extends AbstractGateInTest
-{
-
- public void testNodeStateSerialization() throws Exception
- {
- NodeState state = new NodeState.Builder().pageRef("foo").icon("bar").build();
- NodeState copy = IOTools.clone(state);
- assertEquals(state, copy);
- }
-
- public void testNodeDataSerialization() throws Exception
- {
- NodeData data = new NodeData("parent", "this", "foo", new NodeState.Builder().pageRef("bar").icon("bar").build(), new String[]{"child"});
- NodeData copy = IOTools.clone(data);
- assertEquals(copy.parentId, data.parentId);
- assertEquals(copy.id, data.id);
- assertEquals(copy.name, data.name);
- assertEquals(Arrays.asList(copy.children), Arrays.asList(data.children));
- assertEquals(copy.state, data.state);
- }
-
- public void testNavigationStateSerialization() throws Exception
- {
- NavigationState state = new NavigationState(5);
- NavigationState copy = IOTools.clone(state);
- assertEquals(state.getPriority(), copy.getPriority());
- }
-
- public void testNavigationDataSerialization() throws Exception
- {
- NavigationData data = new NavigationData(SiteKey.portal("classic"), new NavigationState(3), "root");
- NavigationData copy = IOTools.clone(data);
- assertEquals(data.rootId, copy.rootId);
- assertEquals(data.state.getPriority(), copy.state.getPriority());
- assertEquals(data.key, copy.key);
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestSerialization.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.navigation;
+
+import org.exoplatform.component.test.AbstractGateInTest;
+import org.exoplatform.portal.mop.SiteKey;
+import org.gatein.common.io.IOTools;
+
+import java.util.Arrays;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestSerialization extends AbstractGateInTest
+{
+
+ public void testNodeStateSerialization() throws Exception
+ {
+ NodeState state = new NodeState.Builder().pageRef("foo").icon("bar").build();
+ NodeState copy = IOTools.clone(state);
+ assertEquals(state, copy);
+ }
+
+ public void testNodeDataSerialization() throws Exception
+ {
+ NodeData data = new NodeData("parent", "this", "foo", new NodeState.Builder().pageRef("bar").icon("bar").build(), new String[]{"child"});
+ NodeData copy = IOTools.clone(data);
+ assertEquals(copy.parentId, data.parentId);
+ assertEquals(copy.id, data.id);
+ assertEquals(copy.name, data.name);
+ assertEquals(Arrays.asList(copy.children), Arrays.asList(data.children));
+ assertEquals(copy.state, data.state);
+ }
+
+ public void testNavigationStateSerialization() throws Exception
+ {
+ NavigationState state = new NavigationState(5);
+ NavigationState copy = IOTools.clone(state);
+ assertEquals(state.getPriority(), copy.getPriority());
+ }
+
+ public void testNavigationDataSerialization() throws Exception
+ {
+ NavigationData data = new NavigationData(SiteKey.portal("classic"), new NavigationState(3), "root");
+ NavigationData copy = IOTools.clone(data);
+ assertEquals(data.rootId, copy.rootId);
+ assertEquals(data.state.getPriority(), copy.state.getPriority());
+ assertEquals(data.key, copy.key);
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import junit.framework.TestCase;
-
-import java.util.Arrays;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- */
-public class TestParsePath extends TestCase
-{
-
- public void testFoo()
- {
- assertPath("a", "a");
- assertPath("a/", "a");
- assertPath("a//", "a");
- assertPath("a/b", "a", "b");
- assertPath("a/b/", "a", "b");
- assertPath("a/b//", "a", "b");
- assertPath("a//b", "a", "", "b");
- assertPath("a//b/", "a", "", "b");
- assertPath("a//b//", "a", "", "b");
- assertPath("/", (String[])null);
- assertPath("//");
- assertPath("///");
- assertPath("/a", "a");
- assertPath("//a", "", "a");
- assertPath("/a/", "a");
- assertPath("/a//", "a");
- assertPath("/a////", "a");
- }
-
- private void assertPath(String path, String... expected)
- {
- // Previous behavior
- assertEquals(expected, legacy(path));
- assertEquals(expected, Utils.parsePath(path));
- }
-
- private void assertEquals(String[] expected, String[] actual)
- {
- if (actual == null)
- {
- assertNull(expected);
- }
- else
- {
- assertNotNull(expected);
- assertEquals(Arrays.asList(expected), Arrays.asList(actual));
- }
- }
-
- private String[] legacy(String path)
- {
- // Remove any leading /
- if (path.length() > 0 && path.charAt(0) == '/')
- {
- path = path.substring(1);
- }
-
- // Find the first navigation available or return null
- if (path.length() == 0)
- {
- return null;
- }
-
- // Split into segments
- return path.split("/");
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestParsePath.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ */
+public class TestParsePath extends TestCase
+{
+
+ public void testFoo()
+ {
+ assertPath("a", "a");
+ assertPath("a/", "a");
+ assertPath("a//", "a");
+ assertPath("a/b", "a", "b");
+ assertPath("a/b/", "a", "b");
+ assertPath("a/b//", "a", "b");
+ assertPath("a//b", "a", "", "b");
+ assertPath("a//b/", "a", "", "b");
+ assertPath("a//b//", "a", "", "b");
+ assertPath("/", (String[])null);
+ assertPath("//");
+ assertPath("///");
+ assertPath("/a", "a");
+ assertPath("//a", "", "a");
+ assertPath("/a/", "a");
+ assertPath("/a//", "a");
+ assertPath("/a////", "a");
+ }
+
+ private void assertPath(String path, String... expected)
+ {
+ // Previous behavior
+ assertEquals(expected, legacy(path));
+ assertEquals(expected, Utils.parsePath(path));
+ }
+
+ private void assertEquals(String[] expected, String[] actual)
+ {
+ if (actual == null)
+ {
+ assertNull(expected);
+ }
+ else
+ {
+ assertNotNull(expected);
+ assertEquals(Arrays.asList(expected), Arrays.asList(actual));
+ }
+ }
+
+ private String[] legacy(String path)
+ {
+ // Remove any leading /
+ if (path.length() > 0 && path.charAt(0) == '/')
+ {
+ path = path.substring(1);
+ }
+
+ // Find the first navigation available or return null
+ if (path.length() == 0)
+ {
+ return null;
+ }
+
+ // Split into segments
+ return path.split("/");
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,1471 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.mop.user;
-
-import junit.framework.AssertionFailedError;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.config.AbstractPortalTest;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.pom.config.POMDataStorage;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.services.listener.Event;
-import org.exoplatform.services.listener.Listener;
-import org.exoplatform.services.listener.ListenerService;
-import org.exoplatform.services.organization.OrganizationService;
-import org.exoplatform.services.security.Authenticator;
-import org.exoplatform.services.security.ConversationState;
-import org.gatein.common.i18n.MapResourceBundle;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-
-import java.util.Collection;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.TimeZone;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestUserPortal extends AbstractPortalTest
-{
-
- /** . */
- private UserPortalConfigService userPortalConfigSer_;
-
- /** . */
- private OrganizationService orgService_;
-
- /** . */
- private DataStorage storage_;
-
- /** . */
- private POMSessionManager mgr;
-
- /** . */
- private Authenticator authenticator;
-
- /** . */
- private ListenerService listenerService;
-
- /** . */
- private LinkedList<Event> events;
-
- /** . */
- private boolean registered;
-
- /** . */
- private POMDataStorage mopStorage;
-
- public TestUserPortal(String name)
- {
- super(name);
-
- //
- registered = false;
- }
-
- @Override
- protected void setUp() throws Exception
- {
- Listener listener = new Listener()
- {
- @Override
- public void onEvent(Event event) throws Exception
- {
- events.add(event);
- }
- };
-
- PortalContainer container = getContainer();
- userPortalConfigSer_ =
- (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- orgService_ = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
- mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
- listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
- events = new LinkedList<Event>();
- storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- mopStorage = (POMDataStorage)container.getComponentInstanceOfType(POMDataStorage.class);
-
- // Register only once for all unit tests
- if (!registered)
- {
- // I'm using this due to crappy design of
- // org.exoplatform.services.listener.ListenerService
- listenerService.addListener(DataStorage.PAGE_CREATED, listener);
- listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
- listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
- }
- }
-
- private static Map<SiteKey, UserNavigation> toMap(UserPortalConfig cfg) throws Exception
- {
- return toMap(cfg.getUserPortal().getNavigations());
- }
-
- private static Map<SiteKey, UserNavigation> toMap(List<UserNavigation> navigations)
- {
- Map<SiteKey, UserNavigation> map = new HashMap<SiteKey, UserNavigation>();
- for (UserNavigation nav : navigations)
- {
- map.put(nav.getKey(), nav);
- }
- return map;
- }
-
-/*
- public void testUpdatePortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "root");
- assertNotNull(userPortalCfg);
- PortalConfig portalCfg = userPortalCfg.getPortalConfig();
- assertNotNull(portalCfg);
- assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
- assertEquals("classic", portalCfg.getName());
- assertEquals("en", portalCfg.getLocale());
- portalCfg.setLocale("fr");
-
- storage_.save(portalCfg);
-
- userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "root");
- portalCfg = userPortalCfg.getPortalConfig();
- assertEquals("fr", portalCfg.getLocale());
- }
- }.execute("root");
- }
-
-*/
-
- public void testRootGetUserPortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- Map<SiteKey, UserNavigation> navigations = toMap(userPortalCfg);
- assertEquals(5, navigations.size());
- assertTrue(navigations.containsKey(SiteKey.portal("classic")));
- assertTrue(navigations.containsKey(SiteKey.user("root")));
- assertTrue(navigations.containsKey(SiteKey.group("/platform/administrators")));
- assertTrue(navigations.containsKey(SiteKey.group("/organization/management/executive-board")));
- assertTrue(navigations.containsKey(SiteKey.group("/organization/management/executive-board")));
- assertTrue(navigations.containsKey(SiteKey.group("/platform/users")));
-
- // Now try with the specific api
- UserNavigation rootNav = userPortalCfg.getUserPortal().getNavigation(SiteKey.user("root"));
- assertNotNull(rootNav);
- assertEquals(SiteKey.user("root"), rootNav.getKey());
- }
- }.execute("root");
- }
-
- public void testFilter()
- {
- UnitTest test = new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- UserPortal portal = userPortalCfg.getUserPortal();
- UserNavigation nav = portal.getNavigation(SiteKey.portal("classic"));
-
- //
- UserNode root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().build(), null);
- assertNotNull(root.getChild("home"));
- assertNotNull(root.getChild("webexplorer"));
- }
- };
-
- //
- test.execute("root");
- test.execute(null);
- }
-
- public void testFilterWithVisibility()
- {
- UnitTest test = new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("system", getUserId());
- UserPortal portal = userPortalCfg.getUserPortal();
- UserNavigation nav = portal.getNavigation(SiteKey.portal("system"));
-
- //
- UserNode root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().withVisibility(Visibility.DISPLAYED).build(), null);
- assertNotNull(root.getChild("home"));
- assertNotNull(root.getChild("sitemap"));
- assertNull(root.getChild("groupnavigation"));
-
- //
- root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().withVisibility(Visibility.DISPLAYED, Visibility.SYSTEM).build(), null);
- assertNotNull(root.getChild("home"));
- assertNotNull(root.getChild("sitemap"));
- assertNotNull(root.getChild("groupnavigation"));
- }
- };
-
- //
- test.execute("root");
- }
-
- public void testFilterWithAuthorizationCheck()
- {
- class Check extends UnitTest
- {
-
- /** . */
- boolean pass = true;
-
- @Override
- protected void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- UserPortal portal = userPortalCfg.getUserPortal();
- UserNavigation nav = portal.getNavigation(SiteKey.group("/platform/administrators"));
-
- //
- UserNode root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().withAuthorizationCheck().build(), null);
- pass &= root.getChild("administration") != null;
- pass &= root.getChild("administration").getChild("communityManagement") != null;
- }
- }
-
- //
- Check root = new Check();
- root.execute("root");
- assertTrue(root.pass);
-
- //
- Check anon = new Check();
- anon.execute("john");
- assertFalse(anon.pass);
- }
-
- public void testFilterPropagation()
- {
- UnitTest test = new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("system", getUserId());
- UserPortal portal = userPortalCfg.getUserPortal();
- UserNavigation nav = portal.getNavigation(SiteKey.portal("system"));
-
- //
- UserNode root = portal.getNode(nav, Scope.SINGLE, UserNodeFilterConfig.builder().withVisibility(Visibility.DISPLAYED).build(), null);
- assertFalse(root.hasChildrenRelationship());
-
- //
- portal.updateNode(root, Scope.ALL, null);
- assertTrue(root.hasChildrenRelationship());
- assertNotNull(root.getChild("home"));
- assertNotNull(root.getChild("sitemap"));
- assertNull(root.getChild("groupnavigation"));
- }
- };
-
- //
- test.execute("root");
- }
-/*
- public void testJohnGetUserPortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "john");
- assertNotNull(userPortalCfg);
- PortalConfig portalCfg = userPortalCfg.getPortalConfig();
- assertNotNull(portalCfg);
- assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
- assertEquals("classic", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
- assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
- assertTrue(navigations.containsKey("portal::classic"));
- assertTrue(navigations.containsKey("group::/platform/administrators"));
- assertTrue(navigations.containsKey("group::/organization/management/executive-board"));
- assertTrue(navigations.containsKey("group::/platform/users"));
- assertTrue(navigations.containsKey("user::john"));
- }
- }.execute("john");
- }
-
- public void testMaryGetUserPortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "mary");
- assertNotNull(userPortalCfg);
- PortalConfig portalCfg = userPortalCfg.getPortalConfig();
- assertNotNull(portalCfg);
- assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
- assertEquals("classic", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
- assertEquals(3, navigations.size());
- assertTrue(navigations.containsKey("portal::classic"));
- assertTrue(navigations.containsKey("group::/platform/users"));
- assertTrue(navigations.containsKey("user::mary"));
- }
- }.execute("mary");
- }
-
- public void testGuestGetUserPortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", null);
- assertNotNull(userPortalCfg);
- PortalConfig portalCfg = userPortalCfg.getPortalConfig();
- assertNotNull(portalCfg);
- assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
- assertEquals("classic", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
- assertEquals("" + navigations, 1, navigations.size());
- assertTrue(navigations.containsKey("portal::classic"));
- }
- }.execute(null);
- }
-
-*/
-
- public void testNavigationOrder()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- UserPortal userPortal = userPortalCfg.getUserPortal();
- List<UserNavigation> navigations = userPortal.getNavigations();
- assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
- assertEquals(SiteKey.portal("classic"), navigations.get(0).getKey()); // 1
- assertEquals(SiteKey.group("/platform/administrators"), navigations.get(1).getKey()); // 2
- assertEquals(SiteKey.user("root"), navigations.get(2).getKey()); // 3
- assertEquals(SiteKey.group("/organization/management/executive-board"), navigations.get(3).getKey()); // 4
- assertEquals(SiteKey.group("/platform/users"), navigations.get(4).getKey()); // 5
- }
- }.execute("root");
- }
-
- public void testPathResolution()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- UserPortal userPortal = userPortalCfg.getUserPortal();
-
- //
- UserNode nav = userPortal.resolvePath(null, "/");
- assertEquals(SiteKey.portal("classic"), nav.getNavigation().getKey());
- assertEquals("home", nav.getName());
- assertEquals("default", nav.getParent().getName());
- assertNull(nav.getParent().getParent());
-
- //
- nav = userPortal.resolvePath(null, "/foo");
- assertEquals(SiteKey.portal("classic"), nav.getNavigation().getKey());
- assertEquals("home", nav.getName());
- assertEquals("default", nav.getParent().getName());
- assertNull(nav.getParent().getParent());
-
- //
- nav = userPortal.resolvePath(null, "/home");
- assertEquals(SiteKey.portal("classic"), nav.getNavigation().getKey());
- assertEquals("home", nav.getName());
- assertEquals("default", nav.getParent().getName());
- assertNull(nav.getParent().getParent());
-
- //
- nav = userPortal.resolvePath(null, "/administration/communityManagement");
- assertEquals(SiteKey.group("/platform/administrators"), nav.getNavigation().getKey());
- assertEquals("communityManagement", nav.getName());
- assertEquals("administration", nav.getParent().getName());
- assertEquals("default", nav.getParent().getParent().getName());
- assertNull(nav.getParent().getParent().getParent());
- }
- }.execute("root");
- }
-
- public void testPathResolutionPerNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- UserPortal userPortal = userPortalCfg.getUserPortal();
- UserNavigation navigation = userPortal.getNavigation(SiteKey.group("/platform/administrators"));
-
- //
- UserNode path = userPortal.resolvePath(navigation, null, "/");
- assertNull(path);
-
- //
- path = userPortal.resolvePath(navigation, null, "/foo");
- assertNull(path);
-
- //
- path = userPortal.resolvePath(navigation, null, "/administration");
- assertNotNull(path);
- assertEquals("administration", path.getName());
-
- //
- path = userPortal.resolvePath(navigation, null, "/administration/communityManagement");
- assertNotNull(path);
- assertEquals("communityManagement", path.getName());
- }
- }.execute("root");
- }
-
- public void testLabel()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalContext userPortalContext = new UserPortalContext()
- {
- final MapResourceBundle bundle;
-
- {
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("portal.classic.home", "foo");
- map.put("portal.classic.emoh", "bar");
- bundle = new MapResourceBundle(map);
- }
-
- public ResourceBundle getBundle(UserNavigation navigation)
- {
- return bundle;
- }
- };
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId(), userPortalContext);
- UserPortal userPortal = userPortalCfg.getUserPortal();
-
- //
- UserNode path = userPortal.resolvePath(null, "/home");
- assertEquals("#{portal.classic.home}", path.getLabel());
- assertEquals("foo", path.getResolvedLabel());
-
- // Note that we don't save otherwise that may affect other tests
- // this is fine for this test I think
- path.setLabel("#{portal.classic.emoh}");
- assertEquals("bar", path.getResolvedLabel());
- }
- }.execute("root");
- }
-
- public void testLoadNode()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- UserPortal userPortal = userPortalCfg.getUserPortal();
- UserNavigation navigation = userPortal.getNavigation(SiteKey.group("/platform/administrators"));
-
- //
- UserNode root = userPortal.getNode(navigation, Scope.SINGLE, null, null);
- assertEquals("default", root.getName());
- assertEquals(1, root.getChildrenCount());
- assertEquals(0, root.getChildren().size());
- assertFalse(root.hasChildrenRelationship());
-
- //
- root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
- assertEquals("default", root.getName());
- assertEquals(1, root.getChildrenCount());
- assertEquals(1, root.getChildren().size());
- assertTrue(root.hasChildrenRelationship());
- Iterator<UserNode> children = root.getChildren().iterator();
- UserNode administration = children.next();
- assertEquals("administration", administration.getName());
- assertEquals(5, administration.getChildrenCount());
- assertEquals(0, administration.getChildren().size());
- assertFalse(administration.hasChildrenRelationship());
-
- //
- userPortal.updateNode(administration, Scope.CHILDREN, null);
- assertEquals("administration", administration.getName());
- assertEquals(5, administration.getChildrenCount());
- assertEquals(5, administration.getChildren().size());
- assertTrue(administration.hasChildrenRelationship());
-
- //
- UserNode registry = administration.getChildren().iterator().next();
- assertEquals("registry", registry.getName());
- assertEquals(0, registry.getChildrenCount());
- assertEquals(0, registry.getChildren().size());
- assertFalse(registry.hasChildrenRelationship());
-
- // I'm too lazy to check the remaining nodes...
- }
- }.execute("root");
- }
-
- public void testPublicationTime()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("test", getUserId());
- UserPortal userPortal = userPortalCfg.getUserPortal();
- UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("test"));
-
- UserNode root = userPortal.getNode(navigation, Scope.ALL, UserNodeFilterConfig.builder().withTemporalCheck().build(), null);
- GregorianCalendar start = new GregorianCalendar(2000, 2, 21, 1, 33, 0);
- start.setTimeZone(TimeZone.getTimeZone("UTC"));
- GregorianCalendar end = new GregorianCalendar(2050, 2, 21, 1, 33, 0);
- end.setTimeZone(TimeZone.getTimeZone("UTC"));
-
- assertEquals(3, root.getChildrenCount());
-
- UserNode node1 = root.getChild("node_name1");
- assertNotNull(node1);
- assertEquals(start.getTimeInMillis(), node1.getStartPublicationTime());
- assertEquals(end.getTimeInMillis(), node1.getEndPublicationTime());
-
- UserNode node2 = root.getChild("node_name3");
- assertNotNull(node2);
- assertEquals(-1, node2.getStartPublicationTime());
- assertEquals(end.getTimeInMillis(), node2.getEndPublicationTime());
-
- UserNode node3 = root.getChild("node_name4");
- assertNotNull(node3);
- assertEquals(-1, node3.getStartPublicationTime());
- assertEquals(-1, node3.getEndPublicationTime());
- }
- }.execute("root");
- }
-
- public void testSave()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- storage_.create(new PortalConfig("portal", "usernode_recursive"));
- end(true);
-
- //
- begin();
- Site site = mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "usernode_recursive");
- site.getRootNavigation().addChild("default");
- end(true);
-
- //
- begin();
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("usernode_recursive", getUserId());
- UserPortal userPortal = userPortalCfg.getUserPortal();
- UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("usernode_recursive"));
- UserNode root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
- root.addChild("foo");
- userPortal.saveNode(root, null);
- end(true);
-
- //
- begin();
- root = userPortal.getNode(navigation, Scope.ALL, null, null);
- root.addChild("bar");
- root.getChild("foo").addChild("juu");
- userPortal.saveNode(root, null);
- end(true);
-
- //
- begin();
- userPortalCfg = userPortalConfigSer_.getUserPortalConfig("usernode_recursive", getUserId());
- userPortal = userPortalCfg.getUserPortal();
- navigation = userPortal.getNavigation(SiteKey.portal("usernode_recursive"));
- root = userPortal.getNode(navigation, Scope.ALL, null, null);
- assertNotNull(root.getChild("bar"));
- UserNode foo = root.getChild("foo");
- assertNotNull(foo.getChild("juu"));
-
- root.removeChild("foo");
- root.addChild("foo");
- userPortal.saveNode(root, null);
- end(true);
-
- begin();
- root = userPortal.getNode(navigation, Scope.ALL, null, null);
- foo = root.getChild("foo");
- assertNull(foo.getChild("juu"));
- }
- }.execute("root");
- }
-
- public void testNodeExtension()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- storage_.create(new PortalConfig("portal", "node_extension"));
- end(true);
-
- //
- begin();
- Site site = mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "node_extension");
- site.getRootNavigation().addChild("default");
- end(true);
-
- begin();
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("node_extension", getUserId());
- UserPortal userPortal = userPortalCfg.getUserPortal();
- UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("node_extension"));
- UserNode root1 = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
- end(true);
-
- begin();
- UserNode root2 = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
- UserNode foo2 = root2.addChild("foo");
- userPortal.saveNode(root2, null);
- end(true);
-
- begin();
- UserNode foo1 = root1.getChild("foo");
- assertNull(foo1);
- userPortal.updateNode(root1, Scope.GRANDCHILDREN, null);
- foo1 = root1.getChild("foo");
- assertNotNull(foo1);
- foo1.addChild("bar");
- userPortal.saveNode(root1, null);
- end(true);
-
- begin();
- UserNode bar2 = foo2.getChild("bar");
- assertNull(foo2.getChild("bar"));
- userPortal.updateNode(foo2, Scope.GRANDCHILDREN, null);
- bar2 = foo2.getChild("bar");
- assertNotNull(bar2);
- bar2.addChild("foo_bar");
- userPortal.saveNode(root2, null);
- end(true);
-
- begin();
- root1 = userPortal.getNode(navigation, Scope.ALL, null, null);
- UserNode bar1 = root1.getChild("foo").getChild("bar");
- assertNotNull(bar1);
- assertNotNull(bar1.getChild("foo_bar"));
- }
- }.execute("root");
- }
-
- public void testCacheInvalidation()
- {
-
- new UnitTest()
- {
- public void execute() throws Exception
- {
- storage_.create(new PortalConfig("portal", "cache_invalidation"));
- end(true);
-
- //
- begin();
- Site site = mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "cache_invalidation");
- site.getRootNavigation().addChild("default");
- end(true);
-
- begin();
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("cache_invalidation", "root");
- UserPortal userPortal = userPortalCfg.getUserPortal();
- UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("cache_invalidation"));
- UserNode root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
- root.addChild("foo");
-
- userPortal.saveNode(root, null);
- root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
- assertNotNull(root.getChild("foo")); // should Cache be invalidated right after save()
- }
- }.execute("root");
- }
-
- public void testInfiniteLoop()
- {
- new UnitTest()
- {
- @Override
- protected void execute() throws Exception
- {
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
- UserPortal portal = userPortalCfg.getUserPortal();
- UserNavigation nav = portal.getNavigation(SiteKey.group("/platform/administrators"));
-
- //
- UserNode root = portal.getNode(nav, Scope.GRANDCHILDREN, null, null);
- portal.updateNode(root, Scope.GRANDCHILDREN, null); //Re-update the root node
- Collection<UserNode> children = root.getChildren();
- int level = 0;
- for (UserNode child : children)
- {
- println(child, level);
- }
- }
-
- private void println(UserNode node, int level)
- {
- Collection<UserNode> children = node.getChildren();
- UserNode temp = null;
- Iterator<UserNode> it = children.iterator();
- while (it.hasNext())
- {
- UserNode child = it.next();
- if (child == temp)
- {
- child = it.next();
- fail("There is infinite loop");
- }
- temp = child;
- println(child, level + 1);
- }
- }
- }.execute("root");
- }
-
-/*
- public void testCreateUserPortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- userPortalConfigSer_.createUserPortalConfig(PortalConfig.PORTAL_TYPE, "jazz", "test");
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("jazz", "root");
- assertNotNull(userPortalCfg);
- PortalConfig portalCfg = userPortalCfg.getPortalConfig();
- assertNotNull(portalCfg);
- assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
- assertEquals("jazz", portalCfg.getName());
- assertNotNull(userPortalCfg.getNavigations());
- Map<String, PageNavigation> navigations = toMap(userPortalCfg);
- assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
- assertTrue(navigations.containsKey("portal::jazz"));
- assertTrue(navigations.containsKey("group::/platform/administrators"));
- assertTrue(navigations.containsKey("group::/organization/management/executive-board"));
- assertTrue(navigations.containsKey("group::/platform/users"));
- assertTrue(navigations.containsKey("user::root"));
-
- queryPage();
- }
-
- private void queryPage()
- {
- Query<Page> query = new Query<Page>("portal", null, null, null, Page.class);
- try
- {
- storage_.find(query);
- }
- catch (Exception ex)
- {
- assertTrue("Exception while querying pages with new portal", false);
- }
- }
-
- }.execute("root");
- }
-
- public void testRemoveUserPortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- userPortalConfigSer_.createUserPortalConfig(PortalConfig.PORTAL_TYPE, "jazz", "test");
- UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("jazz", "root");
- assertNotNull(userPortalCfg);
- saveMOP();
- userPortalConfigSer_.removeUserPortalConfig("jazz");
- saveMOP();
- assertNull(userPortalConfigSer_.getUserPortalConfig("jazz", "root"));
- }
- }.execute("root");
- }
-
- public void testRootGetMakableNavigations()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Set<String> navigations = new HashSet<String>(userPortalConfigSer_.getMakableNavigations("root", false));
- Set<String> expectedNavigations =
- new HashSet<String>(Arrays.asList("/platform/users", "/organization/management/human-resources",
- "/partners", "/customers", "/organization/communication", "/organization/management/executive-board",
- "/organization/management", "/organization/operations", "/organization", "/platform",
- "/organization/communication/marketing", "/platform/guests",
- "/organization/communication/press-and-media", "/platform/administrators",
- "/organization/operations/sales", "/organization/operations/finances"));
- assertEquals(expectedNavigations, navigations);
- }
- }.execute(null);
- }
-
- public void testJohnGetMakableNavigations()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Set<String> navigations = new HashSet<String>(userPortalConfigSer_.getMakableNavigations("john", false));
- Set<String> expectedNavigations = Collections.singleton("/organization/management/executive-board");
- assertEquals(expectedNavigations, navigations);
- }
- }.execute(null);
- }
-
- public void testMaryGetMakableNavigations()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Set<String> navigations = new HashSet<String>(userPortalConfigSer_.getMakableNavigations("mary", false));
- Set<String> expectedNavigations = Collections.emptySet();
- assertEquals(expectedNavigations, navigations);
- }
- }.execute(null);
- }
-
- public void testRootGetPage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- assertEquals("group::/platform/administrators::newAccount", userPortalConfigSer_.getPage(
- "group::/platform/administrators::newAccount", null).getPageId());
- assertEquals("group::/organization/management/executive-board::newStaff", userPortalConfigSer_.getPage(
- "group::/organization/management/executive-board::newStaff", null).getPageId());
- }
- }.execute("root");
- }
-
- public void testJohnGetPage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount", null));
- assertEquals("group::/organization/management/executive-board::newStaff", userPortalConfigSer_.getPage(
- "group::/organization/management/executive-board::newStaff", null).getPageId());
- }
- }.execute("john");
- }
-
- public void testMaryGetPage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount", null));
- assertEquals(null, userPortalConfigSer_.getPage(
- "group::/organization/management/executive-board::newStaff", null));
- }
- }.execute("mary");
- }
-
- public void testAnonymousGetPage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount", null));
- assertEquals(null, userPortalConfigSer_.getPage(
- "group::/organization/management/executive-board::newStaff", null));
- }
- }.execute(null);
- }
-
- public void testRemovePage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("/platform/administrators");
- page.setName("newAccount");
- assertTrue(events.isEmpty());
- storage_.remove(page);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.PAGE_REMOVED, event.getEventName());
- Page p = ((Page)event.getData());
- assertEquals("group", p.getOwnerType());
- assertEquals("/platform/administrators", p.getOwnerId());
- assertEquals("newAccount", p.getName());
- assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount"));
- }
- }.execute(null);
- }
-
- public void testCreatePage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("/platform/administrators");
- page.setName("whatever");
- assertTrue(events.isEmpty());
- storage_.create(page);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
- Page p = ((Page)event.getData());
- assertEquals("group", p.getOwnerType());
- assertEquals("/platform/administrators", p.getOwnerId());
- assertEquals("whatever", p.getName());
- assertNotNull(userPortalConfigSer_.getPage("group::/platform/administrators::whatever"));
- }
- }.execute(null);
- }
-
- // Julien : see who added that and find out is test is relevant or not
-
- public void testClonePage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("/platform/administrators");
- page.setName("whatever");
- page.setTitle("testTitle");
- storage_.create(page);
-
- String newName = "newPage";
- Page newPage = storage_.clonePage(page.getPageId(), page.getOwnerType(), page.getOwnerId(), newName);
-
- assertEquals(newName, newPage.getName());
- assertEquals(page.getTitle(), newPage.getTitle());
- }
- }.execute(null);
- }
-
- public void testUpdatePage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("/platform/administrators");
- page.setName("newAccount");
- page.setShowMaxWindow(true);
- page.setTitle("newAccount title");
- assertTrue(events.isEmpty());
- storage_.create(page);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
- Page p = ((Page)event.getData());
- assertEquals("group", p.getOwnerType());
- assertEquals("/platform/administrators", p.getOwnerId());
- assertEquals("newAccount", p.getName());
- assertEquals("newAccount title", p.getTitle());
- assertTrue(p.isShowMaxWindow());
-
- p.setShowMaxWindow(false);
- storage_.save(p);
- p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
- assertFalse(p.isShowMaxWindow());
- p.setShowMaxWindow(true);
- storage_.save(p);
- p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
- assertTrue(p.isShowMaxWindow());
- p.setShowMaxWindow(false);
- storage_.save(p);
- p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
- assertFalse(p.isShowMaxWindow());
- p.setShowMaxWindow(true);
- storage_.save(p);
- p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
- assertTrue(p.isShowMaxWindow());
-
- Page p2 = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
- assertEquals("group", p2.getOwnerType());
- assertEquals("/platform/administrators", p2.getOwnerId());
- assertEquals("newAccount", p2.getName());
- // assertFalse(p2.isShowMaxWindow());
- p2.setTitle("newAccount title 1");
- p2.setShowMaxWindow(true);
- storage_.save(p2);
-
- Page p3 = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
- assertEquals("newAccount title 1", p3.getTitle());
- // assertTrue(p3.isShowMaxWindow());
-
- }
- }.execute(null);
- }
-
- public void testRemoveNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType("group");
- navigation.setOwnerId("/platform/administrators");
- assertTrue(events.isEmpty());
- storage_.remove(navigation);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.NAVIGATION_REMOVED, event.getEventName());
- PageNavigation n = ((PageNavigation)event.getData());
- assertEquals("group", n.getOwnerType());
- assertEquals("/platform/administrators", n.getOwnerId());
- assertEquals(null, storage_.getPageNavigation("group", "/platform/administrators"));
- }
- }.execute(null);
- }
-
- public void testCreateNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType("group");
- navigation.setOwnerId("/platform/administrators");
- storage_.remove(navigation);
- assertNotNull(events.removeLast());
- assertTrue(events.isEmpty());
- storage_.create(navigation);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.NAVIGATION_CREATED, event.getEventName());
- PageNavigation n = ((PageNavigation)event.getData());
- assertEquals("group", n.getOwnerType());
- assertEquals("/platform/administrators", n.getOwnerId());
- PageNavigation n2 = storage_.getPageNavigation("group", "/platform/administrators");
- assertEquals("group", n2.getOwnerType());
- assertEquals("/platform/administrators", n2.getOwnerId());
- }
- }.execute(null);
- }
-
- */
-/*
- public void testCreateMultipleNavigations(){
- for(int i =0; i < 10; i++){
- createNavigation(null, "group", "/platform/administrators" + i);
- }
- }
-
- private void createNavigation(final String user, final String ownerType, final String ownerId)
- {
- new UnitTest()
- {
-
- public void execute() throws Exception
- {
- createNavigationInSeperatedThread();
- }
-
- private void createNavigationInSeperatedThread()
- {
- Thread task = new Thread()
- {
- public void run()
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType(ownerType);
- navigation.setOwnerId(ownerId);
- try
- {
- userPortalConfigSer_.create(navigation);
- Event event = events.removeFirst();
- assertEquals(DataStorage.CREATE_NAVIGATION_EVENT, event.getEventName());
- PageNavigation n1 = (PageNavigation)event.getSource();
- assertEquals(ownerType, n1.getOwnerType());
- assertEquals(ownerId, n1.getOwnerId());
- PageNavigation n2 = storage_.getPageNavigation(ownerType, ownerId);
- assertEquals(ownerType, n2.getOwnerType());
- assertEquals(ownerId, n2.getOwnerId());
- }
- catch (Exception ex)
- {
- assertTrue("Failed while create '" + ownerType + " ' navigation for owner: " + ownerId, false);
- ex.printStackTrace();
- }
- }
- };
-
- task.start();
- try
- {
- task.sleep(200);
- }
- catch (InterruptedException ex)
- {
- ex.printStackTrace();
- }
- }
- }.execute(user);
- }
- *//*
-
-
- public void testUpdateNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- PageNavigation navigation = new PageNavigation();
- navigation.setOwnerType("group");
- navigation.setOwnerId("/platform/administrators");
- navigation.setPriority(3);
- assertTrue(events.isEmpty());
- storage_.save(navigation);
- assertEquals(1, events.size());
- Event event = events.removeFirst();
- assertEquals(DataStorage.NAVIGATION_UPDATED, event.getEventName());
- PageNavigation n = ((PageNavigation)event.getData());
- assertEquals("group", n.getOwnerType());
- assertEquals("/platform/administrators", n.getOwnerId());
- assertEquals(3, n.getPriority());
- PageNavigation n2 = storage_.getPageNavigation("group", "/platform/administrators");
- assertEquals("group", n2.getOwnerType());
- assertEquals("/platform/administrators", n2.getOwnerId());
- assertEquals(3, n2.getPriority());
- }
- }.execute(null);
- }
-
- public void testRenewPage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Page clone = storage_.clonePage("portal::test::test4", "portal", "test", "test5");
- assertNotNull(clone);
- assertEquals("portal", clone.getOwnerType());
- assertEquals("test", clone.getOwnerId());
- assertEquals("test5", clone.getName());
-
- //
- Application<Portlet> app = (Application<Portlet>)clone.getChildren().get(0);
- Portlet prefs2 = storage_.load(app.getState(), ApplicationType.PORTLET);
- assertEquals(new PortletBuilder().add("template",
- "par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl").build(), prefs2);
-
- // Update prefs of original page
- PortletPreferences prefs = new PortletPreferences();
- prefs.setWindowId("portal#test:/web/BannerPortlet/banner");
- storage_.save(prefs);
-
- //
- prefs2 = storage_.load(app.getState(), ApplicationType.PORTLET);
- assertEquals(new PortletBuilder().add("template",
- "par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl").build(), prefs2);
- }
- }.execute(null);
- }
-
- public void testCreateFromTemplate()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- Page clone = userPortalConfigSer_.createPageTemplate("dashboard", "portal", "test");
- assertNotNull(clone);
- assertEquals("portal", clone.getOwnerType());
- assertEquals("test", clone.getOwnerId());
-
- //
- assertEquals(1, clone.getChildren().size());
-
- //
- Application<Portlet> app = (Application<Portlet>)clone.getChildren().get(0);
- assertEquals("Dashboard", app.getTitle());
- assertNotNull(app.getState());
- assertEquals("dashboard/DashboardPortlet", storage_.getId(app.getState()));
- // assertEquals("portal", app.getInstanceState().getOwnerType());
- // assertEquals("test", app.getInstanceState().getOwnerId());
- Portlet prefs2 = storage_.load(app.getState(), ApplicationType.PORTLET);
- assertNull(prefs2);
- }
- }.execute(null);
- }
-
- public void testOverwriteUserLayout()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- mgr.clearCache();
-
- PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "overwritelayout");
- assertNotNull(cfg);
-
- Container container = cfg.getPortalLayout();
- assertNotNull(container);
- assertEquals(2, container.getChildren().size());
- assertTrue(container.getChildren().get(0) instanceof PageBody);
- assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
- Application<Portlet> pa = (Application<Portlet>)container.getChildren().get(1);
- ApplicationState<Portlet> state = pa.getState();
- assertEquals("overwrite_application_ref/overwrite_portlet_ref", storage_.getId(state));
- }
- }.execute(null);
- }
-
- public void testUserTemplate()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- assertNull(storage_.getPortalConfig(PortalConfig.USER_TYPE, "user"));
- assertNull(storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien"));
-
- //
- UserHandler userHandler = orgService_.getUserHandler();
- User user = userHandler.createUserInstance("julien");
- user.setPassword("default");
- user.setFirstName("default");
- user.setLastName("default");
- user.setEmail("exo(a)exoportal.org");
- userHandler.createUser(user, true);
-
- //
- PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien");
- assertNotNull(cfg);
- Container container = cfg.getPortalLayout();
- assertNotNull(container);
- assertEquals(2, container.getChildren().size());
- assertTrue(container.getChildren().get(0) instanceof PageBody);
- assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
- Application<Portlet> pa = (Application<Portlet>)container.getChildren().get(1);
- ApplicationState state = pa.getState();
- assertEquals("foo/bar", storage_.getId(pa.getState()));
- }
- }.execute(null);
- }
-
- public void testGroupTemplate()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- String groupName = "groupTest";
- assertNull(storage_.getPortalConfig(PortalConfig.GROUP_TYPE, groupName));
-
- //
- GroupHandler groupHandler = orgService_.getGroupHandler();
- Group group = groupHandler.createGroupInstance();
- group.setGroupName(groupName);
- group.setDescription("this is a group for test");
- groupHandler.addChild(null, group, true);
-
- //
- PortalConfig cfg = storage_.getPortalConfig(PortalConfig.GROUP_TYPE, "/" + groupName);
- assertNotNull(cfg);
- Container container = cfg.getPortalLayout();
- assertNotNull(container);
- assertEquals(4, container.getChildren().size());
- assertTrue(container.getChildren().get(2) instanceof PageBody);
- assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
-
- groupHandler.removeGroup(group, true);
- }
- }.execute(null);
- }
-
- public void testCacheUserPortalConfig()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- mgr.clearCache();
- DataCache cache = mgr.getDecorator(DataCache.class);
- long readCount0 = cache.getReadCount();
- userPortalConfigSer_.getUserPortalConfig("classic", null);
- long readCount1 = cache.getReadCount();
- assertTrue(readCount1 > readCount0);
- userPortalConfigSer_.getUserPortalConfig("classic", null);
- long readCount2 = cache.getReadCount();
- assertEquals(readCount1, readCount2);
- }
- }.execute(null);
- }
-
- public void testCachePage()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- mgr.clearCache();
- DataCache cache = mgr.getDecorator(DataCache.class);
- long readCount0 = cache.getReadCount();
- userPortalConfigSer_.getPage("portal::test::test1");
- long readCount1 = cache.getReadCount();
- assertTrue(readCount1 > readCount0);
- userPortalConfigSer_.getPage("portal::test::test1");
- long readCount2 = cache.getReadCount();
- assertEquals(readCount1, readCount2);
- }
- }.execute(null);
- }
-
- public void testCachePageNavigation()
- {
- new UnitTest()
- {
- public void execute() throws Exception
- {
- mgr.clearCache();
- DataCache cache = mgr.getDecorator(DataCache.class);
- long readCount0 = cache.getReadCount();
- storage_.getPageNavigation("portal", "test");
- long readCount1 = cache.getReadCount();
- assertTrue(readCount1 > readCount0);
- storage_.getPageNavigation("portal", "test");
- long readCount2 = cache.getReadCount();
- assertEquals(readCount1, readCount2);
- }
- }.execute(null);
- }
-
- */
-
- private abstract class UnitTest
- {
-
- /** . */
- private String userId;
-
- protected final void execute(String userId)
- {
- Throwable failure = null;
-
- //
- begin();
-
- //
- ConversationState conversationState = null;
- if (userId != null)
- {
- try
- {
- conversationState = new ConversationState(authenticator.createIdentity(userId));
- }
- catch (Exception e)
- {
- failure = e;
- }
- }
-
- //
- if (failure == null)
- {
- // Clear cache for test
- mgr.clearCache();
-
- //
- this.userId = userId;
- ConversationState.setCurrent(conversationState);
- try
- {
- execute();
- }
- catch (Exception e)
- {
- failure = e;
- log.error("Test failed", e);
- }
- finally
- {
- this.userId = null;
- ConversationState.setCurrent(null);
- end();
- }
- }
-
- // Report error as a junit assertion failure
- if (failure != null)
- {
- AssertionFailedError err = new AssertionFailedError();
- err.initCause(failure);
- throw err;
- }
- }
-
- public final String getUserId()
- {
- return userId;
- }
-
- protected abstract void execute() throws Exception;
-
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,1471 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop.user;
+
+import junit.framework.AssertionFailedError;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.AbstractPortalTest;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.UserPortalConfig;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.pom.config.POMDataStorage;
+import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.services.listener.Event;
+import org.exoplatform.services.listener.Listener;
+import org.exoplatform.services.listener.ListenerService;
+import org.exoplatform.services.organization.OrganizationService;
+import org.exoplatform.services.security.Authenticator;
+import org.exoplatform.services.security.ConversationState;
+import org.gatein.common.i18n.MapResourceBundle;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+
+import java.util.Collection;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.TimeZone;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestUserPortal extends AbstractPortalTest
+{
+
+ /** . */
+ private UserPortalConfigService userPortalConfigSer_;
+
+ /** . */
+ private OrganizationService orgService_;
+
+ /** . */
+ private DataStorage storage_;
+
+ /** . */
+ private POMSessionManager mgr;
+
+ /** . */
+ private Authenticator authenticator;
+
+ /** . */
+ private ListenerService listenerService;
+
+ /** . */
+ private LinkedList<Event> events;
+
+ /** . */
+ private boolean registered;
+
+ /** . */
+ private POMDataStorage mopStorage;
+
+ public TestUserPortal(String name)
+ {
+ super(name);
+
+ //
+ registered = false;
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ Listener listener = new Listener()
+ {
+ @Override
+ public void onEvent(Event event) throws Exception
+ {
+ events.add(event);
+ }
+ };
+
+ PortalContainer container = getContainer();
+ userPortalConfigSer_ =
+ (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
+ orgService_ = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
+ mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+ authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
+ listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
+ events = new LinkedList<Event>();
+ storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
+ mopStorage = (POMDataStorage)container.getComponentInstanceOfType(POMDataStorage.class);
+
+ // Register only once for all unit tests
+ if (!registered)
+ {
+ // I'm using this due to crappy design of
+ // org.exoplatform.services.listener.ListenerService
+ listenerService.addListener(DataStorage.PAGE_CREATED, listener);
+ listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
+ listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
+ }
+ }
+
+ private static Map<SiteKey, UserNavigation> toMap(UserPortalConfig cfg) throws Exception
+ {
+ return toMap(cfg.getUserPortal().getNavigations());
+ }
+
+ private static Map<SiteKey, UserNavigation> toMap(List<UserNavigation> navigations)
+ {
+ Map<SiteKey, UserNavigation> map = new HashMap<SiteKey, UserNavigation>();
+ for (UserNavigation nav : navigations)
+ {
+ map.put(nav.getKey(), nav);
+ }
+ return map;
+ }
+
+/*
+ public void testUpdatePortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "root");
+ assertNotNull(userPortalCfg);
+ PortalConfig portalCfg = userPortalCfg.getPortalConfig();
+ assertNotNull(portalCfg);
+ assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
+ assertEquals("classic", portalCfg.getName());
+ assertEquals("en", portalCfg.getLocale());
+ portalCfg.setLocale("fr");
+
+ storage_.save(portalCfg);
+
+ userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "root");
+ portalCfg = userPortalCfg.getPortalConfig();
+ assertEquals("fr", portalCfg.getLocale());
+ }
+ }.execute("root");
+ }
+
+*/
+
+ public void testRootGetUserPortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ Map<SiteKey, UserNavigation> navigations = toMap(userPortalCfg);
+ assertEquals(5, navigations.size());
+ assertTrue(navigations.containsKey(SiteKey.portal("classic")));
+ assertTrue(navigations.containsKey(SiteKey.user("root")));
+ assertTrue(navigations.containsKey(SiteKey.group("/platform/administrators")));
+ assertTrue(navigations.containsKey(SiteKey.group("/organization/management/executive-board")));
+ assertTrue(navigations.containsKey(SiteKey.group("/organization/management/executive-board")));
+ assertTrue(navigations.containsKey(SiteKey.group("/platform/users")));
+
+ // Now try with the specific api
+ UserNavigation rootNav = userPortalCfg.getUserPortal().getNavigation(SiteKey.user("root"));
+ assertNotNull(rootNav);
+ assertEquals(SiteKey.user("root"), rootNav.getKey());
+ }
+ }.execute("root");
+ }
+
+ public void testFilter()
+ {
+ UnitTest test = new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ UserPortal portal = userPortalCfg.getUserPortal();
+ UserNavigation nav = portal.getNavigation(SiteKey.portal("classic"));
+
+ //
+ UserNode root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().build(), null);
+ assertNotNull(root.getChild("home"));
+ assertNotNull(root.getChild("webexplorer"));
+ }
+ };
+
+ //
+ test.execute("root");
+ test.execute(null);
+ }
+
+ public void testFilterWithVisibility()
+ {
+ UnitTest test = new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("system", getUserId());
+ UserPortal portal = userPortalCfg.getUserPortal();
+ UserNavigation nav = portal.getNavigation(SiteKey.portal("system"));
+
+ //
+ UserNode root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().withVisibility(Visibility.DISPLAYED).build(), null);
+ assertNotNull(root.getChild("home"));
+ assertNotNull(root.getChild("sitemap"));
+ assertNull(root.getChild("groupnavigation"));
+
+ //
+ root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().withVisibility(Visibility.DISPLAYED, Visibility.SYSTEM).build(), null);
+ assertNotNull(root.getChild("home"));
+ assertNotNull(root.getChild("sitemap"));
+ assertNotNull(root.getChild("groupnavigation"));
+ }
+ };
+
+ //
+ test.execute("root");
+ }
+
+ public void testFilterWithAuthorizationCheck()
+ {
+ class Check extends UnitTest
+ {
+
+ /** . */
+ boolean pass = true;
+
+ @Override
+ protected void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ UserPortal portal = userPortalCfg.getUserPortal();
+ UserNavigation nav = portal.getNavigation(SiteKey.group("/platform/administrators"));
+
+ //
+ UserNode root = portal.getNode(nav, Scope.ALL, UserNodeFilterConfig.builder().withAuthorizationCheck().build(), null);
+ pass &= root.getChild("administration") != null;
+ pass &= root.getChild("administration").getChild("communityManagement") != null;
+ }
+ }
+
+ //
+ Check root = new Check();
+ root.execute("root");
+ assertTrue(root.pass);
+
+ //
+ Check anon = new Check();
+ anon.execute("john");
+ assertFalse(anon.pass);
+ }
+
+ public void testFilterPropagation()
+ {
+ UnitTest test = new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("system", getUserId());
+ UserPortal portal = userPortalCfg.getUserPortal();
+ UserNavigation nav = portal.getNavigation(SiteKey.portal("system"));
+
+ //
+ UserNode root = portal.getNode(nav, Scope.SINGLE, UserNodeFilterConfig.builder().withVisibility(Visibility.DISPLAYED).build(), null);
+ assertFalse(root.hasChildrenRelationship());
+
+ //
+ portal.updateNode(root, Scope.ALL, null);
+ assertTrue(root.hasChildrenRelationship());
+ assertNotNull(root.getChild("home"));
+ assertNotNull(root.getChild("sitemap"));
+ assertNull(root.getChild("groupnavigation"));
+ }
+ };
+
+ //
+ test.execute("root");
+ }
+/*
+ public void testJohnGetUserPortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "john");
+ assertNotNull(userPortalCfg);
+ PortalConfig portalCfg = userPortalCfg.getPortalConfig();
+ assertNotNull(portalCfg);
+ assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
+ assertEquals("classic", portalCfg.getName());
+ assertNotNull(userPortalCfg.getNavigations());
+ Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
+ assertTrue(navigations.containsKey("portal::classic"));
+ assertTrue(navigations.containsKey("group::/platform/administrators"));
+ assertTrue(navigations.containsKey("group::/organization/management/executive-board"));
+ assertTrue(navigations.containsKey("group::/platform/users"));
+ assertTrue(navigations.containsKey("user::john"));
+ }
+ }.execute("john");
+ }
+
+ public void testMaryGetUserPortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", "mary");
+ assertNotNull(userPortalCfg);
+ PortalConfig portalCfg = userPortalCfg.getPortalConfig();
+ assertNotNull(portalCfg);
+ assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
+ assertEquals("classic", portalCfg.getName());
+ assertNotNull(userPortalCfg.getNavigations());
+ Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ assertEquals(3, navigations.size());
+ assertTrue(navigations.containsKey("portal::classic"));
+ assertTrue(navigations.containsKey("group::/platform/users"));
+ assertTrue(navigations.containsKey("user::mary"));
+ }
+ }.execute("mary");
+ }
+
+ public void testGuestGetUserPortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", null);
+ assertNotNull(userPortalCfg);
+ PortalConfig portalCfg = userPortalCfg.getPortalConfig();
+ assertNotNull(portalCfg);
+ assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
+ assertEquals("classic", portalCfg.getName());
+ assertNotNull(userPortalCfg.getNavigations());
+ Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ assertEquals("" + navigations, 1, navigations.size());
+ assertTrue(navigations.containsKey("portal::classic"));
+ }
+ }.execute(null);
+ }
+
+*/
+
+ public void testNavigationOrder()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ List<UserNavigation> navigations = userPortal.getNavigations();
+ assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
+ assertEquals(SiteKey.portal("classic"), navigations.get(0).getKey()); // 1
+ assertEquals(SiteKey.group("/platform/administrators"), navigations.get(1).getKey()); // 2
+ assertEquals(SiteKey.user("root"), navigations.get(2).getKey()); // 3
+ assertEquals(SiteKey.group("/organization/management/executive-board"), navigations.get(3).getKey()); // 4
+ assertEquals(SiteKey.group("/platform/users"), navigations.get(4).getKey()); // 5
+ }
+ }.execute("root");
+ }
+
+ public void testPathResolution()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+
+ //
+ UserNode nav = userPortal.resolvePath(null, "/");
+ assertEquals(SiteKey.portal("classic"), nav.getNavigation().getKey());
+ assertEquals("home", nav.getName());
+ assertEquals("default", nav.getParent().getName());
+ assertNull(nav.getParent().getParent());
+
+ //
+ nav = userPortal.resolvePath(null, "/foo");
+ assertEquals(SiteKey.portal("classic"), nav.getNavigation().getKey());
+ assertEquals("home", nav.getName());
+ assertEquals("default", nav.getParent().getName());
+ assertNull(nav.getParent().getParent());
+
+ //
+ nav = userPortal.resolvePath(null, "/home");
+ assertEquals(SiteKey.portal("classic"), nav.getNavigation().getKey());
+ assertEquals("home", nav.getName());
+ assertEquals("default", nav.getParent().getName());
+ assertNull(nav.getParent().getParent());
+
+ //
+ nav = userPortal.resolvePath(null, "/administration/communityManagement");
+ assertEquals(SiteKey.group("/platform/administrators"), nav.getNavigation().getKey());
+ assertEquals("communityManagement", nav.getName());
+ assertEquals("administration", nav.getParent().getName());
+ assertEquals("default", nav.getParent().getParent().getName());
+ assertNull(nav.getParent().getParent().getParent());
+ }
+ }.execute("root");
+ }
+
+ public void testPathResolutionPerNavigation()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ UserNavigation navigation = userPortal.getNavigation(SiteKey.group("/platform/administrators"));
+
+ //
+ UserNode path = userPortal.resolvePath(navigation, null, "/");
+ assertNull(path);
+
+ //
+ path = userPortal.resolvePath(navigation, null, "/foo");
+ assertNull(path);
+
+ //
+ path = userPortal.resolvePath(navigation, null, "/administration");
+ assertNotNull(path);
+ assertEquals("administration", path.getName());
+
+ //
+ path = userPortal.resolvePath(navigation, null, "/administration/communityManagement");
+ assertNotNull(path);
+ assertEquals("communityManagement", path.getName());
+ }
+ }.execute("root");
+ }
+
+ public void testLabel()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalContext userPortalContext = new UserPortalContext()
+ {
+ final MapResourceBundle bundle;
+
+ {
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("portal.classic.home", "foo");
+ map.put("portal.classic.emoh", "bar");
+ bundle = new MapResourceBundle(map);
+ }
+
+ public ResourceBundle getBundle(UserNavigation navigation)
+ {
+ return bundle;
+ }
+ };
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId(), userPortalContext);
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+
+ //
+ UserNode path = userPortal.resolvePath(null, "/home");
+ assertEquals("#{portal.classic.home}", path.getLabel());
+ assertEquals("foo", path.getResolvedLabel());
+
+ // Note that we don't save otherwise that may affect other tests
+ // this is fine for this test I think
+ path.setLabel("#{portal.classic.emoh}");
+ assertEquals("bar", path.getResolvedLabel());
+ }
+ }.execute("root");
+ }
+
+ public void testLoadNode()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ UserNavigation navigation = userPortal.getNavigation(SiteKey.group("/platform/administrators"));
+
+ //
+ UserNode root = userPortal.getNode(navigation, Scope.SINGLE, null, null);
+ assertEquals("default", root.getName());
+ assertEquals(1, root.getChildrenCount());
+ assertEquals(0, root.getChildren().size());
+ assertFalse(root.hasChildrenRelationship());
+
+ //
+ root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
+ assertEquals("default", root.getName());
+ assertEquals(1, root.getChildrenCount());
+ assertEquals(1, root.getChildren().size());
+ assertTrue(root.hasChildrenRelationship());
+ Iterator<UserNode> children = root.getChildren().iterator();
+ UserNode administration = children.next();
+ assertEquals("administration", administration.getName());
+ assertEquals(5, administration.getChildrenCount());
+ assertEquals(0, administration.getChildren().size());
+ assertFalse(administration.hasChildrenRelationship());
+
+ //
+ userPortal.updateNode(administration, Scope.CHILDREN, null);
+ assertEquals("administration", administration.getName());
+ assertEquals(5, administration.getChildrenCount());
+ assertEquals(5, administration.getChildren().size());
+ assertTrue(administration.hasChildrenRelationship());
+
+ //
+ UserNode registry = administration.getChildren().iterator().next();
+ assertEquals("registry", registry.getName());
+ assertEquals(0, registry.getChildrenCount());
+ assertEquals(0, registry.getChildren().size());
+ assertFalse(registry.hasChildrenRelationship());
+
+ // I'm too lazy to check the remaining nodes...
+ }
+ }.execute("root");
+ }
+
+ public void testPublicationTime()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("test", getUserId());
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("test"));
+
+ UserNode root = userPortal.getNode(navigation, Scope.ALL, UserNodeFilterConfig.builder().withTemporalCheck().build(), null);
+ GregorianCalendar start = new GregorianCalendar(2000, 2, 21, 1, 33, 0);
+ start.setTimeZone(TimeZone.getTimeZone("UTC"));
+ GregorianCalendar end = new GregorianCalendar(2050, 2, 21, 1, 33, 0);
+ end.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+ assertEquals(3, root.getChildrenCount());
+
+ UserNode node1 = root.getChild("node_name1");
+ assertNotNull(node1);
+ assertEquals(start.getTimeInMillis(), node1.getStartPublicationTime());
+ assertEquals(end.getTimeInMillis(), node1.getEndPublicationTime());
+
+ UserNode node2 = root.getChild("node_name3");
+ assertNotNull(node2);
+ assertEquals(-1, node2.getStartPublicationTime());
+ assertEquals(end.getTimeInMillis(), node2.getEndPublicationTime());
+
+ UserNode node3 = root.getChild("node_name4");
+ assertNotNull(node3);
+ assertEquals(-1, node3.getStartPublicationTime());
+ assertEquals(-1, node3.getEndPublicationTime());
+ }
+ }.execute("root");
+ }
+
+ public void testSave()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ storage_.create(new PortalConfig("portal", "usernode_recursive"));
+ end(true);
+
+ //
+ begin();
+ Site site = mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "usernode_recursive");
+ site.getRootNavigation().addChild("default");
+ end(true);
+
+ //
+ begin();
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("usernode_recursive", getUserId());
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("usernode_recursive"));
+ UserNode root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
+ root.addChild("foo");
+ userPortal.saveNode(root, null);
+ end(true);
+
+ //
+ begin();
+ root = userPortal.getNode(navigation, Scope.ALL, null, null);
+ root.addChild("bar");
+ root.getChild("foo").addChild("juu");
+ userPortal.saveNode(root, null);
+ end(true);
+
+ //
+ begin();
+ userPortalCfg = userPortalConfigSer_.getUserPortalConfig("usernode_recursive", getUserId());
+ userPortal = userPortalCfg.getUserPortal();
+ navigation = userPortal.getNavigation(SiteKey.portal("usernode_recursive"));
+ root = userPortal.getNode(navigation, Scope.ALL, null, null);
+ assertNotNull(root.getChild("bar"));
+ UserNode foo = root.getChild("foo");
+ assertNotNull(foo.getChild("juu"));
+
+ root.removeChild("foo");
+ root.addChild("foo");
+ userPortal.saveNode(root, null);
+ end(true);
+
+ begin();
+ root = userPortal.getNode(navigation, Scope.ALL, null, null);
+ foo = root.getChild("foo");
+ assertNull(foo.getChild("juu"));
+ }
+ }.execute("root");
+ }
+
+ public void testNodeExtension()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ storage_.create(new PortalConfig("portal", "node_extension"));
+ end(true);
+
+ //
+ begin();
+ Site site = mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "node_extension");
+ site.getRootNavigation().addChild("default");
+ end(true);
+
+ begin();
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("node_extension", getUserId());
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("node_extension"));
+ UserNode root1 = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
+ end(true);
+
+ begin();
+ UserNode root2 = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
+ UserNode foo2 = root2.addChild("foo");
+ userPortal.saveNode(root2, null);
+ end(true);
+
+ begin();
+ UserNode foo1 = root1.getChild("foo");
+ assertNull(foo1);
+ userPortal.updateNode(root1, Scope.GRANDCHILDREN, null);
+ foo1 = root1.getChild("foo");
+ assertNotNull(foo1);
+ foo1.addChild("bar");
+ userPortal.saveNode(root1, null);
+ end(true);
+
+ begin();
+ UserNode bar2 = foo2.getChild("bar");
+ assertNull(foo2.getChild("bar"));
+ userPortal.updateNode(foo2, Scope.GRANDCHILDREN, null);
+ bar2 = foo2.getChild("bar");
+ assertNotNull(bar2);
+ bar2.addChild("foo_bar");
+ userPortal.saveNode(root2, null);
+ end(true);
+
+ begin();
+ root1 = userPortal.getNode(navigation, Scope.ALL, null, null);
+ UserNode bar1 = root1.getChild("foo").getChild("bar");
+ assertNotNull(bar1);
+ assertNotNull(bar1.getChild("foo_bar"));
+ }
+ }.execute("root");
+ }
+
+ public void testCacheInvalidation()
+ {
+
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ storage_.create(new PortalConfig("portal", "cache_invalidation"));
+ end(true);
+
+ //
+ begin();
+ Site site = mgr.getPOMService().getModel().getWorkspace().getSite(ObjectType.PORTAL_SITE, "cache_invalidation");
+ site.getRootNavigation().addChild("default");
+ end(true);
+
+ begin();
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("cache_invalidation", "root");
+ UserPortal userPortal = userPortalCfg.getUserPortal();
+ UserNavigation navigation = userPortal.getNavigation(SiteKey.portal("cache_invalidation"));
+ UserNode root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
+ root.addChild("foo");
+
+ userPortal.saveNode(root, null);
+ root = userPortal.getNode(navigation, Scope.CHILDREN, null, null);
+ assertNotNull(root.getChild("foo")); // should Cache be invalidated right after save()
+ }
+ }.execute("root");
+ }
+
+ public void testInfiniteLoop()
+ {
+ new UnitTest()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("classic", getUserId());
+ UserPortal portal = userPortalCfg.getUserPortal();
+ UserNavigation nav = portal.getNavigation(SiteKey.group("/platform/administrators"));
+
+ //
+ UserNode root = portal.getNode(nav, Scope.GRANDCHILDREN, null, null);
+ portal.updateNode(root, Scope.GRANDCHILDREN, null); //Re-update the root node
+ Collection<UserNode> children = root.getChildren();
+ int level = 0;
+ for (UserNode child : children)
+ {
+ println(child, level);
+ }
+ }
+
+ private void println(UserNode node, int level)
+ {
+ Collection<UserNode> children = node.getChildren();
+ UserNode temp = null;
+ Iterator<UserNode> it = children.iterator();
+ while (it.hasNext())
+ {
+ UserNode child = it.next();
+ if (child == temp)
+ {
+ child = it.next();
+ fail("There is infinite loop");
+ }
+ temp = child;
+ println(child, level + 1);
+ }
+ }
+ }.execute("root");
+ }
+
+/*
+ public void testCreateUserPortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ userPortalConfigSer_.createUserPortalConfig(PortalConfig.PORTAL_TYPE, "jazz", "test");
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("jazz", "root");
+ assertNotNull(userPortalCfg);
+ PortalConfig portalCfg = userPortalCfg.getPortalConfig();
+ assertNotNull(portalCfg);
+ assertEquals(PortalConfig.PORTAL_TYPE, portalCfg.getType());
+ assertEquals("jazz", portalCfg.getName());
+ assertNotNull(userPortalCfg.getNavigations());
+ Map<String, PageNavigation> navigations = toMap(userPortalCfg);
+ assertEquals("expected to have 5 navigations instead of " + navigations, 5, navigations.size());
+ assertTrue(navigations.containsKey("portal::jazz"));
+ assertTrue(navigations.containsKey("group::/platform/administrators"));
+ assertTrue(navigations.containsKey("group::/organization/management/executive-board"));
+ assertTrue(navigations.containsKey("group::/platform/users"));
+ assertTrue(navigations.containsKey("user::root"));
+
+ queryPage();
+ }
+
+ private void queryPage()
+ {
+ Query<Page> query = new Query<Page>("portal", null, null, null, Page.class);
+ try
+ {
+ storage_.find(query);
+ }
+ catch (Exception ex)
+ {
+ assertTrue("Exception while querying pages with new portal", false);
+ }
+ }
+
+ }.execute("root");
+ }
+
+ public void testRemoveUserPortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ userPortalConfigSer_.createUserPortalConfig(PortalConfig.PORTAL_TYPE, "jazz", "test");
+ UserPortalConfig userPortalCfg = userPortalConfigSer_.getUserPortalConfig("jazz", "root");
+ assertNotNull(userPortalCfg);
+ saveMOP();
+ userPortalConfigSer_.removeUserPortalConfig("jazz");
+ saveMOP();
+ assertNull(userPortalConfigSer_.getUserPortalConfig("jazz", "root"));
+ }
+ }.execute("root");
+ }
+
+ public void testRootGetMakableNavigations()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Set<String> navigations = new HashSet<String>(userPortalConfigSer_.getMakableNavigations("root", false));
+ Set<String> expectedNavigations =
+ new HashSet<String>(Arrays.asList("/platform/users", "/organization/management/human-resources",
+ "/partners", "/customers", "/organization/communication", "/organization/management/executive-board",
+ "/organization/management", "/organization/operations", "/organization", "/platform",
+ "/organization/communication/marketing", "/platform/guests",
+ "/organization/communication/press-and-media", "/platform/administrators",
+ "/organization/operations/sales", "/organization/operations/finances"));
+ assertEquals(expectedNavigations, navigations);
+ }
+ }.execute(null);
+ }
+
+ public void testJohnGetMakableNavigations()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Set<String> navigations = new HashSet<String>(userPortalConfigSer_.getMakableNavigations("john", false));
+ Set<String> expectedNavigations = Collections.singleton("/organization/management/executive-board");
+ assertEquals(expectedNavigations, navigations);
+ }
+ }.execute(null);
+ }
+
+ public void testMaryGetMakableNavigations()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Set<String> navigations = new HashSet<String>(userPortalConfigSer_.getMakableNavigations("mary", false));
+ Set<String> expectedNavigations = Collections.emptySet();
+ assertEquals(expectedNavigations, navigations);
+ }
+ }.execute(null);
+ }
+
+ public void testRootGetPage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ assertEquals("group::/platform/administrators::newAccount", userPortalConfigSer_.getPage(
+ "group::/platform/administrators::newAccount", null).getPageId());
+ assertEquals("group::/organization/management/executive-board::newStaff", userPortalConfigSer_.getPage(
+ "group::/organization/management/executive-board::newStaff", null).getPageId());
+ }
+ }.execute("root");
+ }
+
+ public void testJohnGetPage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount", null));
+ assertEquals("group::/organization/management/executive-board::newStaff", userPortalConfigSer_.getPage(
+ "group::/organization/management/executive-board::newStaff", null).getPageId());
+ }
+ }.execute("john");
+ }
+
+ public void testMaryGetPage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount", null));
+ assertEquals(null, userPortalConfigSer_.getPage(
+ "group::/organization/management/executive-board::newStaff", null));
+ }
+ }.execute("mary");
+ }
+
+ public void testAnonymousGetPage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount", null));
+ assertEquals(null, userPortalConfigSer_.getPage(
+ "group::/organization/management/executive-board::newStaff", null));
+ }
+ }.execute(null);
+ }
+
+ public void testRemovePage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("/platform/administrators");
+ page.setName("newAccount");
+ assertTrue(events.isEmpty());
+ storage_.remove(page);
+ assertEquals(1, events.size());
+ Event event = events.removeFirst();
+ assertEquals(DataStorage.PAGE_REMOVED, event.getEventName());
+ Page p = ((Page)event.getData());
+ assertEquals("group", p.getOwnerType());
+ assertEquals("/platform/administrators", p.getOwnerId());
+ assertEquals("newAccount", p.getName());
+ assertEquals(null, userPortalConfigSer_.getPage("group::/platform/administrators::newAccount"));
+ }
+ }.execute(null);
+ }
+
+ public void testCreatePage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("/platform/administrators");
+ page.setName("whatever");
+ assertTrue(events.isEmpty());
+ storage_.create(page);
+ assertEquals(1, events.size());
+ Event event = events.removeFirst();
+ assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
+ Page p = ((Page)event.getData());
+ assertEquals("group", p.getOwnerType());
+ assertEquals("/platform/administrators", p.getOwnerId());
+ assertEquals("whatever", p.getName());
+ assertNotNull(userPortalConfigSer_.getPage("group::/platform/administrators::whatever"));
+ }
+ }.execute(null);
+ }
+
+ // Julien : see who added that and find out is test is relevant or not
+
+ public void testClonePage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("/platform/administrators");
+ page.setName("whatever");
+ page.setTitle("testTitle");
+ storage_.create(page);
+
+ String newName = "newPage";
+ Page newPage = storage_.clonePage(page.getPageId(), page.getOwnerType(), page.getOwnerId(), newName);
+
+ assertEquals(newName, newPage.getName());
+ assertEquals(page.getTitle(), newPage.getTitle());
+ }
+ }.execute(null);
+ }
+
+ public void testUpdatePage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("/platform/administrators");
+ page.setName("newAccount");
+ page.setShowMaxWindow(true);
+ page.setTitle("newAccount title");
+ assertTrue(events.isEmpty());
+ storage_.create(page);
+ assertEquals(1, events.size());
+ Event event = events.removeFirst();
+ assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
+ Page p = ((Page)event.getData());
+ assertEquals("group", p.getOwnerType());
+ assertEquals("/platform/administrators", p.getOwnerId());
+ assertEquals("newAccount", p.getName());
+ assertEquals("newAccount title", p.getTitle());
+ assertTrue(p.isShowMaxWindow());
+
+ p.setShowMaxWindow(false);
+ storage_.save(p);
+ p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
+ assertFalse(p.isShowMaxWindow());
+ p.setShowMaxWindow(true);
+ storage_.save(p);
+ p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
+ assertTrue(p.isShowMaxWindow());
+ p.setShowMaxWindow(false);
+ storage_.save(p);
+ p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
+ assertFalse(p.isShowMaxWindow());
+ p.setShowMaxWindow(true);
+ storage_.save(p);
+ p = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
+ assertTrue(p.isShowMaxWindow());
+
+ Page p2 = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
+ assertEquals("group", p2.getOwnerType());
+ assertEquals("/platform/administrators", p2.getOwnerId());
+ assertEquals("newAccount", p2.getName());
+ // assertFalse(p2.isShowMaxWindow());
+ p2.setTitle("newAccount title 1");
+ p2.setShowMaxWindow(true);
+ storage_.save(p2);
+
+ Page p3 = userPortalConfigSer_.getPage("group::/platform/administrators::newAccount");
+ assertEquals("newAccount title 1", p3.getTitle());
+ // assertTrue(p3.isShowMaxWindow());
+
+ }
+ }.execute(null);
+ }
+
+ public void testRemoveNavigation()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ PageNavigation navigation = new PageNavigation();
+ navigation.setOwnerType("group");
+ navigation.setOwnerId("/platform/administrators");
+ assertTrue(events.isEmpty());
+ storage_.remove(navigation);
+ assertEquals(1, events.size());
+ Event event = events.removeFirst();
+ assertEquals(DataStorage.NAVIGATION_REMOVED, event.getEventName());
+ PageNavigation n = ((PageNavigation)event.getData());
+ assertEquals("group", n.getOwnerType());
+ assertEquals("/platform/administrators", n.getOwnerId());
+ assertEquals(null, storage_.getPageNavigation("group", "/platform/administrators"));
+ }
+ }.execute(null);
+ }
+
+ public void testCreateNavigation()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ PageNavigation navigation = new PageNavigation();
+ navigation.setOwnerType("group");
+ navigation.setOwnerId("/platform/administrators");
+ storage_.remove(navigation);
+ assertNotNull(events.removeLast());
+ assertTrue(events.isEmpty());
+ storage_.create(navigation);
+ assertEquals(1, events.size());
+ Event event = events.removeFirst();
+ assertEquals(DataStorage.NAVIGATION_CREATED, event.getEventName());
+ PageNavigation n = ((PageNavigation)event.getData());
+ assertEquals("group", n.getOwnerType());
+ assertEquals("/platform/administrators", n.getOwnerId());
+ PageNavigation n2 = storage_.getPageNavigation("group", "/platform/administrators");
+ assertEquals("group", n2.getOwnerType());
+ assertEquals("/platform/administrators", n2.getOwnerId());
+ }
+ }.execute(null);
+ }
+
+ */
+/*
+ public void testCreateMultipleNavigations(){
+ for(int i =0; i < 10; i++){
+ createNavigation(null, "group", "/platform/administrators" + i);
+ }
+ }
+
+ private void createNavigation(final String user, final String ownerType, final String ownerId)
+ {
+ new UnitTest()
+ {
+
+ public void execute() throws Exception
+ {
+ createNavigationInSeperatedThread();
+ }
+
+ private void createNavigationInSeperatedThread()
+ {
+ Thread task = new Thread()
+ {
+ public void run()
+ {
+ PageNavigation navigation = new PageNavigation();
+ navigation.setOwnerType(ownerType);
+ navigation.setOwnerId(ownerId);
+ try
+ {
+ userPortalConfigSer_.create(navigation);
+ Event event = events.removeFirst();
+ assertEquals(DataStorage.CREATE_NAVIGATION_EVENT, event.getEventName());
+ PageNavigation n1 = (PageNavigation)event.getSource();
+ assertEquals(ownerType, n1.getOwnerType());
+ assertEquals(ownerId, n1.getOwnerId());
+ PageNavigation n2 = storage_.getPageNavigation(ownerType, ownerId);
+ assertEquals(ownerType, n2.getOwnerType());
+ assertEquals(ownerId, n2.getOwnerId());
+ }
+ catch (Exception ex)
+ {
+ assertTrue("Failed while create '" + ownerType + " ' navigation for owner: " + ownerId, false);
+ ex.printStackTrace();
+ }
+ }
+ };
+
+ task.start();
+ try
+ {
+ task.sleep(200);
+ }
+ catch (InterruptedException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }.execute(user);
+ }
+ *//*
+
+
+ public void testUpdateNavigation()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ PageNavigation navigation = new PageNavigation();
+ navigation.setOwnerType("group");
+ navigation.setOwnerId("/platform/administrators");
+ navigation.setPriority(3);
+ assertTrue(events.isEmpty());
+ storage_.save(navigation);
+ assertEquals(1, events.size());
+ Event event = events.removeFirst();
+ assertEquals(DataStorage.NAVIGATION_UPDATED, event.getEventName());
+ PageNavigation n = ((PageNavigation)event.getData());
+ assertEquals("group", n.getOwnerType());
+ assertEquals("/platform/administrators", n.getOwnerId());
+ assertEquals(3, n.getPriority());
+ PageNavigation n2 = storage_.getPageNavigation("group", "/platform/administrators");
+ assertEquals("group", n2.getOwnerType());
+ assertEquals("/platform/administrators", n2.getOwnerId());
+ assertEquals(3, n2.getPriority());
+ }
+ }.execute(null);
+ }
+
+ public void testRenewPage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Page clone = storage_.clonePage("portal::test::test4", "portal", "test", "test5");
+ assertNotNull(clone);
+ assertEquals("portal", clone.getOwnerType());
+ assertEquals("test", clone.getOwnerId());
+ assertEquals("test5", clone.getName());
+
+ //
+ Application<Portlet> app = (Application<Portlet>)clone.getChildren().get(0);
+ Portlet prefs2 = storage_.load(app.getState(), ApplicationType.PORTLET);
+ assertEquals(new PortletBuilder().add("template",
+ "par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl").build(), prefs2);
+
+ // Update prefs of original page
+ PortletPreferences prefs = new PortletPreferences();
+ prefs.setWindowId("portal#test:/web/BannerPortlet/banner");
+ storage_.save(prefs);
+
+ //
+ prefs2 = storage_.load(app.getState(), ApplicationType.PORTLET);
+ assertEquals(new PortletBuilder().add("template",
+ "par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl").build(), prefs2);
+ }
+ }.execute(null);
+ }
+
+ public void testCreateFromTemplate()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ Page clone = userPortalConfigSer_.createPageTemplate("dashboard", "portal", "test");
+ assertNotNull(clone);
+ assertEquals("portal", clone.getOwnerType());
+ assertEquals("test", clone.getOwnerId());
+
+ //
+ assertEquals(1, clone.getChildren().size());
+
+ //
+ Application<Portlet> app = (Application<Portlet>)clone.getChildren().get(0);
+ assertEquals("Dashboard", app.getTitle());
+ assertNotNull(app.getState());
+ assertEquals("dashboard/DashboardPortlet", storage_.getId(app.getState()));
+ // assertEquals("portal", app.getInstanceState().getOwnerType());
+ // assertEquals("test", app.getInstanceState().getOwnerId());
+ Portlet prefs2 = storage_.load(app.getState(), ApplicationType.PORTLET);
+ assertNull(prefs2);
+ }
+ }.execute(null);
+ }
+
+ public void testOverwriteUserLayout()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ mgr.clearCache();
+
+ PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "overwritelayout");
+ assertNotNull(cfg);
+
+ Container container = cfg.getPortalLayout();
+ assertNotNull(container);
+ assertEquals(2, container.getChildren().size());
+ assertTrue(container.getChildren().get(0) instanceof PageBody);
+ assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
+ Application<Portlet> pa = (Application<Portlet>)container.getChildren().get(1);
+ ApplicationState<Portlet> state = pa.getState();
+ assertEquals("overwrite_application_ref/overwrite_portlet_ref", storage_.getId(state));
+ }
+ }.execute(null);
+ }
+
+ public void testUserTemplate()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ assertNull(storage_.getPortalConfig(PortalConfig.USER_TYPE, "user"));
+ assertNull(storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien"));
+
+ //
+ UserHandler userHandler = orgService_.getUserHandler();
+ User user = userHandler.createUserInstance("julien");
+ user.setPassword("default");
+ user.setFirstName("default");
+ user.setLastName("default");
+ user.setEmail("exo(a)exoportal.org");
+ userHandler.createUser(user, true);
+
+ //
+ PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien");
+ assertNotNull(cfg);
+ Container container = cfg.getPortalLayout();
+ assertNotNull(container);
+ assertEquals(2, container.getChildren().size());
+ assertTrue(container.getChildren().get(0) instanceof PageBody);
+ assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
+ Application<Portlet> pa = (Application<Portlet>)container.getChildren().get(1);
+ ApplicationState state = pa.getState();
+ assertEquals("foo/bar", storage_.getId(pa.getState()));
+ }
+ }.execute(null);
+ }
+
+ public void testGroupTemplate()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ String groupName = "groupTest";
+ assertNull(storage_.getPortalConfig(PortalConfig.GROUP_TYPE, groupName));
+
+ //
+ GroupHandler groupHandler = orgService_.getGroupHandler();
+ Group group = groupHandler.createGroupInstance();
+ group.setGroupName(groupName);
+ group.setDescription("this is a group for test");
+ groupHandler.addChild(null, group, true);
+
+ //
+ PortalConfig cfg = storage_.getPortalConfig(PortalConfig.GROUP_TYPE, "/" + groupName);
+ assertNotNull(cfg);
+ Container container = cfg.getPortalLayout();
+ assertNotNull(container);
+ assertEquals(4, container.getChildren().size());
+ assertTrue(container.getChildren().get(2) instanceof PageBody);
+ assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
+
+ groupHandler.removeGroup(group, true);
+ }
+ }.execute(null);
+ }
+
+ public void testCacheUserPortalConfig()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ mgr.clearCache();
+ DataCache cache = mgr.getDecorator(DataCache.class);
+ long readCount0 = cache.getReadCount();
+ userPortalConfigSer_.getUserPortalConfig("classic", null);
+ long readCount1 = cache.getReadCount();
+ assertTrue(readCount1 > readCount0);
+ userPortalConfigSer_.getUserPortalConfig("classic", null);
+ long readCount2 = cache.getReadCount();
+ assertEquals(readCount1, readCount2);
+ }
+ }.execute(null);
+ }
+
+ public void testCachePage()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ mgr.clearCache();
+ DataCache cache = mgr.getDecorator(DataCache.class);
+ long readCount0 = cache.getReadCount();
+ userPortalConfigSer_.getPage("portal::test::test1");
+ long readCount1 = cache.getReadCount();
+ assertTrue(readCount1 > readCount0);
+ userPortalConfigSer_.getPage("portal::test::test1");
+ long readCount2 = cache.getReadCount();
+ assertEquals(readCount1, readCount2);
+ }
+ }.execute(null);
+ }
+
+ public void testCachePageNavigation()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ mgr.clearCache();
+ DataCache cache = mgr.getDecorator(DataCache.class);
+ long readCount0 = cache.getReadCount();
+ storage_.getPageNavigation("portal", "test");
+ long readCount1 = cache.getReadCount();
+ assertTrue(readCount1 > readCount0);
+ storage_.getPageNavigation("portal", "test");
+ long readCount2 = cache.getReadCount();
+ assertEquals(readCount1, readCount2);
+ }
+ }.execute(null);
+ }
+
+ */
+
+ private abstract class UnitTest
+ {
+
+ /** . */
+ private String userId;
+
+ protected final void execute(String userId)
+ {
+ Throwable failure = null;
+
+ //
+ begin();
+
+ //
+ ConversationState conversationState = null;
+ if (userId != null)
+ {
+ try
+ {
+ conversationState = new ConversationState(authenticator.createIdentity(userId));
+ }
+ catch (Exception e)
+ {
+ failure = e;
+ }
+ }
+
+ //
+ if (failure == null)
+ {
+ // Clear cache for test
+ mgr.clearCache();
+
+ //
+ this.userId = userId;
+ ConversationState.setCurrent(conversationState);
+ try
+ {
+ execute();
+ }
+ catch (Exception e)
+ {
+ failure = e;
+ log.error("Test failed", e);
+ }
+ finally
+ {
+ this.userId = null;
+ ConversationState.setCurrent(null);
+ end();
+ }
+ }
+
+ // Report error as a junit assertion failure
+ if (failure != null)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(failure);
+ throw err;
+ }
+ }
+
+ public final String getUserId()
+ {
+ return userId;
+ }
+
+ protected abstract void execute() throws Exception;
+
+ }
+}
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,738 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.tree.list;
-
-import junit.framework.TestCase;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestListTree extends TestCase
-{
-
- public static class IntegerTree extends ListTree<IntegerTree>
- {
-
- /** . */
- private final int value;
-
- public IntegerTree(int value)
- {
- this.value = value;
- }
- }
-
- private static IntegerTree tree(String name, int value, IntegerTree... trees)
- {
- IntegerTree tree = new IntegerTree(value);
- if (trees != null)
- {
- for (IntegerTree child : trees)
- {
- tree.insertAt(null, child);
- }
- }
- return tree;
- }
-
- private void assertChildren(IntegerTree tree, Integer... expected)
- {
- List<Integer> children = new ArrayList<Integer>();
- for (Iterator<IntegerTree> iterator = tree.listIterator();iterator.hasNext();)
- {
- IntegerTree next = iterator.next();
- children.add(next.value);
- }
- assertEquals(Arrays.asList(expected), children);
- }
-
- private void assertAllChildren(IntegerTree tree, Integer... expected)
- {
- List<Integer> children = new ArrayList<Integer>();
- for (IntegerTree current = tree.getFirst();current != null;current = current.getNext())
- {
- children.add(current.value);
- }
- assertEquals(Arrays.asList(expected), children);
- }
-
- private void assertAllChildren(IntegerTree tree)
- {
- assertAllChildren(tree, new Integer[0]);
- }
-
- public void testInsert1()
- {
- IntegerTree root = tree("", 0);
- assertChildren(root);
- assertAllChildren(root);
-
- //
- root = tree("", 0);
- root.insertAt(0, tree("a", 1));
- assertChildren(root, 1);
- assertAllChildren(root, 1);
-
- //
- root = tree("", 0);
- root.insertAt(null, tree("a", 1));
- assertChildren(root, 1);
- assertAllChildren(root, 1);
- }
-
-/*
- public void testInsertDuplicate()
- {
- IntegerTree root = tree("", 0, tree("a", 1));
- assertChildren(root, 1);
- assertAllChildren(root, 1);
-
- //
- try
- {
- root.insertAt(0, tree("a", 2));
- fail();
- }
- catch (IllegalArgumentException ignore)
- {
- assertAllChildren(root, 1);
- }
- }
-*/
-
- public void testInsertMove1()
- {
- IntegerTree a = tree("a", 1);
- IntegerTree b = tree("b", 2);
- IntegerTree root1 = tree("", 0, a, b);
-
- //
- root1.insertAt(0, b);
- assertAllChildren(root1, 2, 1);
- }
-
- public void testInsertMove2()
- {
- IntegerTree a = tree("a", 1);
- IntegerTree root1 = tree("", 0, a);
-
- //
- root1.insertAt(null, a);
- assertAllChildren(root1, 1);
-
- //
- root1.insertAt(0, a);
- assertAllChildren(root1, 1);
- }
-
- public void testInsertMove3()
- {
- IntegerTree a = tree("a", 1);
- IntegerTree root1 = tree("", 0, a);
- IntegerTree root2 = tree("", 0);
-
- //
- root2.insertAt(0, a);
- assertAllChildren(root1);
- assertAllChildren(root2, 1);
- assertSame(root2, a.getParent());
- }
-
- public void testInsertReorder1()
- {
- IntegerTree a = tree("a", 1);
- IntegerTree root1 = tree("", 0, a);
-
- //
- root1.insertAt(0, a);
- assertAllChildren(root1, 1);
- assertSame(root1, a.getParent());
- }
-
- public void testInsertReorder2()
- {
- IntegerTree a = tree("a", 1);
- IntegerTree root1 = tree("", 0, a, tree("b", 2));
-
- //
- root1.insertAt(2, a);
- assertAllChildren(root1, 2, 1);
- assertSame(root1, a.getParent());
-
- //
- root1.insertAt(0, a);
- assertAllChildren(root1, 1, 2);
- assertSame(root1, a.getParent());
- }
-
- public void testRemove()
- {
- IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
- assertAllChildren(root, 1, 2, 3);
-
- //
- IntegerTree b = root.get(1);
- b.remove();
- assertNull(b.getParent());
- assertNull(b.getPrevious());
- assertNull(b.getNext());
- assertEquals(2, b.value);
- assertAllChildren(root, 1, 3);
- }
-
- public void testRemoveLast()
- {
- IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2));
- assertAllChildren(root, 1, 2);
-
- //
- IntegerTree b = root.get(1);
- assertEquals(2, b.value);
- b.remove();
- assertAllChildren(root, 1);
- assertEquals(1, root.getLast().value);
- }
-
-/*
- public void testRename()
- {
- IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
- assertAllChildren(root, 1, 2, 3);
- assertAllChildren(root, "a", "b", "c");
-
- //
- root.rename("a", "a");
- assertAllChildren(root, 1, 2, 3);
- assertAllChildren(root, "a", "b", "c");
-
- //
- root.rename("a", "d");
- assertAllChildren(root, 1, 2, 3);
- assertAllChildren(root, "d", "b", "c");
- }
-
- public void testRenameWithNoChildren()
- {
- IntegerTree root = tree("", 0, (IntegerTree[]) null);
- assertFalse(root.hasTrees());
-
- //
- try
- {
- root.rename("a", "b");
- fail();
- }
- catch (IllegalStateException e)
- {
- assertFalse(root.hasTrees());
- }
- }
-
- public void testRenameWithNonExisting()
- {
- IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
- assertAllChildren(root, 1, 2, 3);
- assertAllChildren(root, "a", "b", "c");
-
- //
- try
- {
- root.rename("d", "e");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertAllChildren(root, 1, 2, 3);
- assertAllChildren(root, "a", "b", "c");
- }
- }
-
- public void testRenameWithExisting()
- {
- IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
- assertAllChildren(root, 1, 2, 3);
- assertAllChildren(root, "a", "b", "c");
-
- //
- try
- {
- root.rename("a", "c");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertAllChildren(root, 1, 2, 3);
- assertAllChildren(root, "a", "b", "c");
- }
- }
-*/
-
-/*
- public void testGetByIndexWithNoChildren()
- {
- IntegerTree root = tree("", 0, (IntegerTree[]) null);
-
- //
- try
- {
- root.get(0);
- fail();
- }
- catch (IllegalStateException e)
- {
- }
- }
-*/
-
- public void testIteratorRemove()
- {
- IntegerTree root = tree("", 0, tree("a", 1));
- Iterator<IntegerTree> it = root.listIterator();
-
- //
- try
- {
- it.remove();
- fail();
- }
- catch (IllegalStateException e)
- {
- }
-
- //
- IntegerTree a = it.next();
- it.remove();
- assertNull(a.getParent());
- assertFalse(it.hasNext());
- assertAllChildren(root);
- }
-
- public void testListIterator1()
- {
- IntegerTree a = tree("a", 1);
- IntegerTree root = tree("", 0, a);
-
- //
- ListIterator<IntegerTree> i = root.listIterator();
- assertTrue(i.hasNext());
- assertEquals(0, i.nextIndex());
- assertFalse(i.hasPrevious());
- assertEquals(-1, i.previousIndex());
-
- //
- assertSame(a, i.next());
- assertFalse(i.hasNext());
- assertEquals(1, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(0, i.previousIndex());
-
- //
- assertSame(a, i.previous());
- assertTrue(i.hasNext());
- assertEquals(0, i.nextIndex());
- assertFalse(i.hasPrevious());
- assertEquals(-1, i.previousIndex());
- }
-
- public void testListIterator2()
- {
- IntegerTree a = tree("a", 1);
- IntegerTree b = tree("b", 2);
- IntegerTree root = tree("", 0, a, b);
-
- //
- ListIterator<IntegerTree> i = root.listIterator();
- assertTrue(i.hasNext());
- assertEquals(0, i.nextIndex());
- assertFalse(i.hasPrevious());
- assertEquals(-1, i.previousIndex());
- assertSame(a, i.next());
- assertTrue(i.hasNext());
- assertEquals(1, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(0, i.previousIndex());
- assertSame(b, i.next());
- assertFalse(i.hasNext());
- assertEquals(2, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(1, i.previousIndex());
- i.remove();
- assertFalse(i.hasNext());
- assertEquals(1, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(0, i.previousIndex());
- }
-
- public void testListIterator3()
- {
- // Remove middle
- IntegerTree a = tree("a", 1);
- IntegerTree b = tree("b", 2);
- IntegerTree c = tree("c", 3);
- IntegerTree root = tree("", 0, a, b, c);
- ListIterator<IntegerTree> i = root.listIterator();
- i.next();
- i.next();
- i.remove();
- assertTrue(i.hasNext());
- assertEquals(1, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(0, i.previousIndex());
- assertSame(c, i.next());
-
- // Remove middle
- root = tree("", 0, a = tree("a", 1), b = tree("b", 2), c = tree("c", 3));
- i = root.listIterator();
- i.next();
- i.next();
- i.next();
- i.previous();
- i.previous();
- i.remove();
- assertTrue(i.hasNext());
- assertEquals(1, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(0, i.previousIndex());
- assertSame(c, i.next());
-
- // Remove middle
- root = tree("", 0, a = tree("a", 1), b = tree("b", 2), c = tree("c", 3));
- i = root.listIterator();
- i.next();
- i.next();
- i.remove();
- assertTrue(i.hasNext());
- assertEquals(1, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(0, i.previousIndex());
- assertSame(a, i.previous());
-
- // Remove middle
- root = tree("", 0, a = tree("a", 1), b = tree("b", 2), c = tree("c", 3));
- i = root.listIterator();
- i.next();
- i.next();
- i.next();
- i.previous();
- i.previous();
- i.remove();
- assertTrue(i.hasNext());
- assertEquals(1, i.nextIndex());
- assertTrue(i.hasPrevious());
- assertEquals(0, i.previousIndex());
- assertSame(a, i.previous());
- }
-
- @SuppressWarnings("unchecked")
- public void testListIteratorNavigation()
- {
- IntegerTree root = tree("", 0, tree("1", 1), tree("2", 2), tree("3", 3), tree("4", 4), tree("5", 5));
- ListIterator<IntegerTree> it = root.listIterator();
- assertTrue(it.hasNext());
- assertTrue(!it.hasPrevious());
- assertEquals(-1, it.previousIndex());
- assertEquals(0, it.nextIndex());
- assertEquals(1, it.next().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(0, it.previousIndex());
- assertEquals(1, it.nextIndex());
- assertEquals(1, it.previous().value);
- assertTrue(it.hasNext());
- assertTrue(!it.hasPrevious());
- assertEquals(-1, it.previousIndex());
- assertEquals(0, it.nextIndex());
- assertEquals(1, it.next().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(0, it.previousIndex());
- assertEquals(1, it.nextIndex());
- assertEquals(2, it.next().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(1, it.previousIndex());
- assertEquals(2, it.nextIndex());
- assertEquals(2, it.previous().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(0, it.previousIndex());
- assertEquals(1, it.nextIndex());
- assertEquals(2, it.next().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(1, it.previousIndex());
- assertEquals(2, it.nextIndex());
- assertEquals(3, it.next().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(2, it.previousIndex());
- assertEquals(3, it.nextIndex());
- assertEquals(4, it.next().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(3, it.previousIndex());
- assertEquals(4, it.nextIndex());
- assertEquals(5, it.next().value);
- assertTrue(!it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(4, it.previousIndex());
- assertEquals(5, it.nextIndex());
- assertEquals(5, it.previous().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(3, it.previousIndex());
- assertEquals(4, it.nextIndex());
- assertEquals(4, it.previous().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(2, it.previousIndex());
- assertEquals(3, it.nextIndex());
- assertEquals(3, it.previous().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(1, it.previousIndex());
- assertEquals(2, it.nextIndex());
- assertEquals(2, it.previous().value);
- assertTrue(it.hasNext());
- assertTrue(it.hasPrevious());
- assertEquals(0, it.previousIndex());
- assertEquals(1, it.nextIndex());
- assertEquals(1, it.previous().value);
- assertTrue(it.hasNext());
- assertTrue(!it.hasPrevious());
- assertEquals(-1, it.previousIndex());
- assertEquals(0, it.nextIndex());
- }
-
- /*
- @Override
- @SuppressWarnings("unchecked")
- public void testListIteratorSet() {
- list.add((E) "1");
- list.add((E) "2");
- list.add((E) "3");
- list.add((E) "4");
- list.add((E) "5");
-
- ListIterator<E> it = list.listIterator();
- assertEquals("1", it.next());
- it.set((E) "a");
- assertEquals("a", it.previous());
- it.set((E) "A");
- assertEquals("A", it.next());
- assertEquals("2", it.next());
- it.set((E) "B");
- assertEquals("3", it.next());
- assertEquals("4", it.next());
- it.set((E) "D");
- assertEquals("5", it.next());
- it.set((E) "E");
- assertEquals("[A, B, 3, D, E]", list.toString());
- }
- */
-
- public void testListIteratorRemove()
- {
- IntegerTree root = tree("", 0, tree("1", 1), tree("2", 2), tree("3", 3), tree("4", 4), tree("5", 5));
- ListIterator<IntegerTree> it = root.listIterator();
- try
- {
- it.remove();
- fail();
- }
- catch (IllegalStateException e)
- {
- // expected
- }
- assertEquals(1, it.next().value);
- assertEquals(2, it.next().value);
- assertAllChildren(root, 1, 2, 3, 4, 5);
- it.remove();
- assertAllChildren(root, 1, 3, 4, 5);
- assertEquals(3, it.next().value);
- assertEquals(3, it.previous().value);
- assertEquals(1, it.previous().value);
- it.remove();
- assertAllChildren(root, 3, 4, 5);
- assertTrue(!it.hasPrevious());
- assertEquals(3, it.next().value);
- it.remove();
- assertAllChildren(root, 4, 5);
- try
- {
- it.remove();
- fail();
- }
- catch (IllegalStateException e)
- {
- // expected
- }
- assertEquals(4, it.next().value);
- assertEquals(5, it.next().value);
- it.remove();
- assertAllChildren(root, 4);
- assertEquals(4, it.previous().value);
- it.remove();
- assertAllChildren(root);
- }
-
- public void testListIteratorAdd()
- {
- IntegerTree root = tree("", 0);
- ListIterator<IntegerTree> it = root.listIterator();
- it.add(tree("a", 1));
- assertEquals(0, it.previousIndex());
- assertEquals(1, it.nextIndex());
- assertAllChildren(root, 1);
- it.add(tree("c", 3));
- assertEquals(1, it.previousIndex());
- assertEquals(2, it.nextIndex());
- assertAllChildren(root, 1, 3);
- it.add(tree("e", 5));
- assertEquals(2, it.previousIndex());
- assertEquals(3, it.nextIndex());
- assertAllChildren(root, 1, 3, 5);
- assertEquals(5, it.previous().value);
- assertEquals(1, it.previousIndex());
- assertEquals(2, it.nextIndex());
- it.add(tree("d", 4));
- assertEquals(2, it.previousIndex());
- assertEquals(3, it.nextIndex());
- assertAllChildren(root, 1, 3, 4, 5);
- assertEquals(4, it.previous().value);
- assertEquals(1, it.previousIndex());
- assertEquals(2, it.nextIndex());
- assertEquals(3, it.previous().value);
- assertEquals(0, it.previousIndex());
- assertEquals(1, it.nextIndex());
- it.add(tree("b", 2));
- assertEquals(1, it.previousIndex());
- assertEquals(2, it.nextIndex());
- assertAllChildren(root, 1, 2, 3, 4, 5);
- }
-
- public void testListIteratorMove()
- {
- IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
- ListIterator<IntegerTree> it = root.listIterator();
- it.add(root.get(2));
- assertAllChildren(root, 3, 1, 2);
- }
-
- public void testInsertFirstThrowsNPE()
- {
- IntegerTree a = tree("a", 0);
- try
- {
- a.insertFirst(null);
- fail();
- }
- catch (NullPointerException ignore)
- {
- }
- }
-
- public void testInsertLastThrowsNPE()
- {
- IntegerTree a = tree("a", 0);
- try
- {
- a.insertLast(null);
- fail();
- }
- catch (NullPointerException ignore)
- {
- }
- }
-
- public void testInsertBeforeThrowsNPE()
- {
- IntegerTree a = tree("a", 0);
- try
- {
- a.insertBefore(null);
- fail();
- }
- catch (NullPointerException ignore)
- {
- }
- }
-
- public void testInsertBeforeThrowsISE()
- {
- IntegerTree a = tree("a", 0);
- IntegerTree b = tree("b", 1);
- try
- {
- a.insertBefore(b);
- fail();
- }
- catch (IllegalStateException ignore)
- {
- }
- }
-
- public void testInsertAfterThrowsNPE()
- {
- IntegerTree a = tree("a", 0);
- try
- {
- a.insertAfter(null);
- fail();
- }
- catch (NullPointerException ignore)
- {
- }
- }
-
- public void testInsertAfterThrowsISE()
- {
- IntegerTree a = tree("a", 0);
- IntegerTree b = tree("b", 1);
- try
- {
- a.insertAfter(b);
- fail();
- }
- catch (IllegalStateException ignore)
- {
- }
- }
-
- public void testRemoveThrowsISE()
- {
- IntegerTree a = tree("a", 0);
- try
- {
- a.remove();
- fail();
- }
- catch (IllegalStateException ignore)
- {
- }
- }
-}
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java (from rev 6783, portal/trunk/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/tree/list/TestListTree.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,738 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.tree.list;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestListTree extends TestCase
+{
+
+ public static class IntegerTree extends ListTree<IntegerTree>
+ {
+
+ /** . */
+ private final int value;
+
+ public IntegerTree(int value)
+ {
+ this.value = value;
+ }
+ }
+
+ private static IntegerTree tree(String name, int value, IntegerTree... trees)
+ {
+ IntegerTree tree = new IntegerTree(value);
+ if (trees != null)
+ {
+ for (IntegerTree child : trees)
+ {
+ tree.insertAt(null, child);
+ }
+ }
+ return tree;
+ }
+
+ private void assertChildren(IntegerTree tree, Integer... expected)
+ {
+ List<Integer> children = new ArrayList<Integer>();
+ for (Iterator<IntegerTree> iterator = tree.listIterator();iterator.hasNext();)
+ {
+ IntegerTree next = iterator.next();
+ children.add(next.value);
+ }
+ assertEquals(Arrays.asList(expected), children);
+ }
+
+ private void assertAllChildren(IntegerTree tree, Integer... expected)
+ {
+ List<Integer> children = new ArrayList<Integer>();
+ for (IntegerTree current = tree.getFirst();current != null;current = current.getNext())
+ {
+ children.add(current.value);
+ }
+ assertEquals(Arrays.asList(expected), children);
+ }
+
+ private void assertAllChildren(IntegerTree tree)
+ {
+ assertAllChildren(tree, new Integer[0]);
+ }
+
+ public void testInsert1()
+ {
+ IntegerTree root = tree("", 0);
+ assertChildren(root);
+ assertAllChildren(root);
+
+ //
+ root = tree("", 0);
+ root.insertAt(0, tree("a", 1));
+ assertChildren(root, 1);
+ assertAllChildren(root, 1);
+
+ //
+ root = tree("", 0);
+ root.insertAt(null, tree("a", 1));
+ assertChildren(root, 1);
+ assertAllChildren(root, 1);
+ }
+
+/*
+ public void testInsertDuplicate()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1));
+ assertChildren(root, 1);
+ assertAllChildren(root, 1);
+
+ //
+ try
+ {
+ root.insertAt(0, tree("a", 2));
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ assertAllChildren(root, 1);
+ }
+ }
+*/
+
+ public void testInsertMove1()
+ {
+ IntegerTree a = tree("a", 1);
+ IntegerTree b = tree("b", 2);
+ IntegerTree root1 = tree("", 0, a, b);
+
+ //
+ root1.insertAt(0, b);
+ assertAllChildren(root1, 2, 1);
+ }
+
+ public void testInsertMove2()
+ {
+ IntegerTree a = tree("a", 1);
+ IntegerTree root1 = tree("", 0, a);
+
+ //
+ root1.insertAt(null, a);
+ assertAllChildren(root1, 1);
+
+ //
+ root1.insertAt(0, a);
+ assertAllChildren(root1, 1);
+ }
+
+ public void testInsertMove3()
+ {
+ IntegerTree a = tree("a", 1);
+ IntegerTree root1 = tree("", 0, a);
+ IntegerTree root2 = tree("", 0);
+
+ //
+ root2.insertAt(0, a);
+ assertAllChildren(root1);
+ assertAllChildren(root2, 1);
+ assertSame(root2, a.getParent());
+ }
+
+ public void testInsertReorder1()
+ {
+ IntegerTree a = tree("a", 1);
+ IntegerTree root1 = tree("", 0, a);
+
+ //
+ root1.insertAt(0, a);
+ assertAllChildren(root1, 1);
+ assertSame(root1, a.getParent());
+ }
+
+ public void testInsertReorder2()
+ {
+ IntegerTree a = tree("a", 1);
+ IntegerTree root1 = tree("", 0, a, tree("b", 2));
+
+ //
+ root1.insertAt(2, a);
+ assertAllChildren(root1, 2, 1);
+ assertSame(root1, a.getParent());
+
+ //
+ root1.insertAt(0, a);
+ assertAllChildren(root1, 1, 2);
+ assertSame(root1, a.getParent());
+ }
+
+ public void testRemove()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
+ assertAllChildren(root, 1, 2, 3);
+
+ //
+ IntegerTree b = root.get(1);
+ b.remove();
+ assertNull(b.getParent());
+ assertNull(b.getPrevious());
+ assertNull(b.getNext());
+ assertEquals(2, b.value);
+ assertAllChildren(root, 1, 3);
+ }
+
+ public void testRemoveLast()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2));
+ assertAllChildren(root, 1, 2);
+
+ //
+ IntegerTree b = root.get(1);
+ assertEquals(2, b.value);
+ b.remove();
+ assertAllChildren(root, 1);
+ assertEquals(1, root.getLast().value);
+ }
+
+/*
+ public void testRename()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
+ assertAllChildren(root, 1, 2, 3);
+ assertAllChildren(root, "a", "b", "c");
+
+ //
+ root.rename("a", "a");
+ assertAllChildren(root, 1, 2, 3);
+ assertAllChildren(root, "a", "b", "c");
+
+ //
+ root.rename("a", "d");
+ assertAllChildren(root, 1, 2, 3);
+ assertAllChildren(root, "d", "b", "c");
+ }
+
+ public void testRenameWithNoChildren()
+ {
+ IntegerTree root = tree("", 0, (IntegerTree[]) null);
+ assertFalse(root.hasTrees());
+
+ //
+ try
+ {
+ root.rename("a", "b");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ assertFalse(root.hasTrees());
+ }
+ }
+
+ public void testRenameWithNonExisting()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
+ assertAllChildren(root, 1, 2, 3);
+ assertAllChildren(root, "a", "b", "c");
+
+ //
+ try
+ {
+ root.rename("d", "e");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ assertAllChildren(root, 1, 2, 3);
+ assertAllChildren(root, "a", "b", "c");
+ }
+ }
+
+ public void testRenameWithExisting()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
+ assertAllChildren(root, 1, 2, 3);
+ assertAllChildren(root, "a", "b", "c");
+
+ //
+ try
+ {
+ root.rename("a", "c");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ assertAllChildren(root, 1, 2, 3);
+ assertAllChildren(root, "a", "b", "c");
+ }
+ }
+*/
+
+/*
+ public void testGetByIndexWithNoChildren()
+ {
+ IntegerTree root = tree("", 0, (IntegerTree[]) null);
+
+ //
+ try
+ {
+ root.get(0);
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+*/
+
+ public void testIteratorRemove()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1));
+ Iterator<IntegerTree> it = root.listIterator();
+
+ //
+ try
+ {
+ it.remove();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+
+ //
+ IntegerTree a = it.next();
+ it.remove();
+ assertNull(a.getParent());
+ assertFalse(it.hasNext());
+ assertAllChildren(root);
+ }
+
+ public void testListIterator1()
+ {
+ IntegerTree a = tree("a", 1);
+ IntegerTree root = tree("", 0, a);
+
+ //
+ ListIterator<IntegerTree> i = root.listIterator();
+ assertTrue(i.hasNext());
+ assertEquals(0, i.nextIndex());
+ assertFalse(i.hasPrevious());
+ assertEquals(-1, i.previousIndex());
+
+ //
+ assertSame(a, i.next());
+ assertFalse(i.hasNext());
+ assertEquals(1, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(0, i.previousIndex());
+
+ //
+ assertSame(a, i.previous());
+ assertTrue(i.hasNext());
+ assertEquals(0, i.nextIndex());
+ assertFalse(i.hasPrevious());
+ assertEquals(-1, i.previousIndex());
+ }
+
+ public void testListIterator2()
+ {
+ IntegerTree a = tree("a", 1);
+ IntegerTree b = tree("b", 2);
+ IntegerTree root = tree("", 0, a, b);
+
+ //
+ ListIterator<IntegerTree> i = root.listIterator();
+ assertTrue(i.hasNext());
+ assertEquals(0, i.nextIndex());
+ assertFalse(i.hasPrevious());
+ assertEquals(-1, i.previousIndex());
+ assertSame(a, i.next());
+ assertTrue(i.hasNext());
+ assertEquals(1, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(0, i.previousIndex());
+ assertSame(b, i.next());
+ assertFalse(i.hasNext());
+ assertEquals(2, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(1, i.previousIndex());
+ i.remove();
+ assertFalse(i.hasNext());
+ assertEquals(1, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(0, i.previousIndex());
+ }
+
+ public void testListIterator3()
+ {
+ // Remove middle
+ IntegerTree a = tree("a", 1);
+ IntegerTree b = tree("b", 2);
+ IntegerTree c = tree("c", 3);
+ IntegerTree root = tree("", 0, a, b, c);
+ ListIterator<IntegerTree> i = root.listIterator();
+ i.next();
+ i.next();
+ i.remove();
+ assertTrue(i.hasNext());
+ assertEquals(1, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(0, i.previousIndex());
+ assertSame(c, i.next());
+
+ // Remove middle
+ root = tree("", 0, a = tree("a", 1), b = tree("b", 2), c = tree("c", 3));
+ i = root.listIterator();
+ i.next();
+ i.next();
+ i.next();
+ i.previous();
+ i.previous();
+ i.remove();
+ assertTrue(i.hasNext());
+ assertEquals(1, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(0, i.previousIndex());
+ assertSame(c, i.next());
+
+ // Remove middle
+ root = tree("", 0, a = tree("a", 1), b = tree("b", 2), c = tree("c", 3));
+ i = root.listIterator();
+ i.next();
+ i.next();
+ i.remove();
+ assertTrue(i.hasNext());
+ assertEquals(1, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(0, i.previousIndex());
+ assertSame(a, i.previous());
+
+ // Remove middle
+ root = tree("", 0, a = tree("a", 1), b = tree("b", 2), c = tree("c", 3));
+ i = root.listIterator();
+ i.next();
+ i.next();
+ i.next();
+ i.previous();
+ i.previous();
+ i.remove();
+ assertTrue(i.hasNext());
+ assertEquals(1, i.nextIndex());
+ assertTrue(i.hasPrevious());
+ assertEquals(0, i.previousIndex());
+ assertSame(a, i.previous());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testListIteratorNavigation()
+ {
+ IntegerTree root = tree("", 0, tree("1", 1), tree("2", 2), tree("3", 3), tree("4", 4), tree("5", 5));
+ ListIterator<IntegerTree> it = root.listIterator();
+ assertTrue(it.hasNext());
+ assertTrue(!it.hasPrevious());
+ assertEquals(-1, it.previousIndex());
+ assertEquals(0, it.nextIndex());
+ assertEquals(1, it.next().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(0, it.previousIndex());
+ assertEquals(1, it.nextIndex());
+ assertEquals(1, it.previous().value);
+ assertTrue(it.hasNext());
+ assertTrue(!it.hasPrevious());
+ assertEquals(-1, it.previousIndex());
+ assertEquals(0, it.nextIndex());
+ assertEquals(1, it.next().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(0, it.previousIndex());
+ assertEquals(1, it.nextIndex());
+ assertEquals(2, it.next().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(1, it.previousIndex());
+ assertEquals(2, it.nextIndex());
+ assertEquals(2, it.previous().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(0, it.previousIndex());
+ assertEquals(1, it.nextIndex());
+ assertEquals(2, it.next().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(1, it.previousIndex());
+ assertEquals(2, it.nextIndex());
+ assertEquals(3, it.next().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(2, it.previousIndex());
+ assertEquals(3, it.nextIndex());
+ assertEquals(4, it.next().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(3, it.previousIndex());
+ assertEquals(4, it.nextIndex());
+ assertEquals(5, it.next().value);
+ assertTrue(!it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(4, it.previousIndex());
+ assertEquals(5, it.nextIndex());
+ assertEquals(5, it.previous().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(3, it.previousIndex());
+ assertEquals(4, it.nextIndex());
+ assertEquals(4, it.previous().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(2, it.previousIndex());
+ assertEquals(3, it.nextIndex());
+ assertEquals(3, it.previous().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(1, it.previousIndex());
+ assertEquals(2, it.nextIndex());
+ assertEquals(2, it.previous().value);
+ assertTrue(it.hasNext());
+ assertTrue(it.hasPrevious());
+ assertEquals(0, it.previousIndex());
+ assertEquals(1, it.nextIndex());
+ assertEquals(1, it.previous().value);
+ assertTrue(it.hasNext());
+ assertTrue(!it.hasPrevious());
+ assertEquals(-1, it.previousIndex());
+ assertEquals(0, it.nextIndex());
+ }
+
+ /*
+ @Override
+ @SuppressWarnings("unchecked")
+ public void testListIteratorSet() {
+ list.add((E) "1");
+ list.add((E) "2");
+ list.add((E) "3");
+ list.add((E) "4");
+ list.add((E) "5");
+
+ ListIterator<E> it = list.listIterator();
+ assertEquals("1", it.next());
+ it.set((E) "a");
+ assertEquals("a", it.previous());
+ it.set((E) "A");
+ assertEquals("A", it.next());
+ assertEquals("2", it.next());
+ it.set((E) "B");
+ assertEquals("3", it.next());
+ assertEquals("4", it.next());
+ it.set((E) "D");
+ assertEquals("5", it.next());
+ it.set((E) "E");
+ assertEquals("[A, B, 3, D, E]", list.toString());
+ }
+ */
+
+ public void testListIteratorRemove()
+ {
+ IntegerTree root = tree("", 0, tree("1", 1), tree("2", 2), tree("3", 3), tree("4", 4), tree("5", 5));
+ ListIterator<IntegerTree> it = root.listIterator();
+ try
+ {
+ it.remove();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+ assertEquals(1, it.next().value);
+ assertEquals(2, it.next().value);
+ assertAllChildren(root, 1, 2, 3, 4, 5);
+ it.remove();
+ assertAllChildren(root, 1, 3, 4, 5);
+ assertEquals(3, it.next().value);
+ assertEquals(3, it.previous().value);
+ assertEquals(1, it.previous().value);
+ it.remove();
+ assertAllChildren(root, 3, 4, 5);
+ assertTrue(!it.hasPrevious());
+ assertEquals(3, it.next().value);
+ it.remove();
+ assertAllChildren(root, 4, 5);
+ try
+ {
+ it.remove();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+ assertEquals(4, it.next().value);
+ assertEquals(5, it.next().value);
+ it.remove();
+ assertAllChildren(root, 4);
+ assertEquals(4, it.previous().value);
+ it.remove();
+ assertAllChildren(root);
+ }
+
+ public void testListIteratorAdd()
+ {
+ IntegerTree root = tree("", 0);
+ ListIterator<IntegerTree> it = root.listIterator();
+ it.add(tree("a", 1));
+ assertEquals(0, it.previousIndex());
+ assertEquals(1, it.nextIndex());
+ assertAllChildren(root, 1);
+ it.add(tree("c", 3));
+ assertEquals(1, it.previousIndex());
+ assertEquals(2, it.nextIndex());
+ assertAllChildren(root, 1, 3);
+ it.add(tree("e", 5));
+ assertEquals(2, it.previousIndex());
+ assertEquals(3, it.nextIndex());
+ assertAllChildren(root, 1, 3, 5);
+ assertEquals(5, it.previous().value);
+ assertEquals(1, it.previousIndex());
+ assertEquals(2, it.nextIndex());
+ it.add(tree("d", 4));
+ assertEquals(2, it.previousIndex());
+ assertEquals(3, it.nextIndex());
+ assertAllChildren(root, 1, 3, 4, 5);
+ assertEquals(4, it.previous().value);
+ assertEquals(1, it.previousIndex());
+ assertEquals(2, it.nextIndex());
+ assertEquals(3, it.previous().value);
+ assertEquals(0, it.previousIndex());
+ assertEquals(1, it.nextIndex());
+ it.add(tree("b", 2));
+ assertEquals(1, it.previousIndex());
+ assertEquals(2, it.nextIndex());
+ assertAllChildren(root, 1, 2, 3, 4, 5);
+ }
+
+ public void testListIteratorMove()
+ {
+ IntegerTree root = tree("", 0, tree("a", 1), tree("b", 2), tree("c", 3));
+ ListIterator<IntegerTree> it = root.listIterator();
+ it.add(root.get(2));
+ assertAllChildren(root, 3, 1, 2);
+ }
+
+ public void testInsertFirstThrowsNPE()
+ {
+ IntegerTree a = tree("a", 0);
+ try
+ {
+ a.insertFirst(null);
+ fail();
+ }
+ catch (NullPointerException ignore)
+ {
+ }
+ }
+
+ public void testInsertLastThrowsNPE()
+ {
+ IntegerTree a = tree("a", 0);
+ try
+ {
+ a.insertLast(null);
+ fail();
+ }
+ catch (NullPointerException ignore)
+ {
+ }
+ }
+
+ public void testInsertBeforeThrowsNPE()
+ {
+ IntegerTree a = tree("a", 0);
+ try
+ {
+ a.insertBefore(null);
+ fail();
+ }
+ catch (NullPointerException ignore)
+ {
+ }
+ }
+
+ public void testInsertBeforeThrowsISE()
+ {
+ IntegerTree a = tree("a", 0);
+ IntegerTree b = tree("b", 1);
+ try
+ {
+ a.insertBefore(b);
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ }
+
+ public void testInsertAfterThrowsNPE()
+ {
+ IntegerTree a = tree("a", 0);
+ try
+ {
+ a.insertAfter(null);
+ fail();
+ }
+ catch (NullPointerException ignore)
+ {
+ }
+ }
+
+ public void testInsertAfterThrowsISE()
+ {
+ IntegerTree a = tree("a", 0);
+ IntegerTree b = tree("b", 1);
+ try
+ {
+ a.insertAfter(b);
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ }
+
+ public void testRemoveThrowsISE()
+ {
+ IntegerTree a = tree("a", 0);
+ try
+ {
+ a.remove();
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ }
+}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -106,6 +106,11 @@
</component>
<component>
+ <key>org.exoplatform.portal.mop.navigation.NavigationService</key>
+ <type>org.exoplatform.portal.mop.navigation.NavigationServiceWrapper</type>
+ </component>
+
+ <component>
<key>org.exoplatform.portal.config.UserPortalConfigService</key>
<type>org.exoplatform.portal.config.UserPortalConfigService</type>
</component>
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -95,6 +95,9 @@
<value>
<string>system</string>
</value>
+ <value>
+ <string>large</string>
+ </value>
</collection>
</field>
<field name="ownerType">
Deleted: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/navigation.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/portal/portal/large/navigation.xml 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/navigation.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-
-<node-navigation>
- <owner-type>portal</owner-type>
- <owner-id>large</owner-id>
- <priority>1</priority>
-
- <page-nodes>
- <node>
- <uri>a</uri>
- <name>a</name>
- <label>A</label>
- <node>
- <uri>c</uri>
- <name>c</name>
- <label>C</label>
- </node>
- </node>
- <node>
- <uri>b</uri>
- <name>b</name>
- <label>B</label>
- <node>
- <uri>d</uri>
- <name>d</name>
- <label>D</label>
- <node>
- <uri>e</uri>
- <name>e</name>
- <label>E</label>
- </node>
- </node>
- </node>
- </page-nodes>
-</node-navigation>
Copied: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/navigation.xml (from rev 6783, portal/trunk/component/portal/src/test/resources/portal/portal/large/navigation.xml)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/navigation.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/large/navigation.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<node-navigation>
+ <owner-type>portal</owner-type>
+ <owner-id>large</owner-id>
+ <priority>1</priority>
+
+ <page-nodes>
+ <node>
+ <uri>a</uri>
+ <name>a</name>
+ <label>A</label>
+ <node>
+ <uri>c</uri>
+ <name>c</name>
+ <label>C</label>
+ </node>
+ </node>
+ <node>
+ <uri>b</uri>
+ <name>b</name>
+ <label>B</label>
+ <node>
+ <uri>d</uri>
+ <name>d</name>
+ <label>D</label>
+ <node>
+ <uri>e</uri>
+ <name>e</name>
+ <label>E</label>
+ </node>
+ </node>
+ </node>
+ </page-nodes>
+</node-navigation>
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,46 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<!-- Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the hope
+ that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org. -->
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-
<node-navigation>
- <owner-type>portal</owner-type>
- <owner-id>test</owner-id>
- <priority>1</priority>
+ <owner-type>portal</owner-type>
+ <owner-id>test</owner-id>
+ <priority>1</priority>
- <page-nodes>
- <node>
- <uri>node_uri</uri>
- <name>node_name</name>
- <label>node_label</label>
- <icon>node_icon</icon>
- <start-publication-date>2000-03-21T01:33:00</start-publication-date>
- <end-publication-date>2009-03-21T01:33:00</end-publication-date>
- <visibility>TEMPORAL</visibility>
- <page-reference>portal::test::test</page-reference>
- </node>
- <node>
- <uri>node_uri2</uri>
- <name>node_name2</name>
- <label>node_label2</label>
- <page-reference>portal::test::test</page-reference>
- </node>
- </page-nodes>
+ <page-nodes>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+ <start-publication-date>2000-03-21T01:33:00</start-publication-date>
+ <end-publication-date>2009-03-21T01:33:00</end-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name1</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+ <start-publication-date>2000-03-21T01:33:00</start-publication-date>
+ <end-publication-date>2050-03-21T01:33:00</end-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name2</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+ <start-publication-date>2050-03-21T01:33:00</start-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name3</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+ <end-publication-date>2050-03-21T01:33:00</end-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name4</name>
+ <label>node_label4</label>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ </page-nodes>
</node-navigation>
Modified: epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -54,13 +54,6 @@
<portlet-skin>
<application-name>web</application-name>
- <portlet-name>PortalNavigationPortlet</portlet-name>
- <skin-name>SimpleSkin</skin-name>
- <css-path>/skin/webPortlet/webui/component/UIPortalNavigationPortlet/Stylesheet.css</css-path>
- </portlet-skin>
-
- <portlet-skin>
- <application-name>web</application-name>
<portlet-name>SiteMapPortlet</portlet-name>
<skin-name>SimpleSkin</skin-name>
<css-path>/skin/webPortlet/webui/component/UISiteMap/Stylesheet.css</css-path>
Modified: epp/portal/branches/EPP_5_2_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -49,7 +49,12 @@
<org.gatein.pc.version>2.3.0-Beta04</org.gatein.pc.version>
<org.picketlink.idm>1.3.0.Alpha03</org.picketlink.idm>
<org.gatein.wsrp.version>2.1.0-Beta04</org.gatein.wsrp.version>
- <org.gatein.mop.version>1.1.0-Beta02</org.gatein.mop.version>
+ <org.gatein.mop.version>1.1.0-Beta03</org.gatein.mop.version>
+ <org.slf4j.version>1.5.8</org.slf4j.version>
+ <commons-pool.version>1.5.5</commons-pool.version>
+ <rhino.version>1.6R5</rhino.version>
+ <org.codehaus.groovy.version>1.7.6</org.codehaus.groovy.version>
+ <javax.servlet.version>2.5</javax.servlet.version>
<org.slf4j.version>1.5.6</org.slf4j.version>
<rhino.version>1.6R5</rhino.version>
<org.codehaus.groovy.version>1.7.6</org.codehaus.groovy.version>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -23,10 +23,8 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.container.UIContainer;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -75,10 +73,10 @@
//
try
{
- PageNode node = portal.getSelectedNode();
+ UserNode node = portal.getSelectedUserNode();
if (node != null)
{
- String pageRef = node.getPageReference();
+ String pageRef = node.getPageRef();
DataStorage storage = portal.getApplicationComponent(DataStorage.class);
Page page = storage.getPage(pageRef);
if (page != null)
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,15 +19,29 @@
package org.exoplatform.dashboard.webui.component;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.web.application.ApplicationMessage;
@@ -40,10 +54,6 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-
/**
*
* Created by eXoPlatform SAS
@@ -74,35 +84,30 @@
private DataStorage dataService;
private UIPortal uiPortal;
+
+ private UserNode cachedParent;
final private static int MAX_SHOWED_TAB_NUMBER = 6;
final public static String PAGE_TEMPLATE = "dashboard";
+ final private UserNodeFilterConfig filterConfig;
+ static final private Scope TAB_PANE_DASHBOARD_SCOPE = Scope.CHILDREN;
+
public UITabPaneDashboard() throws Exception
{
configService = getApplicationComponent(UserPortalConfigService.class);
dataService = getApplicationComponent(DataStorage.class);
uiPortal = Util.getUIPortal();
- }
- /*
- private PageNavigation getPageNavigation(String owner) throws Exception
- {
- List<PageNavigation> allNavigations = uiPortal.getNavigations();
- for (PageNavigation nav : allNavigations)
- {
- if (nav.getOwner().equals(owner))
- return nav;
- }
- return null;
+ UserNodeFilterConfig.Builder scopeBuilder = UserNodeFilterConfig.builder();
+ scopeBuilder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED, Visibility.TEMPORAL);
+ scopeBuilder.withTemporalCheck();
+ filterConfig = scopeBuilder.build();
}
- */
-
public int getCurrentNumberOfTabs() throws Exception
{
-
return getSameSiblingsNode().size();
}
@@ -123,81 +128,106 @@
}
}
- public List<PageNode> getSameSiblingsNode() throws Exception
+ public UserNode getParentTab() throws Exception
{
- List<PageNode> siblings = getPageNavigation().getNodes();
- List<PageNode> selectedPath = Util.getUIPortal().getSelectedPath();
- if (selectedPath != null && selectedPath.size() > 1)
+ UserPortal userPortal = getUserPortal();
+ UserNode selectedNode = uiPortal.getSelectedUserNode();
+ UserNode currParent = selectedNode.getParent();
+
+ UserNode parent = this.cachedParent;
+ if (parent == null || (currParent != null && !currParent.getId().equals(parent.getId())))
+ {
+ if ("".equals(currParent.getURI()))
+ {
+ this.cachedParent = userPortal.getNode(currParent.getNavigation(), TAB_PANE_DASHBOARD_SCOPE, filterConfig, null);
+ }
+ else
+ {
+ this.cachedParent = userPortal.resolvePath(currParent.getNavigation(), filterConfig, currParent.getURI());
+ }
+ parent = this.cachedParent;
+ }
+
+ if (parent != null)
{
- PageNode currentParent = selectedPath.get(selectedPath.size() - 2);
- siblings = currentParent.getChildren();
+ try
+ {
+ userPortal.updateNode(parent, TAB_PANE_DASHBOARD_SCOPE, null);
+ }
+ catch (NavigationServiceException e)
+ {
+ parent = null;
+ }
+ }
+ this.cachedParent = parent;
+ return parent;
+ }
+
+ public Collection<UserNode> getSameSiblingsNode() throws Exception
+ {
+ UserNode parentTab = getParentTab();
+
+ if (parentTab == null)
+ {
+ return Collections.emptyList();
}
- return siblings;
+ return parentTab.getChildren();
+ }
+
+ public UserNavigation getCurrentUserNavigation() throws Exception
+ {
+ UserPortal userPortal = getUserPortal();
+ WebuiRequestContext rcontext = WebuiRequestContext.getCurrentInstance();
+ return userPortal.getNavigation(SiteKey.user(rcontext.getRemoteUser()));
}
- public PageNavigation getPageNavigation() throws Exception
+ private UserPortal getUserPortal()
{
- return uiPortal.getSelectedNavigation();
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ return uiApp.getUserPortalConfig().getUserPortal();
}
/**
- * Remove node specified by nodeIndex and returns the node to switch to
- * @param nodeIndex
- * @return
+ * Remove node specified by nodeName and returns the node to switch to
+ * @param nodeName - name of the Node that will be remove
+ * @return return the node that should be selected after remove node
*/
- public PageNode removePageNode(int nodeIndex)
+ public UserNode removePageNode(String nodeName)
{
try
- {
- PageNavigation pageNavigation = getPageNavigation();
- List<PageNode> nodes = pageNavigation.getNodes();
- PageNode tobeRemoved = nodes.get(nodeIndex);
- PageNode selectedNode = uiPortal.getSelectedNode();
-
- boolean isRemoved = true; // To check
- PageNavigation updateNav =
- dataService.getPageNavigation(pageNavigation.getOwnerType(), pageNavigation.getOwnerId());
- for (PageNode pageNode : updateNav.getNodes())
+ {
+ UserNode parentNode = getParentTab();
+ if (parentNode == null || parentNode.getChild(nodeName) == null)
{
- if (pageNode.getUri().equals(tobeRemoved.getUri()))
- {
- isRemoved = false;
- break;
- }
+ return null;
}
- if (nodes.size() >= 2)
+ UserNode tobeRemoved = parentNode.getChild(nodeName);
+ UserNode prevNode = null;
+
+ if (parentNode.getChildrenCount() >= 2)
{
- // Remove node
- nodes.remove(tobeRemoved);
-
- // Choose selected Node
- if (tobeRemoved.getUri().equals(selectedNode.getUri()))
+ for (UserNode child : parentNode.getChildren())
{
- selectedNode = nodes.get(Math.max(0, nodeIndex - 1));
-
+ if (child.getName().equals(nodeName))
+ {
+ parentNode.removeChild(nodeName);
+ break;
+ }
+ prevNode = child;
}
- else if (!nodes.contains(selectedNode))
- {
- selectedNode = nodes.get(0);
- }
- // Update
- if (!isRemoved)
+ String pageRef = tobeRemoved.getPageRef();
+ if (pageRef != null && pageRef.length() > 0)
{
- String pageRef = tobeRemoved.getPageReference();
- if (pageRef != null && pageRef.length() > 0)
- {
- Page page = configService.getPage(pageRef);
- if (page != null)
- dataService.remove(page);
- UIPortal uiPortal = Util.getUIPortal();
- // Remove from cache
- uiPortal.setUIPage(pageRef, null);
- }
- //uiPortal.setSelectedNode(selectedNode);
- dataService.save(pageNavigation);
+ Page page = configService.getPage(pageRef);
+ if (page != null)
+ dataService.remove(page);
+ UIPortal uiPortal = Util.getUIPortal();
+ // Remove from cache
+ uiPortal.setUIPage(pageRef, null);
}
+ getUserPortal().saveNode(parentNode, null);
}
else
{
@@ -206,6 +236,11 @@
return null;
}
+ UserNode selectedNode = uiPortal.getSelectedUserNode();
+ if (nodeName.equals(selectedNode.getName()))
+ {
+ selectedNode = prevNode != null ? prevNode : parentNode.getChildren().iterator().next();
+ }
return selectedNode;
}
catch (Exception ex)
@@ -222,49 +257,35 @@
{
nodeLabel = "Tab_" + getCurrentNumberOfTabs();
}
- PageNavigation pageNavigation = getPageNavigation();
- Page page =
- configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE, pageNavigation.getOwnerType(),
- pageNavigation.getOwnerId());
- page.setTitle(nodeLabel);
- List<PageNode> selectedPath = uiPortal.getSelectedPath();
- PageNode parentNode = null;
- if (selectedPath != null && selectedPath.size() > 1)
+ UserNavigation userNav = getCurrentUserNavigation();
+ UserNode parentNode = getParentTab();
+ if (userNav == null || parentNode == null)
{
- parentNode = selectedPath.get(selectedPath.size() - 2);
+ return null;
}
- PageNode pageNode = new PageNode();
- pageNode.setLabel(nodeLabel);
String uniqueNodeName = nodeLabel.toLowerCase().replace(' ', '_');
- if (nameExisted(uniqueNodeName))
- {
- uniqueNodeName = uniqueNodeName + "_" + System.currentTimeMillis();
- }
- String fullName = (parentNode != null) ? parentNode.getUri() + "/" + uniqueNodeName : uniqueNodeName;
+ SiteKey siteKey = userNav.getKey();
+ Page page =
+ configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE, siteKey.getTypeName(), siteKey.getName());
+ page.setTitle(nodeLabel);
+ page.setName(uniqueNodeName + page.hashCode());
+ dataService.create(page);
- page.setName(uniqueNodeName);
- pageNode.setName(uniqueNodeName);
- pageNode.setUri(fullName);
- pageNode.setPageReference(page.getPageId());
-
- if (parentNode == null)
+ if (parentNode.getChild(uniqueNodeName) != null)
{
- pageNavigation.addNode(pageNode);
+ uniqueNodeName = uniqueNodeName + "_" + System.currentTimeMillis();
}
- else if (parentNode.getChildren() != null)
- {
- parentNode.getChildren().add(pageNode);
- }
- //uiPortal.setSelectedNode(pageNode);
+ UserNode tabNode = parentNode.addChild(uniqueNodeName);
+ tabNode.setLabel(nodeLabel);
+ tabNode.setPageRef(page.getPageId());
- dataService.create(page);
- dataService.save(pageNavigation);
+ getUserPortal().saveNode(parentNode, null);
- return fullName;
+ return tabNode.getURI();
}
catch (Exception ex)
{
@@ -296,58 +317,34 @@
return true;
}
- private boolean nameExisted(String nodeName) throws Exception
+ public String renamePageNode(String nodeName, String newNodeLabel)
{
- for (PageNode node : getPageNavigation().getNodes())
- {
- if (node.getName().equals(nodeName))
- {
- return true;
- }
- }
- return false;
- }
-
- public String renamePageNode(int nodeIndex, String newNodeLabel)
- {
try
{
- PageNavigation pageNavigation = getPageNavigation();
- List<PageNode> nodes = pageNavigation.getNodes();
- List<PageNode> selectedPath = uiPortal.getSelectedPath();
- PageNode parentNode = null;
- if (selectedPath != null && selectedPath.size() > 1)
+ UserNode parentNode = getParentTab();
+ if (parentNode == null || parentNode.getChild(nodeName) == null)
{
- parentNode = selectedPath.get(selectedPath.size() - 2);
- nodes = parentNode.getChildren();
- }
-
- PageNode renamedNode = nodes.get(nodeIndex);
- if (renamedNode == null || newNodeLabel.length() == 0)
- {
return null;
}
-
+ UserNode renamedNode = parentNode.getChild(nodeName);
renamedNode.setLabel(newNodeLabel);
String newNodeName = newNodeLabel.toLowerCase().replace(' ', '_');
- if (nameExisted(newNodeName))
+ if (parentNode.getChild(newNodeName) != null)
{
newNodeName = newNodeName + "_" + System.currentTimeMillis();
}
renamedNode.setName(newNodeName);
- String newUri = (parentNode != null) ? parentNode.getUri() + "/" + newNodeName : newNodeName;
-
- renamedNode.setUri(newUri);
-
- Page page = configService.getPage(renamedNode.getPageReference());
- page.setTitle(newNodeLabel);
+ Page page = configService.getPage(renamedNode.getPageRef());
if (page != null)
+ {
+ page.setTitle(newNodeLabel);
dataService.save(page);
-
- dataService.save(pageNavigation);
- return newUri;
+ }
+
+ getUserPortal().saveNode(parentNode, null);
+ return renamedNode.getURI();
}
catch (Exception ex)
{
@@ -360,10 +357,11 @@
*
* @param firstIndex
* @param secondIndex
- * @return
*/
- public boolean permutePageNode(int firstIndex, int secondIndex)
+ public boolean permutePageNode(int firstIndex, int secondIndex) throws Exception
{
+ UserNode parentNode = getParentTab();
+ List<UserNode> siblings = new ArrayList<UserNode>(getSameSiblingsNode());
if (firstIndex == secondIndex)
{
return false;
@@ -371,14 +369,10 @@
try
{
- PageNavigation pageNavigation = getPageNavigation();
- ArrayList<PageNode> nodes = pageNavigation.getNodes();
- PageNode firstNode = nodes.get(firstIndex);
- PageNode secondNode = nodes.get(secondIndex);
- nodes.set(firstIndex, secondNode);
- nodes.set(secondIndex, firstNode);
+ UserNode firstNode = siblings.get(firstIndex);
+ parentNode.addChild(secondIndex, firstNode);
- dataService.save(pageNavigation);
+ getUserPortal().saveNode(parentNode, null);
return true;
}
catch (Exception ex)
@@ -387,14 +381,34 @@
}
}
+ private String encodeURI(String uri) throws UnsupportedEncodingException
+ {
+ if (uri == null || uri.isEmpty())
+ {
+ return "";
+ }
+ String[] path = uri.split("/");
+ StringBuilder uriBuilder = new StringBuilder();
+ for (String name : path)
+ {
+ uriBuilder.append("/").append(URLEncoder.encode(name, "UTF-8"));
+ }
+ if (uriBuilder.indexOf("/") == 0)
+ {
+ uriBuilder.deleteCharAt(0);
+ }
+ return uriBuilder.toString();
+ }
+
static public class DeleteTabActionListener extends EventListener<UITabPaneDashboard>
{
public void execute(Event<UITabPaneDashboard> event) throws Exception
{
UITabPaneDashboard source = event.getSource();
WebuiRequestContext context = event.getRequestContext();
- int removedNodeIndex = Integer.parseInt(context.getRequestParameter(UIComponent.OBJECTID));
- PageNode selectedNode = source.removePageNode(removedNodeIndex);
+ String nodeName = context.getRequestParameter(UIComponent.OBJECTID);
+ String newUri = source.getFirstAvailableURI();
+ UserNode selectedNode = source.removePageNode(nodeName);
//If the node is removed successfully, then redirect to the node specified by tab on the left
if (selectedNode != null)
@@ -406,11 +420,12 @@
{
uiPageBody.setMaximizedUIComponent(null);
}
+ newUri = selectedNode.getURI();
+ }
- PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.setResponseComplete(true);
- prContext.getResponse().sendRedirect(prContext.getPortalURI() + URLEncoder.encode(selectedNode.getUri(), "UTF-8"));
- }
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.setResponseComplete(true);
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() + source.encodeURI(newUri));
}
}
@@ -421,27 +436,24 @@
UITabPaneDashboard tabPane = event.getSource();
WebuiRequestContext context = event.getRequestContext();
String newTabLabel = context.getRequestParameter(UIComponent.OBJECTID);
+ String newUri = tabPane.getFirstAvailableURI();
if (!tabPane.validateName(newTabLabel))
- {
- //TODO nguyenanhkien2a(a)gmail.com
- //We should redirect to current node while adding new tab fails
- PageNode currentNode = tabPane.uiPortal.getSelectedNode();
- PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.getResponse().sendRedirect(prContext.getPortalURI() + URLEncoder.encode(currentNode.getUri(), "UTF-8"));
-
+ {
Object[] args = {newTabLabel};
context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
- return;
}
- String uri = tabPane.createNewPageNode(newTabLabel);
-
- //If new node is created with success, then redirect to it
- if (uri != null)
+ else
{
- PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.setResponseComplete(true);
- prContext.getResponse().sendRedirect(prContext.getPortalURI() + URLEncoder.encode(uri, "UTF-8"));
+ String uri = tabPane.createNewPageNode(newTabLabel);
+ if (uri != null)
+ {
+ newUri = uri;
+ }
}
+
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.setResponseComplete(true);
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() + tabPane.encodeURI(newUri));
}
}
@@ -459,29 +471,29 @@
public void execute(Event<UITabPaneDashboard> event) throws Exception
{
- UITabPaneDashboard tabPane = event.getSource();
+ UITabPaneDashboard tabPane = event.getSource();
WebuiRequestContext context = event.getRequestContext();
- int nodeIndex = Integer.parseInt(context.getRequestParameter(UIComponent.OBJECTID));
+ UIApplication rootUI = context.getUIApplication();
+
String newTabLabel = context.getRequestParameter(RENAMED_TAB_LABEL_PARAMETER);
+ String newUri = tabPane.getFirstAvailableURI();
if (!tabPane.validateName(newTabLabel))
- {
- //We should redirect to current node while renaming fails
- PageNode currentNode = tabPane.uiPortal.getSelectedNode();
- PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.getResponse().sendRedirect(prContext.getPortalURI() + URLEncoder.encode(currentNode.getUri(), "UTF-8"));
-
+ {
Object[] args = {newTabLabel};
- context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
- return;
+ rootUI.addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
}
- String newUri = tabPane.renamePageNode(nodeIndex, newTabLabel);
-
- //If page node is renamed with success, then redirect to new URL
- if (newUri != null)
+ else
{
- PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.getResponse().sendRedirect(prContext.getPortalURI() + URLEncoder.encode(newUri, "UTF-8"));
+ String nodeName = context.getRequestParameter(UIComponent.OBJECTID);
+ String returnUri = tabPane.renamePageNode(nodeName, newTabLabel);
+ if (returnUri != null)
+ {
+ newUri = returnUri;
+ }
}
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() + tabPane.encodeURI(newUri));
+ prContext.setResponseComplete(true);
}
}
@@ -504,4 +516,33 @@
}
}
}
+
+ /**
+ * Return the current node uri, if it's been deleted, return first sibling node uri
+ * if there is no node remain, return default path
+ * @throws Exception
+ */
+ public String getFirstAvailableURI() throws Exception
+ {
+ UserNode parentTab = getParentTab();
+ if (parentTab != null)
+ {
+ UserNode currNode = Util.getUIPortal().getSelectedUserNode();
+ if (parentTab.getChildren().size() == 0 && parentTab.getURI() != null)
+ {
+ return parentTab.getURI();
+ }
+
+ if (parentTab.getChild(currNode.getName()) != null)
+ {
+ return currNode.getURI();
+ }
+ else
+ {
+ return parentTab.getChild(0).getURI();
+ }
+ }
+
+ return getUserPortal().getDefaultPath(null).getURI();
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,23 +1,18 @@
-<%
- import java.util.ArrayList;
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
+<%
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.web.application.JavascriptManager;
- import org.gatein.common.text.EntityEncoder;
+ import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.portal.mop.user.UserNode;
- //PageNavigation pageNavigation = uicomponent.getPageNavigation();
- //ArrayList<PageNode> nodes = pageNavigation.getNodes();
- ArrayList<PageNode> nodes = uicomponent.getSameSiblingsNode();
+ def nodes = uicomponent.getSameSiblingsNode();
def tabNbs = nodes.size();
PortalRequestContext pcontext = Util.getPortalRequestContext();
- def String portalURI = pcontext.getPortalURI();
+ def portalURI = pcontext.getPortalURI();
- PageNode selectedNode = Util.getUIPortal().getSelectedNode();
- PageNode node;
+ def selectedNode = Util.getUIPortal().getSelectedUserNode();
JavascriptManager jsManager = pcontext.getJavascriptManager();
jsManager.importJavascript("eXo.webui.UITabbedDashboard");
@@ -26,24 +21,29 @@
<div id="$uicomponent.id" class="UITabPaneDashboard">
<div class="LtTabDashboard">
<div class="RtTabDashboard">
- <div class="CtTabDashboard">
- <div class="UIHorizontalTabs">
+ <div class="CtTabDashboard">
+ <div class="UIHorizontalTabs">
<div class="TabsContainer ClearFix">
- <% for(int i = 0;i < tabNbs;i++){
- node = nodes.get(i);
- String tabLabel = node.getResolvedLabel();
- EntityEncoder encoder = EntityEncoder.FULL;
- tabLabel = encoder.encode(tabLabel);
- String param = "" + i;
- if(node.getUri().equals(selectedNode.getUri())){
+ <%
+ int i = 0;
+ for(UserNode node : nodes){
+ def tabLabel = node.getLabel();
+ if ("Tab_Default".equals(node.getName()))
+ {
+ tabLabel = _ctx.appRes("UIUserToolBarDashboard.page." + node.getLabel());
+ }
+ EntityEncoder encoder = EntityEncoder.FULL;
+ tabLabel = encoder.encode(tabLabel);
+ String param = node.getName();
+ if(node.getURI().equals(selectedNode.getURI())){
%>
<div class="UITab GrayTabStyle">
<div class="SelectedTab">
<div class="LeftTab">
<div class="RightTab">
<div class="MiddleTab">
- <%
- String ondblclick = "eXo.webui.UITabbedDashboard.showEditLabelInput(this," + i + ",\"" + tabLabel + "\")";
+ <%
+ String ondblclick = "eXo.webui.UITabbedDashboard.showEditLabelInput(this,\"" + param + "\",\"" + tabLabel + "\")";
%>
<span ondblclick='$ondblclick'>$tabLabel</span>
<a href="<%= uicomponent.url("DeleteTab",param); %>">
@@ -60,7 +60,7 @@
<div class="LeftTab">
<div class="RightTab">
<div class="MiddleTab">
- <a href="<%= portalURI + node.getUri(); %>"><span>$tabLabel</span></a>
+ <a href="<%= portalURI + node.getURI(); %>"><span>$tabLabel</span></a>
<a href="<%= uicomponent.url("DeleteTab",param); %>">
<img class="CloseIcon" src="/eXoResources/skin/sharedImages/Blank.gif" alt="DEL" />
</a>
Copied: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java (from rev 6783, portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/TreeNode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,363 @@
+package org.exoplatform.navigation.webui;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.navigation.NodeChangeListener;
+import org.exoplatform.portal.mop.navigation.NodeState;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+
+/**
+ * A wrapper class of {@link UserNode} for manipulation in WebUI part
+ *
+ * @author <a href="mailto:trong.tran@exoplatform.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class TreeNode implements NodeChangeListener<UserNode>
+{
+ private Map<String, TreeNode> caches;
+
+ private UserNavigation nav;
+
+ private UserNode node;
+
+ private TreeNode rootNode;
+
+ private boolean deleteNode = false;
+
+ private boolean cloneNode = false;
+
+ private String id;
+
+ private List<TreeNode> children;
+
+ public TreeNode(UserNavigation nav, UserNode node)
+ {
+ this(nav, node, null);
+ this.rootNode = this;
+ this.caches = new HashMap<String, TreeNode>();
+ addToCached(this);
+ }
+
+ private TreeNode(UserNavigation nav, UserNode node, TreeNode rootNode)
+ {
+ this.rootNode = rootNode;
+ this.nav = nav;
+ this.node = node;
+ }
+
+ public List<TreeNode> getChildren()
+ {
+ if (children == null)
+ {
+ children = new LinkedList<TreeNode>();
+ for (UserNode child : node.getChildren())
+ {
+ String key = child.getId() == null ? String.valueOf(child.hashCode()) : child.getId();
+ TreeNode node = findNode(key);
+ if (node == null)
+ {
+ throw new IllegalStateException("Can' find node " + child.getURI() + " in the cache");
+ }
+ children.add(node);
+ }
+ }
+ return children;
+ }
+
+ public TreeNode getChild(String name)
+ {
+ UserNode child = node.getChild(name);
+ if (child == null)
+ {
+ return null;
+ }
+ return findNode(child.getId() == null ? String.valueOf(child.hashCode()) : child.getId());
+ }
+
+ public boolean removeChild(TreeNode child)
+ {
+ children = null;
+ if (child == null)
+ {
+ return false;
+ }
+ removeFromCached(child);
+ return node.removeChild(child.getName());
+ }
+
+ public TreeNode getParent()
+ {
+ UserNode parent = node.getParent();
+ if (parent == null)
+ return null;
+
+ return findNode(parent.getId() == null ? String.valueOf(parent.hashCode()) : parent.getId());
+ }
+
+ public TreeNode getChild(int childIndex) throws IndexOutOfBoundsException
+ {
+ UserNode child = node.getChild(childIndex);
+ if (child == null)
+ {
+ return null;
+ }
+ return findNode(child.getId() == null ? String.valueOf(child.hashCode()) : child.getId());
+ }
+
+ public TreeNode addChild(String childName)
+ {
+ children = null;
+ UserNode child = node.addChild(childName);
+ return addToCached(new TreeNode(nav, child, this.rootNode));
+ }
+
+ public void addChild(TreeNode child)
+ {
+ TreeNode oldParent = child.getParent();
+ if (oldParent != null)
+ {
+ oldParent.children = null;
+ }
+ children = null;
+ this.node.addChild(child.getNode());
+ }
+
+ public void addChild(int index, TreeNode child)
+ {
+ TreeNode oldParent = child.getParent();
+ if (oldParent != null)
+ {
+ oldParent.children = null;
+ }
+ children = null;
+ node.addChild(index, child.getNode());
+ }
+
+ public TreeNode findNode(String nodeID)
+ {
+ return this.rootNode.caches.get(nodeID);
+ }
+
+ public UserNode getNode()
+ {
+ return node;
+ }
+
+ public UserNavigation getPageNavigation()
+ {
+ return nav;
+ }
+
+ public boolean isDeleteNode()
+ {
+ return deleteNode;
+ }
+
+ public void setDeleteNode(boolean deleteNode)
+ {
+ this.deleteNode = deleteNode;
+ }
+
+ public boolean isCloneNode()
+ {
+ return cloneNode;
+ }
+
+ public void setCloneNode(boolean b)
+ {
+ cloneNode = b;
+ }
+
+ public String getPageRef()
+ {
+ return node.getPageRef();
+ }
+
+ public String getId()
+ {
+ if (this.id == null)
+ {
+ this.id = node.getId() == null ? String.valueOf(node.hashCode()) : node.getId();
+ }
+ return this.id;
+ }
+
+ public String getURI()
+ {
+ return node.getURI();
+ }
+
+ public String getIcon()
+ {
+ return node.getIcon();
+ }
+
+ public void setIcon(String icon)
+ {
+ node.setIcon(icon);
+ }
+
+ public String getEncodedResolvedLabel()
+ {
+ String encodedLabel = node.getEncodedResolvedLabel();
+ return encodedLabel == null ? "" : encodedLabel;
+ }
+
+ public String getName()
+ {
+ return node.getName();
+ }
+
+ public void setName(String name)
+ {
+ node.setName(name);
+ }
+
+ public String getLabel()
+ {
+ return node.getLabel();
+ }
+
+ public void setLabel(String label)
+ {
+ node.setLabel(label);
+ }
+
+ public Visibility getVisibility()
+ {
+ return node.getVisibility();
+ }
+
+ public void setVisibility(Visibility visibility)
+ {
+ node.setVisibility(visibility);
+ }
+
+ public long getStartPublicationTime()
+ {
+ return node.getStartPublicationTime();
+ }
+
+ public void setStartPublicationTime(long startPublicationTime)
+ {
+ node.setStartPublicationTime(startPublicationTime);
+ }
+
+ public long getEndPublicationTime()
+ {
+ return node.getEndPublicationTime();
+ }
+
+ public void setEndPublicationTime(long endPublicationTime)
+ {
+ node.setEndPublicationTime(endPublicationTime);
+ }
+
+ public void setPageRef(String pageRef)
+ {
+ node.setPageRef(pageRef);
+ }
+
+ public String getResolvedLabel()
+ {
+ String resolvedLabel = node.getResolvedLabel();
+ return resolvedLabel == null ? "" : resolvedLabel;
+ }
+
+ public boolean hasChildrenRelationship()
+ {
+ return node.hasChildrenRelationship();
+ }
+
+ public int getChildrenCount()
+ {
+ return node.getChildrenCount();
+ }
+
+ private TreeNode addToCached(TreeNode node)
+ {
+ if (node == null)
+ {
+ return null;
+ }
+
+ if (findNode(node.getId()) != null)
+ {
+ return node;
+ }
+
+ this.rootNode.caches.put(node.getId(), node);
+ for (UserNode child : node.getNode().getChildren())
+ {
+ addToCached(new TreeNode(nav, child, this.rootNode));
+ }
+ return node;
+ }
+
+ private TreeNode removeFromCached(TreeNode node)
+ {
+ if (node == null)
+ {
+ return null;
+ }
+
+ this.rootNode.caches.remove(node.getId());
+ if (node.hasChildrenRelationship())
+ {
+ for (TreeNode child : node.getChildren())
+ {
+ removeFromCached(child);
+ }
+ }
+ return node;
+ }
+
+ @Override
+ public void onAdd(UserNode target, UserNode parent, UserNode previous)
+ {
+ addToCached(new TreeNode(this.nav, target, this.rootNode));
+ findNode(parent.getId()).children = null;
+ }
+
+ @Override
+ public void onCreate(UserNode target, UserNode parent, UserNode previous, String name)
+ {
+ }
+
+ @Override
+ public void onRemove(UserNode target, UserNode parent)
+ {
+ removeFromCached(findNode(target.getId()));
+ findNode(parent.getId()).children = null;
+ }
+
+ @Override
+ public void onDestroy(UserNode target, UserNode parent)
+ {
+ }
+
+ @Override
+ public void onRename(UserNode target, UserNode parent, String name)
+ {
+ }
+
+ @Override
+ public void onUpdate(UserNode target, NodeState state)
+ {
+ }
+
+ @Override
+ public void onMove(UserNode target, UserNode from, UserNode to, UserNode previous)
+ {
+ TreeNode fromTreeNode = findNode(from.getId());
+ TreeNode toTreeNode = findNode(to.getId());
+ fromTreeNode.children = null;
+ toTreeNode.children = null;
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -20,18 +20,17 @@
package org.exoplatform.navigation.webui.component;
import org.exoplatform.commons.utils.ObjectPageList;
+import org.exoplatform.navigation.webui.TreeNode;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.navigation.UIAddGroupNavigation;
-import org.exoplatform.portal.webui.navigation.UINavigationManagement;
-import org.exoplatform.portal.webui.navigation.UINavigationNodeSelector;
import org.exoplatform.portal.webui.navigation.UIPageNavigationForm;
-import org.exoplatform.portal.webui.page.UIPageNodeForm;
-import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -49,9 +48,8 @@
import org.exoplatform.webui.core.UIVirtualList;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
-
+import org.exoplatform.webui.event.EventListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -76,14 +74,14 @@
@EventConfig(listeners = UIPageNodeForm.SwitchPublicationDateActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchVisibleActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.ClearPageActionListener.class, phase = Phase.DECODE),
- @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase = Phase.DECODE)})})
+ @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase = Phase.DECODE)}),
+ @ComponentConfig(type = UIPopupWindow.class, template = "system:/groovy/webui/core/UIPopupWindow.gtmpl",
+ events = @EventConfig(listeners = UIGroupNavigationManagement.CloseActionListener.class, name = "ClosePopup"))})
public class UIGroupNavigationManagement extends UIContainer
{
- private List<PageNavigation> navigations;
+ private UINavigationManagement naviManager;
- private PageNavigation selectedNavigation;
-
public UIGroupNavigationManagement() throws Exception
{
UIVirtualList virtualList = addChild(UIVirtualList.class, null, "GroupNavigationList");
@@ -96,80 +94,22 @@
public void loadNavigations() throws Exception
{
- UserPortalConfigService userPortalConfigService = getApplicationComponent(UserPortalConfigService.class);
- navigations = userPortalConfigService.loadEditableNavigations();
- UIVirtualList virtualList = getChild(UIVirtualList.class);
- virtualList.dataBind(new ObjectPageList<PageNavigation>(navigations, navigations.size()));
- }
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
- public List<PageNavigation> getNavigations()
- {
- return navigations;
- }
-
- public void addPageNavigation(PageNavigation navigation)
- {
- if (navigations == null)
+ List<UserNavigation> allNavs = userPortal.getNavigations();
+ List<UserNavigation> groupNav = new ArrayList<UserNavigation>();
+ for (UserNavigation nav : allNavs)
{
- navigations = new ArrayList<PageNavigation>();
- }
- navigations.add(navigation);
- }
-
- public void deletePageNavigation(PageNavigation navigation)
- {
- if (navigations == null || navigations.size() < 1)
- {
- return;
- }
- navigations.remove(navigation);
- }
-
- public PageNavigation getPageNavigation(int id)
- {
- for (PageNavigation ele : getPageNavigations())
- {
- if (ele.getId() == id)
+ if (nav.getKey().getType().equals(SiteType.GROUP) && nav.isModifiable())
{
- return ele;
+ groupNav.add(nav);
}
}
- return null;
- }
- public List<PageNavigation> getPageNavigations()
- {
- if (navigations == null)
- {
- navigations = new ArrayList<PageNavigation>();
- }
- return navigations;
+ UIVirtualList virtualList = getChild(UIVirtualList.class);
+ virtualList.dataBind(new ObjectPageList<UserNavigation>(groupNav, groupNav.size()));
}
- public PageNavigation getNavigationById(Integer navId)
- {
- PageNavigation navigation = new PageNavigation();
- for (PageNavigation nav : navigations)
- {
- if (nav.getId() == navId)
- {
- navigation = nav;
- break;
- }
- }
- return navigation;
- }
-
- public PageNavigation getSelectedNavigation()
- {
- return selectedNavigation;
- }
-
- public void setSelectedNavigation(PageNavigation navigation)
- {
- selectedNavigation = navigation;
- }
-
/**
* User has right to add navigation to a group in below cases
*
@@ -177,7 +117,7 @@
*
* 2. He/She is manager of the group
*
- * @param pcontext
+ * @param
* @return
*/
private boolean userHasRightToAddNavigation()
@@ -199,172 +139,122 @@
try
{
Collection<?> groups = orgService.getGroupHandler().findGroupByMembership(remoteUser, userACL.getMakableMT());
- if (groups != null && groups.size() > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
+ return groups != null && groups.size() > 0;
}
catch (Exception ex)
{
return false;
}
}
-
- static public class EditNavigationActionListener extends EventListener<UIGroupNavigationManagement>
+
+ static public abstract class BaseEditAction extends EventListener<UIGroupNavigationManagement>
{
public void execute(Event<UIGroupNavigationManagement> event) throws Exception
{
-
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
UIGroupNavigationManagement uicomp = event.getSource();
-
- // get navigation id
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- Integer navId = Integer.parseInt(id);
- // get PageNavigation by navigation id
- PageNavigation navigation = uicomp.getNavigationById(navId);
- uicomp.setSelectedNavigation(navigation);
WebuiRequestContext context = event.getRequestContext();
UIApplication uiApplication = context.getUIApplication();
+ // get navigation id
+ String groupName = event.getRequestContext().getRequestParameter(OBJECTID);
+ SiteKey siteKey = SiteKey.group(groupName);
+
// check edit permission, ensure that user has edit permission on that
// navigation
UserACL userACL = uicomp.getApplicationComponent(UserACL.class);
-
- if (!userACL.hasEditPermission(navigation))
+ if (!userACL.hasEditPermissionOnNavigation(siteKey))
{
uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.Invalid-editPermission", null));
return;
}
- // ensure this navigation is exist
- DataStorage service = uicomp.getApplicationComponent(DataStorage.class);
- if (service.getPageNavigation(navigation.getOwnerType(), navigation.getOwnerId()) == null)
+ UserNavigation navigation = userPortal.getNavigation(siteKey);
+ if (navigation == null)
{
uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.navigation-not-exist", null));
+ UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
+ uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
return;
}
- UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
+ doEdit(navigation, event);
+ }
- UINavigationManagement pageManager = popUp.createUIComponent(UINavigationManagement.class, null, null, popUp);
- pageManager.setOwner(navigation.getOwnerId());
- pageManager.setOwnerType(navigation.getOwnerType());
+ protected abstract void doEdit(UserNavigation navigation, Event<UIGroupNavigationManagement> event) throws Exception;
+ }
+
+ static public class EditNavigationActionListener extends BaseEditAction
+ {
+ @Override
+ protected void doEdit(UserNavigation nav, Event<UIGroupNavigationManagement> event) throws Exception
+ {
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ UIGroupNavigationManagement uicomp = event.getSource();
+ SiteKey siteKey = nav.getKey();
- UINavigationNodeSelector selector = pageManager.getChild(UINavigationNodeSelector.class);
-
- selector.setEdittedNavigation(navigation);
+ UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
+ UINavigationManagement naviManager = popUp.createUIComponent(UINavigationManagement.class, null, null, popUp);
+ uicomp.naviManager = naviManager;
+
+ naviManager.setOwner(siteKey.getName());
+ naviManager.setOwnerType(siteKey.getTypeName());
+
+ UINavigationNodeSelector selector = naviManager.getChild(UINavigationNodeSelector.class);
+ selector.setEdittedNavigation(nav);
+ selector.setUserPortal(userPortal);
selector.initTreeData();
- popUp.setUIComponent(pageManager);
+
+ popUp.setUIComponent(naviManager);
popUp.setWindowSize(400, 400);
popUp.setShowMask(true);
popUp.setShow(true);
}
}
- static public class EditPropertiesActionListener extends EventListener<UIGroupNavigationManagement>
+ static public class EditPropertiesActionListener extends BaseEditAction
{
- public void execute(Event<UIGroupNavigationManagement> event) throws Exception
+ @Override
+ protected void doEdit(UserNavigation navigation, Event<UIGroupNavigationManagement> event) throws Exception
{
-
UIGroupNavigationManagement uicomp = event.getSource();
+ SiteKey siteKey = navigation.getKey();
- // get navigation id
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- Integer navId = Integer.parseInt(id);
-
- // get PageNavigation by navigation id
- PageNavigation navigation = uicomp.getNavigationById(navId);
-
// open a add navigation popup
UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
UIPageNavigationForm pageNavigation = popUp.createUIComponent(UIPageNavigationForm.class, null, null, popUp);
- pageNavigation.setOwnerId(navigation.getOwnerId());
- pageNavigation.setOwnerType(navigation.getOwnerType());
+ pageNavigation.setOwnerId(siteKey.getName());
+ pageNavigation.setOwnerType(siteKey.getTypeName());
pageNavigation.setPriority(String.valueOf(navigation.getPriority()));
pageNavigation.addFormInput();
- pageNavigation.setPageNav(navigation);
+ pageNavigation.setUserNav(navigation);
popUp.setUIComponent(pageNavigation);
popUp.setWindowSize(600, 400);
popUp.setShowMask(true);
- popUp.setShow(true);
+ popUp.setShow(true);
}
}
- static public class DeleteNavigationActionListener extends EventListener<UIGroupNavigationManagement>
+ static public class DeleteNavigationActionListener extends BaseEditAction
{
- public void execute(Event<UIGroupNavigationManagement> event) throws Exception
+ @Override
+ protected void doEdit(UserNavigation navigation, Event<UIGroupNavigationManagement> event) throws Exception
{
UIGroupNavigationManagement uicomp = event.getSource();
+ NavigationService service = uicomp.getApplicationComponent(NavigationService.class);
- WebuiRequestContext context = event.getRequestContext();
- UIApplication uiApplication = context.getUIApplication();
-
- // get navigation id
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- Integer navId = Integer.parseInt(id);
-
- // get PageNavigation by navigation id
- PageNavigation navigation = uicomp.getNavigationById(navId);
-
- // check edit permission, ensure that user has edit permission on that
- // navigation
- UserACL userACL = uicomp.getApplicationComponent(UserACL.class);
-
- if (!userACL.hasEditPermission(navigation))
+ NavigationContext ctx = service.loadNavigation(navigation.getKey());
+ if (ctx != null)
{
- uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.Invalid-editPermission", null));
- return;
+ service.destroyNavigation(ctx);
}
- // TODO ensure this navigation is exist
- DataStorage service = uicomp.getApplicationComponent(DataStorage.class);
- if (service.getPageNavigation(navigation.getOwnerType(), navigation.getOwnerId()) == null)
- {
- uiApplication.addMessage(new ApplicationMessage("UIGroupNavigationManagement.msg.navigation-not-exist", null));
- return;
- }
-
- // remove selected navigation
- if (uicomp.navigations == null || uicomp.navigations.size() < 1)
- {
- return;
- }
- uicomp.navigations.remove(navigation);
-
- // remove navigation from UIPortalApplication
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- removeNavigationByID(uiPortalApp.getUserPortalConfig().getNavigations(), navigation);
- removeNavigationByID(uiPortalApp.getNavigations(), navigation);
-
-
- service.remove(navigation);
+ //
event.getRequestContext().addUIComponentToUpdateByAjax(uicomp);
-
//Update UserToolbarGroupPortlet
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);
- uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
+ UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
+ uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
}
-
- private void removeNavigationByID(List<PageNavigation> navs, PageNavigation target)
- {
- if (navs == null)
- {
- return;
- }
- for (PageNavigation nav : navs)
- {
- if (nav.getId() == target.getId())
- {
- navs.remove(nav);
- return;
- }
- }
- }
-
}
static public class AddNavigationActionListener extends EventListener<UIGroupNavigationManagement>
@@ -381,7 +271,10 @@
uiMaskWS.setUIComponent(uiNewPortal);
uiMaskWS.setShow(true);
prContext.addUIComponentToUpdateByAjax(uiMaskWS);
-
+
+ //If other users has add or remove group navigation, we need to refresh this portlet
+ UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
+ uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
}
}
@@ -391,32 +284,36 @@
public void execute(Event<UIPageNodeForm> event) throws Exception
{
UIPageNodeForm uiPageNodeForm = event.getSource();
- PageNavigation contextNavigation = uiPageNodeForm.getContextPageNavigation();
-
UIGroupNavigationManagement uiGroupNavigation =
uiPageNodeForm.getAncestorOfType(UIGroupNavigationManagement.class);
- PageNavigation selectedNavigation = uiGroupNavigation.getSelectedNavigation();
- UIPopupWindow uiNavigationPopup = uiGroupNavigation.getChild(UIPopupWindow.class);
- UINavigationManagement navigationManager =
- uiPageNodeForm.createUIComponent(UINavigationManagement.class, null, null);
- navigationManager.setOwner(contextNavigation.getOwnerId());
- navigationManager.setOwnerType(contextNavigation.getOwnerType());
- UINavigationNodeSelector selector = navigationManager.getChild(UINavigationNodeSelector.class);
- selector.setEdittedNavigation(contextNavigation);
- selector.initTreeData();
+ UINavigationManagement navigationManager = uiGroupNavigation.naviManager;
- if (uiPageNodeForm.getSelectedParent() instanceof PageNode)
- {
- PageNode selectedParent = (PageNode)uiPageNodeForm.getSelectedParent();
- selector.selectPageNodeByUri(selectedParent.getUri());
- }
-
+ UINavigationNodeSelector selector = navigationManager.getChild(UINavigationNodeSelector.class);
+ TreeNode selectedParent = (TreeNode)uiPageNodeForm.getSelectedParent();
+ selector.selectNode(selectedParent);
+
+ UIPopupWindow uiNavigationPopup = uiGroupNavigation.getChild(UIPopupWindow.class);
uiNavigationPopup.setUIComponent(navigationManager);
uiNavigationPopup.setWindowSize(400, 400);
uiNavigationPopup.setRendered(true);
-
event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
+
+ selector.createEvent("NodeModified", Phase.PROCESS, event.getRequestContext()).broadcast();
}
}
+
+ static public class CloseActionListener extends UIPopupWindow.CloseActionListener
+ {
+ public void execute(Event<UIPopupWindow> event) throws Exception
+ {
+ UIPopupWindow popWindow = event.getSource();
+ popWindow.setUIComponent(null);
+
+ UIGroupNavigationManagement grpMan = popWindow.getAncestorOfType(UIGroupNavigationManagement.class);
+ grpMan.naviManager = null;
+
+ super.execute(event);
+ }
+ }
}
Copied: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationManagement.java (from rev 6783, portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationManagement.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationManagement.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationManagement.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,155 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.navigation.webui.component;
+
+import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.UserPortalConfig;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
+import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.core.UIPopupWindow;
+import org.exoplatform.webui.core.UIRightClickPopupMenu;
+import org.exoplatform.webui.core.UITree;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
+
+@ComponentConfig(template = "app:/groovy/navigation/webui/component/UINavigationManagement.gtmpl", events = {
+ @EventConfig(listeners = UINavigationManagement.SaveActionListener.class),
+ @EventConfig(listeners = UINavigationManagement.AddRootNodeActionListener.class)})
+public class UINavigationManagement extends UIContainer
+{
+
+ private String owner;
+
+ private String ownerType;
+
+ public UINavigationManagement() throws Exception
+ {
+ addChild(UINavigationNodeSelector.class, null, null);
+ }
+
+ public void setOwner(String owner)
+ {
+ this.owner = owner;
+ }
+
+ public String getOwner()
+ {
+ return this.owner;
+ }
+
+ public <T extends UIComponent> T setRendered(boolean b)
+ {
+ return super.<T> setRendered(b);
+ }
+
+ public void loadView(Event<? extends UIComponent> event) throws Exception
+ {
+ UINavigationNodeSelector uiNodeSelector = getChild(UINavigationNodeSelector.class);
+ UITree uiTree = uiNodeSelector.getChild(UITree.class);
+ uiTree.createEvent("ChangeNode", event.getExecutionPhase(), event.getRequestContext()).broadcast();
+ }
+
+ public void setOwnerType(String ownerType)
+ {
+ this.ownerType = ownerType;
+ }
+
+ public String getOwnerType()
+ {
+ return this.ownerType;
+ }
+
+ static public class SaveActionListener extends EventListener<UINavigationManagement>
+ {
+
+ public void execute(Event<UINavigationManagement> event) throws Exception
+ {
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ UINavigationManagement uiManagement = event.getSource();
+ UINavigationNodeSelector uiNodeSelector = uiManagement.getChild(UINavigationNodeSelector.class);
+ UserPortalConfigService portalConfigService = uiManagement.getApplicationComponent(UserPortalConfigService.class);
+
+ UIPopupWindow uiPopup = uiManagement.getParent();
+ uiPopup.createEvent("ClosePopup", Phase.PROCESS, event.getRequestContext()).broadcast();
+
+ UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
+ UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ prContext.setFullRender(true);
+
+ UserNavigation navigation = uiNodeSelector.getEdittedNavigation();
+ SiteKey siteKey = navigation.getKey();
+ String editedOwnerId = siteKey.getName();
+
+ // Check existed
+ UserPortalConfig userPortalConfig;
+ if (PortalConfig.PORTAL_TYPE.equals(siteKey.getTypeName()))
+ {
+ userPortalConfig = portalConfigService.getUserPortalConfig(editedOwnerId, event.getRequestContext().getRemoteUser());
+ if (userPortalConfig == null)
+ {
+ prContext.getUIApplication().addMessage(
+ new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null, ApplicationMessage.ERROR));
+ return;
+ }
+ }
+ else
+ {
+ userPortalConfig = portalConfigService.getUserPortalConfig(prContext.getPortalOwner(), event.getRequestContext().getRemoteUser());
+ }
+
+ UserNavigation persistNavigation = userPortalConfig.getUserPortal().getNavigation(siteKey);
+ if (persistNavigation == null)
+ {
+ prContext.getUIApplication().addMessage(
+ new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null, ApplicationMessage.ERROR));
+ return;
+ }
+
+ uiNodeSelector.save();
+ }
+ }
+
+ static public class AddRootNodeActionListener extends EventListener<UINavigationManagement>
+ {
+
+ @Override
+ public void execute(Event<UINavigationManagement> event) throws Exception
+ {
+ UINavigationManagement uiManagement = event.getSource();
+ UINavigationNodeSelector uiNodeSelector = uiManagement.getChild(UINavigationNodeSelector.class);
+ UIRightClickPopupMenu menu = uiNodeSelector.getChild(UIRightClickPopupMenu.class);
+ menu.createEvent("AddNode", Phase.PROCESS, event.getRequestContext()).broadcast();
+ }
+
+ }
+}
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java (from rev 6783, portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UINavigationNodeSelector.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,822 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.navigation.webui.component;
+
+import java.util.Collection;
+
+import org.exoplatform.navigation.webui.TreeNode;
+import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NavigationError;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
+import org.exoplatform.portal.webui.page.UIPage;
+import org.exoplatform.portal.webui.portal.UIPortalComposer;
+import org.exoplatform.portal.webui.util.PortalDataMapper;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIEditInlineWorkspace;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
+import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
+import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.ComponentConfigs;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIApplication;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.core.UIPopupWindow;
+import org.exoplatform.webui.core.UIRightClickPopupMenu;
+import org.exoplatform.webui.core.UITree;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
+import org.gatein.common.util.ParameterValidation;
+
+/** Copied by The eXo Platform SARL Author May 28, 2009 3:07:15 PM */
+@ComponentConfigs({
+ @ComponentConfig(template = "system:/groovy/portal/webui/navigation/UINavigationNodeSelector.gtmpl", events = {
+ @EventConfig(listeners = UINavigationNodeSelector.ChangeNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.NodeModifiedActionListener.class)}),
+ @ComponentConfig(id = "NavigationNodePopupMenu", type = UIRightClickPopupMenu.class, template = "system:/groovy/webui/core/UIRightClickPopupMenu.gtmpl", events = {
+ @EventConfig(listeners = UINavigationNodeSelector.AddNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.EditPageNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.EditSelectedNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.CopyNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.CutNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.CloneNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.PasteNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.MoveUpActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.MoveDownActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.DeleteNodeActionListener.class, confirm = "UIPageNodeSelector.deleteNavigation")}),
+ @ComponentConfig(id = "UINavigationNodeSelectorPopupMenu", type = UIRightClickPopupMenu.class, template = "system:/groovy/webui/core/UIRightClickPopupMenu.gtmpl", events = {
+ @EventConfig(listeners = UINavigationNodeSelector.AddNodeActionListener.class),
+ @EventConfig(listeners = UINavigationNodeSelector.PasteNodeActionListener.class)})})
+public class UINavigationNodeSelector extends UIContainer
+{
+ private UserNavigation edittedNavigation;
+
+ /**
+ * This field holds transient copy of edittedTreeNodeData, which is used when
+ * user pastes the content to a new tree node
+ */
+ private TreeNode copyOfTreeNodeData;
+
+ private TreeNode rootNode;
+
+ private UserPortal userPortal;
+
+ private UserNodeFilterConfig filterConfig;
+
+ private static final Scope NODE_SCOPE = Scope.GRANDCHILDREN;
+
+ public UINavigationNodeSelector() throws Exception
+ {
+ UIRightClickPopupMenu rightClickPopup =
+ addChild(UIRightClickPopupMenu.class, "UINavigationNodeSelectorPopupMenu", null).setRendered(true);
+ rightClickPopup.setActions(new String[]{"AddNode", "PasteNode"});
+
+ UITree uiTree = addChild(UITree.class, null, "TreeNodeSelector");
+ uiTree.setIcon("DefaultPageIcon");
+ uiTree.setSelectedIcon("DefaultPageIcon");
+ uiTree.setBeanIdField("Id");
+ uiTree.setBeanChildCountField("childrenCount");
+ uiTree.setBeanLabelField("encodedResolvedLabel");
+ uiTree.setBeanIconField("icon");
+
+ UIRightClickPopupMenu uiPopupMenu =
+ createUIComponent(UIRightClickPopupMenu.class, "NavigationNodePopupMenu", null);
+ uiPopupMenu.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode",
+ "CutNode", "DeleteNode", "MoveUp", "MoveDown"});
+ uiTree.setUIRightClickPopupMenu(uiPopupMenu);
+ }
+
+ /**
+ * Init the UITree wrapped in UINavigationNodeSelector
+ *
+ * @throws Exception
+ */
+ public void initTreeData() throws Exception
+ {
+ if (edittedNavigation == null || userPortal == null)
+ {
+ throw new IllegalStateException("edittedNavigation and userPortal must be initialized first");
+ }
+
+ try
+ {
+ this.rootNode =
+ new TreeNode(edittedNavigation, userPortal.getNode(edittedNavigation, NODE_SCOPE, filterConfig, null));
+
+ TreeNode node = this.rootNode;
+ if (this.rootNode.getChildren().size() > 0)
+ {
+ node = rebaseNode(this.rootNode.getChild(0), NODE_SCOPE);
+ if (node == null)
+ {
+ initTreeData();
+ return;
+ }
+ }
+ selectNode(node);
+ }
+ catch (Exception ex)
+ {
+ // Navigation deleted --> close the editor
+ this.rootNode = null;
+
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ context.getUIApplication().addMessage(
+ new ApplicationMessage("UINavigationNodeSelector.msg." + NavigationError.NAVIGATION_NO_SITE.name(), null,
+ ApplicationMessage.ERROR));
+
+ UIPopupWindow popup = getAncestorOfType(UIPopupWindow.class);
+ popup.createEvent("ClosePopup", Phase.PROCESS, context).broadcast();
+
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
+ prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ prContext.setFullRender(true);
+ }
+ }
+
+ public TreeNode selectNode(TreeNode node) throws Exception
+ {
+ if (node == null)
+ {
+ return null;
+ }
+
+ UITree tree = getChild(UITree.class);
+ tree.setSelected(node);
+ if (node.getId().equals(rootNode.getId()))
+ {
+ tree.setChildren(null);
+ tree.setSibbling(node.getChildren());
+ tree.setParentSelected(node);
+ }
+ else
+ {
+ TreeNode parentNode = node.getParent();
+ tree.setChildren(node.getChildren());
+ tree.setSibbling(parentNode.getChildren());
+ tree.setParentSelected(parentNode);
+ }
+ return node;
+ }
+
+ public TreeNode rebaseNode(TreeNode treeNode, Scope scope) throws Exception
+ {
+ if (treeNode == null || treeNode.getNode() == null)
+ {
+ return null;
+ }
+
+ UserNode userNode = treeNode.getNode();
+ if (userNode.getId() == null)
+ {
+ // Transient node
+ return treeNode;
+ }
+
+ userPortal.rebaseNode(userNode, scope, getRootNode());
+ //this line return null if node has been deleted
+ return findNode(treeNode.getId());
+ }
+
+ public void save()
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ try
+ {
+ userPortal.saveNode(getRootNode().getNode(), null);
+ }
+ catch (NavigationServiceException ex)
+ {
+ context.getUIApplication().addMessage(
+ new ApplicationMessage("UINavigationNodeSelector.msg." + ex.getError().name(), null, ApplicationMessage.ERROR));
+ }
+ }
+
+ public TreeNode getCopyNode()
+ {
+ return copyOfTreeNodeData;
+ }
+
+ public void setCopyNode(TreeNode copyNode)
+ {
+ this.copyOfTreeNodeData = copyNode;
+ }
+
+ public TreeNode getRootNode()
+ {
+ return rootNode;
+ }
+
+ public void setUserPortal(UserPortal userPortal) throws Exception
+ {
+ this.userPortal = userPortal;
+ setFilterConfig(UserNodeFilterConfig.builder().withAuthorizationCheck().build());
+ }
+
+ private void setFilterConfig(UserNodeFilterConfig config)
+ {
+ this.filterConfig = config;
+ }
+
+ public void setEdittedNavigation(UserNavigation nav) throws Exception
+ {
+ this.edittedNavigation = nav;
+ }
+
+ public UserNavigation getEdittedNavigation()
+ {
+ return this.edittedNavigation;
+ }
+
+ public TreeNode findNode(String nodeID)
+ {
+ if (getRootNode() == null)
+ {
+ return null;
+ }
+ return getRootNode().findNode(nodeID);
+ }
+
+ static public abstract class BaseActionListener<T> extends EventListener<T>
+ {
+ protected TreeNode rebaseNode(TreeNode node, UINavigationNodeSelector selector) throws Exception
+ {
+ return rebaseNode(node, UINavigationNodeSelector.NODE_SCOPE, selector);
+ }
+
+ protected TreeNode rebaseNode(TreeNode node, Scope scope, UINavigationNodeSelector selector) throws Exception
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ TreeNode rebased = selector.rebaseNode(node, scope);
+ if (rebased == null)
+ {
+ context.getUIApplication().addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.staleData", null,
+ ApplicationMessage.WARNING));
+ selector.selectNode(selector.getRootNode());
+ context.addUIComponentToUpdateByAjax(selector);
+ }
+ return rebased;
+ }
+
+ protected void handleError(NavigationError error, UINavigationNodeSelector selector) throws Exception
+ {
+ selector.initTreeData();
+ if (selector.getRootNode() != null)
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ UIApplication uiApp = context.getUIApplication();
+ uiApp.addMessage(new ApplicationMessage("UINavigationNodeSelector.msg." + error.name(), null,
+ ApplicationMessage.ERROR));
+ }
+ }
+ }
+
+ static public class ChangeNodeActionListener extends BaseActionListener<UITree>
+ {
+ public void execute(Event<UITree> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UINavigationNodeSelector uiNodeSelector = event.getSource().getParent();
+
+ String nodeID = context.getRequestParameter(OBJECTID);
+ TreeNode node = uiNodeSelector.findNode(nodeID);
+
+ try
+ {
+ node = rebaseNode(node, uiNodeSelector);
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ return;
+ }
+
+ uiNodeSelector.selectNode(node);
+ context.addUIComponentToUpdateByAjax(uiNodeSelector);
+ }
+ }
+
+ static public class AddNodeActionListener extends BaseActionListener<UIRightClickPopupMenu>
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UIRightClickPopupMenu uiPopupMenu = event.getSource();
+ UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
+
+ String nodeID = context.getRequestParameter(UIComponent.OBJECTID);
+ TreeNode node;
+ if (ParameterValidation.isNullOrEmpty(nodeID))
+ {
+ node = uiNodeSelector.getRootNode();
+ }
+ else
+ {
+ node = uiNodeSelector.findNode(nodeID);
+ }
+
+ try
+ {
+ node = rebaseNode(node, uiNodeSelector);
+ if (node == null) return;
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ return;
+ }
+
+ UIPopupWindow uiManagementPopup = uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
+ UIPageNodeForm uiNodeForm = uiManagementPopup.createUIComponent(UIPageNodeForm.class, null, null);
+ uiNodeForm.setValues(null);
+ uiManagementPopup.setUIComponent(uiNodeForm);
+
+ uiNodeForm.setSelectedParent(node);
+ UserNavigation edittedNavigation = uiNodeSelector.getEdittedNavigation();
+ uiNodeForm.setContextPageNavigation(edittedNavigation);
+ uiManagementPopup.setWindowSize(800, 500);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
+ }
+ }
+
+ static public class NodeModifiedActionListener extends BaseActionListener<UINavigationNodeSelector>
+ {
+ @Override
+ public void execute(Event<UINavigationNodeSelector> event) throws Exception
+ {
+ UINavigationNodeSelector uiNodeSelector = event.getSource();
+
+ try
+ {
+ rebaseNode(uiNodeSelector.getRootNode(), uiNodeSelector);
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ }
+ }
+ }
+
+ static public class EditPageNodeActionListener extends EventListener<UIRightClickPopupMenu>
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ // get nodeID
+ String nodeID = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+
+ // get UINavigationNodeSelector
+ UIRightClickPopupMenu uiPopupMenu = event.getSource();
+ UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
+
+ // get Selected Node
+ TreeNode selectedPageNode = uiNodeSelector.findNode(nodeID);
+
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ if (selectedPageNode == null || selectedPageNode.getPageRef() == null)
+ {
+ uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
+ return;
+ }
+
+ UserPortalConfigService userService = uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);
+
+ // get selected page
+ String pageId = selectedPageNode.getPageRef();
+ Page selectPage = (pageId != null) ? userService.getPage(pageId) : null;
+ if (selectPage != null)
+ {
+ UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
+ if (!userACL.hasEditPermission(selectPage))
+ {
+ uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId}, 1));
+ return;
+ }
+
+ uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
+ // uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
+ // uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor",
+ // null);
+
+ UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ UIPortalToolPanel uiToolPanel =
+ uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
+ uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
+
+ UIPortalComposer portalComposer =
+ uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(true);
+ portalComposer.setShowControl(true);
+ portalComposer.setEditted(false);
+ portalComposer.setCollapse(false);
+ portalComposer.setId("UIPageEditor");
+ portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");
+
+ uiToolPanel.setShowMaskLayer(false);
+ uiToolPanel.setWorkingComponent(UIPage.class, null);
+ UIPage uiPage = (UIPage)uiToolPanel.getUIComponent();
+
+ if (selectPage.getTitle() == null)
+ selectPage.setTitle(selectedPageNode.getLabel());
+
+ // convert Page to UIPage
+ PortalDataMapper.toUIPage(uiPage, selectPage);
+ Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
+ }
+ else
+ {
+ uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
+ }
+ }
+ }
+
+ static public class EditSelectedNodeActionListener extends BaseActionListener<UIRightClickPopupMenu>
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UIRightClickPopupMenu popupMenu = event.getSource();
+ UINavigationNodeSelector uiNodeSelector = popupMenu.getAncestorOfType(UINavigationNodeSelector.class);
+
+ String nodeID = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ TreeNode node = uiNodeSelector.findNode(nodeID);
+ try
+ {
+ node = rebaseNode(node, uiNodeSelector);
+ if (node == null) return;
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ return;
+ }
+
+ UIApplication uiApp = context.getUIApplication();
+ UserPortalConfigService service = uiApp.getApplicationComponent(UserPortalConfigService.class);
+ String pageId = node.getPageRef();
+ Page page = (pageId != null) ? service.getPage(pageId) : null;
+ if (page != null)
+ {
+ UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
+ if (!userACL.hasPermission(page))
+ {
+ uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId}, 1));
+ return;
+ }
+ }
+
+ UIPopupWindow uiManagementPopup = uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
+ UIPageNodeForm uiNodeForm = uiApp.createUIComponent(UIPageNodeForm.class, null, null);
+ uiManagementPopup.setUIComponent(uiNodeForm);
+
+ UserNavigation edittedNav = uiNodeSelector.getEdittedNavigation();
+ uiNodeForm.setContextPageNavigation(edittedNav);
+ uiNodeForm.setValues(node);
+ uiNodeForm.setSelectedParent(node.getParent());
+ uiManagementPopup.setWindowSize(800, 500);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
+ }
+ }
+
+ static public class CopyNodeActionListener extends BaseActionListener<UIRightClickPopupMenu>
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector);
+
+ String nodeID = context.getRequestParameter(UIComponent.OBJECTID);
+ TreeNode node = uiNodeSelector.findNode(nodeID);
+ try
+ {
+ node = rebaseNode(node, Scope.ALL, uiNodeSelector);
+ if (node == null) return;
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ return;
+ }
+
+ node.setDeleteNode(false);
+ uiNodeSelector.setCopyNode(node);
+ event.getSource().setActions(
+ new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode", "CutNode",
+ "PasteNode", "DeleteNode", "MoveUp", "MoveDown"});
+ }
+ }
+
+ static public class CutNodeActionListener extends BaseActionListener<UIRightClickPopupMenu>
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
+ context.addUIComponentToUpdateByAjax(uiNodeSelector);
+
+ String nodeID = context.getRequestParameter(UIComponent.OBJECTID);
+ TreeNode node = uiNodeSelector.findNode(nodeID);
+ try
+ {
+ node = rebaseNode(node, Scope.SINGLE, uiNodeSelector);
+ if (node == null) return;
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ return;
+ }
+
+ if (node != null && Visibility.SYSTEM.equals(node.getVisibility()))
+ {
+ context.getUIApplication().addMessage(
+ new ApplicationMessage("UINavigationNodeSelector.msg.systemnode-move", null));
+ return;
+ }
+
+ node.setDeleteNode(true);
+ uiNodeSelector.setCopyNode(node);
+ event.getSource().setActions(
+ new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode", "CutNode",
+ "PasteNode", "DeleteNode", "MoveUp", "MoveDown"});
+ }
+ }
+
+ static public class CloneNodeActionListener extends CopyNodeActionListener
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ super.execute(event);
+ UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
+ TreeNode currNode = uiNodeSelector.getCopyNode();
+ String nodeID = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ if (currNode != null && currNode.getId().equals(nodeID))
+ currNode.setCloneNode(true);
+ }
+ }
+
+ static public class PasteNodeActionListener extends BaseActionListener<UIRightClickPopupMenu>
+ {
+ private UINavigationNodeSelector uiNodeSelector;
+
+ private DataStorage dataStorage;
+
+ private UserPortalConfigService service;
+
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UIRightClickPopupMenu uiPopupMenu = event.getSource();
+ uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
+ context.addUIComponentToUpdateByAjax(uiNodeSelector);
+
+ String nodeID = context.getRequestParameter(UIComponent.OBJECTID);
+ TreeNode targetNode = uiNodeSelector.findNode(nodeID);
+ TreeNode sourceNode = uiNodeSelector.getCopyNode();
+ if (sourceNode == null)
+ return;
+
+ try
+ {
+ targetNode = rebaseNode(targetNode, uiNodeSelector);
+ if (targetNode == null) return;
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ return;
+ }
+
+ if (sourceNode.getId().equals(targetNode.getId()))
+ {
+ context.getUIApplication().addMessage(
+ new ApplicationMessage("UIPageNodeSelector.msg.paste.sameSrcAndDes", null));
+ return;
+ }
+
+ if (isExistChild(targetNode, sourceNode))
+ {
+ context.getUIApplication()
+ .addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameName", null));
+ return;
+ }
+
+ UITree uitree = uiNodeSelector.getChild(UITree.class);
+ UIRightClickPopupMenu popup = uitree.getUIRightClickPopupMenu();
+ popup.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CutNode",
+ "CloneNode", "DeleteNode", "MoveUp", "MoveDown"});
+ uiNodeSelector.setCopyNode(null);
+
+ if (uiNodeSelector.findNode(sourceNode.getId()) == null)
+ {
+ context.getUIApplication().addMessage(
+ new ApplicationMessage("UINavigationNodeSelector.msg.copiedNode.deleted", null, ApplicationMessage.WARNING));
+ uiNodeSelector.selectNode(uiNodeSelector.getRootNode());
+ return;
+ }
+
+ if (sourceNode.isDeleteNode())
+ {
+ targetNode.addChild(sourceNode);
+ uiNodeSelector.selectNode(targetNode);
+ return;
+ }
+
+ service = uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);
+ dataStorage = uiNodeSelector.getApplicationComponent(DataStorage.class);
+ pasteNode(sourceNode, targetNode, sourceNode.isCloneNode());
+ uiNodeSelector.selectNode(targetNode);
+ }
+
+ private TreeNode pasteNode(TreeNode sourceNode, TreeNode parent, boolean isClone) throws Exception
+ {
+ TreeNode node = parent.addChild(sourceNode.getName());
+ node.setLabel(sourceNode.getLabel());
+ node.setVisibility(sourceNode.getVisibility());
+ node.setIcon(sourceNode.getIcon());
+ node.setStartPublicationTime(sourceNode.getStartPublicationTime());
+ node.setEndPublicationTime(sourceNode.getEndPublicationTime());
+
+ if (isClone)
+ {
+ String pageName = "page" + node.hashCode();
+ node.setPageRef(clonePageFromNode(sourceNode, pageName, sourceNode.getPageNavigation().getKey()));
+ }
+ else
+ {
+ node.setPageRef(sourceNode.getPageRef());
+ }
+
+ for (TreeNode child : sourceNode.getChildren())
+ {
+ pasteNode(child, node, isClone);
+ }
+
+ return node;
+ }
+
+ private String clonePageFromNode(TreeNode node, String pageName, SiteKey siteKey) throws Exception
+ {
+ String pageId = node.getPageRef();
+ if (pageId != null)
+ {
+ Page page = service.getPage(pageId);
+ if (page != null)
+ {
+ page = dataStorage.clonePage(pageId, siteKey.getTypeName(), siteKey.getName(), pageName);
+ return page.getPageId();
+ }
+ }
+ return null;
+ }
+
+ private boolean isExistChild(TreeNode parent, TreeNode child)
+ {
+ return parent != null && parent.getChild(child.getName()) != null;
+ }
+ }
+
+ static public class MoveUpActionListener extends BaseActionListener<UIRightClickPopupMenu>
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ moveNode(event, -1);
+ }
+
+ protected void moveNode(Event<UIRightClickPopupMenu> event, int i) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
+ context.addUIComponentToUpdateByAjax(uiNodeSelector.getParent());
+
+ String nodeID = context.getRequestParameter(UIComponent.OBJECTID);
+ TreeNode targetNode = uiNodeSelector.findNode(nodeID);
+ // This happen when browser's not sync with server
+ if (targetNode == null)
+ return;
+
+ TreeNode parentNode = targetNode.getParent();
+ try
+ {
+ parentNode = rebaseNode(parentNode, uiNodeSelector);
+ if (parentNode == null) return;
+ // After update the parentNode, maybe targetNode has been deleted or moved
+ TreeNode temp = parentNode.getChild(targetNode.getName());
+ if (temp == null || !temp.getId().equals(targetNode.getId()))
+ {
+ context.getUIApplication().addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.staleData", null,
+ ApplicationMessage.WARNING));
+ uiNodeSelector.selectNode(uiNodeSelector.getRootNode());
+ context.addUIComponentToUpdateByAjax(uiNodeSelector);
+ return;
+ }
+ }
+ catch (NavigationServiceException ex)
+ {
+ handleError(ex.getError(), uiNodeSelector);
+ return;
+ }
+
+ Collection<TreeNode> children = parentNode.getChildren();
+
+ int k;
+ for (k = 0; k < children.size(); k++)
+ {
+ if (parentNode.getChild(k).getId().equals(targetNode.getId()))
+ {
+ break;
+ }
+ }
+
+ if (k == 0 && i == -1)
+ {
+ return;
+ }
+ if (k == children.size() - 1 && i == 2)
+ {
+ return;
+ }
+
+ parentNode.addChild(k + i, targetNode);
+
+ //These lines help to refresh the tree
+ TreeNode selectedNode = uiNodeSelector.getSelectedNode();
+ uiNodeSelector.selectNode(parentNode);
+ uiNodeSelector.selectNode(selectedNode);
+ }
+ }
+
+ static public class MoveDownActionListener extends UINavigationNodeSelector.MoveUpActionListener
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ super.moveNode(event, 2);
+ }
+ }
+
+ static public class DeleteNodeActionListener extends EventListener<UIRightClickPopupMenu>
+ {
+ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
+ {
+ WebuiRequestContext pcontext = event.getRequestContext();
+ UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
+ pcontext.addUIComponentToUpdateByAjax(uiNodeSelector);
+
+ String nodeID = pcontext.getRequestParameter(UIComponent.OBJECTID);
+ TreeNode childNode = uiNodeSelector.findNode(nodeID);
+ if (childNode == null)
+ {
+ return;
+ }
+ TreeNode parentNode = childNode.getParent();
+
+ if (Visibility.SYSTEM.equals(childNode.getVisibility()))
+ {
+ UIApplication uiApp = pcontext.getUIApplication();
+ uiApp.addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.systemnode-delete", null));
+ return;
+ }
+
+ parentNode.removeChild(childNode);
+ uiNodeSelector.selectNode(parentNode);
+ }
+ }
+
+ public TreeNode getSelectedNode()
+ {
+ return getChild(UITree.class).getSelected();
+ }
+}
Copied: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java (from rev 6783, portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,495 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.navigation.webui.component;
+
+import org.exoplatform.navigation.webui.TreeNode;
+import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.webui.page.UIPageSelector;
+import org.exoplatform.portal.webui.page.UIWizardPageSetInfo;
+import org.exoplatform.portal.webui.portal.UIPortal;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.core.UIApplication;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIPopupWindow;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.exception.MessageException;
+import org.exoplatform.webui.form.UIFormCheckBoxInput;
+import org.exoplatform.webui.form.UIFormDateTimeInput;
+import org.exoplatform.webui.form.UIFormInputBase;
+import org.exoplatform.webui.form.UIFormInputIconSelector;
+import org.exoplatform.webui.form.UIFormInputSet;
+import org.exoplatform.webui.form.UIFormStringInput;
+import org.exoplatform.webui.form.UIFormTabPane;
+import org.exoplatform.webui.form.validator.DateTimeValidator;
+import org.exoplatform.webui.form.validator.IdentifierValidator;
+import org.exoplatform.webui.form.validator.MandatoryValidator;
+import org.exoplatform.webui.form.validator.StringLengthValidator;
+import org.exoplatform.webui.form.validator.Validator;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.List;
+
+/**
+ * Author : Dang Van Minh, Pham Tuan minhdv81(a)yahoo.com Jun 14, 2006
+ */
+public class UIPageNodeForm extends UIFormTabPane
+{
+
+ private TreeNode pageNode_;
+
+ private Object selectedParent;
+
+ /**
+ * PageNavigation to which editted PageNode belongs
+ */
+ private UserNavigation contextPageNavigation;
+
+ final private static String SHOW_PUBLICATION_DATE = "showPublicationDate";
+
+ final private static String START_PUBLICATION_DATE = "startPublicationDate";
+
+ final private static String END_PUBLICATION_DATE = "endPublicationDate";
+
+ final private static String VISIBLE = "visible";
+
+ public UIPageNodeForm() throws Exception
+ {
+ super("UIPageNodeForm");
+
+ UIFormInputSet uiSettingSet = new UIFormInputSet("PageNodeSetting");
+ UIFormCheckBoxInput<Boolean> uiDateInputCheck =
+ new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, null, false);
+ UIFormCheckBoxInput<Boolean> uiVisibleCheck = new UIFormCheckBoxInput<Boolean>(VISIBLE, null, true);
+
+ uiDateInputCheck.setOnChange("SwitchPublicationDate");
+ uiVisibleCheck.setOnChange("SwitchVisible");
+ uiSettingSet.addUIFormInput(new UIFormStringInput("URI", "URI", null).setEditable(false))
+ .addUIFormInput(new UIFormStringInput("name", "name", null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class))
+ .addUIFormInput(new UIFormStringInput("label", "label", null).addValidator(StringLengthValidator.class, 3, 120))
+ .addUIFormInput(uiVisibleCheck.setChecked(true))
+ .addUIFormInput(uiDateInputCheck)
+ .addUIFormInput(new UIFormDateTimeInput(START_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class))
+ .addUIFormInput(new UIFormDateTimeInput(END_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class));
+
+ addUIFormInput(uiSettingSet);
+ setSelectedTab(uiSettingSet.getId());
+
+ UIPageSelector uiPageSelector = createUIComponent(UIPageSelector.class, null, null);
+ uiPageSelector.configure("UIPageSelector", "pageRef");
+ addUIFormInput(uiPageSelector);
+
+ UIFormInputIconSelector uiIconSelector = new UIFormInputIconSelector("Icon", "icon");
+ addUIFormInput(uiIconSelector);
+ setActions(new String[]{"Save", "Back"});
+ }
+
+ public TreeNode getPageNode()
+ {
+ return pageNode_;
+ }
+
+ public void setValues(TreeNode pageNode) throws Exception
+ {
+ pageNode_ = pageNode;
+ if (pageNode == null)
+ {
+ getUIStringInput("name").setEditable(UIFormStringInput.ENABLE);
+ getChild(UIFormInputIconSelector.class).setSelectedIcon("Default");
+ setShowPublicationDate(false);
+ return;
+ }
+ getUIStringInput("name").setEditable(UIFormStringInput.DISABLE);
+ invokeGetBindingBean(pageNode_);
+ }
+
+ public void invokeGetBindingBean(Object bean) throws Exception
+ {
+ super.invokeGetBindingBean(bean);
+ TreeNode pageNode = (TreeNode)bean;
+
+ String icon = pageNode.getIcon();
+ if (icon == null || icon.length() < 0)
+ icon = "Default";
+ getChild(UIFormInputIconSelector.class).setSelectedIcon(icon);
+ getUIStringInput("label").setValue(pageNode.getLabel());
+ if(pageNode.getVisibility() == Visibility.SYSTEM)
+ {
+ UIFormInputSet uiSettingSet = getChildById("PageNodeSetting");
+ uiSettingSet.removeChildById(VISIBLE);
+ uiSettingSet.removeChildById(SHOW_PUBLICATION_DATE);
+ uiSettingSet.removeChildById(START_PUBLICATION_DATE);
+ uiSettingSet.removeChildById(END_PUBLICATION_DATE);
+ }
+ else
+ {
+ Visibility visibility = pageNode.getVisibility();
+ boolean isVisible = visibility == null || EnumSet.of(Visibility.DISPLAYED, Visibility.TEMPORAL).contains(visibility);
+ getUIFormCheckBoxInput(VISIBLE).setChecked(isVisible);
+ getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).setChecked(Visibility.TEMPORAL.equals(visibility));
+ setShowCheckPublicationDate(isVisible);
+ Calendar cal = Calendar.getInstance();
+ if (pageNode.getStartPublicationTime() != -1)
+ {
+ cal.setTime(new Date(pageNode.getStartPublicationTime()));
+ getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
+ }
+ else
+ getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
+ if (pageNode.getEndPublicationTime() != -1)
+ {
+ cal.setTime(new Date(pageNode.getEndPublicationTime()));
+ getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
+ }
+ else
+ getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
+ }
+ }
+
+ public void invokeSetBindingBean(Object bean) throws Exception
+ {
+ super.invokeSetBindingBean(bean);
+ TreeNode node = (TreeNode) bean;
+
+ if (node.getVisibility() != Visibility.SYSTEM)
+ {
+ Visibility visibility;
+ if (getUIFormCheckBoxInput(VISIBLE).isChecked())
+ {
+ UIFormCheckBoxInput showPubDate = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ visibility = showPubDate.isChecked() ? Visibility.TEMPORAL : Visibility.DISPLAYED;
+ }
+ else
+ {
+ visibility = Visibility.HIDDEN;
+ }
+ node.setVisibility(visibility);
+
+ Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
+ Date date = (cal != null) ? cal.getTime() : null;
+ node.setStartPublicationTime(date == null ? -1 : date.getTime());
+ cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
+ date = (cal != null) ? cal.getTime() : null;
+ node.setEndPublicationTime(date == null ? -1 : date.getTime());
+ }
+ }
+
+ public void setShowCheckPublicationDate(boolean show)
+ {
+ getUIFormCheckBoxInput(VISIBLE).setChecked(show);
+ UIFormCheckBoxInput<Boolean> uiForm = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ uiForm.setRendered(show);
+ setShowPublicationDate(show && uiForm.isChecked());
+ }
+
+ public void setShowPublicationDate(boolean show)
+ {
+ getUIFormDateTimeInput(START_PUBLICATION_DATE).setRendered(show);
+ getUIFormDateTimeInput(END_PUBLICATION_DATE).setRendered(show);
+ }
+
+ public Object getSelectedParent()
+ {
+ return selectedParent;
+ }
+
+ public void setSelectedParent(Object obj)
+ {
+ this.selectedParent = obj;
+ }
+
+ public void processRender(WebuiRequestContext context) throws Exception
+ {
+ super.processRender(context);
+
+ UIPageSelector uiPageSelector = getChild(UIPageSelector.class);
+ if (uiPageSelector == null)
+ return;
+ UIPopupWindow uiPopupWindowPage = uiPageSelector.getChild(UIPopupWindow.class);
+ if (uiPopupWindowPage == null)
+ return;
+ uiPopupWindowPage.processRender(context);
+ }
+
+ public String getOwner()
+ {
+ return contextPageNavigation.getKey().getName();
+ }
+
+ public String getOwnerType()
+ {
+ return contextPageNavigation.getKey().getTypeName();
+ }
+
+ public void setContextPageNavigation(UserNavigation _contextPageNav)
+ {
+ this.contextPageNavigation = _contextPageNav;
+ }
+
+ public UserNavigation getContextPageNavigation()
+ {
+ return this.contextPageNavigation;
+ }
+
+ static public class SaveActionListener extends EventListener<UIPageNodeForm>
+ {
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ WebuiRequestContext ctx = event.getRequestContext();
+ UIPageNodeForm uiPageNodeForm = event.getSource();
+ UIApplication uiPortalApp = ctx.getUIApplication();
+ TreeNode pageNode = uiPageNodeForm.getPageNode();
+
+ if (pageNode == null || (pageNode.getVisibility() != Visibility.SYSTEM &&
+ uiPageNodeForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked()))
+ {
+ Calendar currentCalendar = Calendar.getInstance();
+ currentCalendar.set(currentCalendar.get(Calendar.YEAR), currentCalendar.get(Calendar.MONTH), currentCalendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+ Date currentDate = currentCalendar.getTime();
+
+ Calendar startCalendar =
+ uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.START_PUBLICATION_DATE).getCalendar();
+ Date startDate = startCalendar != null ? startCalendar.getTime() : currentDate;
+ Calendar endCalendar =
+ uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.END_PUBLICATION_DATE).getCalendar();
+ Date endDate = endCalendar != null ? endCalendar.getTime() : null;
+
+ // Case 1: current date after start date
+ if (currentDate.after(startDate))
+ {
+ Object[] args = {};
+ uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeStartDate", args, ApplicationMessage.WARNING));
+ return;
+ }
+ // Case 2: start date after end date
+ else if ((endCalendar != null) && (startCalendar != null) && (startDate.after(endDate)))
+ {
+ Object[] args = {};
+ uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.startDateBeforeEndDate", args, ApplicationMessage.WARNING));
+ return;
+ }
+ // Case 3: start date is null and current date after end date
+ else if((endCalendar != null) && (currentDate.after(endDate)))
+ {
+ Object[] args = {};
+ uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeEndDate", args, ApplicationMessage.WARNING));
+ return;
+ }
+
+ }
+
+ UIFormStringInput nameInput = uiPageNodeForm.getUIStringInput("name");
+ String nodeName = nameInput.getValue();
+
+ TreeNode selectedParent = (TreeNode)uiPageNodeForm.getSelectedParent();
+ if (pageNode == null && selectedParent.getChild(nodeName) != null)
+ {
+ uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.SameName", null));
+ return;
+ }
+
+ //Add node that need to be rebased to context
+ if (pageNode == null)
+ {
+ pageNode = selectedParent.addChild(nodeName);
+ }
+
+
+ UIPageSelector pageSelector = uiPageNodeForm.getChild(UIPageSelector.class);
+ if (pageSelector.getPage() == null)
+ {
+ pageSelector.setValue(null);
+ }
+ else
+ {
+ Page page = pageSelector.getPage();
+ DataStorage storage = uiPageNodeForm.getApplicationComponent(DataStorage.class);
+ if (storage.getPage(page.getPageId()) == null)
+ {
+ storage.create(page);
+ pageSelector.setValue(page.getPageId());
+ }
+ }
+
+ UIFormInputIconSelector uiIconSelector = uiPageNodeForm.getChild(UIFormInputIconSelector.class);
+ if (uiIconSelector.getSelectedIcon().equals("Default"))
+ pageNode.setIcon(null);
+ else
+ pageNode.setIcon(uiIconSelector.getSelectedIcon());
+ if (pageNode.getLabel() == null)
+ pageNode.setLabel(pageNode.getName());
+
+ uiPageNodeForm.invokeSetBindingBean(pageNode);
+
+ uiPageNodeForm.createEvent("Back", Phase.DECODE, ctx).broadcast();
+ }
+ }
+
+ static public class BackActionListener extends EventListener<UIPageNodeForm>
+ {
+
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ }
+
+ }
+
+ static public class SwitchPublicationDateActionListener extends EventListener<UIPageNodeForm>
+ {
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ UIPageNodeForm uiForm = event.getSource();
+ boolean isCheck = uiForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked();
+ uiForm.setShowPublicationDate(isCheck);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
+ }
+
+ static public class SwitchVisibleActionListener extends EventListener<UIPageNodeForm>
+ {
+ @Override
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ UIPageNodeForm uiForm = event.getSource();
+ boolean isCheck = uiForm.getUIFormCheckBoxInput(VISIBLE).isChecked();
+ uiForm.setShowCheckPublicationDate(isCheck);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
+ }
+
+ static public class ClearPageActionListener extends EventListener<UIPageNodeForm>
+ {
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ UIPageNodeForm uiForm = event.getSource();
+ UIPageSelector pageSelector = uiForm.findFirstComponentOfType(UIPageSelector.class);
+ pageSelector.setPage(null);
+ event.getRequestContext().addUIComponentToUpdateByAjax(pageSelector);
+ }
+ }
+
+ static public class CreatePageActionListener extends EventListener<UIPageNodeForm>
+ {
+ public void execute(Event<UIPageNodeForm> event) throws Exception
+ {
+ UIPageNodeForm uiForm = event.getSource();
+ UIPageSelector pageSelector = uiForm.findFirstComponentOfType(UIPageSelector.class);
+
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
+ UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
+
+ UIFormInputSet uiInputSet = pageSelector.getChild(UIFormInputSet.class);
+ List<UIComponent> children = uiInputSet.getChildren();
+ /*********************************************************************/
+ for (UIComponent uiChild : children)
+ {
+ if (uiChild instanceof UIFormInputBase)
+ {
+ UIFormInputBase uiInput = (UIFormInputBase)uiChild;
+ if (!uiInput.isValid())
+ continue;
+ List<Validator> validators = uiInput.getValidators();
+ if (validators == null)
+ continue;
+ try
+ {
+ for (Validator validator : validators)
+ validator.validate(uiInput);
+ }
+ catch (MessageException ex)
+ {
+ uiPortalApp.addMessage(ex.getDetailMessage());
+ return;
+ }
+ catch (Exception ex)
+ {
+ //TODO: This is a critical exception and should be handle in the UIApplication
+ uiPortalApp.addMessage(new ApplicationMessage(ex.getMessage(), null));
+ return;
+ }
+ }
+ }
+
+ UserACL userACL = uiForm.getApplicationComponent(UserACL.class);
+
+ String ownerId = uiForm.getOwner();
+ String[] accessPermission = new String[1];
+ accessPermission[0] = "*:" + ownerId;
+ String editPermission = userACL.getMakableMT() + ":" + ownerId;
+
+ if (PortalConfig.PORTAL_TYPE.equals(uiForm.getOwnerType()))
+ {
+ UIPortal uiPortal = Util.getUIPortal();
+ accessPermission = uiPortal.getAccessPermissions();
+ editPermission = uiPortal.getEditPermission();
+ }
+
+
+ UIFormStringInput uiPageName = uiInputSet.getChildById("pageName");
+ UIFormStringInput uiPageTitle = uiInputSet.getChildById("pageTitle");
+
+ Page page = new Page();
+ page.setOwnerType(uiForm.getOwnerType());
+ page.setOwnerId(ownerId);
+ page.setName(uiPageName.getValue());
+ String title = uiPageTitle.getValue();
+ if (title == null || title.trim().length() < 1)
+ title = page.getName();
+ page.setTitle(title);
+
+ page.setShowMaxWindow(false);
+
+ page.setAccessPermissions(accessPermission);
+ page.setEditPermission(editPermission);
+
+ userACL.hasPermission(page);
+
+ page.setModifiable(true);
+ if (page.getChildren() == null)
+ page.setChildren(new ArrayList<ModelObject>());
+
+ // check page is exist
+ DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
+ Page existPage = dataService.getPage(page.getPageId());
+ if (existPage != null)
+ {
+ uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));
+ pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
+ return;
+ }
+
+ pageSelector.setPage(page);
+ }
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -21,19 +21,17 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.navigation.webui.TreeNode;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
-import org.exoplatform.portal.webui.navigation.UINavigationManagement;
-import org.exoplatform.portal.webui.navigation.UINavigationNodeSelector;
-import org.exoplatform.portal.webui.page.UIPageNodeForm;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.page.UISiteBody;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
@@ -54,16 +52,14 @@
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.webui.event.Event.Phase;
-
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
-
import javax.servlet.http.HttpServletRequest;
@ComponentConfigs({
@@ -77,7 +73,9 @@
@EventConfig(listeners = UIPageNodeForm.SwitchPublicationDateActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchVisibleActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.ClearPageActionListener.class, phase = Phase.DECODE),
- @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase = Phase.DECODE)})})
+ @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase = Phase.DECODE)}),
+ @ComponentConfig(type = UIPopupWindow.class, template = "system:/groovy/webui/core/UIPopupWindow.gtmpl",
+ events = @EventConfig(listeners = UISiteManagement.CloseActionListener.class, name = "ClosePopup"))})
public class UISiteManagement extends UIContainer
{
@@ -85,7 +83,7 @@
private LazyPageList pageList;
- private PageNavigation selectedNavigation;
+ private UINavigationManagement naviManager;
public UISiteManagement() throws Exception
{
@@ -183,16 +181,6 @@
}
- public PageNavigation getOriginalSelectedNavigation()
- {
- return selectedNavigation;
- }
-
- public void setOriginalSelectedNavigation(PageNavigation navigation)
- {
- selectedNavigation = navigation;
- }
-
private boolean stillKeptInPageList(String portalName) throws Exception {
List<PortalConfig> portals = this.getPortalConfigs();
for(PortalConfig p : portals) {
@@ -272,8 +260,9 @@
UISiteManagement uicomp = event.getSource();
String portalName = event.getRequestContext().getRequestParameter(OBJECTID);
UserPortalConfigService service = uicomp.getApplicationComponent(UserPortalConfigService.class);
- PortalRequestContext prContext = Util.getPortalRequestContext();
+ PortalRequestContext prContext = Util.getPortalRequestContext();
UIPortalApplication portalApp = (UIPortalApplication)prContext.getUIApplication();
+ UIWorkingWorkspace uiWorkingWS = portalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
UserPortalConfig userConfig = service.getUserPortalConfig(portalName, prContext.getRemoteUser());
@@ -281,6 +270,7 @@
{
portalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.portal-not-exist",
new String[]{portalName}));
+ uiWorkingWS.updatePortletsByName("UserToolbarSitePortlet");
return;
}
PortalConfig portalConfig = userConfig.getPortalConfig();
@@ -292,8 +282,7 @@
new String[]{portalConfig.getName()}));
return;
}
-
- UIWorkingWorkspace uiWorkingWS = portalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+
//UIEditInlineWorkspace uiEditWS = uiWorkingWS.addChild(UIEditInlineWorkspace.class, null, UIPortalApplication.UI_EDITTING_WS_ID);
UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChildById(UIPortalApplication.UI_EDITTING_WS_ID);
UIPortalComposer uiComposer = uiEditWS.getComposer().setRendered(true);
@@ -313,9 +302,10 @@
// Check if edit current portal
if (uiPortal.getName().equals(editPortal.getName()))
{
- editPortal.setSelectedNode(uiPortal.getSelectedNode());
- editPortal.setSelectedNavigation(uiPortal.getSelectedNavigation());
- editPortal.setSelectedPath(uiPortal.getSelectedPath());
+// editPortal.setSelectedNode(uiPortal.getSelectedNode());
+// editPortal.setNavigation(uiPortal.getNavigation());
+// editPortal.setSelectedPath(uiPortal.getSelectedPath());
+ editPortal.setNavPath(uiPortal.getNavPath());
UISiteBody siteBody = uiWorkingWS.findFirstComponentOfType(UISiteBody.class);
siteBody.setUIComponent(null);
}
@@ -331,35 +321,35 @@
static public class EditNavigationActionListener extends EventListener<UISiteManagement>
{
+
public void execute(Event<UISiteManagement> event) throws Exception
{
UISiteManagement uicomp = event.getSource();
String portalName = event.getRequestContext().getRequestParameter(OBJECTID);
- DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
WebuiRequestContext context = event.getRequestContext();
- UIApplication uiApplication = context.getUIApplication();
+ UIApplication uiApplication = context.getUIApplication();
//Minh Hoang TO: User could edit navigation if he/she has edit permissions on PortalConfig. That is not
//at all logical and should be modified after release 3.1 GA
UserPortalConfigService configService = uicomp.getApplicationComponent(UserPortalConfigService.class);
- UserPortalConfig userPortalConfig = configService.getUserPortalConfig(portalName, context.getRemoteUser());
+ UserPortalConfig userPortalConfig = configService.getUserPortalConfig(portalName, context.getRemoteUser(),
+ PortalRequestContext.USER_PORTAL_CONTEXT);
if(userPortalConfig == null)
{
uiApplication.addMessage(new ApplicationMessage("UISiteManagement.msg.portal-not-exist",
- new String[]{portalName}));
+ new String[]{portalName}));
+ UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ uiWorkingWS.updatePortletsByName("UserToolbarSitePortlet");
return;
}
UserACL userACL = uicomp.getApplicationComponent(UserACL.class);
if (!userACL.hasEditPermission(userPortalConfig.getPortalConfig()))
{
- uiApplication.addMessage(new ApplicationMessage("UISiteManagement.msg.Invalid-editPermission", null));;
+ uiApplication.addMessage(new ApplicationMessage("UISiteManagement.msg.Invalid-editPermission", null));
return;
}
- PageNavigation edittedNavigation = dataService.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
-
-
//Minh Hoang TO: For release 3.1, Edit Permission check would be rollback to former checks on PortalConfig
/*
if (edittedNavigation == null)
@@ -379,17 +369,22 @@
UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
UINavigationManagement naviManager = popUp.createUIComponent(UINavigationManagement.class, null, null, popUp);
+ uicomp.naviManager = naviManager;
+
naviManager.setOwner(portalName);
naviManager.setOwnerType(PortalConfig.PORTAL_TYPE);
+ UserPortal userPortal = userPortalConfig.getUserPortal();
+ UserNavigation edittedNavigation = userPortal.getNavigation(SiteKey.portal(portalName));
+
UINavigationNodeSelector selector = naviManager.getChild(UINavigationNodeSelector.class);
selector.setEdittedNavigation(edittedNavigation);
+ selector.setUserPortal(userPortal);
selector.initTreeData();
-
popUp.setUIComponent(naviManager);
popUp.setShowMask(true);
popUp.setShow(true);
-
+ popUp.setWindowSize(400, 400);
}
}
@@ -399,28 +394,36 @@
public void execute(Event<UIPageNodeForm> event) throws Exception
{
UIPageNodeForm uiPageNodeForm = event.getSource();
- PageNavigation contextNavigation = uiPageNodeForm.getContextPageNavigation();
UISiteManagement uiSiteManagement = uiPageNodeForm.getAncestorOfType(UISiteManagement.class);
+ UINavigationManagement navigationManager = uiSiteManagement.naviManager;
+
+ UINavigationNodeSelector selector = navigationManager.getChild(UINavigationNodeSelector.class);
+ TreeNode selectedParent = (TreeNode)uiPageNodeForm.getSelectedParent();
+ selector.selectNode(selectedParent);
+
+ WebuiRequestContext context = event.getRequestContext();
UIPopupWindow uiNavigationPopup = uiSiteManagement.getChild(UIPopupWindow.class);
- UINavigationManagement navigationManager = uiPageNodeForm.createUIComponent(UINavigationManagement.class, null, null);
- navigationManager.setOwner(contextNavigation.getOwnerId());
- navigationManager.setOwnerType(contextNavigation.getOwnerType());
- UINavigationNodeSelector selector = navigationManager.getChild(UINavigationNodeSelector.class);
-
- selector.setEdittedNavigation(uiPageNodeForm.getContextPageNavigation());
- selector.initTreeData();
-
- if (uiPageNodeForm.getSelectedParent() instanceof PageNode)
- {
- PageNode selectedParent = (PageNode)uiPageNodeForm.getSelectedParent();
- selector.selectPageNodeByUri(selectedParent.getUri());
- }
-
uiNavigationPopup.setUIComponent(navigationManager);
uiNavigationPopup.setWindowSize(400, 400);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
+ context.addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
+
+ selector.createEvent("NodeModified", Phase.PROCESS, context).broadcast();
}
}
+ static public class CloseActionListener extends UIPopupWindow.CloseActionListener
+ {
+ public void execute(Event<UIPopupWindow> event) throws Exception
+ {
+ UIPopupWindow popWindow = event.getSource();
+ popWindow.setUIComponent(null);
+
+ UISiteManagement siteMan = popWindow.getAncestorOfType(UISiteManagement.class);
+ siteMan.naviManager = null;
+
+ super.execute(event);
+ }
+ }
+
}
Copied: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java (from rev 6783, portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,216 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.toolbar.webui.component;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.portlet.MimeResponse;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceURL;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.GenericScope;
+import org.exoplatform.portal.mop.navigation.NodeChange;
+import org.exoplatform.portal.mop.navigation.NodeChangeQueue;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.core.UIPortletApplication;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+/**
+ * @author <a href="mailto:phuong.vu@exoplatform.com">Vu Viet Phuong</a>
+ * @version $Id$
+ *
+ */
+public abstract class BasePartialUpdateToolbar extends UIPortletApplication
+{
+
+ protected UserNodeFilterConfig toolbarFilterConfig;
+ protected Scope toolbarScope;
+ protected static final int DEFAULT_LEVEL = 2;
+
+ public BasePartialUpdateToolbar() throws Exception
+ {
+ int level = DEFAULT_LEVEL;
+ try
+ {
+ PortletRequestContext context = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
+ PortletRequest prequest = context.getRequest();
+ PortletPreferences prefers = prequest.getPreferences();
+
+ level = Integer.valueOf(prefers.getValue("level", String.valueOf(DEFAULT_LEVEL)));
+ }
+ catch (Exception ex)
+ {
+ log.warn("Preference for navigation level can only be integer");
+ }
+
+ if (level <= 0)
+ {
+ toolbarScope = Scope.ALL;
+ }
+ else
+ {
+ toolbarScope = new GenericScope(level);
+ }
+ }
+
+ protected Collection<UserNode> getNavigationNodes(UserNavigation nav) throws Exception
+ {
+ UserPortal userPortal = getUserPortal();
+ if (nav != null)
+ {
+ try
+ {
+ UserNode rootNodes = userPortal.getNode(nav, toolbarScope, toolbarFilterConfig, null);
+ return rootNodes.getChildren();
+ }
+ catch (Exception ex)
+ {
+ log.warn(nav.getKey().getName() + " has been deleted");
+ }
+ }
+ return Collections.emptyList();
+ }
+
+ protected UserNavigation getNavigation(SiteKey key) throws Exception
+ {
+ UserPortal userPortal = getUserPortal();
+ return userPortal.getNavigation(key);
+ }
+
+ @Override
+ public void serveResource(WebuiRequestContext context) throws Exception
+ {
+ super.serveResource(context);
+
+ ResourceRequest req = context.getRequest();
+ String id = req.getResourceID();
+
+ JSONArray jsChilds = getChildrenAsJSON(getNodeFromResourceID(id));
+ if (jsChilds == null)
+ {
+ return;
+ }
+
+ MimeResponse res = context.getResponse();
+ res.setContentType("text/json");
+ res.getWriter().write(jsChilds.toString());
+ }
+
+ private JSONArray getChildrenAsJSON(UserNode userNode) throws Exception
+ {
+ if (userNode == null)
+ {
+ return null;
+ }
+
+ NodeChangeQueue<UserNode> queue = new NodeChangeQueue<UserNode>();
+ getUserPortal().updateNode(userNode, toolbarScope, queue);
+ for (NodeChange<UserNode> change : queue)
+ {
+ if (change instanceof NodeChange.Removed)
+ {
+ UserNode deletedNode = ((NodeChange.Removed<UserNode>)change).getTarget();
+ if (hasRelationship(deletedNode, userNode))
+ {
+ return null;
+ }
+ }
+ }
+ Collection<UserNode> childs = userNode.getChildren();
+
+ JSONArray jsChilds = new JSONArray();
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ MimeResponse res = context.getResponse();
+ for (UserNode child : childs)
+ {
+ jsChilds.put(toJSON(child, userNode.getNavigation().getKey().getName(), res));
+ }
+ return jsChilds;
+ }
+
+ protected JSONObject toJSON(UserNode node, String navId, MimeResponse res) throws Exception
+ {
+ JSONObject json = new JSONObject();
+ String nodeId = node.getId();
+
+ json.put("label", node.getEncodedResolvedLabel());
+ json.put("hasChild", node.getChildrenCount() > 0);
+ json.put("isSelected", nodeId.equals(getSelectedNode().getId()));
+ json.put("icon", node.getIcon());
+
+ ResourceURL rsURL = res.createResourceURL();
+ rsURL.setResourceID(res.encodeURL(getResourceIdFromNode(node, navId)));
+ json.put("getNodeURL", rsURL.toString());
+ json.put("actionLink", Util.getPortalRequestContext().getPortalURI() + node.getURI());
+
+ JSONArray childs = new JSONArray();
+ for (UserNode child : node.getChildren())
+ {
+ childs.put(toJSON(child, navId, res));
+ }
+ json.put("childs", childs);
+ return json;
+ }
+
+
+ protected UserPortal getUserPortal()
+ {
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ return uiApp.getUserPortalConfig().getUserPortal();
+ }
+
+ protected UserNode getSelectedNode() throws Exception
+ {
+ return Util.getUIPortal().getSelectedUserNode();
+ }
+
+ private boolean hasRelationship(UserNode parent, UserNode userNode)
+ {
+ if (parent.getId().equals(userNode.getId()))
+ {
+ return true;
+ }
+ for (UserNode child : parent.getChildren())
+ {
+ if (hasRelationship(child, userNode))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected abstract String getResourceIdFromNode(UserNode node, String navId) throws Exception;
+
+ protected abstract UserNode getNodeFromResourceID(String resourceId) throws Exception;
+}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -22,9 +22,8 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -45,9 +44,9 @@
{
}
- public PageNavigation getSelectedNavigation() throws Exception
+ public UserNavigation getSelectedNavigation() throws Exception
{
- return Util.getUIPortal().getSelectedNavigation();
+ return Util.getUIPortal().getUserNavigation();
}
@Override
@@ -64,21 +63,12 @@
private boolean hasEditPermissionOnNavigation() throws Exception
{
- PageNavigation selectedNavigation = getSelectedNavigation();
- UIPortalApplication portalApp = Util.getUIPortalApplication();
- UserACL userACL = portalApp.getApplicationComponent(UserACL.class);
- if (selectedNavigation == null || userACL == null)
+ UserNavigation selectedNavigation = getSelectedNavigation();
+ if (selectedNavigation == null)
{
return false;
}
- else
- {
- if (PortalConfig.PORTAL_TYPE.equals(selectedNavigation.getOwnerType()))
- {
- return hasEditPermissionOnPortal();
- }
- return userACL.hasEditPermission(selectedNavigation);
- }
+ return selectedNavigation.isModifiable();
}
private boolean hasEditPermissionOnPortal() throws Exception
@@ -104,8 +94,8 @@
else
{
UIPortal currentUIPortal = portalApp.<UIWorkingWorkspace>findComponentById(UIPortalApplication.UI_WORKING_WS_ID).findFirstComponentOfType(UIPortal.class);
- PageNode currentNode = currentUIPortal.getSelectedNode();
- String pageReference = currentNode.getPageReference();
+ UserNode currentNode = currentUIPortal.getSelectedUserNode();
+ String pageReference = currentNode.getPageRef();
if(pageReference == null)
{
return false;
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,20 +19,28 @@
package org.exoplatform.toolbar.webui.component;
+import java.util.Collection;
+
+import javax.portlet.EventRequest;
+
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -48,39 +56,62 @@
*/
@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl",
events = {@EventConfig(name = "AddDefaultDashboard", listeners = UIUserToolBarDashboardPortlet.AddDashboardActionListener.class),
- @EventConfig(listeners = UIUserToolBarDashboardPortlet.UserPageNodeDeletedActionListener.class)})
-public class UIUserToolBarDashboardPortlet extends UIPortletApplication
+ @EventConfig(listeners = UIUserToolBarDashboardPortlet.NavigationChangeActionListener.class)})
+public class UIUserToolBarDashboardPortlet extends BasePartialUpdateToolbar
{
public static String DEFAULT_TAB_NAME = "Tab_0";
public UIUserToolBarDashboardPortlet() throws Exception
{
+ UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder();
+ builder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED, Visibility.TEMPORAL);
+ builder.withTemporalCheck();
+ toolbarFilterConfig = builder.build();
}
- public PageNavigation getCurrentUserNavigation() throws Exception
+ public UserNavigation getCurrentUserNavigation() throws Exception
{
- String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- return getPageNavigation(PortalConfig.USER_TYPE + "::" + remoteUser);
+ WebuiRequestContext rcontext = WebuiRequestContext.getCurrentInstance();
+ return getNavigation(SiteKey.user(rcontext.getRemoteUser()));
+ }
+
+ @Override
+ protected String getResourceIdFromNode(UserNode node, String navId) throws Exception
+ {
+ if (node == null)
+ {
+ throw new IllegalArgumentException("node can't be null");
+ }
+ return node.getURI();
}
- private PageNavigation getPageNavigation(String owner) throws Exception
+ @Override
+ protected UserNode getNodeFromResourceID(String resourceId) throws Exception
{
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
- List<PageNavigation> allNavigations = Util.getUIPortalApplication().getNavigations();
- for (PageNavigation nav : allNavigations)
+ UserNavigation currNav = getCurrentUserNavigation();
+ if (currNav == null) return null;
+
+ UserPortal userPortal = getUserPortal();
+ UserNode node = userPortal.resolvePath(currNav, toolbarFilterConfig, resourceId);
+ if (node != null && node.getURI().equals(resourceId))
{
- if (nav.getOwner().equals(owner))
- return nav;
+ return node;
}
return null;
}
+
+ static public class NavigationChangeActionListener extends EventListener<UIUserToolBarDashboardPortlet>
+ {
+ private Log log = ExoLogger.getExoLogger(NavigationChangeActionListener.class);
- public PageNode getSelectedPageNode() throws Exception
- {
- return Util.getUIPortal().getSelectedNode();
+ @Override
+ public void execute(Event<UIUserToolBarDashboardPortlet> event) throws Exception
+ {
+ log.debug("PageNode : " + ((EventRequest)event.getRequestContext().getRequest()).getEvent().getValue() + " is deleted");
+ }
}
-
+
static public class UserPageNodeDeletedActionListener extends EventListener<UIUserToolBarDashboardPortlet>
{
private Log log = ExoLogger.getExoLogger(UserPageNodeDeletedActionListener.class);
@@ -104,29 +135,20 @@
UIUserToolBarDashboardPortlet toolBarPortlet = event.getSource();
String nodeName = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- PageNavigation cachedNavigation = toolBarPortlet.getCurrentUserNavigation();
-
- // Update navigation for prevent create first node which already existed
- DataStorage dataStorage = toolBarPortlet.getApplicationComponent(DataStorage.class);
- PageNavigation userNavigation =
- dataStorage.getPageNavigation(cachedNavigation.getOwnerType(), cachedNavigation.getOwnerId());
- cachedNavigation.merge(userNavigation);
-
- UserPortalConfigService configService = toolBarPortlet.getApplicationComponent(UserPortalConfigService.class);
- if (cachedNavigation != null && configService != null && cachedNavigation.getNodes().size() < 1)
+ Collection<UserNode> nodes = toolBarPortlet.getNavigationNodes(toolBarPortlet.getCurrentUserNavigation());
+ if (nodes.size() < 1)
{
- createDashboard(nodeName, cachedNavigation, configService);
+ createDashboard(nodeName, toolBarPortlet);
}
else
{
PortalRequestContext prContext = Util.getPortalRequestContext();
prContext.getResponse().sendRedirect(
- prContext.getPortalURI() + cachedNavigation.getNodes().get(0).getName());
+ prContext.getPortalURI() + nodes.iterator().next().getURI());
}
}
- private static void createDashboard(String _nodeName, PageNavigation _pageNavigation,
- UserPortalConfigService _configService)
+ private static void createDashboard(String _nodeName, UIUserToolBarDashboardPortlet toolBarPortlet)
{
try
{
@@ -136,24 +158,29 @@
logger.debug("Parsed nodeName is null, hence use Tab_0 as default name");
_nodeName = DEFAULT_TAB_NAME;
}
+
+ UserPortal userPortal = toolBarPortlet.getUserPortal();
+ UserNavigation userNav = toolBarPortlet.getCurrentUserNavigation();
+ if (userNav == null)
+ {
+ return;
+ }
+ SiteKey siteKey = userNav.getKey();
+
+ UserPortalConfigService _configService = toolBarPortlet.getApplicationComponent(UserPortalConfigService.class);
Page page =
- _configService.createPageTemplate(PAGE_TEMPLATE, _pageNavigation.getOwnerType(), _pageNavigation
- .getOwnerId());
+ _configService.createPageTemplate(PAGE_TEMPLATE, siteKey.getTypeName(), siteKey.getName());
page.setTitle(_nodeName);
page.setName(_nodeName);
+ toolBarPortlet.getApplicationComponent(DataStorage.class).create(page);
- PageNode pageNode = new PageNode();
- pageNode.setName(_nodeName);
- pageNode.setLabel(prContext.getApplicationResourceBundle().getString("UIUserToolBarDashboard.page.ClickAndType"));
- pageNode.setResolvedLabel(prContext.getApplicationResourceBundle());
- pageNode.setUri(_nodeName);
- pageNode.setPageReference(page.getPageId());
+ UserNode rootNode = userPortal.getNode(userNav, Scope.CHILDREN, toolBarPortlet.toolbarFilterConfig, null);
+ UserNode tabNode = rootNode.addChild(_nodeName);
+ tabNode.setLabel(_nodeName);
+ tabNode.setPageRef(page.getPageId());
- _pageNavigation.addNode(pageNode);
- _configService.create(page);
- _configService.update(_pageNavigation);
-
- prContext.getResponse().sendRedirect(prContext.getPortalURI() + _nodeName);
+ userPortal.saveNode(rootNode, null);
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() + tabNode.getURI());
}
catch (Exception ex)
{
@@ -161,4 +188,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,16 +19,21 @@
package org.exoplatform.toolbar.webui.component;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
-import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.core.UIPortletApplication;
+import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
+import org.gatein.common.util.ParameterValidation;
-import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -37,32 +42,87 @@
* thanhtungty(a)gmail.com
* May 26, 2009
*/
-@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl")
-public class UIUserToolBarGroupPortlet extends UIPortletApplication
+@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl",
+ events = {
+ @EventConfig(listeners = UIUserToolBarGroupPortlet.NavigationChangeActionListener.class)
+ }
+)
+public class UIUserToolBarGroupPortlet extends BasePartialUpdateToolbar
{
+ private static final String SPLITTER_STRING = "::";
+
public UIUserToolBarGroupPortlet() throws Exception
+ {
+ UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder();
+ builder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED, Visibility.TEMPORAL);
+ builder.withTemporalCheck();
+ toolbarFilterConfig = builder.build();
+ }
+
+ public List<UserNavigation> getGroupNavigations() throws Exception
{
+ UserPortal userPortal = getUserPortal();
+ List<UserNavigation> allNavs = userPortal.getNavigations();
+
+ List<UserNavigation> groupNav = new LinkedList<UserNavigation>();
+ for (UserNavigation nav : allNavs)
+ {
+ if (nav.getKey().getType().equals(SiteType.GROUP))
+ {
+ groupNav.add(nav);
+ }
+ }
+ return groupNav;
+ }
+
+ @Override
+ protected String getResourceIdFromNode(UserNode node, String navId) throws Exception
+ {
+ return navId + SPLITTER_STRING + node.getURI();
}
- public List<PageNavigation> getGroupNavigations() throws Exception
+ @Override
+ protected UserNode getNodeFromResourceID(String resourceId) throws Exception
{
- String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
- List<PageNavigation> allNavigations = Util.getUIPortalApplication().getNavigations();
- List<PageNavigation> navigations = new ArrayList<PageNavigation>();
- for (PageNavigation navigation : allNavigations)
+ String[] parsedId = parseResourceId(resourceId);
+ if (parsedId == null)
{
- if (navigation.getOwnerType().equals(PortalConfig.GROUP_TYPE))
+ throw new IllegalArgumentException("resourceId " + resourceId + " is invalid");
+ }
+ String groupId = parsedId[0];
+ String nodeURI = parsedId[1];
+
+ UserNavigation grpNav = getNavigation(SiteKey.group(groupId));
+ if (grpNav == null) return null;
+
+ UserNode node = getUserPortal().resolvePath(grpNav, toolbarFilterConfig, nodeURI);
+ if (node != null && node.getURI().equals(nodeURI))
+ {
+ return node;
+ }
+ return null;
+ }
+
+ private String[] parseResourceId(String resourceId)
+ {
+ if (!ParameterValidation.isNullOrEmpty(resourceId))
+ {
+ String[] parsedId = resourceId.split(SPLITTER_STRING);
+ if (parsedId.length == 2)
{
- navigations.add(PageNavigationUtils.filterNavigation(navigation, remoteUser, false, true));
+ return parsedId;
}
}
- return navigations;
+ return null;
}
- public PageNode getSelectedPageNode() throws Exception
+ public static class NavigationChangeActionListener extends EventListener<UIUserToolBarGroupPortlet>
{
- return Util.getUIPortal().getSelectedNode();
+ @Override
+ public void execute(Event<UIUserToolBarGroupPortlet> event) throws Exception
+ {
+ // This event is only a trick for updating the Toolbar group portlet
+ }
}
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,33 +19,37 @@
package org.exoplatform.toolbar.webui.component;
+import java.util.List;
+
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-import java.util.List;
-
/**
* Created by The eXo Platform SAS
* Author : Pham Thanh Tung
* thanhtungty(a)gmail.com
* May 26, 2009
*/
-@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl"
-
-)
-public class UIUserToolBarSitePortlet extends UIPortletApplication
+@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl")
+public class UIUserToolBarSitePortlet extends BasePartialUpdateToolbar
{
public UIUserToolBarSitePortlet() throws Exception
{
+ UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder();
+ builder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED, Visibility.TEMPORAL);
+ builder.withTemporalCheck();
+ toolbarFilterConfig = builder.build();
}
public List<String> getAllPortalNames() throws Exception
@@ -76,29 +80,30 @@
{
String currentPortalURI = Util.getPortalRequestContext().getPortalURI();
return currentPortalURI.substring(0, currentPortalURI.lastIndexOf(getCurrentPortal())) + portalName + "/";
- }
+ }
- public PageNavigation getCurrentPortalNavigation() throws Exception
- {
- PageNavigation navi = getPageNavigation(PortalConfig.PORTAL_TYPE + "::" + getCurrentPortal());
- String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- return PageNavigationUtils.filterNavigation(navi, remoteUser, false, true);
- }
-
- private PageNavigation getPageNavigation(String owner) throws Exception
- {
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
- List<PageNavigation> allNavigations = Util.getUIPortalApplication().getUserPortalConfig().getNavigations();
- for (PageNavigation nav : allNavigations)
+ @Override
+ protected UserNode getNodeFromResourceID(String resourceId) throws Exception
+ {
+ UserNavigation currNav = getNavigation(SiteKey.portal(getCurrentPortal()));
+ if (currNav == null) return null;
+
+ UserPortal userPortal = getUserPortal();
+ UserNode node = userPortal.resolvePath(currNav, toolbarFilterConfig, resourceId);
+ if (node != null && node.getURI().equals(resourceId))
{
- if (nav.getOwner().equals(owner))
- return nav;
+ return node;
}
return null;
}
- public PageNode getSelectedPageNode() throws Exception
+ @Override
+ protected String getResourceIdFromNode(UserNode node, String navId) throws Exception
{
- return Util.getUIPortal().getSelectedNode();
+ if (node == null)
+ {
+ throw new IllegalArgumentException("node can't be null");
+ }
+ return node.getURI();
}
-}
\ No newline at end of file
+}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -145,6 +145,9 @@
<short-title>Group Navigation Portlet</short-title>
<keywords>Administration</keywords>
</portlet-info>
+ <supported-publishing-event>
+ <name>NavigationChange</name>
+ </supported-publishing-event>
</portlet>
<portlet>
@@ -198,7 +201,7 @@
<keywords>Administration</keywords>
</portlet-info>
<supported-publishing-event>
- <name>UserPageNodeDeleted</name>
+ <name>NavigationChange</name>
</supported-publishing-event>
</portlet>
@@ -315,8 +318,13 @@
<title>User Toolbar Site Portlet</title>
<short-title>UserToolbarSite</short-title>
<keywords>gatein_internal</keywords>
- </portlet-info>
-
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>level</name>
+ <value>2</value>
+ </preference>
+ </portlet-preferences>
<security-role-ref>
<role-name>admin</role-name>
<role-link>admin</role-link>
@@ -346,14 +354,19 @@
<short-title>UserToolbarDashboard</short-title>
<keywords>gatein_internal</keywords>
</portlet-info>
-
+ <portlet-preferences>
+ <preference>
+ <name>level</name>
+ <value>2</value>
+ </preference>
+ </portlet-preferences>
<security-role-ref>
<role-name>admin</role-name>
<role-link>admin</role-link>
</security-role-ref>
- <supported-processing-event>
- <name>UserPageNodeDeleted</name>
- </supported-processing-event>
+ <supported-publishing-event>
+ <name>NavigationChange</name>
+ </supported-publishing-event>
</portlet>
<portlet>
@@ -379,11 +392,19 @@
<short-title>UserToolbarGroup</short-title>
<keywords>gatein_internal</keywords>
</portlet-info>
-
+ <portlet-preferences>
+ <preference>
+ <name>level</name>
+ <value>2</value>
+ </preference>
+ </portlet-preferences>
<security-role-ref>
<role-name>admin</role-name>
<role-link>admin</role-link>
</security-role-ref>
+ <supported-processing-event>
+ <name>NavigationChange</name>
+ </supported-processing-event>
</portlet>
<portlet>
<description xml:lang="EN">Star Toolbar Portlet</description>
@@ -414,6 +435,6 @@
<name>NewAccountAdded</name>
</event-definition>
<event-definition>
- <name>UserPageNodeDeleted</name>
+ <name>NavigationChange</name>
</event-definition>
</portlet-app>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,13 +1,12 @@
-<%
- import org.exoplatform.toolbar.webui.component.UIAdminToolbarPortlet;
+<%
import org.exoplatform.web.application.JavascriptManager;
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.services.organization.User;
- import org.exoplatform.services.security.ConversationState;
- import org.exoplatform.web.CacheUserProfileFilter;
-
+ import org.exoplatform.portal.webui.util.Util;
+ import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+ import org.exoplatform.portal.webui.page.UIPage;
+ import org.exoplatform.portal.mop.user.UserNavigation;
+
def rcontext = _ctx.getRequestContext();
-
+
JavascriptManager jsmanager = rcontext.getJavascriptManager();
jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
jsmanager.importJavascript('eXo.portal.UIAdminToolbar');
@@ -24,9 +23,9 @@
boolean userCouldEditPage = uicomponent.hasEditPermissionOnPage();
boolean userCouldEditPortal = uicomponent.hasEditPermissionOnPortal();
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
+ UserNavigation selectedNav = uicomponent.getSelectedNavigation();
if (selectedNav != null) {
- editorLabel = _ctx.appRes("UIAdminToolbarPortlet.action." + selectedNav.getOwnerType() + ".Editor");
+ editorLabel = _ctx.appRes("UIAdminToolbarPortlet.action." + selectedNav.getKey().getTypeName() + ".Editor");
}
String accountSetting = "javascript:if(document.getElementById('UIMaskWorkspace')) ajaxGet(eXo.env.server.createPortalURL('UIPortal', 'AccountSettings', true));"
%>
@@ -51,7 +50,7 @@
</div>
<% } %>
- <% if(userCouldEditPortal){ %>
+ <% if(userCouldEditPortal){ %>
<div class="MenuItem">
<a href="javascript:ajaxGet(eXo.env.server.createPortalURL('UIWorkingWorkspace', 'EditInline', true))" title="" class="ItemIcon EditSiteIcon">$editSiteLayout</a>
</div>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,127 +1,132 @@
-<%
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.web.application.JavascriptManager;
- import org.exoplatform.portal.webui.util.Util ;
- import org.exoplatform.webui.organization.OrganizationUtils;
- import org.gatein.common.text.EntityEncoder;
-
- def rcontext = _ctx.getRequestContext() ;
- JavascriptManager jsmanager = rcontext.getJavascriptManager();
- jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
- jsmanager.importJavascript('eXo.portal.UIAdminToolbar');
- jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' + uicomponent.id + '");');
-
- def currentUserNavigation = uicomponent.getCurrentUserNavigation();
- def portalURI = Util.getPortalRequestContext().getPortalURI();
- void renderDashboards(){
- PageNavigation userNavigation = uicomponent.getCurrentUserNavigation();
- if(userNavigation == null){
- return;
- }
-
- nodes = userNavigation.getNodes();
- int size = nodes.size();
- if(size < 1){
- return;
- }
- String clazz = "";
-
- print """
- <div style="display:none" class="MenuItemContainer">
- <div class="SubBlock">
- """;
- for(int i = 0; i < size; i++) {
- renderPageNode( nodes.get(i), i%2 == 0);
- }
- print """
- </div>
- </div>
- """ ;
- }
-
- void renderPageNode(PageNode node, boolean flag) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- String tabStyleNavigation = "";
- if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedItem";
- }
-
- boolean hasChild = (node.getChildren() != null && node.getChildren().size() > 0);
- String clazz = "";
- if(hasChild) clazz = "ArrowIcon";
- String href = Util.getPortalRequestContext().getPortalURI() + node.getUri();
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- boolean toolong = (node.resolvedLabel.length() > 60);
- String label = ( toolong ? node.resolvedLabel.substring(0, 57) + "..." : node.resolvedLabel);
- String title = "";
- if(toolong) title = "title='$node.resolvedLabel'";
- else title = "";
- EntityEncoder entityEncoder = EntityEncoder.FULL;
- label = entityEncoder.encode(label);
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$clazz">
- """;
- if(node.pageReference != null) {
- print """<a class="ItemIcon $icon" href="$href" $title>$label</a>""";
- } else {
- print """<a class="ItemIcon $icon" href="#" $title>$label</a>""";
- }
- print """
- </div>
- """ ;
- if(hasChild) {
- print """
- <div class="MenuItemContainer">
- <div class="SubBlock">
- """ ;
- for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(node.getChildren().get(j), j%2 == 0);
- }
- print """
- </div>
- </div>
- """ ;
-
- }
- print """
- </div>
- """ ;
- }
-%>
-
-<%
- String defaultDashboardPage;
- if(currentUserNavigation == null || currentUserNavigation.getNodes() == null || currentUserNavigation.getNodes().size() < 1){
- defaultDashboardPage = org.exoplatform.toolbar.webui.component.UIUserToolBarDashboardPortlet.DEFAULT_TAB_NAME;
-%>
- <div class="UIUserToolBarDashboardPortlet" id="$uicomponent.id">
- <div class="UIHorizontalTabs">
- <div class="TabsContainer">
- <div class="UITab NormalToolbarTab">
- <div class="">
- <a class="DashboardIcon TBIcon" href="<%= uicomponent.url("AddDefaultDashboard", defaultDashboardPage); %>">Dashboard</a>
- </div>
- </div>
- </div>
- </div>
- </div>
-<%
- }else{
- defaultDashboardPage = currentUserNavigation.getNodes().get(0).getName();
-%>
- <div class="UIUserToolBarDashboardPortlet" id="$uicomponent.id" >
- <div class="UIHorizontalTabs">
- <div class="TabsContainer" >
- <div class="UITab NormalToolbarTab">
- <div class="">
- <a class="DashboardIcon TBIcon" href="<%= portalURI + defaultDashboardPage %>">Dashboard</a>
- </div>
- <% renderDashboards(); %>
- </div>
- </div>
- </div>
- </div>
+<%
+ import org.exoplatform.web.application.JavascriptManager;
+ import org.exoplatform.portal.webui.util.Util ;
+ import org.exoplatform.portal.mop.user.UserNode;
+ import java.util.Collection;
+ import javax.portlet.MimeResponse;
+ import javax.portlet.ResourceURL;
+
+ def rcontext = _ctx.getRequestContext() ;
+ JavascriptManager jsmanager = rcontext.getJavascriptManager();
+ jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
+ jsmanager.importJavascript('eXo.portal.UIAdminToolbar');
+ jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' + uicomponent.id + '");');
+
+ def portalURI = Util.getPortalRequestContext().getPortalURI();
+ void renderDashboards(Collection nodes) {
+ String clazz = "";
+
+ print """
+ <div style="display:none" class="MenuItemContainer">
+ <div class="SubBlock">
+ """;
+ int idx = 0;
+ for(UserNode node : nodes) {
+ renderPageNode(node, idx++ % 2 == 0);
+ }
+ print """
+ </div>
+ </div>
+ """ ;
+ }
+
+ void renderPageNode(UserNode node, boolean flag) {
+ UserNode selectedNode = uicomponent.getSelectedNode();
+ String tabStyleNavigation = "";
+ if(selectedNode != null && node.getURI() == selectedNode.getURI()) {
+ tabStyleNavigation = "SelectedItem";
+ }
+
+ boolean hasChild = (node.getChildrenCount() > 0);
+ String clazz = "";
+ if(hasChild) clazz = "ArrowIcon";
+ String href = Util.getPortalRequestContext().getPortalURI() + node.getURI();
+ String icon = node.getIcon();
+ if(icon == null) icon = "DefaultPageIcon";
+ def resolvedLabel = node.getLabel();
+ if ("Tab_Default".equals(node.getName()))
+ {
+ resolvedLabel = _ctx.appRes("UIUserToolBarDashboard.page." + node.getLabel());
+ }
+
+ boolean toolong = (resolvedLabel.length() > 60);
+ String label = ( toolong ? resolvedLabel.substring(0, 57) + "..." : resolvedLabel);
+ String title = "";
+ if(toolong) title = "title='$resolvedLabel'";
+ else title = "";
+
+ def getNodeURL = "";
+ if (hasChild) {
+ MimeResponse res = _ctx.getRequestContext().getResponse();
+ ResourceURL resourceURL = res.createResourceURL();
+ resourceURL.setResourceID(res.encodeURL(node.getURI()));
+ getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
+ }
+
+ print """
+ <div class="MenuItem $tabStyleNavigation" $getNodeURL>
+ <div class="$clazz">
+ """;
+ if(node.pageRef != null) {
+ print """<a class="ItemIcon $icon" href="$href" $title>$label</a>""";
+ } else {
+ print """<a class="ItemIcon $icon" href="#" $title>$label</a>""";
+ }
+ print """
+ </div>
+ """ ;
+ if(hasChild) {
+ print """
+ <div class="MenuItemContainer">
+ <div class="SubBlock">
+ """ ;
+ int idx = 0;
+ for(UserNode child : node.getChildren()) {
+ renderPageNode(child, idx++ % 2 == 0);
+ }
+ print """
+ </div>
+ </div>
+ """ ;
+
+ }
+ print """
+ </div>
+ """ ;
+ }
+%>
+
+<%
+ def userNodes = uicomponent.getNavigationNodes(uicomponent.getCurrentUserNavigation());
+ String defaultDashboardPage;
+ if(userNodes.size() < 1) {
+ defaultDashboardPage = org.exoplatform.toolbar.webui.component.UIUserToolBarDashboardPortlet.DEFAULT_TAB_NAME;
+%>
+ <div class="UIUserToolBarDashboardPortlet" id="$uicomponent.id">
+ <div class="UIHorizontalTabs">
+ <div class="TabsContainer">
+ <div class="UITab NormalToolbarTab">
+ <div class="">
+ <a class="DashboardIcon TBIcon" href="<%= uicomponent.url("AddDefaultDashboard", defaultDashboardPage); %>">Dashboard</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+<%
+ }else{
+ defaultDashboardPage =userNodes.iterator().next().getName();
+%>
+ <div class="UIUserToolBarDashboardPortlet" id="$uicomponent.id" >
+ <div class="UIHorizontalTabs">
+ <div class="TabsContainer" >
+ <div class="UITab NormalToolbarTab">
+ <div class="">
+ <a class="DashboardIcon TBIcon" href="<%= portalURI + defaultDashboardPage %>">Dashboard</a>
+ </div>
+ <% renderDashboards(userNodes); %>
+ </div>
+ </div>
+ </div>
+ </div>
<% } %>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,10 +1,12 @@
<%
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util ;
import org.exoplatform.webui.organization.OrganizationUtils;
import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.portal.mop.user.UserNode;
+ import org.exoplatform.portal.mop.user.UserNavigation;
+ import javax.portlet.MimeResponse;
+ import javax.portlet.ResourceURL;
def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
@@ -14,34 +16,36 @@
def groupNavigations = uicomponent.getGroupNavigations();
def portalURI = Util.getPortalRequestContext().getPortalURI();
- void renderGroupPageNavigation(PageNavigation navigation) {
- nodes = navigation.getNodes() ;
+ void renderGroupPageNavigation(UserNavigation navigation) {
+ def nodes = uicomponent.getNavigationNodes(navigation);
if(nodes.size() < 1) return ;
String navTitle = _ctx.appRes("UIPageNavigation.label.titleBar") ;
- navTitle = navTitle.replace("{0}", OrganizationUtils.getGroupLabel(navigation.ownerId));
+ def ownerId = navigation.getKey().getName();
+ navTitle = navTitle.replace("{0}", OrganizationUtils.getGroupLabel(ownerId));
print """
- <div class="TitleBar"><div style="width: 99%" title="$navigation.ownerId">$navTitle</div></div>
+ <div class="TitleBar portlet-menu-description"><div style="width: 99%" title="$ownerId">$navTitle</div></div>
<div class="SubBlock">
""" ;
- for(int i = 0; i < nodes.size(); i++) {
- renderPageNode(nodes.get(i), i%2 == 0 ) ;
+ int idx = 0;
+ for(UserNode node : nodes) {
+ renderPageNode(node, ownerId, idx++ % 2 == 0);
}
print """
</div>
""" ;
}
- void renderPageNode(PageNode node, boolean flag) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
+ void renderPageNode(UserNode node, String groupId, boolean flag) {
+ UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "";
- if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedItem";
+ if(selectedNode != null && node.getURI() == selectedNode.getURI()) {
+ tabStyleNavigation = "SelectedItem portlet-menu-item-selected";
}
- boolean hasChild = (node.getChildren() != null && node.getChildren().size() > 0);
+ boolean hasChild = node.getChildrenCount() > 0;
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
- String href = Util.getPortalRequestContext().getPortalURI() + node.getUri();
+ String href = Util.getPortalRequestContext().getPortalURI() + node.getURI();
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
boolean toolong = (node.resolvedLabel.length() > 60);
@@ -51,11 +55,20 @@
else title = "";
EntityEncoder entityEncoder = EntityEncoder.FULL;
label = entityEncoder.encode(label);
+
+ def getNodeURL = "";
+ if (hasChild) {
+ MimeResponse res = _ctx.getRequestContext().getResponse();
+ ResourceURL resourceURL = res.createResourceURL();
+ resourceURL.setResourceID(res.encodeURL(groupId + "::" + node.getURI()));
+ getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
+ }
+
print """
- <div class="MenuItem $tabStyleNavigation">
+ <div class="MenuItem $tabStyleNavigation portlet-menu-cascade-item" $getNodeURL>
<div class="$clazz">
""";
- if(node.pageReference != null) {
+ if(node.pageRef != null) {
print """<a class="ItemIcon $icon" href="$href" $title>$label</a>""";
} else {
print """<a class="ItemIcon $icon" href="#" $title>$label</a>""";
@@ -68,8 +81,9 @@
<div class="MenuItemContainer" style="position: absolute; display:none">
<div class="SubBlock">
""" ;
- for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(node.getChildren().get(j), j%2 == 0);
+ int idx = 0;
+ for(UserNode child : node.getChildren()) {
+ renderPageNode(child, groupId, idx++ % 2 == 0);
}
print """
</div>
@@ -89,7 +103,9 @@
<div class="">
<a class="GroupIcon TBIcon" href="<%= portalURI + "groupnavigation" %>">Group</a>
</div>
- <% if (!groupNavigations.isEmpty()) { %>
+ <%
+ if (!groupNavigations.isEmpty()) {
+ %>
<div style="display:none" class="MenuItemContainer">
<% for(navigation in groupNavigations) {
renderGroupPageNavigation(navigation);
@@ -99,4 +115,4 @@
</div>
</div>
</div>
-</div>
\ No newline at end of file
+</div>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,20 +1,24 @@
<%
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util ;
import org.exoplatform.webui.organization.OrganizationUtils;
import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.portal.mop.user.UserNode;
+ import java.util.Collection;
+ import javax.portlet.MimeResponse;
+ import javax.portlet.ResourceURL;
+ import org.exoplatform.portal.mop.SiteKey;
def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
jsmanager.importJavascript('eXo.portal.UIPortalNavigation') ;
jsmanager.importJavascript('eXo.portal.UIAdminToolbar') ;
jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' + uicomponent.id + '");');
-
- def portalURI = Util.getPortalRequestContext().getPortalURI();
+ def portalURI = Util.getPortalRequestContext().getPortalURI();
+
void renderPortalNavigations() {
-
+ def currentPortal = uicomponent.getCurrentPortal()
+ def nodes = uicomponent.getNavigationNodes(uicomponent.getNavigation(SiteKey.portal(currentPortal)));
print """
<div style="position: absolute; display:none" class="MenuItemContainer">
<div class="SubBlock">
@@ -22,13 +26,10 @@
boolean isCurrent = false;
String clazz = "";
String href = "#";
-
- def navigation = uicomponent.getCurrentPortalNavigation();
- def nodes = navigation.getNodes();
for(int i = 0; i < uicomponent.getAllPortalNames().size(); i++) {
String portal = uicomponent.getAllPortalNames().get(i);
- if(portal.equals(uicomponent.getCurrentPortal())) {
+ if(portal.equals(currentPortal)) {
isCurrent = true;
} else isCurrent = false;
@@ -45,7 +46,7 @@
</div>
""";
if(isCurrent) {
- renderCurrentPortal();
+ renderCurrentPortal(nodes);
}
print """
</div>
@@ -56,16 +57,15 @@
</div>
""";
}
-
- void renderCurrentPortal() {
- navigation = uicomponent.getCurrentPortalNavigation();
- nodes = navigation.getNodes();
+
+ void renderCurrentPortal(Collection nodes) {
print """
<div style="position: absolute; display:none" class="MenuItemContainer">
<div class="SubBlock">
""";
- for(int i = 0; i < nodes.size(); i++) {
- renderPageNode(nodes.get(i), i%2 == 0);
+ int idx = 0;
+ for(UserNode node : nodes) {
+ renderPageNode(node, idx++ % 2 == 0);
}
print """
</div>
@@ -73,17 +73,17 @@
""";
}
- void renderPageNode(PageNode node, boolean flag) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
+ void renderPageNode(UserNode node, boolean flag) {
+ UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "";
- if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedItem";
+ if(selectedNode != null && node.getId() == selectedNode.getId()) {
+ tabStyleNavigation = "SelectedItem portlet-menu-cascade-item-selected";
}
- boolean hasChild = (node.getChildren() != null && node.getChildren().size() > 0);
+ boolean hasChild = node.getChildrenCount() > 0;
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
- String href = Util.getPortalRequestContext().getPortalURI() + node.getUri();
+ String href = Util.getPortalRequestContext().getPortalURI() + node.getURI();
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
boolean toolong = (node.resolvedLabel.length() > 60);
@@ -93,11 +93,20 @@
else title = "";
EntityEncoder entityEncoder = EntityEncoder.FULL;
label = entityEncoder.encode(label);
+
+ def getNodeURL = "";
+ if (hasChild) {
+ MimeResponse res = _ctx.getRequestContext().getResponse();
+ ResourceURL resourceURL = res.createResourceURL();
+ resourceURL.setResourceID(res.encodeURL(node.getURI()));
+ getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
+ }
+
print """
- <div class="MenuItem $tabStyleNavigation">
+ <div class="MenuItem $tabStyleNavigation portlet-menu-cascade-item" $getNodeURL>
<div class="$clazz">
""";
- if(node.pageReference != null) {
+ if(node.pageRef != null) {
print """<a class="ItemIcon $icon" href="$href" $title>$label</a>""";
} else {
print """<a class="ItemIcon $icon" href="#" $title>$label</a>""";
@@ -110,8 +119,9 @@
<div class="MenuItemContainer" style="position: absolute; display:none">
<div class="SubBlock">
""" ;
- for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(node.getChildren().get(j), j%2 == 0);
+ int idx = 0;
+ for(UserNode child : node.getChildren()) {
+ renderPageNode(child, idx++ % 2 == 0);
}
print """
</div>
@@ -122,7 +132,7 @@
print """
</div>
""" ;
- }
+ }
%>
<div class="UIUserToolBarSitePortlet" id="$uicomponent.id" >
@@ -138,4 +148,4 @@
</div>
</div>
</div>
-</div>
\ No newline at end of file
+</div>
Deleted: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/NewUIGroupManagement.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/NewUIGroupManagement.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/NewUIGroupManagement.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,107 +0,0 @@
-
-
-<div class="UIGroupManagement UIManagement">
- <div class="UIManagementBlock GroupManagement">
- <div class="Image FloatLeft"><img src="/exoadmin/skin/navigation/webui/component/background/GroupImage.gif"></div>
- <div class="Label FloatLeft">Administrator</div>
- <div class="EditLayoutBox FloatLeft"><a href="#" class="EditLayout">Edit Layout</a></div>
- <div class="EditIcoBox FloatLeft"><a href="#" class="EditIco">Edit Navigation</a></div>
- <div class="DeleteIcoBox FloatLeft"><a href="#" class="DeleteIco">Delete</a></div>
- <div class="ClearLeft"><span></span></div>
- </div>
- <div class="UIManagementBlock GroupManagement">
- <div class="Image FloatLeft"><img src="/exoadmin/skin/navigation/webui/component/background/GroupImage.gif"></div>
- <div class="Label FloatLeft">Administrator</div>
- <div class="EditLayoutBox FloatLeft"><a href="#" class="EditLayout">Edit Layout</a></div>
- <div class="EditIcoBox FloatLeft"><a href="#" class="EditIco">Edit Navigation</a></div>
- <div class="DeleteIcoBox FloatLeft"><a href="#" class="DeleteIco">Delete</a></div>
- <div class="ClearLeft"><span></span></div>
- </div>
- <div class="UIManagementBlock GroupManagement">
- <div class="Image FloatLeft"><img src="/exoadmin/skin/navigation/webui/component/background/GroupImage.gif"></div>
- <div class="Label FloatLeft">Administrator</div>
- <div class="EditLayoutBox FloatLeft"><a href="#" class="EditLayout">Edit Layout</a></div>
- <div class="EditIcoBox FloatLeft"><a href="#" class="EditIco">Edit Navigation</a></div>
- <div class="DeleteIcoBox FloatLeft"><a href="#" class="DeleteIco">Delete</a></div>
- <div class="ClearLeft"><span></span></div>
- </div>
-
- <div class="UIAction ManagerButton">
- <table class="ActionContainer">
- <tr>
- <td>
- <div class="ActionButton AddBtn">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="#">Add Site</a>
- </div>
- </div>
- </div>
- </div>
- <div class="ActionButton CancelBtn">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="#">Cancel</a>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
-
-</div>
-
-
-<!-- <div class="NewUIGroupManagement" id="<%=uicomponent.getId();%>">
- <%
- import org.exoplatform.portal.config.model.PageNavigation;
- navigations = uicomponent.getNavigations();
- %>
-
- <%/*Begin ItemDetailList:*/%>
- <div style="margin:0px 0px 0px 0px">
- <div class="ItemDetailContainer" style="border:1px solid #C7C7C7">
- <% for(navigation in navigations) {
- deleteLink = uicomponent.event("DeleteNavigation",String.valueOf(navigation.getId()));
- editLink = uicomponent.event("EditNavigation",String.valueOf(navigation.getId()));%>
- <div class="ItemDetail" style="width:100%;border-bottom:1px solid #E9E7E7;height:20px;padding-top:5px">
- <div style="float:left;width:70%;padding-left:10px">
- <%= navigation.getOwnerId() %>
- </div>
- <div style="float:right;width:29%">
- <a href="<%=editLink%>">Edit Navigation</a> | <a href="<%=deleteLink%>">Delete Navigation</a>
- </div>
- <div style="clear:both"></div>
- </div>
- <% } %>
-
- </div>
- </div>
- <%/*End ItemDetailList*/%>
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div onclick="<%=uicomponent.event("AddNewPortal")%>" class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".action.addNewPortal")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
- %uicomponent.renderChildren();%>
-</div>
-
--->
-
-
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,25 +1,27 @@
<%
import java.util.List;
- import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.webui.organization.OrganizationUtils;
+ import org.exoplatform.portal.mop.SiteKey;
def parent = uicomponent.getParent();
- def navigations = (List<PageNavigation>) uicomponent.getBeans();
+ def navigations = uicomponent.getBeans();
%>
<div id="$uicomponent.id" class="FeedBox">
<%
boolean isEvenRow = true;
- for(navigation in navigations) {
- deleteLink = parent.event("DeleteNavigation",String.valueOf(navigation.getId()));
- editProperties = parent.event("EditProperties",String.valueOf(navigation.getId()));
- editLink = parent.event("EditNavigation",String.valueOf(navigation.getId()));%>
+ SiteKey siteKey;
+ for(navigation in navigations) {
+ siteKey = navigation.getKey();
+ deleteLink = parent.event("DeleteNavigation",String.valueOf(siteKey.getName()));
+ editProperties = parent.event("EditProperties",String.valueOf(siteKey.getName()));
+ editLink = parent.event("EditNavigation",String.valueOf(siteKey.getName()));%>
<table class="ManagementBlock <%=isEvenRow ? "EvenRow":"OddRow"%>" style="table-layout: fixed">
<tr>
<td class="Image"><img src="/exoadmin/skin/navigation/webui/component/background/GroupImage.png" alt="" /></td>
<td class="Content">
- <div class="Label" title="$navigation.ownerId"><%= OrganizationUtils.getGroupLabel(navigation.ownerId) %></div>
- <div><%=_ctx.appRes("UIGroupNavigationManagement.Label.Description")%>: <%= OrganizationUtils.getGroupDescription(navigation.ownerId) %></div>
+ <div class="Label" title="$siteKey.name"><%= OrganizationUtils.getGroupLabel(siteKey.getName()) %></div>
+ <div><%=_ctx.appRes("UIGroupNavigationManagement.Label.Description")%>: <%= OrganizationUtils.getGroupDescription(siteKey.getName()) %></div>
</td>
<td class="ActionBlock">
<a href="<%=editLink%>" class="EditNavIcon"><%=_ctx.appRes("UIGroupNavigationManagement.Label.EditNavigation")%></a>
Copied: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationManagement.gtmpl (from rev 6783, portal/trunk/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationManagement.gtmpl)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationManagement.gtmpl (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationManagement.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,56 @@
+<%
+ import org.exoplatform.portal.webui.page.UIPageBrowser;
+ import org.exoplatform.navigation.webui.component.UINavigationNodeSelector;
+%>
+<div class="UINavigationManagement" id="$uicomponent.id">
+ <div class="TopTitleBar">
+ <div class="DecoratorBox">
+ <div class="BarDecorator">
+ <div class="TopLeftBar">
+ <div class="TopCenterBar"><span></span></div>
+ </div>
+ <div class="MiddleLeftBar">
+ <div class="MiddleCenterBar" style="background-image: none;">
+ <%= uicomponent.getOwner();%>
+ </div>
+ </div>
+ <div class="BottomLeftBar">
+ <div class="BottomCenterBar"><span></span></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <%
+ uicomponent.renderChild(UINavigationNodeSelector.class);
+ %>
+ <div class="UIAction">
+ <table class="ActionContainer">
+ <tr>
+
+ <td>
+ <div onclick="<%=uicomponent.event("AddRootNode")%>" class="ActionButton LightBlueStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".action.addNode")%></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </td>
+ <td>
+ <div onclick="<%=uicomponent.event("Save")%>" class="ActionButton LightBlueStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".action.Save")%></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </td>
+
+ </tr>
+ </table>
+ </div>
+</div>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,7 +19,7 @@
package org.exoplatform.portal.webui.component;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
@@ -28,14 +28,14 @@
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIBreadcumbs;
+import org.exoplatform.webui.core.UIBreadcumbs.LocalPath;
import org.exoplatform.webui.core.UIPortletApplication;
-import org.exoplatform.webui.core.UIBreadcumbs.LocalPath;
-import org.exoplatform.webui.core.UIBreadcumbs.SelectPathActionListener;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.portlet.PortletPreferences;
@@ -62,23 +62,27 @@
uiBreadCumbs.setTemplate(template);
}
- public void loadSelectedPath()
+ private void loadSelectedPath() throws Exception
{
- List<PageNode> nodes = Util.getUIPortal().getSelectedPath();
+ UserNode node = Util.getUIPortal().getSelectedUserNode();
List<LocalPath> paths = new ArrayList<LocalPath>();
- for (PageNode node : nodes)
+
+ do
{
- if (node == null)
- continue;
- if (node.getPageReference() == null)
+ if (node.getPageRef() == null)
{
paths.add(new LocalPath(null, node.getResolvedLabel()));
}
else
{
- paths.add(new LocalPath(node.getUri(), node.getResolvedLabel()));
+ paths.add(new LocalPath(node.getURI(), node.getResolvedLabel()));
}
+ node = node.getParent();
}
+ while (node != null && node.getParent() != null);
+
+ Collections.reverse(paths);
+
UIBreadcumbs uiBreadCumbs = getChild(UIBreadcumbs.class);
uiBreadCumbs.setPath(paths);
}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,8 +19,9 @@
package org.exoplatform.portal.webui.component;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.security.ConversationState;
@@ -54,12 +55,13 @@
public String getNavigationTitle() throws Exception
{
- PageNavigation navigation = Util.getUIPortal().getSelectedNavigation();
- if (navigation.getOwnerType().equals(PortalConfig.GROUP_TYPE))
+ UserNode navPath = Util.getUIPortal().getNavPath();
+ UserNavigation nav = navPath.getNavigation();
+ if (nav.getKey().getType().equals(SiteType.GROUP))
{
- return OrganizationUtils.getGroupLabel(navigation.getOwnerId());
+ return OrganizationUtils.getGroupLabel(nav.getKey().getName());
}
- else if (navigation.getOwnerType().equals(PortalConfig.USER_TYPE))
+ else if (nav.getKey().getType().equals(SiteType.USER))
{
ConversationState state = ConversationState.getCurrent();
User user = (User)state.getAttribute(CacheUserProfileFilter.USER_PROFILE);
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,7 +19,20 @@
package org.exoplatform.portal.webui.component;
+import java.util.Collection;
+
+import javax.portlet.MimeResponse;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceURL;
+
+import org.exoplatform.portal.mop.navigation.GenericScope;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.navigation.UIPortalNavigation;
+import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -27,15 +40,16 @@
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
+import org.json.JSONArray;
+import org.json.JSONObject;
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequest;
-
@ComponentConfigs({
@ComponentConfig(lifecycle = UIApplicationLifecycle.class),
@ComponentConfig(type = UIPortalNavigation.class, id = "UIHorizontalNavigation", events = @EventConfig(listeners = UIPortalNavigation.SelectNodeActionListener.class))})
public class UINavigationPortlet extends UIPortletApplication
{
+ public static final int DEFAULT_LEVEL = 2;
+
public UINavigationPortlet() throws Exception
{
PortletRequestContext context = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
@@ -44,10 +58,122 @@
String template = prefers.getValue("template", "app:/groovy/portal/webui/component/UIPortalNavigation.gtmpl");
UIPortalNavigation portalNavigation = addChild(UIPortalNavigation.class, "UIHorizontalNavigation", null);
- portalNavigation.setUseAjax(Boolean.valueOf(prefers.getValue("useAJAX", "true")));
+ portalNavigation.setUseAjax(isUseAjax());
portalNavigation.setShowUserNavigation(Boolean.valueOf(prefers.getValue("showUserNavigation", "true")));
portalNavigation.setTemplate(template);
portalNavigation.setCssClassName(prefers.getValue("CSSClassName", ""));
+
+ int level = DEFAULT_LEVEL;
+ try
+ {
+ level = Integer.valueOf(prefers.getValue("level", String.valueOf(DEFAULT_LEVEL)));
+ }
+ catch (Exception ex)
+ {
+ log.warn("Preference for navigation level can only be integer");
+ }
+
+ if (level <= 0)
+ {
+ portalNavigation.setScope(Scope.ALL);
+ }
+ else
+ {
+ portalNavigation.setScope(new GenericScope(level));
+ }
}
+
+ @Override
+ public void serveResource(WebuiRequestContext context) throws Exception
+ {
+ super.serveResource(context);
+
+ ResourceRequest req = context.getRequest();
+ String nodeURI = req.getResourceID();
+
+ JSONArray jsChilds = getChildrenAsJSON(nodeURI);
+ if (jsChilds == null)
+ {
+ return;
+ }
+
+ MimeResponse res = context.getResponse();
+ res.setContentType("text/json");
+ res.getWriter().write(jsChilds.toString());
+ }
+
+
+ public JSONArray getChildrenAsJSON(String nodeURI) throws Exception
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ UIPortalNavigation uiPortalNavigation = getChild(UIPortalNavigation.class);
+
+ Collection<UserNode> childs = null;
+ UserNode userNode = uiPortalNavigation.resolvePath(nodeURI);
+ if (userNode != null)
+ {
+ childs = userNode.getChildren();
+ }
+
+ JSONArray jsChilds = new JSONArray();
+ if (childs == null)
+ {
+ return null;
+ }
+ MimeResponse res = context.getResponse();
+ for (UserNode child : childs)
+ {
+ jsChilds.put(toJSON(child, res));
+ }
+ return jsChilds;
+ }
+
+ private JSONObject toJSON(UserNode node, MimeResponse res) throws Exception
+ {
+ JSONObject json = new JSONObject();
+ String nodeId = node.getId();
+
+ json.put("label", node.getEncodedResolvedLabel());
+ json.put("hasChild", node.getChildrenCount() > 0);
+
+ UserNode selectedNode = Util.getUIPortal().getNavPath();
+ json.put("isSelected", nodeId.equals(selectedNode.getId()));
+ json.put("icon", node.getIcon());
+
+ ResourceURL rsURL = res.createResourceURL();
+ rsURL.setResourceID(res.encodeURL(node.getURI()));
+ json.put("getNodeURL", rsURL.toString());
+
+ String actionLink;
+ if (node.getPageRef() == null)
+ {
+ actionLink = null;
+ }
+ else if (isUseAjax())
+ {
+ actionLink = event("SelectNode", nodeId);
+ }
+ else
+ {
+ actionLink = Util.getPortalRequestContext().getPortalURI() + node.getURI();
+ }
+ json.put("actionLink", actionLink);
+
+ JSONArray childs = new JSONArray();
+ for (UserNode child : node.getChildren())
+ {
+ childs.put(toJSON(child, res));
+ }
+ json.put("childs", childs);
+ return json;
+ }
+
+ public boolean isUseAjax()
+ {
+ PortletRequestContext context = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
+ PortletRequest prequest = context.getRequest();
+ PortletPreferences prefers = prequest.getPreferences();
+ return Boolean.valueOf(prefers.getValue("useAJAX", "true"));
+ }
}
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,50 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.component;
-
-import org.exoplatform.portal.webui.navigation.UIPortalNavigation2;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.application.portlet.PortletRequestContext;
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
-import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIPortletApplication;
-import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequest;
-
-@ComponentConfigs({
- @ComponentConfig(lifecycle = UIApplicationLifecycle.class),
- @ComponentConfig(type = UIPortalNavigation2.class, id = "UIHorizontalNavigation", events = @EventConfig(listeners = UIPortalNavigation2.SelectNodeActionListener.class))})
-public class UIPortalNavigationPortlet extends UIPortletApplication
-{
- public UIPortalNavigationPortlet() throws Exception
- {
- PortletRequestContext context = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
- PortletRequest prequest = context.getRequest();
- PortletPreferences prefers = prequest.getPreferences();
- String template = prefers.getValue("template", "app:/groovy/portal/webui/component/UIPortalNavigation2.gtmpl");
-
- UIPortalNavigation2 portalNavigation = addChild(UIPortalNavigation2.class, "UIHorizontalNavigation", null);
- portalNavigation.setUseAjax(Boolean.valueOf(prefers.getValue("useAJAX", "true")));
- portalNavigation.setTemplate(template);
- }
-}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,7 +19,20 @@
package org.exoplatform.portal.webui.component;
+import java.util.List;
+
+import javax.portlet.MimeResponse;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceURL;
+
+import org.exoplatform.portal.mop.navigation.GenericScope;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.webui.navigation.TreeNode;
import org.exoplatform.portal.webui.navigation.UIPortalNavigation;
+import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -27,10 +40,9 @@
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
+import org.json.JSONArray;
+import org.json.JSONObject;
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequest;
-
/**
* Created by The eXo Platform SARL
* Author : Dang Van Minh
@@ -38,16 +50,18 @@
* Jul 3, 2006
*/
@ComponentConfigs({
- @ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "system:/groovy/webui/core/UISitemap2.gtmpl"),
+ @ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "system:/groovy/webui/core/UISitemap.gtmpl"),
@ComponentConfig(type = UIPortalNavigation.class, id = "UISiteMap", events = {
@EventConfig(listeners = UIPortalNavigation.SelectNodeActionListener.class),
- @EventConfig(listeners = UIPortalNavigation.ExpandAllNodeActionListener.class),
+// @EventConfig(listeners = UIPortalNavigation.ExpandAllNodeActionListener.class),
@EventConfig(listeners = UIPortalNavigation.CollapseAllNodeActionListener.class),
- @EventConfig(listeners = UIPortalNavigation.CollapseNodeActionListener.class),
- @EventConfig(listeners = UIPortalNavigation.ExpandNodeActionListener.class)})})
+ @EventConfig(listeners = UIPortalNavigation.CollapseNodeActionListener.class)})})
+// @EventConfig(listeners = UIPortalNavigation.ExpandNodeActionListener.class)
public class UISitemapPortlet extends UIPortletApplication
{
+ public static final int DEFAULT_LEVEL = 2;
+
public UISitemapPortlet() throws Exception
{
@@ -57,10 +71,119 @@
String template = prefers.getValue("template", "system:/groovy/webui/core/UISitemapTree.gtmpl");
UIPortalNavigation uiPortalNavigation = addChild(UIPortalNavigation.class, "UISiteMap", null);
- uiPortalNavigation.loadTreeNodes();
uiPortalNavigation.setTemplate(template);
+ uiPortalNavigation.setUseAjax(isUseAjax());
+
+ int level = DEFAULT_LEVEL;
+ try
+ {
+ level = Integer.valueOf(prefers.getValue("level", String.valueOf(DEFAULT_LEVEL)));
+ }
+ catch (Exception ex)
+ {
+ log.warn("Preference for navigation level can only be integer");
+ }
+
+ if (level <= 0)
+ {
+ uiPortalNavigation.setScope(Scope.ALL);
+ }
+ else
+ {
+ uiPortalNavigation.setScope(new GenericScope(level));
+ }
}
+ @Override
+ public void serveResource(WebuiRequestContext context) throws Exception
+ {
+ super.serveResource(context);
+
+ ResourceRequest req = context.getRequest();
+ String nodeID = req.getResourceID();
+
+ JSONArray jsChilds = getChildrenAsJSON(nodeID);
+ if (jsChilds == null)
+ {
+ return;
+ }
+
+ MimeResponse res = context.getResponse();
+ res.setContentType("text/json");
+ res.getWriter().write(jsChilds.toString());
+ }
+
+ private JSONArray getChildrenAsJSON(String nodeID) throws Exception
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ List<TreeNode> childs = null;
+
+ UIPortalNavigation uiPortalNavigation = getChild(UIPortalNavigation.class);
+ TreeNode tnode = uiPortalNavigation.getTreeNodes().findNodes(nodeID);
+ if (tnode != null)
+ {
+ UserNode userNode = uiPortalNavigation.updateNode(tnode.getNode());
+ if (userNode != null)
+ {
+ tnode.setExpanded(true);
+ tnode.setChildren(userNode.getChildren());
+ childs = tnode.getChildren();
+ }
+ }
+
+ JSONArray jsChilds = new JSONArray();
+ if (childs == null)
+ {
+ return null;
+ }
+ MimeResponse res = context.getResponse();
+ for (TreeNode child : childs)
+ {
+ jsChilds.put(toJSON(child, res));
+ }
+ return jsChilds;
+ }
+
+ private JSONObject toJSON(TreeNode tnode, MimeResponse res) throws Exception
+ {
+ UIPortalNavigation uiPortalNavigation = getChild(UIPortalNavigation.class);
+ JSONObject json = new JSONObject();
+ UserNode node = tnode.getNode();
+ String nodeId = node.getId();
+
+ json.put("label", node.getEncodedResolvedLabel());
+ json.put("hasChild", tnode.hasChild());
+ json.put("isExpanded", tnode.isExpanded());
+ json.put("collapseURL", uiPortalNavigation.url("CollapseNode", nodeId));
+
+ ResourceURL rsURL = res.createResourceURL();
+ rsURL.setResourceID(nodeId);
+ json.put("getNodeURL", rsURL.toString());
+
+ String actionLink;
+ if (node.getPageRef() == null)
+ {
+ actionLink = null;
+ }
+ else if (isUseAjax())
+ {
+ actionLink = uiPortalNavigation.event("SelectNode", nodeId);
+ }
+ else
+ {
+ actionLink = Util.getPortalRequestContext().getPortalURI() + node.getURI();
+ }
+ json.put("actionLink", actionLink);
+
+ JSONArray childs = new JSONArray();
+ for (TreeNode child : tnode.getChildren())
+ {
+ childs.put(toJSON(child, res));
+ }
+ json.put("childs", childs);
+ return json;
+ }
+
public boolean isUseAjax()
{
PortletRequestContext context = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
Deleted: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/conf/portlet/web/PortalNavigationPortlet/webui/configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/conf/portlet/web/PortalNavigationPortlet/webui/configuration.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/conf/portlet/web/PortalNavigationPortlet/webui/configuration.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,29 +0,0 @@
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-
-<webui-configuration>
- <application>
- <ui-component-root>org.exoplatform.portal.webui.component.UIPortalNavigationPortlet</ui-component-root>
- <state-manager>org.exoplatform.webui.application.portlet.ParentAppStateManager</state-manager>
- <application-lifecycle-listeners>
- </application-lifecycle-listeners>
- </application>
-</webui-configuration>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -80,5 +80,12 @@
<skin-name>Default</skin-name>
<css-path>/skin/portal/webui/component/UIIFramePortlet/DefaultStylesheet.css</css-path>
</portlet-skin>
+
+ <javascript>
+ <param>
+ <js-module>eXo.webui.UISiteMap</js-module>
+ <js-path>/javascript/eXo/webui/UISiteMap.js</js-path>
+ </param>
+ </javascript>
</gatein-resources>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -197,6 +197,10 @@
<value>false</value>
<read-only>false</read-only>
</preference>
+ <preference>
+ <name>level</name>
+ <value>2</value>
+ </preference>
</portlet-preferences>
</portlet>
@@ -235,7 +239,11 @@
<name>template</name>
<value>system:/groovy/webui/core/UISitemapTree.gtmpl</value>
<read-only>false</read-only>
- </preference>
+ </preference>
+ <preference>
+ <name>level</name>
+ <value>2</value>
+ </preference>
</portlet-preferences>
</portlet>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,9 +1,10 @@
<%
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.portal.config.model.PageNavigation;
+ import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util;
import org.gatein.common.text.EntityEncoder;
+ import javax.portlet.MimeResponse;
+ import javax.portlet.ResourceURL;
def rcontext = _ctx.getRequestContext();
JavascriptManager jsmanager = rcontext.getJavascriptManager();
@@ -12,55 +13,58 @@
jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation.onLoad');
jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation.loadScroll');
- //jsmanager.addOnResizeJavascript('eXo.portal.UIPortalNavigation.initScroll');
+ //jsmanager.addOnResizeJavascript('eXo.portal.UIPortalNavigation.initScroll');
- navigations = uicomponent.getNavigations();
-
- public void renderChildrenContainer(PageNavigation nav, PageNode node) {
- print """
- <div class="MenuItemContainer" style="display: none;">
- <div class="MenuItemDecorator">
- <div class="LeftTopMenuDecorator">
- <div class="RightTopMenuDecorator">
- <div class="CenterTopMenuDecorator"><span></span></div>
- </div>
- </div>
- <div class="LeftMiddleMenuDecorator">
- <div class="RightMiddleMenuDecorator">
- <div class="CenterMiddleMenuDecorator">
- """;
- for(child in node.getChildren()) {
- renderChildNode(nav, child);
- }
- print """
- </div>
- </div>
- </div>
- <div class="LeftBottomMenuDecorator">
- <div class="RightBottomMenuDecorator">
- <div class="CenterBottomMenuDecorator"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- """;
- }
- public void renderChildNode(PageNavigation nav, PageNode node) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
+ public void renderChildrenContainer(UserNode node) {
+ print """
+ <div class="MenuItemContainer" style="display: none;">
+ <div class="MenuItemDecorator">
+ <div class="LeftTopMenuDecorator">
+ <div class="RightTopMenuDecorator">
+ <div class="CenterTopMenuDecorator"><span></span></div>
+ </div>
+ </div>
+ <div class="LeftMiddleMenuDecorator">
+ <div class="RightMiddleMenuDecorator">
+ <div class="CenterMiddleMenuDecorator">
+ """;
+ for(child in node.getChildren()) {
+ renderChildNode(child);
+ }
+ print """
+ </div>
+ </div>
+ </div>
+ <div class="LeftBottomMenuDecorator">
+ <div class="RightBottomMenuDecorator">
+ <div class="CenterBottomMenuDecorator"><span></span></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ """;
+ }
+
+ public void renderChildNode(UserNode node) {
+ UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "NormalItem"; // OverItem
- if(selectedNode != null && selectedNav != null &&
- selectedNav.getId () == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
+ if(selectedNode != null && node.getId() == selectedNode.getId()) {
tabStyleNavigation = "SelectedItem";
- }
+ }
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() > 0) arrowIcon = "ArrowIcon";
+ String getNodeURL = "";
+ if (node.getChildrenCount() > 0) {
+ arrowIcon = "ArrowIcon";
+ MimeResponse res = _ctx.getRequestContext().getResponse();
+ ResourceURL resourceURL = res.createResourceURL();
+ resourceURL.setResourceID(res.encodeURL(node.getURI()));
+ getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
+ }
- String label = node.resolvedLabel;
+ String label = node.getResolvedLabel();
String title = "";
if(label.length() > 40) {
title = label;
@@ -68,12 +72,12 @@
}
EntityEncoder entityEncoder = EntityEncoder.FULL;
label = entityEncoder.encode(label);
- String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri();
- if(node.pageReference != null) {
+ String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getURI();
+ if(node.getPageRef() != null) {
if(uicomponent.isUseAjax()) {
- String onclickEvt = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri()) + ";return false;" ;
+ String onclickEvt = uicomponent.event("SelectNode", node.getId()) + ";return false;" ;
print """
- <div class="MenuItem $tabStyleNavigation">
+ <div class="MenuItem $tabStyleNavigation" $getNodeURL>
<div class="$arrowIcon" title="$title">
<div class="ItemIcon $icon">
<a href="$pageURI" onclick="$onclickEvt">$label</a>
@@ -82,7 +86,7 @@
""";
} else {
print """
- <div class="MenuItem $tabStyleNavigation">
+ <div class="MenuItem $tabStyleNavigation" $getNodeURL>
<div class="$arrowIcon" title="$title">
<div class="ItemIcon $icon">
<a href="$pageURI">$label</a>
@@ -92,7 +96,7 @@
}
} else {
print """
- <div class="MenuItem $tabStyleNavigation">
+ <div class="MenuItem $tabStyleNavigation" $getNodeURL>
<div class="$arrowIcon" title="$title">
<div class="ItemIcon $icon">
<a href="#">$label</a>
@@ -101,13 +105,13 @@
""";
}
- if (node.getChildren() != null && node.getChildren().size() > 0) {
- renderChildrenContainer(nav, node);
+ if (node.getChildren().size() > 0) {
+ renderChildrenContainer(node);
}
print "</div>";
}
%>
-
+
<div class="UINavigationBar <%=uicomponent.getCssClassName()%>">
<div class="LeftNavigationBar">
<div class="RightNavigationBar">
@@ -115,24 +119,29 @@
<div class="UIHorizontalTabs">
<div class="TabsContainer">
<%
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- if(navigations != null) {
- for(nav in navigations) {
+ MimeResponse res = _ctx.getRequestContext().getResponse();
+
+ def rootNodes = uicomponent.getNavigations();
+ UserNode selectedNode = uicomponent.getSelectedNode();
+ if(rootNodes != null) {
+ for(nav in rootNodes) {
- def pageNodes = nav.getNodes();
- for(PageNode node in pageNodes) {
+ def childs = nav.getChildren();
+
+ for(Node node in childs) {
String tabStyleNavigation = "NormalNavigationTab";
- if(selectedNode != null && selectedNav != null &&
- selectedNav.getId() == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
+ if(selectedNode != null && node.getId() == selectedNode.getId()) {
tabStyleNavigation = "SelectedNavigationTab";
}
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- %>
-
+
+ if (node.getChildrenCount() > 0) {
+ ResourceURL resourceURL = res.createResourceURL();
+ resourceURL.setResourceID(res.encodeURL(node.getURI()));
+ %>
+ <div class="UITab" exo:getNodeURL="<%=resourceURL.toString() %>">
+ <% } else { %>
<div class="UITab">
+ <% } %>
<div class="$tabStyleNavigation">
<div class="LeftTab">
<div class="RightTab">
@@ -140,7 +149,7 @@
<div class="TabIcon">
<%
String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() > 0) {
+ if (node.getChildrenCount() > 0) {
arrowIcon = "DropDownArrowIcon";
}
String iconType = node.getIcon();
@@ -148,14 +157,14 @@
%>
<div class="$arrowIcon">
<%
- String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri();
- String label = node.resolvedLabel;
+ String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getURI();
+ String label = node.getResolvedLabel();
if(label.length() > 30) label = label.substring(0,29) + "...";
EntityEncoder entityEncoder = EntityEncoder.FULL;
label=entityEncoder.encode(label);
- if(node.pageReference != null) {
+ if(node.getPageRef() != null) {
if(uicomponent.isUseAjax()) {
- String onclickEvt = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri()) + ";return false;";
+ String onclickEvt = uicomponent.event("SelectNode", node.getId()) + ";return false;";
%>
<a class="TabLabel ${iconType}" onclick="$onclickEvt" href="$pageURI">$label</a>
<%
@@ -173,11 +182,11 @@
</div>
</div>
<%
- /*Render Popup Menu*/
- if (node.getChildren() != null && node.getChildren().size() > 0) {
- renderChildrenContainer(nav, node);
- }
- %>
+ /*Render Popup Menu*/
+ if (node.getChildren().size() > 0) {
+ renderChildrenContainer(node);
+ }
+ %>
</div>
<%
}
Deleted: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation2.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation2.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation2.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,237 +0,0 @@
-<%
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.web.application.JavascriptManager;
- import org.exoplatform.portal.webui.util.Util;
-
- def rcontext = _ctx.getRequestContext();
- JavascriptManager jsmanager = rcontext.getJavascriptManager();
- jsmanager.importJavascript('eXo.webui.UIHorizontalTabs');
- jsmanager.importJavascript('eXo.portal.UIPortalNavigation2');
- jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation2.onLoad');
-
- jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation2.loadScroll');
- //jsmanager.addOnResizeJavascript('eXo.portal.UIPortalNavigation2.initScroll');
-
- navigations = uicomponent.getNavigations();
- PageNode mySiteRoot = createRootNode(_ctx.appRes("UIPortalNavigation.Root.MySite"));
- PageNode mySpaceRoot = createRootNode(_ctx.appRes("UIPortalNavigation.Root.MySpace"));
-
- for(nav in navigations) {
- String ownerType = nav.getOwnerType();
- if (ownerType.equals("portal")) {
- addNodesToRoot(mySiteRoot, nav.getNodes());
- } else if (ownerType.equals("group")) {
- addNodesToRoot(mySpaceRoot, nav.getNodes());
- }
- }
-
- public PageNode createRootNode(String name) {
- PageNode node = new PageNode();
- node.setShowPublicationDate(false);
- node.setVisible(true) ;
- node.setModifiable(false);
- node.setLabel(name);
- node.setName(name);
- return node;
- }
-
- public void addNodesToRoot(PageNode root, ArrayList<PageNode> nodes) {
- for(PageNode ele : nodes) {
- root.getChildren().add(ele);
- }
- }
-
- public void renderChildrenContainer(PageNavigation nav, PageNode node) {
- print """
- <div class="MenuItemContainer" style="display: none;">
- <div class="MenuItemDecorator">
- <div class="LeftTopMenuDecorator">
- <div class="RightTopMenuDecorator">
- <div class="CenterTopMenuDecorator"><span></span></div>
- </div>
- </div>
-
- <div class="LeftMiddleMenuDecorator">
- <div class="RightMiddleMenuDecorator">
- <div class="CenterMiddleMenuDecorator">
- """;
- for(child in node.getChildren()) {
- renderChildNode(nav, child);
- }
- print """
- </div>
- </div>
- </div>
- <div class="LeftBottomMenuDecorator">
- <div class="RightBottomMenuDecorator">
- <div class="CenterBottomMenuDecorator"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- """;
- }
-
- public void renderChildNode(PageNavigation nav, PageNode node) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
- String tabStyleNavigation = "NormalItem"; // OverItem
- if(selectedNode != null && selectedNav != null &&
- selectedNav.getId () == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedItem";
- }
-
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() > 0) arrowIcon = "ArrowIcon";
-
- String label = node.resolvedLabel;
- String title = "";
- if(label.length() > 40) {
- title = label;
- label = label.substring(0,37) + "...";
- }
-
- String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri();
- if(node.pageReference != null) {
- if(uicomponent.isUseAjax()) {
- String onclickEvt = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri()) + ";return false;";
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$arrowIcon" title="$title">
- <div class="ItemIcon $icon">
- <a href="$pageURI" onclick="$onclickEvt">$label</a>
- </div>
- </div>
- """;
- } else {
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$arrowIcon" title="$title">
- <div class="ItemIcon $icon">
- <a href="$pageURI">$label</a>
- </div>
- </div>
- """;
- }
- } else {
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$arrowIcon" title="$title">
- <div class="ItemIcon $icon">
- <a href="$pageURI">$label</a>
- </div>
- </div>
- """;
- }
-
- if (node.getChildren() != null && node.getChildren().size() > 0) {
- renderChildrenContainer(nav, node);
- }
-
- print "</div>";
- }
-%>
-
-<div class="UINavigationBar">
- <div class="LeftNavigationBar">
- <div class="RightNavigationBar">
- <div class="MiddleNavigationBar">
- <div class="UIHorizontalTabs">
- <div class="TabsContainer">
- <%
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- if(navigations != null) {
- Hashtable<String, Boolean> usedNavs = new Hashtable<String, Boolean>();
- for(nav in navigations) {
- ArrayList<PageNode> pageNodes = new ArrayList<PageNode>();
- String navOwnerType = nav.getOwnerType();
- if (usedNavs.get(navOwnerType)) {
- continue;
- } else if (navOwnerType.equals("portal")) {
- pageNodes.add(mySiteRoot);
- usedNavs.put(navOwnerType, true);
- } else if (navOwnerType.equals("group")) {
- pageNodes.add(mySpaceRoot);
- usedNavs.put(navOwnerType, true);
- } else {
- pageNodes = nav.getNodes();
- }
-
- for(PageNode node in pageNodes) {
- String tabStyleNavigation = "NormalNavigationTab";
- if(selectedNode != null && selectedNav != null &&
- selectedNav.getId() == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedNavigationTab";
- }
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- %>
-
- <div class="UITab">
- <div class="$tabStyleNavigation">
- <div class="LeftTab">
- <div class="RightTab">
- <div class="MiddleTab">
- <div class="TabIcon">
- <%
- String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() > 0) {
- arrowIcon = "DropDownArrowIcon";
- }
- String iconType = node.getIcon();
- if(iconType == null) iconType = "DefaultPageIcon";
- %>
- <div class="$arrowIcon">
- <%
- String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri() ;
- String label = node.resolvedLabel ;
- if(label.length() > 30) label = label.substring(0,29) + "..." ;
- if(node.pageReference != null) {
- if(uicomponent.isUseAjax()) {
- String onclickEvt = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri()) + ";return false;" ;
- %>
- <a class="TabLabel ${iconType}" onclick="$onclickEvt" href="$pageURI">$label</a>
- <%
- } else {
- %>
- <a class="TabLabel ${iconType}" href="$pageURI">$label</a>
- <% }
- } else {%>
- <a class="TabLabel ${iconType}">$label</a>
- <%}%>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <%
- /*Render Popup Menu*/
- if (node.getChildren() != null && node.getChildren().size() > 0) {
- renderChildrenContainer(nav, node);
- }
- %>
- </div>
-
- <%
- }
- }
- }
- %>
- <div class="ScrollButtons">
- <div class="ScrollLeftButton" title="<%= _ctx.appRes("UIPortalNavigation.Label.Previous") %>">
- <div class="ScrollRightButton" title="<%= _ctx.appRes("UIPortalNavigation.Label.Next") %>"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js
===================================================================
--- portal/trunk/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-function UISiteMap() {};
-
-UISiteMap.prototype.updateTreeNode = function (nodeToUpdate, getNodeURL) {
- if (!nodeToUpdate || ! getNodeURL) return;
-
- var subGroup = eXo.core.DOMUtil.findFirstChildByClass(nodeToUpdate.parentNode, "div", "ChildrenContainer") ;
- if (!subGroup || subGroup.innerHTML.trim() !== "") return;
-
- var jsChilds = ajaxAsyncGetRequest(getNodeURL, false);
- try {
- var data = eXo.core.JSON.parse(jsChilds);
- } catch (e) {
- }
- if (data && data.length) {
- eXo.webui.UISiteMap.generateHtml(data, nodeToUpdate, subGroup);
- return;
- }
- eXo.core.DOMUtil.removeClass(nodeToUpdate, "CollapseIcon");
- eXo.core.DOMUtil.addClass(nodeToUpdate, "NullItem");
-};
-
-UISiteMap.prototype.generateHtml = function(data, nodeToUpdate, subGroup) {
- function toHtml(node, isLast) {
- if (!node) return;
- var lastNode = isLast ? "LastNode" : "";
- var actionLink = node.actionLink ? node.actionLink : "javascript:void(0);";
-
- var actionExpand = 'eXo.webui.UISiteMap.updateTreeNode(this, "' + node.getNodeURL + '")';
- var actionCollapse = 'ajaxAsyncGetRequest("' + node.collapseURL + '", true)';
-
- var str = "";
- if (node.hasChild) {
- str += "<div class='" + lastNode + " Node'>";
- if (node.isExpanded) {
- str += "<div class='CollapseIcon ClearFix' onclick='eXo.portal.UIPortal.collapseExpand(this); " + actionCollapse + "'>";
- str += "<a class='NodeIcon DefaultPageIcon' href='" + actionLink + "'>" + node.label + "</a>";
- str += "</div><div class='ChildrenContainer' style='display: block'>";
- for (var idx = 0; idx < node.childs.length; idx++) {
- str += toHtml(node.childs[idx], idx == node.childs.length - 1);
- }
- } else {
- str += "<div class='ExpandIcon ClearFix' onclick='eXo.portal.UIPortal.collapseExpand(this); " + actionExpand + "'>";
- str += "<a class='NodeIcon DefaultPageIcon' href='" + actionLink + "'>" + node.label + "</a>";
- str += "</div><div class='ChildrenContainer' style='display: none'>";
- for (var idx = 0; idx < node.childs.length; idx++) {
- str += toHtml(node.childs[idx], idx == node.childs.length - 1);
- }
- }
- str += "</div></div>";
- } else {
- str += "<div class='" + lastNode + " Node ClearFix'><div class='NullItem'><div class='ClearFix'>";
- str += "<a class='NodeIcon DefaultPageIcon' href='" + actionLink + "'>" + node.label + "</a></div></div></div>";
- }
- return str;
- }
-
- var htmlFrags = "";
- for (var i = 0; i < data.length; i++) {
- htmlFrags += toHtml(data[i], i == data.length - 1);
- }
-
- subGroup.innerHTML = htmlFrags;
- subGroup.style.display = "block";
-};
-
-eXo.webui.UISiteMap = new UISiteMap();
Copied: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js (from rev 6783, portal/trunk/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/javascript/eXo/webui/UISiteMap.js 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+function UISiteMap() {};
+
+UISiteMap.prototype.updateTreeNode = function (nodeToUpdate, getNodeURL) {
+ if (!nodeToUpdate || ! getNodeURL) return;
+
+ var subGroup = eXo.core.DOMUtil.findFirstChildByClass(nodeToUpdate.parentNode, "div", "ChildrenContainer") ;
+ if (!subGroup || subGroup.innerHTML.trim() !== "") return;
+
+ var jsChilds = ajaxAsyncGetRequest(getNodeURL, false);
+ try {
+ var data = eXo.core.JSON.parse(jsChilds);
+ } catch (e) {
+ }
+ if (data && data.length) {
+ eXo.webui.UISiteMap.generateHtml(data, nodeToUpdate, subGroup);
+ return;
+ }
+ eXo.core.DOMUtil.removeClass(nodeToUpdate, "CollapseIcon");
+ eXo.core.DOMUtil.addClass(nodeToUpdate, "NullItem");
+};
+
+UISiteMap.prototype.generateHtml = function(data, nodeToUpdate, subGroup) {
+ function toHtml(node, isLast) {
+ if (!node) return;
+ var lastNode = isLast ? "LastNode" : "";
+ var actionLink = node.actionLink ? node.actionLink : "javascript:void(0);";
+
+ var actionExpand = 'eXo.webui.UISiteMap.updateTreeNode(this, "' + node.getNodeURL + '")';
+ var actionCollapse = 'ajaxAsyncGetRequest("' + node.collapseURL + '", true)';
+
+ var str = "";
+ if (node.hasChild) {
+ str += "<div class='" + lastNode + " Node'>";
+ if (node.isExpanded) {
+ str += "<div class='CollapseIcon ClearFix' onclick='eXo.portal.UIPortal.collapseExpand(this); " + actionCollapse + "'>";
+ str += "<a class='NodeIcon DefaultPageIcon' href='" + actionLink + "'>" + node.label + "</a>";
+ str += "</div><div class='ChildrenContainer' style='display: block'>";
+ for (var idx = 0; idx < node.childs.length; idx++) {
+ str += toHtml(node.childs[idx], idx == node.childs.length - 1);
+ }
+ } else {
+ str += "<div class='ExpandIcon ClearFix' onclick='eXo.portal.UIPortal.collapseExpand(this); " + actionExpand + "'>";
+ str += "<a class='NodeIcon DefaultPageIcon' href='" + actionLink + "'>" + node.label + "</a>";
+ str += "</div><div class='ChildrenContainer' style='display: none'>";
+ for (var idx = 0; idx < node.childs.length; idx++) {
+ str += toHtml(node.childs[idx], idx == node.childs.length - 1);
+ }
+ }
+ str += "</div></div>";
+ } else {
+ str += "<div class='" + lastNode + " Node ClearFix'><div class='NullItem'><div class='ClearFix'>";
+ str += "<a class='NodeIcon DefaultPageIcon' href='" + actionLink + "'>" + node.label + "</a></div></div></div>";
+ }
+ return str;
+ }
+
+ var htmlFrags = "";
+ for (var i = 0; i < data.length; i++) {
+ htmlFrags += toHtml(data[i], i == data.length - 1);
+ }
+
+ subGroup.innerHTML = htmlFrags;
+ subGroup.style.display = "block";
+};
+
+eXo.webui.UISiteMap = new UISiteMap();
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2011-07-18 22:48:36 UTC (rev 6885)
@@ -654,6 +654,7 @@
var requestStr = eXo.env.server.createPortalURL(portalComposer.id, "Toggle", true);
ajaxAsyncGetRequest(requestStr);
};
+
/**
* Clollapse or expand an element (all its children) of tree
* @param {Object} element object to collapse or expand
@@ -661,17 +662,16 @@
UIPortal.prototype.collapseExpand = function(element) {
var subGroup = eXo.core.DOMUtil.findFirstChildByClass(element.parentNode, "div", "ChildrenContainer") ;
var className = element.className;
- if(!subGroup) return false;
+ if(!subGroup) return;
if(subGroup.style.display == "none") {
- if (className.indexOf("ExpandIcon") == 0) element.className = "CollapseIcon ClearFix" ;
+ if (className.indexOf("ExpandIcon") == 0) element.className = "CollapseIcon ClearFix" ;
subGroup.style.display = "block" ;
} else {
if (className.indexOf("CollapseIcon") == 0) element.className = "ExpandIcon ClearFix" ;
subGroup.style.display = "none" ;
}
- return true;
};
-
+
/*
* This method will start the creation of a new javascript application such as a widget
*
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalControl.js
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalControl.js 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalControl.js 2011-07-18 22:48:36 UTC (rev 6885)
@@ -41,20 +41,8 @@
var parentNode = DOMUtil.findAncestorByClass(selectedElement, "Node");
var childrenContainer = DOMUtil.findFirstDescendantByClass(parentNode, "div", "ChildrenContainer");
-
- if (eXo.core.Browser.browserType != "ie") {
- var expandIcon = document.createElement('a');
- expandIcon.href = childrenContainer.getAttribute("actionLink") ;
- expandIcon.className = "ExpandIcon" ;
- expandIcon.innerHTML = selectedElement.innerHTML ;
- parentNode.removeChild(childrenContainer);
- parentNode.insertBefore(expandIcon, selectedElement);
- parentNode.removeChild(selectedElement);
- } else {
- // Fix for GTNPORTAL-379 IE7: Can't hide sub-group
- var newHTML = "<div onclick=\"" + childrenContainer.getAttribute("actionLink") + "\" class=\"ExpandIcon\">" + selectedElement.innerHTML + "</div>";
- parentNode.innerHTML = newHTML;
- }
+ var newHTML = "<div onclick=\"" + childrenContainer.getAttribute("actionLink") + "\" class=\"ExpandIcon\">" + selectedElement.innerHTML + "</div>";
+ parentNode.innerHTML = newHTML;
};
/**
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js 2011-07-18 22:48:36 UTC (rev 6885)
@@ -23,7 +23,7 @@
function UIPortalNavigation() {
this.currentOpenedMenu = null;
this.scrollMgr = null;
- this.scrollManagerLoaded = false;
+ this.scrollManagerLoaded = false;
};
/**
* Sets some parameters :
@@ -54,7 +54,7 @@
eXo.portal.UIPortalNavigation.init(uiNavPortlets[0], mainContainer, 0, 0);
for (var i = 1; i < uiNavPortlets.length; ++i) {
uiNavPortlets[i].style.display = "none";
- }
+ }
}
};
/**
@@ -83,32 +83,34 @@
item.onmousemove = eXo.portal.UIPortalNavigation.tabOnMouseMove ;
}
item.style.width = item.offsetWidth + "px";
- /**
- * TODO: fix IE7;
- */
- var container = DOMUtil.findFirstDescendantByClass(item, "div", this.containerStyleClass);
- if (container) {
- if (eXo.core.Browser.isIE6()) {
- container.style.width = item.offsetWidth + "px";
- } else {
- container.style.minWidth = item.offsetWidth + "px";
- }
- }
}
- var itemConts = DOMUtil.findDescendantsByClass(topContainer, "div", this.containerStyleClass);
- for (var i = 0; i < itemConts.length; i++) {
- var cont = itemConts[i];
- if(!cont.id) cont.id = DOMUtil.generateId("PortalNavigationContainer");
- cont.resized = false;
-
- var items = DOMUtil.findDescendantsByClass(cont, "div", this.tabStyleClass);
- if(items.length == 0) cont.parentNode.removeChild(cont);
- for(var j = 0; j < items.length; j ++) {
- items[j].onmouseover = eXo.portal.UIPortalNavigation.onMenuItemOver;
- items[j].onmouseout = eXo.portal.UIPortalNavigation.onMenuItemOut;
- }
- }
+ /**
+ * TODO: fix IE7;
+ */
+ var container = DOMUtil.findFirstDescendantByClass(item, "div", this.containerStyleClass);
+ if (container) {
+ if (eXo.core.Browser.isIE6()) {
+ container.style.width = item.offsetWidth + "px";
+ } else {
+ container.style.minWidth = item.offsetWidth + "px";
+ }
+ }
+
+ var itemConts = DOMUtil.findDescendantsByClass(topContainer, "div", this.containerStyleClass);
+ for (var i = 0; i < itemConts.length; i++) {
+ var cont = itemConts[i];
+ if(!cont.id) cont.id = DOMUtil.generateId("PortalNavigationContainer");
+ cont.resized = false;
+
+ var items = DOMUtil.findDescendantsByClass(cont, "div", this.tabStyleClass);
+ if(items.length == 0) cont.parentNode.removeChild(cont);
+ for(var j = 0; j < items.length; j ++) {
+ items[j].onmouseover = eXo.portal.UIPortalNavigation.onMenuItemOver;
+ items[j].onmouseout = eXo.portal.UIPortalNavigation.onMenuItemOut;
+ }
+ }
+
};
/**
* Sets the tab style on mouse over and mouse out
@@ -129,16 +131,62 @@
// }
//}
+UIPortalNavigation.prototype.generateContainer = function(data) {
+ var htmlFrags = "<div class='" + this.containerStyleClass + "' style='display: none;' id='";
+ htmlFrags += eXo.core.DOMUtil.generateId("PortalNavigationContainer") + "' resized='false'>";
+ htmlFrags += "<div class='MenuItemDecorator'>";
+ htmlFrags += "<div class='LeftTopMenuDecorator'><div class='RightTopMenuDecorator'>";
+ htmlFrags += "<div class='CenterTopMenuDecorator'><span></span></div></div></div>";
+ htmlFrags += "<div class='LeftMiddleMenuDecorator'><div class='RightMiddleMenuDecorator'>";
+ htmlFrags += "<div class='CenterMiddleMenuDecorator'>";
+ for (var i = 0; i < data.length; i++) {
+ var node = data[i];
+ var actionLink = node.actionLink ? node.actionLink : "javascript:void(0);";
+
+ htmlFrags += ("<div class='MenuItem " + (node.isSelected ? "SelectedItem'" : "NormalItem'"));
+ htmlFrags += (node.hasChild ? (" exo:getNodeURL='" + node.getNodeURL + "' ") : "" );
+ htmlFrags += ("onmouseover='eXo.portal.UIPortalNavigation.onMenuItemOver(this)' onmouseout='eXo.portal.UIPortalNavigation.onMenuItemOut(this)'>");
+ htmlFrags += ("<div class='" + (node.hasChild ? "ArrowIcon" : "") + "' title='" + node.label + "'>");
+ htmlFrags += ("<div class='ItemIcon " + (node.icon ? node.icon : "DefaultPageIcon") + "'>");
+ htmlFrags += ("<a href='" + actionLink + "'>" + (node.label.length > 40 ? node.label.substring(0,37) + "..." : node.label) + "</a>");
+ htmlFrags += ("</div></div>");
+ if (node.childs.length) {
+ htmlFrags += eXo.portal.UIPortalNavigation.generateContainer(node.childs);
+ }
+ htmlFrags += "</div>";
+ }
+ htmlFrags += "</div></div></div><div class='LeftBottomMenuDecorator'><div class='RightBottomMenuDecorator'>";
+ htmlFrags += "<div class='CenterBottomMenuDecorator'><span></span></div></div></div></div></div>";
+ return htmlFrags;
+};
+
UIPortalNavigation.prototype.setTabStyleOnMouseOver = function(e) {
var tab = this ;
if (eXo.portal.UIPortalNavigation.previousMenuItem != tab) {
eXo.portal.UIPortalNavigation.hideMenu() ;
}
- eXo.portal.UIPortalNavigation.setTabStyleOnMouseOut(e, tab) ;
- eXo.portal.UIPortalNavigation.previousMenuItem = tab ;
- if (!eXo.portal.UIPortalNavigation.menuVisible) {
- var menuItemContainer = eXo.core.DOMUtil.findFirstDescendantByClass(tab, "div", eXo.portal.UIPortalNavigation.containerStyleClass);
+ eXo.portal.UIPortalNavigation.setTabStyleOnMouseOut(e, tab) ;
+ eXo.portal.UIPortalNavigation.previousMenuItem = tab ;
+
+ var getNodeURL = tab.getAttribute("exo:getNodeURL");
+ var menuItemContainer = eXo.core.DOMUtil.findFirstDescendantByClass(tab, "div", eXo.portal.UIPortalNavigation.containerStyleClass);
+ if (getNodeURL && !menuItemContainer) {
+ var jsChilds = ajaxAsyncGetRequest(getNodeURL,false)
+ try {
+ var data = eXo.core.JSON.parse(jsChilds);
+ } catch (e) {
+ }
+ if (!data || !data.length) {
+ return;
+ }
+ var temp = document.createElement("div");
+ temp.innerHTML = eXo.portal.UIPortalNavigation.generateContainer(data);
+ tab.appendChild(eXo.core.DOMUtil.findFirstChildByClass(temp, "div", eXo.portal.UIPortalNavigation.containerStyleClass));
+ }
+
+ if (!eXo.portal.UIPortalNavigation.menuVisible) {
var hideSubmenu = tab.getAttribute('hideSubmenu') ;
+ menuItemContainer = eXo.core.DOMUtil.findFirstDescendantByClass(tab, "div", eXo.portal.UIPortalNavigation.containerStyleClass);
if (menuItemContainer && !hideSubmenu) {
var DOMUtil = eXo.core.DOMUtil ;
if(eXo.core.Browser.browserType == "ie") {
@@ -157,8 +205,10 @@
}
eXo.portal.UIPortalNavigation.toggleSubMenu(e, tab, menuItemContainer) ;
}
- }
- eXo.portal.UIPortalNavigation.menuVisible = true ;
+ }
+
+ eXo.portal.UIPortalNavigation.cancelHideMenuContainer() ;
+ eXo.portal.UIPortalNavigation.menuVisible = true ;
} ;
UIPortalNavigation.prototype.setTabStyleOnMouseOut = function(e, src) {
@@ -281,7 +331,7 @@
eXo.portal.UIPortalNavigation.superClass.popVisibleContainer();
eXo.portal.UIPortalNavigation.superClass.setCloseTimeout();
eXo.portal.UIPortalNavigation.superClass.hide(menuItemContainer);
- eXo.portal.UIPortalNavigation.currentOpenedMenu = null;
+ eXo.portal.UIPortalNavigation.currentOpenedMenu = null;
}
this.previousMenuItem = false ;
eXo.portal.UIPortalNavigation.menuVisible = false ;
@@ -308,17 +358,37 @@
tabsContainer.style.position = "relative" ;
}
}
- }
+ }
};
/**
* When the mouse goes over a menu item (in the main nav menu)
* Check if this menu item has a sub menu, if yes, opens it
* Changes the style of the button
*/
-UIPortalNavigation.prototype.onMenuItemOver = function(e) {
- var menuItem = this;
+UIPortalNavigation.prototype.onMenuItemOver = function(menuItem) {
+ if (!menuItem || !menuItem.nodeName) menuItem = this;
var DOMUtil = eXo.core.DOMUtil;
+
+ var getNodeURL = menuItem.getAttribute("exo:getNodeURL");
var subContainer = DOMUtil.findFirstDescendantByClass(menuItem, "div", eXo.portal.UIPortalNavigation.containerStyleClass);
+ if (getNodeURL && !subContainer) {
+ var jsChilds = ajaxAsyncGetRequest(getNodeURL,false)
+ try {
+ var data = eXo.core.JSON.parse(jsChilds);
+ } catch (e) {
+ }
+ if (!data || !data.length) {
+ var arrow = DOMUtil.findFirstChildByClass(menuItem, "div", "ArrowIcon");
+ DOMUtil.removeClass(arrow, "ArrowIcon");
+ menuItem.removeAttribute("exo:getNodeURL");
+ return;
+ }
+ var temp = document.createElement("div");
+ temp.innerHTML = eXo.portal.UIPortalNavigation.generateContainer(data);
+ menuItem.appendChild(eXo.core.DOMUtil.findFirstChildByClass(temp, "div", eXo.portal.UIPortalNavigation.containerStyleClass));
+ }
+
+ subContainer = DOMUtil.findFirstDescendantByClass(menuItem, "div", eXo.portal.UIPortalNavigation.containerStyleClass);
if (subContainer) {
eXo.portal.UIPortalNavigation.superClass.pushVisibleContainer(subContainer.id);
eXo.portal.UIPortalNavigation.showMenuItemContainer(menuItem, subContainer) ;
@@ -347,8 +417,9 @@
* When the mouse goes out a menu item from the main nav menu
* Checks if this item has a sub menu, if yes calls methods from superClass to hide it
*/
-UIPortalNavigation.prototype.onMenuItemOut = function(e) {
- var menuItem = this;
+UIPortalNavigation.prototype.onMenuItemOut = function(menuItem) {
+ if (!menuItem || !menuItem.nodeName) menuItem = this;
+
var subContainer = eXo.core.DOMUtil.findFirstDescendantByClass(menuItem, "div", eXo.portal.UIPortalNavigation.containerStyleClass);
if (subContainer) {
eXo.portal.UIPortalNavigation.superClass.pushHiddenContainer(subContainer.id);
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js 2011-07-18 22:48:36 UTC (rev 6885)
@@ -37,7 +37,7 @@
var DOMUtil = eXo.core.DOMUtil;
var portletFrag = DOMUtil.findAncestorByClass(inputElement, "PORTLET-FRAGMENT");
var compId = portletFrag.parentNode.id;
- var nodeIndex = inputElement.id;
+ var nodeName = inputElement.id;
//Send request to server to change node name
var href = eXo.env.server.portalBaseURL + "?portal:componentId=" + compId;
@@ -45,7 +45,7 @@
href += "&portal:isSecure=false";
href += "&uicomponent=UITabPaneDashboard";
href += "&op=RenameTabLabel";
- href += "&objectId=" + nodeIndex;
+ href += "&objectId=" + nodeName;
href += "&newTabLabel=" + encodeURIComponent(newTabLabel);
window.location = href;
}
@@ -59,7 +59,7 @@
}
},
- showEditLabelInput : function(selectedElement, nodeIndex, currentContent){
+ showEditLabelInput : function(selectedElement, nodeName, currentContent){
eXo.webui.UITabbedDashboard.backupElement = selectedElement;
var prNode = selectedElement.parentNode;
var tabContainer = eXo.core.DOMUtil.findAncestorByClass(prNode, "TabsContainer");
@@ -67,7 +67,7 @@
var inputElement = document.createElement("input");
inputElement.type = "text";
- inputElement.id = nodeIndex;
+ inputElement.id = nodeName;
inputElement.name = currentContent; // To store old value
inputElement.value = currentContent;
inputElement.style.border = "1px solid #b7b7b7";
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js 2011-07-18 22:48:36 UTC (rev 6885)
@@ -29,7 +29,7 @@
childrenHeight += children[i].offsetHeight;
}
- if (!uiVirtualList.isFinished && childrenHeight <= uiVirtualList.offsetHeight) {
+ if (!uiVirtualList.isFinished && childrenHeight <= uiVirtualList.offsetHeight && childrenHeight != 0) {
uiVirtualList.onscroll();
} else {
uiVirtualList.isInitiated = true;
@@ -50,7 +50,7 @@
UIVirtualList.prototype.scrollMove = function(uiVirtualList, url) {
if (uiVirtualList.isFinished || uiVirtualList.isLocked) return;
var DOMUtil = eXo.core.DOMUtil;
-var componentHeight = uiVirtualList.offsetHeight;
+ var componentHeight = uiVirtualList.offsetHeight;
var scrollPosition = uiVirtualList.scrollTop;
var scrollerHeight = uiVirtualList.scrollHeight;
var scrollable_gap = scrollerHeight - (scrollPosition + componentHeight);
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/Stylesheet.css
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/Stylesheet.css 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/Stylesheet.css 2011-07-18 22:48:36 UTC (rev 6885)
@@ -24,4 +24,5 @@
@import url(UIDropDownControl/Stylesheet.css);
@import url(UIGroupInfoContainer/Stylesheet.css);
-@import url(UINotification/Stylesheet.css);
+@import url(UINotification/Stylesheet.css);
+@import url(UIPageSearch/Stylesheet.css);
Deleted: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css 2011-07-01 06:44:15 UTC (rev 6783)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,85 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-.UIPageSearchForm {
- height: 39px;
- line-height: 39px;
- padding-bottom: 2px;
-}
-
-.UIPageSearchForm .UISearchContainer {
- height: 38px; line-height: 38px;
-}
-
-.UIPageSearchForm .UISearchContainer .QuickSet {
- overflow: hidden;
- width: 100%;
- padding-top: 9px;
-}
-
-.UIPageSearchForm .UISearchContainer .QuickSet .SearchLabel {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- font-weight: bold;
- height: 20px;
- line-height: 20px;
- padding-left: 10px; /* orientation=lt */
- padding-right: 10px; /* orientation=rt */
-}
-
-.UIPageSearchForm .UISearchContainer .QuickSet .SearchIcon {
- margin-left: 10px; /* orientation=lt */
- margin-right: 10px; /* orientation=rt */
- width: 24px;
- height: 24px;
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/24x24/icons/QuickSearch.gif') no-repeat; /* orientation=lt */
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/24x24/icons/QuickSearch-rt.gif') no-repeat; /* orientation=rt */
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
-}
-
-.UIPageSearchForm .UISearchContainer .QuickSet a:hover{
- color: blue;
-}
-
-.UIPageSearchForm .UISearchContainer .QuickSet .UIForm {
- background-color: transparent;
- border: none;
-}
-
-.UIPageSearchForm .UISearchContainer .QuickSet select {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- width: 115px;
- padding: 1px;
- border: solid 1px gray;
- font-size: 12px;
- margin: 0 5px 0 10px;
-}
-
-.UIPageSearchForm .UISearchContainer .QuickSet input {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- margin: 0px 5px 0px 10px; /* orientation=lt */
- margin: 0px 10px 0px 5px; /* orientation=rt */
- padding-left: 4px; /* orientation=lt */
- padding-right: 4px; /* orientation=rt */
- border: 1px solid gray;
- width: 160px; height: 16px;
-}
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css (from rev 6783, portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPageSearch/Stylesheet.css 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,85 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+.UIPageSearchForm {
+ height: 39px;
+ line-height: 39px;
+ padding-bottom: 2px;
+}
+
+.UIPageSearchForm .UISearchContainer {
+ height: 38px; line-height: 38px;
+}
+
+.UIPageSearchForm .UISearchContainer .QuickSet {
+ overflow: hidden;
+ width: 100%;
+ padding-top: 9px;
+}
+
+.UIPageSearchForm .UISearchContainer .QuickSet .SearchLabel {
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
+ font-weight: bold;
+ height: 20px;
+ line-height: 20px;
+ padding-left: 10px; /* orientation=lt */
+ padding-right: 10px; /* orientation=rt */
+}
+
+.UIPageSearchForm .UISearchContainer .QuickSet .SearchIcon {
+ margin-left: 10px; /* orientation=lt */
+ margin-right: 10px; /* orientation=rt */
+ width: 24px;
+ height: 24px;
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/24x24/icons/QuickSearch.gif') no-repeat; /* orientation=lt */
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/24x24/icons/QuickSearch-rt.gif') no-repeat; /* orientation=rt */
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
+}
+
+.UIPageSearchForm .UISearchContainer .QuickSet a:hover{
+ color: blue;
+}
+
+.UIPageSearchForm .UISearchContainer .QuickSet .UIForm {
+ background-color: transparent;
+ border: none;
+}
+
+.UIPageSearchForm .UISearchContainer .QuickSet select {
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
+ width: 115px;
+ padding: 1px;
+ border: solid 1px gray;
+ font-size: 12px;
+ margin: 0 5px 0 10px;
+}
+
+.UIPageSearchForm .UISearchContainer .QuickSet input {
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
+ margin: 0px 5px 0px 10px; /* orientation=lt */
+ margin: 0px 10px 0px 5px; /* orientation=rt */
+ padding-left: 4px; /* orientation=lt */
+ padding-right: 4px; /* orientation=rt */
+ border: 1px solid gray;
+ width: 160px; height: 16px;
+}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -836,7 +836,7 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-->
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name> اسم</name>
<id> صفحة رقم</id>
@@ -853,7 +853,7 @@
<name> #{word.name}</name>
<accessGroups> مجموعات الوصول</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission> لا يوجد لديك إذن لدخول هذه الصفحة.</NoPermission>
@@ -1052,7 +1052,7 @@
<label>
<PageNodeSetting>عقدة إعداد الصفحة </PageNodeSetting>
<Icon>#{word.icon} </Icon>
- <UIPageSelector2>تحديد الصفحة </UIPageSelector2>
+ <UIPageSelector>تحديد الصفحة </UIPageSelector>
</label>
</tab>
<action>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -392,18 +392,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Name
-UIPageSelector2.header.id=Seiten-ID
-UIPageSelector2.header.accessGroups=Gruppen
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Seiten leeren
-UIPageSelector2.label.createPage=Seite erstellen
-UIPageSelector2.label.searchandSelectPage=Seite suchen und ausw\u00e4hlen
-UIPageSelector2.label.currentSelectedPage=Ausgew\u00e4hlte Seite
-UIPageSelector2.label.title=Titel
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Gruppen
+UIPageSelector.header.name=Name
+UIPageSelector.header.id=Seiten-ID
+UIPageSelector.header.accessGroups=Gruppen
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Seiten leeren
+UIPageSelector.label.createPage=Seite erstellen
+UIPageSelector.label.searchandSelectPage=Seite suchen und ausw\u00e4hlen
+UIPageSelector.label.currentSelectedPage=Ausgew\u00e4hlte Seite
+UIPageSelector.label.title=Titel
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Gruppen
UIPageBrowser.msg.NoPermission=Sie haben keine Zugriffsberechtigung f\u00fcr diese Seite.
UIPageBrowser.msg.PageNotExist=Die Seite existiert nicht.
UIPageBrowser.msg.UserNotPermission=Sie haben keine Zugriffsberechtigung f\u00fcr die Seite dieses Knotens.
@@ -514,7 +514,7 @@
UIPageNodeForm.Icon.title.SetDefault=Standardeinstellung
UIPageNodeForm.tab.label.PageNodeSetting=Seitenknoten-Eigenschaften
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Seiten-Auswahl
+UIPageNodeForm.tab.label.UIPageSelector=Seiten-Auswahl
#############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -410,18 +410,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Name
-UIPageSelector2.header.id=Page Id
-UIPageSelector2.header.accessGroups=Access groups
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Clear Page
-UIPageSelector2.label.createPage=Create Page
-UIPageSelector2.label.searchandSelectPage=Search and Select Page
-UIPageSelector2.label.currentSelectedPage=Selected Page Info
-UIPageSelector2.label.title=Title
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Access groups
+UIPageSelector.header.name=Name
+UIPageSelector.header.id=Page Id
+UIPageSelector.header.accessGroups=Access groups
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Clear Page
+UIPageSelector.label.createPage=Create Page
+UIPageSelector.label.searchandSelectPage=Search and Select Page
+UIPageSelector.label.currentSelectedPage=Selected Page Info
+UIPageSelector.label.title=Title
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Access groups
UIPageBrowser.msg.NoPermission=You have no permission to access this page.
UIPageBrowser.msg.PageNotExist=Page doesn't exist.
UIPageBrowser.msg.UserNotPermission=You have no permission to access the node's page.
@@ -545,7 +545,7 @@
UIPageNodeForm.Icon.title.SetDefault=Get Default
UIPageNodeForm.tab.label.PageNodeSetting=Page Node Setting
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Page Selector
+UIPageNodeForm.tab.label.UIPageSelector=Page Selector
UIPageNodeForm.action.Save=#{word.save}
UIPageNodeForm.action.Back=#{word.back}
@@ -555,10 +555,16 @@
#############################################################################
UIPageBrowse.deletePage=Do you want to delete this page?
-UIPageSearch.label.option.ownerType=Owner type
-UIPageSearch.label.option.ownerId=Owner id
-UIPageSearch.label.option.name=Name
-UIPageSearch.label.option.title=#{word.title}
+UIPageSearchForm.label.QuickSearch=Quick Search
+UIPageSearchForm.label.siteName=Site Name
+UIPageSearchForm.label.pageTitle=Title
+UIPageSearchForm.label.searchOption=Type
+UIPageSearchForm.label.option.ownerType=Owner type
+UIPageSearchForm.label.option.ownerId=Owner id
+UIPageSearchForm.label.option.name=Name
+UIPageSearchForm.label.option.title=#{word.title}
+UIPageSearchForm.label.option.portal=portal
+UIPageSearchForm.label.option.group=group
#############################################################################
# org.exoplatform.portal.component.customization.UIPageNavigationForm #
@@ -687,6 +693,11 @@
UIPageCreationWizard.msg.NameNotSame=This name already exists.
UIPageCreationWizard.msg.notSelectedPageNavigation=You have to select a navigation.
UIPageCreationWizard.msg.StepByStep=At first you must go through step by step.
+UIPageCreationWizard.msg.concurrent.error=Concurrent modification error :
+UIPageCreationWizard.msg.ADD_CONCURRENTLY_REMOVED_PARENT_NODE=#{UIPageCreationWizard.msg.concurrent.error} Can't add a node to deleted node
+UIPageCreationWizard.msg.ADD_CONCURRENTLY_ADDED_NODE=#{UIPageCreationWizard.msg.concurrent.error} Duplicated node name
+UIPageCreationWizard.msg.ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE=#{UIPageCreationWizard.msg.concurrent.error} Node order has been changed
+UIPageCreationWizard.msg.UPDATE_CONCURRENTLY_REMOVED_NODE=#{UIPageCreationWizard.msg.concurrent.error} Navigation has been deleted
UIPageNodeWizardPreview.action.Finish=Save and Finish
UIPageNodeWizardPreview.label.nodeName=Node Name
UIPageNodeWizardPreview.label.nodeLabel=Node Label
@@ -735,6 +746,8 @@
UIWizardPageSetInfo.label.endPublicationDate=End Publication Date
UIWizardPageSetInfo.action.Save=#{word.save}
UIWizardPageSetInfo.msg.null=No page not found.
+UIWizardPageSetInfo.msg.node.deleted=Concurrent modification error : The node you select has been deleted
+UIWizardPageSetInfo.msg.navigation.deleted=Concurrent modification error : Navigation's been deleted, wizard must be closed now
#############################################################################
# org.exoplatform.portal.component.customization.UIPageNodeWizardPreview #
@@ -758,6 +771,8 @@
UIPortalManagement.msg.Invalid-EditLayout-Permission=You have no right to edit this layout.
UIPortalManagement.msg.Invalid-EditPage-Permission=You have no right to edit this page.
UIPortalManagement.msg.Invalid-CreatePage-Permission=You have no right to create new page.
+UIPortalManagement.msg.navigation.deleted=Can't open wizard. Navigation has been deleted
+UIPortalManagement.msg.node.deleted=Can't open wizard. Current node has been deleted
UIPortalManagement.title.EDIT=Edit current Portal
UIPortalManagement.title.BROWSE=Manage Portals
@@ -1037,8 +1052,25 @@
###############################################################################
UINavigationNodeSelector.msg.systemnode-delete=Cannot delete a system node
UINavigationNodeSelector.msg.systemnode-move=Cannot cut a system node
-
+UINavigationNodeSelector.msg.copiedNode.deleted=Bufferred node has been deleted
+UINavigationNodeSelector.msg.staleData=Node has been deleted by other session
+UINavigationNodeSelector.msg.concurrentError=Concurrent modification error :
+UINavigationNodeSelector.msg.reset=Your editor will be reseted now
+UINavigationNodeSelector.msg.MOVE_CONCURRENTLY_REMOVED_SRC_NODE=#{UINavigationNodeSelector.msg.concurrentError} Can't move node from removed parent node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.MOVE_CONCURRENTLY_REMOVED_DST_NODE=#{UINavigationNodeSelector.msg.concurrentError} Can't move node to removed node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.MOVE_CONCURRENTLY_REMOVED_MOVED_NODE=#{UINavigationNodeSelector.msg.concurrentError} Can't move removed node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.MOVE_CONCURRENTLY_CHANGED_SRC_NODE=#{UINavigationNodeSelector.msg.concurrentError} Node has been moved before, can't move it now. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.MOVE_CONCURRENTLY_REMOVED_PREVIOUS_NODE=#{UINavigationNodeSelector.msg.concurrentError} Node's order has been changed, can't move node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.MOVE_CONCURRENTLY_DUPLICATE_NAME=#{UINavigationNodeSelector.msg.concurrentError} Duplicate name, can't move node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.ADD_CONCURRENTLY_REMOVED_PARENT_NODE=#{UINavigationNodeSelector.msg.concurrentError} Can't add node to deleted node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.ADD_CONCURRENTLY_ADDED_NODE=#{UINavigationNodeSelector.msg.concurrentError} Duplicate node, can't add node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.ADD_CONCURRENTLY_REMOVED_PREVIOUS_NODE=#{UINavigationNodeSelector.msg.concurrentError} Node's order has been changed, can't add node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.UPDATE_CONCURRENTLY_REMOVED_NODE=#{UINavigationNodeSelector.msg.concurrentError} Can't update deleted node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.RENAME_CONCURRENTLY_REMOVED_NODE=#{UINavigationNodeSelector.msg.concurrentError} Can't rename deleted node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.RENAME_CONCURRENTLY_DUPLICATE_NAME=#{UINavigationNodeSelector.msg.concurrentError} Duplicate name, can't rename node. #{UINavigationNodeSelector.msg.reset}
+UINavigationNodeSelector.msg.NAVIGATION_NO_SITE=This navigation has been deleted by other session. The editor must be closed now
+
###############################################################################
# org.exoplatform.portal.webui.component.customization.UIEditCurentPage #
###############################################################################
@@ -1264,6 +1296,7 @@
UIPortalNavigation.Label.Next=Next
UIPortalNavigation.Label.Previous=Previous
+UIPortalNavigation.msg.staleData=Node may be deleted
#############################################################################
# org.exoplatform.portal.component.customization.UIDropDownConfigs #
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -390,18 +390,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nombre
-UIPageSelector2.header.id=Id de P\u00e1gina
-UIPageSelector2.header.accessGroups=Grupos de Acceso
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Limpiar P\u00e1gina
-UIPageSelector2.label.createPage=Crear P\u00e1gina
-UIPageSelector2.label.searchandSelectPage=Buscar y Seleccionar P\u00e1gina
-UIPageSelector2.label.currentSelectedPage=Informaci\u00f3n de la P\u00e1gina Seleccionada
-UIPageSelector2.label.title=T\u00edtulo
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Grupos de Acceso
+UIPageSelector.header.name=Nombre
+UIPageSelector.header.id=Id de P\u00e1gina
+UIPageSelector.header.accessGroups=Grupos de Acceso
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Limpiar P\u00e1gina
+UIPageSelector.label.createPage=Crear P\u00e1gina
+UIPageSelector.label.searchandSelectPage=Buscar y Seleccionar P\u00e1gina
+UIPageSelector.label.currentSelectedPage=Informaci\u00f3n de la P\u00e1gina Seleccionada
+UIPageSelector.label.title=T\u00edtulo
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Grupos de Acceso
UIPageBrowser.msg.NoPermission=No tienes permisos para acceder a esta p\u00e1gina.
UIPageBrowser.msg.PageNotExist=La p\u00e1gina no existe.
UIPageBrowser.msg.UserNotPermission=No tienes permisos para acceder a la p\u00e1gina del nodo.
@@ -512,7 +512,7 @@
UIPageNodeForm.Icon.title.SetDefault=Obtener el por Defecto
UIPageNodeForm.tab.label.PageNodeSetting=Ajustes de Nodo de P\u00e1gina
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Selector P\u00e1gina
+UIPageNodeForm.tab.label.UIPageSelector=Selector P\u00e1gina
#############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -381,18 +381,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nom
-UIPageSelector2.header.id=Id Page
-UIPageSelector2.header.accessGroups=Groupe d'accès
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.searchandSelectPage=Recherche et Sélection d'une Page
-UIPageSelector2.label.currentSelectedPage=Information sur la page sélectionnée
-UIPageSelector2.label.title=Titre
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Groupes
-UIPageSelector2.label.createPage=Créer Page
-UIPageSelector2.label.clearPage=Clear Page
+UIPageSelector.header.name=Nom
+UIPageSelector.header.id=Id Page
+UIPageSelector.header.accessGroups=Groupe d'accès
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.searchandSelectPage=Recherche et Sélection d'une Page
+UIPageSelector.label.currentSelectedPage=Information sur la page sélectionnée
+UIPageSelector.label.title=Titre
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Groupes
+UIPageSelector.label.createPage=Créer Page
+UIPageSelector.label.clearPage=Clear Page
UIPageBrowser.msg.NoPermission=Vous n'avez pas les droits d'accès à cette page!
UIPageBrowser.msg.PageNotExist=La page n'existe pas
UIPageBrowser.msg.UserNotPermission=Vous n'avez pas les droits d'accès à ce noeud de page!
@@ -501,7 +501,7 @@
UIPageNodeForm.Icon.title.SetDefault=Valeur par défaut
UIPageNodeForm.tab.label.PageNodeSetting=Configuration du noeud
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Sélecteur de page
+UIPageNodeForm.tab.label.UIPageSelector=Sélecteur de page
#############################################################################
@@ -509,10 +509,16 @@
#############################################################################
UIPageBrowse.deletePage=Confirmez-vous la suppression de cette page ?
-UIPageSearch.label.option.ownerType=Type de propriétaire
-UIPageSearch.label.option.ownerId=Propriétaire
-UIPageSearch.label.option.name=Nom
-UIPageSearch.label.option.title=#{word.title}
+UIPageSearchForm.label.QuickSearch=Rechercher
+UIPageSearchForm.label.siteName=Nom du site
+UIPageSearchForm.label.pageTitle=Titre
+UIPageSearchForm.label.searchOption=Type
+UIPageSearchForm.label.option.ownerType=Type de propriétaire
+UIPageSearchForm.label.option.ownerId=Propriétaire
+UIPageSearchForm.label.option.name=Nom
+UIPageSearchForm.label.option.title=#{word.title}
+UIPageSearchForm.label.option.portal=portail
+UIPageSearchForm.label.option.group=groupe
#############################################################################
# org.exoplatform.portal.component.customization.UIPageNavigationForm #
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -408,18 +408,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nome
-UIPageSelector2.header.id=Id della Pagina
-UIPageSelector2.header.accessGroups=Accesso ai Gruppi
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Azzera la pagina
-UIPageSelector2.label.createPage=Crea la Pagina
-UIPageSelector2.label.searchandSelectPage=Ricerca e seleziona la Pagina
-UIPageSelector2.label.currentSelectedPage=Info sulla Pagina selezionata
-UIPageSelector2.label.title=Titolo
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Accesso ai Gruppi
+UIPageSelector.header.name=Nome
+UIPageSelector.header.id=Id della Pagina
+UIPageSelector.header.accessGroups=Accesso ai Gruppi
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Azzera la pagina
+UIPageSelector.label.createPage=Crea la Pagina
+UIPageSelector.label.searchandSelectPage=Ricerca e seleziona la Pagina
+UIPageSelector.label.currentSelectedPage=Info sulla Pagina selezionata
+UIPageSelector.label.title=Titolo
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Accesso ai Gruppi
UIPageBrowser.msg.NoPermission=Non hai i permessi per accedere alla pagina.
UIPageBrowser.msg.PageNotExist=La pagina non esiste.
UIPageBrowser.msg.UserNotPermission=Non hai i permessi per accedere al nodo della pagina.
@@ -542,7 +542,7 @@
UIPageNodeForm.Icon.title.SetDefault=Ottieno il Default
UIPageNodeForm.tab.label.PageNodeSetting=Preferenze del Nodo della Pagina
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Selettore della Pagina
+UIPageNodeForm.tab.label.UIPageSelector=Selettore della Pagina
UIPageNodeForm.action.Save=#{word.save}
UIPageNodeForm.action.Back=#{word.back}
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -393,18 +393,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=\u540d\u524d
-UIPageSelector2.header.id=\u30da\u30fc\u30b8ID
-UIPageSelector2.header.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=\u30da\u30fc\u30b8\u3092\u30af\u30ea\u30a2
-UIPageSelector2.label.createPage=\u30da\u30fc\u30b8\u3092\u4f5c\u6210
-UIPageSelector2.label.searchandSelectPage=\u30da\u30fc\u30b8\u3092\u691c\u7d22\u3057\u5909\u66f4
-UIPageSelector2.label.currentSelectedPage=\u9078\u629e\u3057\u305f\u30da\u30fc\u30b8\u60c5\u5831
-UIPageSelector2.label.title=\u30bf\u30a4\u30c8\u30eb
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
+UIPageSelector.header.name=\u540d\u524d
+UIPageSelector.header.id=\u30da\u30fc\u30b8ID
+UIPageSelector.header.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=\u30da\u30fc\u30b8\u3092\u30af\u30ea\u30a2
+UIPageSelector.label.createPage=\u30da\u30fc\u30b8\u3092\u4f5c\u6210
+UIPageSelector.label.searchandSelectPage=\u30da\u30fc\u30b8\u3092\u691c\u7d22\u3057\u5909\u66f4
+UIPageSelector.label.currentSelectedPage=\u9078\u629e\u3057\u305f\u30da\u30fc\u30b8\u60c5\u5831
+UIPageSelector.label.title=\u30bf\u30a4\u30c8\u30eb
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
UIPageBrowser.msg.NoPermission=\u3053\u306e\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u305b\u3093\u3002
UIPageBrowser.msg.PageNotExist=\u30da\u30fc\u30b8 \u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002
UIPageBrowser.msg.UserNotPermission=\u305d\u306e\u30ce\u30fc\u30c9\u306e\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u305b\u3093\u3002
@@ -515,7 +515,7 @@
UIPageNodeForm.Icon.title.SetDefault=\u30c7\u30d5\u30a9\u30eb\u30c8
UIPageNodeForm.tab.label.PageNodeSetting=\u30da\u30fc\u30b8\u30ce\u30fc\u30c9\u8a2d\u5b9a
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=\u30da\u30fc\u30b8\u9078\u629e
+UIPageNodeForm.tab.label.UIPageSelector=\u30da\u30fc\u30b8\u9078\u629e
#############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -614,7 +614,7 @@
<done>완료</done>
</action>
</UIGroupSelector>
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name>이름</name>
<id>페이지 아이디</id>
@@ -631,7 +631,7 @@
<name>#{word.name}</name>
<accessGroups>액세스 그룹</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission>이 페이지의 액세스 권한이 없습니다.</NoPermission>
@@ -814,7 +814,7 @@
<label>
<PageNodeSetting>페이지 노드 설정</PageNodeSetting>
<Icon>#{word.icon}</Icon>
- <UIPageSelector2>페이지 선택기</UIPageSelector2>
+ <UIPageSelector>페이지 선택기</UIPageSelector>
</label>
</tab>
</UIPageNodeForm>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -392,18 +392,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=\u0928\u093e\u092e
-UIPageSelector2.header.id=\u092a\u0947\u091c Id
-UIPageSelector2.header.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940 \u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=\u092a\u0947\u091c \u0916\u093e\u0932\u0940 \u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageSelector2.label.createPage=\u092a\u0947\u091c \u092c\u0928\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageSelector2.label.searchandSelectPage=\u0916\u094b\u091c\u0947\u0930 \u092a\u0947\u091c \u091b\u0928\u094c\u091f \u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageSelector2.label.currentSelectedPage=\u091b\u0928\u094c\u091f \u0917\u0930\u093f\u090f\u0915\u094b \u092a\u0947\u091c\u0915\u094b \u092a\u0930\u093f\u091a\u092f
-UIPageSelector2.label.title=\u0936\u093f\u0930\u094d\u0937\u0915
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940 \u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
+UIPageSelector.header.name=\u0928\u093e\u092e
+UIPageSelector.header.id=\u092a\u0947\u091c Id
+UIPageSelector.header.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940 \u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=\u092a\u0947\u091c \u0916\u093e\u0932\u0940 \u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
+UIPageSelector.label.createPage=\u092a\u0947\u091c \u092c\u0928\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
+UIPageSelector.label.searchandSelectPage=\u0916\u094b\u091c\u0947\u0930 \u092a\u0947\u091c \u091b\u0928\u094c\u091f \u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
+UIPageSelector.label.currentSelectedPage=\u091b\u0928\u094c\u091f \u0917\u0930\u093f\u090f\u0915\u094b \u092a\u0947\u091c\u0915\u094b \u092a\u0930\u093f\u091a\u092f
+UIPageSelector.label.title=\u0936\u093f\u0930\u094d\u0937\u0915
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940 \u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
UIPageBrowser.msg.NoPermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b \u092a\u0947\u091c \u0939\u0947\u0930\u094d\u0928\u0947 \u0905\u0928\u0941\u092e\u0924\u0940 \u091b\u0948\u0928\u0964
UIPageBrowser.msg.PageNotExist=\u092a\u0947\u091c \u0909\u092a\u0932\u092c\u094d\u0927 \u091b\u0948\u0928\u0964
UIPageBrowser.msg.UserNotPermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b \u0928\u094b\u0921\u0915\u094b \u092a\u0947\u091c \u0939\u0947\u0930\u094d\u0928\u0947 \u0905\u0928\u0941\u092e\u0924\u0940 \u091b\u0948\u0928\u0964
@@ -514,7 +514,7 @@
UIPageNodeForm.Icon.title.SetDefault=\u0921\u093f\u092b\u094c\u0932\u094d\u091f \u092a\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
UIPageNodeForm.tab.label.PageNodeSetting=\u092a\u0947\u091c \u0928\u094b\u0921 \u0935\u094d\u092f\u0935\u0938\u094d\u0925\u093e\u092a\u0928
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=\u092a\u0947\u091c\u0915\u094b \u091b\u0928\u094c\u091f\u094d\u0915\u0930\u094d\u0924\u093e
+UIPageNodeForm.tab.label.UIPageSelector=\u092a\u0947\u091c\u0915\u094b \u091b\u0928\u094c\u091f\u094d\u0915\u0930\u094d\u0924\u093e
#############################################################################
# org.exoplatform.portal.component.customization.UIPageBrowser #
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -392,18 +392,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=#{word.name}:
-UIPageSelector2.header.id=Page Id
-UIPageSelector2.header.accessGroups=Toegang groepen
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Wis pagina
-UIPageSelector2.label.createPage=Cre\u00EBer pagina
-UIPageSelector2.label.searchandSelectPage=Zoek en selecteer pagina
-UIPageSelector2.label.currentSelectedPage=Geselecteerde pagina informatie
-UIPageSelector2.label.title=#{word.title}
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Toegang groepen
+UIPageSelector.header.name=#{word.name}:
+UIPageSelector.header.id=Page Id
+UIPageSelector.header.accessGroups=Toegang groepen
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Wis pagina
+UIPageSelector.label.createPage=Cre\u00EBer pagina
+UIPageSelector.label.searchandSelectPage=Zoek en selecteer pagina
+UIPageSelector.label.currentSelectedPage=Geselecteerde pagina informatie
+UIPageSelector.label.title=#{word.title}
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Toegang groepen
UIPageBrowser.msg.NoPermission=U heeft geen permissies om deze pagina te bezoeken.
UIPageBrowser.msg.PageNotExist=Pagina bestaat niet.
UIPageBrowser.msg.UserNotPermission=U heeft geen permissie op deze node van de pagina.
@@ -514,7 +514,7 @@
UIPageNodeForm.Icon.title.SetDefault=Standaard
UIPageNodeForm.tab.label.PageNodeSetting=Pagina node instellingen
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Pagina selecteur
+UIPageNodeForm.tab.label.UIPageSelector=Pagina selecteur
#############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -388,18 +388,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nome
-UIPageSelector2.header.id=Id de Página
-UIPageSelector2.header.accessGroups=Grupos de Acesso
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Limpar Página
-UIPageSelector2.label.createPage=Criar Página
-UIPageSelector2.label.searchandSelectPage=Selecionar Página
-UIPageSelector2.label.currentSelectedPage=Informações da Página
-UIPageSelector2.label.title=Título
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Grupos de Acesso
+UIPageSelector.header.name=Nome
+UIPageSelector.header.id=Id de Página
+UIPageSelector.header.accessGroups=Grupos de Acesso
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Limpar Página
+UIPageSelector.label.createPage=Criar Página
+UIPageSelector.label.searchandSelectPage=Selecionar Página
+UIPageSelector.label.currentSelectedPage=Informações da Página
+UIPageSelector.label.title=Título
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Grupos de Acesso
UIPageBrowser.msg.NoPermission=Usuário sem permissão para acessar essa página.
UIPageBrowser.msg.PageNotExist=Página não existente.
UIPageBrowser.msg.UserNotPermission=Usuário sem permissão para acessar o nodo dessa página.
@@ -510,7 +510,7 @@
UIPageNodeForm.Icon.title.SetDefault=Usar padrão
UIPageNodeForm.tab.label.PageNodeSetting=Configurações de Nodo
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Seletor de Página
+UIPageNodeForm.tab.label.UIPageSelector=Seletor de Página
#############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -376,18 +376,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Название
-UIPageSelector2.header.id=Идентификатор страницы
-UIPageSelector2.header.accessGroups=Группы доступа
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Очистить страницу
-UIPageSelector2.label.createPage=Создать страницу
-UIPageSelector2.label.searchandSelectPage=Поиск и выбор страницы
-UIPageSelector2.label.currentSelectedPage=Информация о выбранной странице
-UIPageSelector2.label.title=Заголовок
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Группы доступа
+UIPageSelector.header.name=Название
+UIPageSelector.header.id=Идентификатор страницы
+UIPageSelector.header.accessGroups=Группы доступа
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Очистить страницу
+UIPageSelector.label.createPage=Создать страницу
+UIPageSelector.label.searchandSelectPage=Поиск и выбор страницы
+UIPageSelector.label.currentSelectedPage=Информация о выбранной странице
+UIPageSelector.label.title=Заголовок
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Группы доступа
UIPageBrowser.msg.NoPermission=У Вас нету прав доступа к этой странице.
UIPageBrowser.msg.PageNotExist=Страница не существует.
UIPageBrowser.msg.UserNotPermission=У Вас нету прав для доступа к страницам узла.
@@ -498,7 +498,7 @@
UIPageNodeForm.Icon.title.SetDefault=По умолчанию
UIPageNodeForm.tab.label.PageNodeSetting=Настройки узла страницы
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Страницы
+UIPageNodeForm.tab.label.UIPageSelector=Страницы
#############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -367,18 +367,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Назва
-UIPageSelector2.header.id=Id сторінки
-UIPageSelector2.header.accessGroups=Привілейовані групи
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Почистити сторінку
-UIPageSelector2.label.createPage=Створити сторінку
-UIPageSelector2.label.searchandSelectPage=Пошук і вибір сторінки
-UIPageSelector2.label.currentSelectedPage=Інформація вибраної сторінки
-UIPageSelector2.label.title=Назва
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Привілейовані групи
+UIPageSelector.header.name=Назва
+UIPageSelector.header.id=Id сторінки
+UIPageSelector.header.accessGroups=Привілейовані групи
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Почистити сторінку
+UIPageSelector.label.createPage=Створити сторінку
+UIPageSelector.label.searchandSelectPage=Пошук і вибір сторінки
+UIPageSelector.label.currentSelectedPage=Інформація вибраної сторінки
+UIPageSelector.label.title=Назва
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Привілейовані групи
UIPageBrowser.msg.NoPermission=У Вас недостатньо прав для доступу на цю сторінку.
UIPageBrowser.msg.PageNotExist=Сторінка не існує.
UIPageBrowser.msg.UserNotPermission=У Вас недостатньо прав для доступу на вузлову сторінку.
@@ -489,7 +489,7 @@
UIPageNodeForm.Icon.title.SetDefault=Взяти за замовчуванням
UIPageNodeForm.tab.label.PageNodeSetting=Встановлення вузлової сторінки
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Селектор сторінок
+UIPageNodeForm.tab.label.UIPageSelector=Селектор сторінок
#############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-07-18 22:48:36 UTC (rev 6885)
@@ -377,18 +377,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Tên trang
-UIPageSelector2.header.id=Mã trang
-UIPageSelector2.header.accessGroups=Các nhóm truy nhập
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Xóa trang
-UIPageSelector2.label.createPage=Tạo trang
-UIPageSelector2.label.searchandSelectPage=Tìm kiếm và chọn trang
-UIPageSelector2.label.currentSelectedPage=Thông tin về trang bạn vừa chọn
-UIPageSelector2.label.title=Tiêu đề trang
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Các nhóm truy nhập
+UIPageSelector.header.name=Tên trang
+UIPageSelector.header.id=Mã trang
+UIPageSelector.header.accessGroups=Các nhóm truy nhập
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Xóa trang
+UIPageSelector.label.createPage=Tạo trang
+UIPageSelector.label.searchandSelectPage=Tìm kiếm và chọn trang
+UIPageSelector.label.currentSelectedPage=Thông tin về trang bạn vừa chọn
+UIPageSelector.label.title=Tiêu đề trang
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Các nhóm truy nhập
UIPageBrowser.msg.NoPermission=Trang này không tồn tại hoặc bạn không được phân quyền để truy cập!
UIPageBrowser.msg.PageNotExist=Trang này không tồn tại!
UIPageBrowser.msg.UserNotPermission=Bạn không được phép truy cập vào trang này!
@@ -504,7 +504,7 @@
UIPageNodeForm.Icon.title.SetDefault=Lấy mặc định
UIPageNodeForm.tab.label.PageNodeSetting=Cấu hình node
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Tùy chọn trang
+UIPageNodeForm.tab.label.UIPageSelector=Tùy chọn trang
UIPageNodeForm.action.Save=#{word.save}
UIPageNodeForm.action.Back=#{word.back}
@@ -514,10 +514,16 @@
#############################################################################
UIPageBrowse.deletePage=Bạn có muốn xóa trang này không?
-UIPageSearch.label.option.ownerType=Kiểu người sở hữu
-UIPageSearch.label.option.ownerId=Mã người sở hữu
-UIPageSearch.label.option.name=Tên
-UIPageSearch.label.option.title=#{word.title}
+UIPageSearchForm.label.QuickSearch=Tìm kiếm
+UIPageSearchForm.label.siteName=Tên Site
+UIPageSearchForm.label.pageTitle=Tiêu đề trang
+UIPageSearchForm.label.searchOption=Loại
+UIPageSearchForm.label.option.ownerType=Kiểu người sở hữu
+UIPageSearchForm.label.option.ownerId=Mã người sở hữu
+UIPageSearchForm.label.option.name=Tên
+UIPageSearchForm.label.option.title=#{word.title}
+UIPageSearchForm.label.option.portal=portal
+UIPageSearchForm.label.option.group=group
#############################################################################
# org.exoplatform.portal.component.customization.UIPageNavigationForm #
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -575,7 +575,7 @@
<done>完成</done>
</action>
</UIGroupSelector>
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name>名称</name>
<id>页面Id</id>
@@ -592,7 +592,7 @@
<name>#{word.name}</name>
<accessGroups>访问组</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission>您无权访问这个页面。</NoPermission>
@@ -770,7 +770,7 @@
<label>
<PageNodeSetting>页面节点设置</PageNodeSetting>
<Icon>#{word.icon}</Icon>
- <UIPageSelector2>页面选择器</UIPageSelector2>
+ <UIPageSelector>页面选择器</UIPageSelector>
</label>
</tab>
</UIPageNodeForm>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -719,7 +719,7 @@
<done>完成</done>
</action>
</UIGroupSelector>
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name>名稱</name>
<id>頁面Id</id>
@@ -736,7 +736,7 @@
<name>#{word.name}</name>
<accessGroups>使用群組</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission>您無權使用這個頁面。</NoPermission>
@@ -915,7 +915,7 @@
<label>
<PageNodeSetting>頁面節點設定</PageNodeSetting>
<Icon>#{word.icon}</Icon>
- <UIPageSelector2>頁面選擇器</UIPageSelector2>
+ <UIPageSelector>頁面選擇器</UIPageSelector>
</label>
</tab>
</UIPageNodeForm>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/navigation.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -27,34 +27,29 @@
<priority>1</priority>
<page-nodes>
<node>
- <uri>home</uri>
<name>home</name>
<label>#{portal.classic.home}</label>
<page-reference>portal::classic::homepage</page-reference>
</node>
<node>
- <uri>sitemap</uri>
<name>sitemap</name>
<label>#{portal.classic.sitemap}</label>
<visibility>DISPLAYED</visibility>
<page-reference>portal::classic::sitemap</page-reference>
</node>
<node>
- <uri>groupnavigation</uri>
<name>groupnavigation</name>
<label>#{portal.classic.groupnavigation}</label>
<visibility>SYSTEM</visibility>
<page-reference>portal::classic::groupnavigation</page-reference>
</node>
<node>
- <uri>portalnavigation</uri>
<name>portalnavigation</name>
<label>#{portal.classic.portalnavigation}</label>
<visibility>SYSTEM</visibility>
<page-reference>portal::classic::portalnavigation</page-reference>
</node>
<node>
- <uri>register</uri>
<name>register</name>
<label>#{portal.classic.register}</label>
<visibility>SYSTEM</visibility>
@@ -63,7 +58,6 @@
<!-- NOT FOUND node -->
<node>
- <uri>notfound</uri>
<name>notfound</name>
<label>NotFound</label>
<visibility>SYSTEM</visibility>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-18 22:48:36 UTC (rev 6885)
@@ -94,6 +94,11 @@
</component>
<component>
+ <key>org.exoplatform.portal.mop.navigation.NavigationService</key>
+ <type>org.exoplatform.portal.mop.navigation.NavigationServiceWrapper</type>
+ </component>
+
+ <component>
<key>org.exoplatform.portal.config.UserPortalConfigService</key>
<type>org.exoplatform.portal.config.UserPortalConfigService</type>
<component-plugins>
@@ -331,6 +336,55 @@
</object-param>
</init-params>
</component-plugin>
+ <component-plugin>
+ <name>addExoCacheConfig</name>
+ <set-method>addExoCacheConfig</set-method>
+ <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+ <description>add Exo Cache Config</description>
+ <init-params>
+ <object-param>
+ <name>cache.config.NavigationService</name>
+ <description>The JBoss Cache configuration for the navigation service</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name">
+ <string>NavigationService</string>
+ </field>
+ <field name="maxSize">
+ <int>5000</int>
+ </field>
+ <field name="liveTime">
+ <long>600</long>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin profiles="cluster">
+ <name>addExoCacheConfig</name>
+ <set-method>addExoCacheConfig</set-method>
+ <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+ <description>add Exo Cache Config</description>
+ <init-params>
+ <object-param>
+ <name>cache.config.NavigationService</name>
+ <description>The JBoss Cache configuration for the navigation service</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
+ <field name="name">
+ <string>NavigationService</string>
+ </field>
+ <field name="expirationTimeout">
+ <long>600000</long>
+ </field>
+ <field name="maxNodes">
+ <int>5000</int>
+ </field>
+ <field name="distributed">
+ <boolean>true</boolean>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
</external-component-plugins>
</configuration>
Deleted: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationManagement.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationManagement.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationManagement.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,56 +0,0 @@
-<%
- import org.exoplatform.portal.webui.page.UIPageBrowser;
- import org.exoplatform.portal.webui.navigation.UINavigationNodeSelector;
-%>
-<div class="UINavigationManagement" id="$uicomponent.id">
- <div class="TopTitleBar">
- <div class="DecoratorBox">
- <div class="BarDecorator">
- <div class="TopLeftBar">
- <div class="TopCenterBar"><span></span></div>
- </div>
- <div class="MiddleLeftBar">
- <div class="MiddleCenterBar" style="background-image: none;">
- <%= uicomponent.getOwner();%>
- </div>
- </div>
- <div class="BottomLeftBar">
- <div class="BottomCenterBar"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- <%
- uicomponent.renderChild(UINavigationNodeSelector.class);
- %>
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
-
- <td>
- <div onclick="<%=uicomponent.event("AddRootNode")%>" class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".action.addNode")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- <td>
- <div onclick="<%=uicomponent.event("Save")%>" class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".action.Save")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
-
- </tr>
- </table>
- </div>
-</div>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationNodeSelector.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationNodeSelector.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UINavigationNodeSelector.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -14,10 +14,11 @@
JavascriptManager jsmanager = _ctx.getRequestContext().getJavascriptManager();
jsmanager.importJavascript('eXo.webui.UIRightClickPopupMenu') ;
+ def objId = uicomponent.getChild(UITree.class).getParentSelected().getId();
if(uicomponent.getCopyNode()!= null) {
- popupMenu = uiPopupMenu.getJSOnclickShowPopup("", "AddNode,PasteNode,EditNavigation,SaveNavigation,DeleteNavigation");
+ popupMenu = uiPopupMenu.getJSOnclickShowPopup(objId, "AddNode,PasteNode,EditNavigation,SaveNavigation,DeleteNavigation");
} else {
- popupMenu = uiPopupMenu.getJSOnclickShowPopup("", "AddNode,EditNavigation,SaveNavigation,DeleteNavigation");
+ popupMenu = uiPopupMenu.getJSOnclickShowPopup(objId, "AddNode,EditNavigation,SaveNavigation,DeleteNavigation");
}
jsmanager.addJavascript("eXo.webui.UIRightClickPopupMenu.disableContextMenu('"+id+"') ;");
uicomponent.renderUIComponent(uiPopupMenu) ;
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -4,8 +4,6 @@
import org.exoplatform.webui.core.UIRightClickPopupMenu;
import org.exoplatform.web.application.JavascriptManager;
- def selectedNav = uicomponent.getSelectedNavigation();
-
UIRightClickPopupMenu uiPopupMenu = uicomponent.getChild(UIRightClickPopupMenu.class);
String popupMenu = "";
%>
@@ -16,11 +14,7 @@
JavascriptManager jsmanager = _ctx.getRequestContext().getJavascriptManager();
jsmanager.importJavascript('eXo.webui.UIRightClickPopupMenu');
- if(uicomponent.getCopyNode()!= null) {
- popupMenu = uiPopupMenu.getJSOnclickShowPopup("", "AddNode,PasteNode,EditNavigation,SaveNavigation,DeleteNavigation");
- } else {
- popupMenu = uiPopupMenu.getJSOnclickShowPopup("", "AddNode,EditNavigation,SaveNavigation,DeleteNavigation");
- }
+ popupMenu = uiPopupMenu.getJSOnclickShowPopup("", "AddNode,EditNavigation,SaveNavigation,DeleteNavigation");
jsmanager.addJavascript("eXo.webui.UIRightClickPopupMenu.disableContextMenu('"+id+"');");
uicomponent.renderUIComponent(uiPopupMenu);
Copied: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSearchForm.gtmpl (from rev 6783, portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSearchForm.gtmpl)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSearchForm.gtmpl (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSearchForm.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,35 @@
+<div class="UIPageSearchForm">
+ <div class="UIBarStyle">
+ <div class="BarStyle2">
+ <div class="LeftBar">
+ <div class="RightBar">
+ <div class="MiddleBar">
+ <div class="UISearchContainer">
+ <%uiform.begin()%>
+ <%String quickSearchlink = uicomponent.event("QuickSearch") ;%>
+ <script type="text/javascript">
+ var executeScript = "<%=quickSearchlink%>";
+ </script>
+ <div class="QuickSet" onkeypress="eXo.portal.UIPortalControl.onEnterPress(event, executeScript)">
+
+ <%
+ QuickSearchInputSet = uiform.getQuickSearchInputSet();
+ for(field in QuickSearchInputSet.getChildren()) {
+ %>
+ <div class="SearchLabel"><%=uiform.getLabel(field.getId())%> </div>
+ <%
+ uiform.renderField(field)
+ }
+ %>
+ <a class="SearchIcon" href="$quickSearchlink" title="<%= _ctx.appRes("UIPageSearchForm.label.QuickSearch") %>">
+ <span></span>
+ </a>
+ </div>
+ <%uiform.end()%>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -2,6 +2,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.form.UIForm;
+ import org.exoplatform.webui.form.UIFormInputSet;
Page page = uicomponent.getPage();
@@ -23,8 +24,10 @@
def rcontext = _ctx.getRequestContext();
rcontext.getJavascriptManager().importJavascript('eXo.webui.UIPopupWindow');
+
+ UIFormInputSet uiform = uicomponent.getChild(UIFormInputSet.class);
%>
-<div class="UIPageSelector" id="<%=uicomponent.getId();%>" >
+<div class="UIPageSelector" id="<%=uicomponent.getId();%>">
<div class="PageSelectorTitle">
<div class="Icon BlueInfoBox16x16Icon"><span></span></div>
<div class="Title"><%=_ctx.appRes(uicomponent.getId()+".label.currentSelectedPage")%></div>
@@ -32,21 +35,37 @@
</div>
<div class="UIFormInfo">
<div class="FormInfoBG">
- <div class="FormInfoIcon">
- <div class="UIPropertyInfo">
- <div class="OverflowContainer">
- <div class="PropertyName"><%=_ctx.appRes(uicomponent.getId()+".header.id")%>:</div>
- <div class="PropertyValue">$pageId</div>
- </div>
- <div class="OverflowContainer">
- <div class="PropertyName"><%=_ctx.appRes(uicomponent.getId()+".label.name")%>:</div>
- <div class="PropertyValue">$name</div>
- </div>
- <div class="OverflowContainer">
- <div class="PropertyName"><%=_ctx.appRes(uicomponent.getId()+".label.title")%>:</div>
- <div class="PropertyValue">$title</div>
- </div>
- </div>
+ <div class="FormInfoIcon UIForm">
+ <table class="UIPropertyInfo UIFormGrid">
+ <tr>
+ <td class="FieldLabel"><%=_ctx.appRes(uicomponent.getId()+".header.id")%>:</td>
+ <td class="FieldComponent">
+ <% if(page != null) { %>
+ $pageId
+ <% } %>
+ </td>
+ </tr>
+ <tr>
+ <td class="FieldLabel"><%=_ctx.appRes(uicomponent.getId()+".label.name")%>:</td>
+ <td class="FieldComponent">
+ <% if(page == null) { %>
+ <% uiform.renderChild("pageName");%>
+ <% } else { %>
+ $name
+ <% } %>
+ </td>
+ </tr>
+ <tr>
+ <td class="FieldLabel"><%=_ctx.appRes(uicomponent.getId()+".label.title")%>:</td>
+ <td class="FieldComponent">
+ <% if(page == null) { %>
+ <% uiform.renderChild("pageTitle");%>
+ <% } else { %>
+ $title
+ <% } %>
+ </td>
+ </tr>
+ </table>
</div>
</div>
</div>
@@ -55,9 +74,10 @@
<tr>
<td>
<%
- String clearPageEvent = "#";
+ String clearPageEvent = "javascript:void(0);";
String css = "FloatBlockHidden ActionButton SimpleStyle";
- def uiForm = uicomponent.getAncestorOfType(UIForm.class);
+ def uiForm = uicomponent.getAncestorOfType(UIForm.class);
+ createPageEvent = uiForm.event("CreatePage");
if(page != null) {
clearPageEvent = uiForm.event("ClearPage");
css = "ActionButton SimpleStyle";
@@ -73,8 +93,22 @@
</div>
</div>
</div>
+ </div>
+ <% if(page == null) { %>
+ <div onclick="<%=createPageEvent%>" class="ActionButton SimpleStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <div class="GreenPlusPage16x16Icon Icon" title="<%=_ctx.appRes(uicomponent.getId()+".label.createPage")%>">
+ <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".label.createPage")%></a>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
- <div class="ActionButton SimpleStyle" onclick="javascript: eXo.webui.UIPopupWindow.show('<%=uicomponent.getChild(UIPopupWindow.class).getId();%>');">
+ <% } %>
+
+ <div class="ActionButton SimpleStyle" onclick="<%=uicomponent.event("OpenSelectPagePopUp")%>">
<div class="ButtonLeft">
<div class="ButtonRight">
<div class="ButtonMiddle">
@@ -85,6 +119,7 @@
</div>
</div>
</div>
+
</td>
</tr>
</table>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,22 +1,21 @@
<%
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
- import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.webui.core.UIComponent;
-%>
-<%
- PageNode pageNode = uicomponent.getSelectedPageNode();
- String nodeName = "";
- if(pageNode!=null ) nodeName = "/"+pageNode.getResolvedLabel();
+
+ String nodeName = "/";
boolean isNoSelecter = !uicomponent.getChild(UIPageNodeSelector.class).isRendered();
%>
<div class="UIWizardPageSetInfo">
<%uiform.begin()%>
<div class="<%=isNoSelecter ? "NoPageSelecter" : ""%>">
- <%if(!isNoSelecter) {%>
+ <%if(!isNoSelecter) {
+ def pageNode = uicomponent.getSelectedPageNode();
+ if( pageNode!=null && pageNode.getResolvedLabel() != null ) nodeName += pageNode.getResolvedLabel();
+ %>
<div class="PageNodeContainer">
<% uicomponent.renderChild(UIPageNodeSelector.class); %>
</div>
- <%}%>
+ <%}%>
<div class="SelectedPageInfo">
<div class="PageInfoContainer">
<div class="PageNodeInfo">
Deleted: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/NewUIGroupManagement.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/NewUIGroupManagement.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/NewUIGroupManagement.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,45 +0,0 @@
-<div class="NewUIGroupManagement" id="<%=uicomponent.getId();%>">
- <%
- import org.exoplatform.portal.config.model.PageNavigation;
- navigations = uicomponent.getNavigations();
- %>
-
- <%/*Begin ItemDetailList:*/%>
- <div style="margin:0px 0px 0px 0px">
- <div class="ItemDetailContainer" style="border:1px solid #C7C7C7">
- <% for(navigation in navigations) {
-deleteLink = uicomponent.event("DeleteNavigation",String.valueOf(navigation.getId()));
-editLink = uicomponent.event("EditNavigation",String.valueOf(navigation.getId()));%>
- <div class="ItemDetail" style="width:100%;border-bottom:1px solid #E9E7E7;height:20px;padding-top:5px">
- <div style="float:left;width:70%;padding-left:10px">
- <%= navigation.getOwnerId() %>
- </div>
- <div style="float:right;width:29%">
- <a href="<%=editLink%>">Edit Navigation</a> | <a href="<%=deleteLink%>">Delete Navigation</a>
- </div>
- <div style="clear:both"></div>
- </div>
- <% } %>
-
- </div>
- </div>
- <%/*End ItemDetailList*/%>
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div onclick="<%=uicomponent.event("AddNewPortal")%>" class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".action.addNewPortal")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
-
-</div>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,236 +1,7 @@
-<div class="UISitemap">
- <div class="ClearFix">
- <div class="CollapseAll FloatLeft">Collapse All</div>
- <div class="ExpandAll FloatLeft">Expand All</div>
- </div>
- <div class="SitemapContent">
- <div class="UISiteTree">
-
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon" href="#">Home</a>
- </div>
- </div>
-
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon" href="#">Web Explorer</a>
- </div>
- </div>
-
- <div class="Node ClearFix">
- <div class="CollapseIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon" href="#">My Link</a>
- </div>
-
- <div class="ChildrenContainer FloatLeft">
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon" href="#">Blog</a>
- </div>
- </div>
- <div class="LastNode Node ClearFix">
- <div class="CollapseIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon" href="#">Facebook</a>
- </div>
-
- <div class="ChildrenContainer FloatLeft">
- <div class="Node ClearFix">
- <div class="NullItem">
- <div class="">
- <a class="NodeIcon DefaultPageIcon" href="#">Samples link</a>
- </div>
- </div>
- </div>
- <div class="LastNode Node ClearFix">
- <div class="NullItem"><a class="NodeIcon DefaultPageIcon" href="#">Samples link</a></div>
- </div>
- </div>
-
- </div>
- </div><!--end ChildrenContainer-->
-
- </div><!--end Node-->
-
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft"><a class="NodeIcon DefaultPageIcon" href="#">Register</a></div>
- </div>
-
- <div class="LastNode Node ClearFix">
- <div class="ExpandIcon"><a class="NodeIcon DefaultPageIcon" href="#">Link</a></div>
- </div>
-
- </div>
- </div>
-</div>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<!--
-<%
- import org.exoplatform.webui.core.UIPortletApplication;
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.portal.application.PortalRequestContext;
- import org.exoplatform.portal.webui.util.Util;
-%>
-<%
- def navigations = uicomponent.getNavigations();
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- def String portalURI = pcontext.getPortalURI();
-
- UIPortletApplication siteMapPortlet = uicomponent.getParent();
- def useAJAX = siteMapPortlet.isUseAjax();
-
- public void renderNextLevelNode(nav, children, int intLevel, String portalUri, boolean useAjax) {
- if(intLevel > 4) return;
-
- for(PageNode node in children) {
- String actionLink;
- if(useAjax){
- actionLink = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri());
- }else{
- actionLink = portalUri + node.getUri();
- }
- String iconType = node.getIcon();
- if(iconType == null) {
- iconType = "DefaultPageIcon";
- }
-
- if(intLevel == 4) {
- println """
- <div class="Item">
- <div class="Level$intLevel">
- <div class="OverflowContainer">
- <a class="IconItem ${iconType}" href="javascript: void(0);">...</a>
- </div>
- </div>
- </div>
- """;
- break;
- }
-
- String label = node.resolvedLabel;
- String title = label;
- if(label.length() > 38) {
- label = label.substring(0,35) + "...";
- }
-
- println """
- <div class="Item">
- <div class="Level$intLevel">
- <div class="OverflowContainer">
- """;
- if(node.pageReference != null) {
- print """<a class="IconItem ${iconType}" href="$actionLink" title="$title">$label</a>""";
- } else {
- print """<a class="IconItem ${iconType}" title="$title">$label</a>""";
- }
- println """
- </div>
- </div>
- </div>
- """;
- if (node.getChildren() != null) {
- renderNextLevelNode(nav, node.getChildren(), intLevel + 1, portalUri, useAjax);
- }
- }
- }
-%>
-<div class="UISitemap">
- <div class="SitemapContainer">
- <div class="SitemapBackground">
- <%
- boolean even = true;
- String cssfloat = "left";
- for(nav in navigations) {
- for(node in nav.getNodes()) {
- String iconType = node.getIcon();
- if(iconType == null) {
- iconType = "DefaultPageIcon";
- }
- if(even)cssfloat = "left";
- else cssfloat = "right";
- String blockFloat = "LeftBlock";
- if(useAJAX){
- actionLink = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri());
- }else{
- actionLink = portalURI + node.getUri();
- }
-
- String label = node.resolvedLabel;
- String title = "";
- if(label.length() > 35) {
- title = label;
- label = label.substring(0,32) + "...";
- }
- %>
- <div class="SitemapItemBox" style="float:${cssfloat};">
- <div class="SitemapItemContainer">
- <div class="TitleBar">
- <%if(node.pageReference != null) {%>
- <a href="<%=actionLink%>" class="Icon ${iconType}" title="$title">$label</a>
- <%} else {%>
- <a class="Icon ${iconType}" title="$title">$label</a>
- <%}%>
- </div>
- <%if(node.getChildren() == null || node.getChildren().size() < 1) { %>
- <div class="NestedSitemapItemBox">
- <div class="SitemapItemBoxSelector BorderBox">
- <div class="Item">
- <div class="SubItem">
- <div class="Icon BlueInfoBox16x16Icon">
- <%=_ctx.appRes("UISitemap.label.message")%>
- </div>
- </div>
- </div>
- </div>
- </div>
- <%} else { %>
- <div class="NestedSitemapItemBox">
- <div class="SitemapItemBoxSelector">
- <div class="ItemContainer">
- <% renderNextLevelNode(nav, node.getChildren(), 1, portalURI, useAJAX); %>
- </div>
- </div>
- </div>
- <%}%>
- </div>
- </div>
- <%
- if(!even) {
- %>
- <div class="ClearBoth"><span></span></div>
- <%
- }
- even = !even;
- }
- }
- if(!even){
- %>
- <div class="ClearBoth"><span></span></div>
- <% } %>
- </div>
- </div>
-</div>
--->
\ No newline at end of file
+<%
+ import org.exoplatform.portal.webui.navigation.UIPortalNavigation;
+
+ def uiPortalNavigation = uicomponent.getChild(UIPortalNavigation.class);
+ uiPortalNavigation.loadTreeNodes();
+ uicomponent.renderChildren();
+%>
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap2.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap2.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap2.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,7 +0,0 @@
-<%
- import org.exoplatform.portal.webui.navigation.UIPortalNavigation;
-
- def uiPortalNavigation = uicomponent.getChild(UIPortalNavigation.class);
- uiPortalNavigation.loadTreeNodes();
- uicomponent.renderChildren();
-%>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,80 +1,89 @@
<%
+ import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.webui.core.UIPortletApplication;
- import org.exoplatform.portal.config.model.PageNode;
+ import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.navigation.TreeNode;
-%>
+ import org.exoplatform.portal.mop.SiteKey;
+ import javax.portlet.MimeResponse;
+ import javax.portlet.ResourceURL;
+%>
<%
- def navigations = uicomponent.getNavigations();
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
+ JavascriptManager jsmanager = pcontext.getJavascriptManager();
+ jsmanager.importJavascript('eXo.webui.UISiteMap') ;
+
+ def portalURI = pcontext.getPortalURI();
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- def String portalURI = pcontext.getPortalURI();
-
UIPortletApplication siteMapPortlet = uicomponent.getParent();
-
def useAJAX = siteMapPortlet.isUseAjax();
-
+
def actionExpandAll = uicomponent.event("ExpandAllNode");
def actionCollapseAll = uicomponent.event("CollapseAllNode");
-
+
public void renderNodes(TreeNode rootTree, String portalUri, boolean useAjax) {
- List childrenNodes=rootTree.getChildren();
- int childrenSize = childrenNodes.size() ;
- int size = 0;
- for(treeNode in childrenNodes) {
-
+ def childrenNodes=rootTree.getChildren();
+ int childrenSize = childrenNodes.size() ;
+ int size = 0;
+ for(treeNode in childrenNodes) {
+
// count size;
size++;
-
- node = treeNode.getNode();
- nav = treeNode.getNavigation();
- String label = node.encodedResolvedLabel;
- actionExpand = uicomponent.event("ExpandNode", nav.getId() + "::" + node.getUri());
- def actionCollapse = "ajaxAsyncGetRequest('" + uicomponent.url("CollapseNode",nav.getId() + "::" + node.getUri()) + "', true)";
-
+
+ def node = treeNode.getNode();
+ def treePath = node.getId();
+ String label = node.getEncodedResolvedLabel();
if(useAjax){
- actionLink = uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri());
- }else{
- actionLink = portalUri + node.getUri();
- }
-
+ actionLink = uicomponent.event("SelectNode", treePath);
+ }else{
+ actionLink = portalUri + node.getURI();
+ }
+
lastNode = '';
-
if (size == childrenSize) {
lastNode = 'LastNode';
}
// if node have child
-
- if(treeNode.isHasChild()) {
+
+ if(treeNode.hasChild()) {
if (treeNode.isExpanded()) {
+ def actionCollapse = "ajaxAsyncGetRequest('" + uicomponent.url("CollapseNode", treePath) + "', true)";
println """
<div class="$lastNode Node">
- <div class="CollapseIcon ClearFix" onclick="eXo.portal.UIPortal.collapseExpand(this);$actionCollapse">
+ <div class="CollapseIcon ClearFix" onclick="eXo.portal.UIPortal.collapseExpand(this); $actionCollapse">
""";
- if(treeNode.getNode().getPageReference() == null) println "<a class='NodeIcon DefaultPageIcon' href='javascript:void(0);'>$label</a>";
+ if(treeNode.getNode().getPageRef() == null) println "<a class='NodeIcon DefaultPageIcon' href='javascript:void(0);'>$label</a>";
else println "<a class='NodeIcon DefaultPageIcon' href='$actionLink'>$label</a>";
println """
</div>
<div class="ChildrenContainer" style="display: block">
""";
-
+
renderNodes(treeNode, portalUri, useAjax);
+
+ } else {
+ MimeResponse res = _ctx.getRequestContext().getResponse();
+ ResourceURL resourceURL = res.createResourceURL();
+ resourceURL.setResourceID(treePath);
- } else {
+ def actionExpand = "eXo.webui.UISiteMap.updateTreeNode(this, '" + resourceURL.toString() + "')";
+
println """
<div class="$lastNode Node">
- <div class="ExpandIcon ClearFix" onclick="if(eXo.portal.UIPortal.collapseExpand(this)){$actionExpand}">
+ <div class="ExpandIcon ClearFix" onclick="eXo.portal.UIPortal.collapseExpand(this); $actionExpand">
""";
- if(treeNode.getNode().getPageReference() == null) println "<a class='NodeIcon DefaultPageIcon' href='javascript:void(0);'>$label</a>";
+ if(treeNode.getNode().getPageRef() == null) println "<a class='NodeIcon DefaultPageIcon' href='javascript:void(0);'>$label</a>";
else println "<a class='NodeIcon DefaultPageIcon' href='$actionLink'>$label</a>";
println """
</div>
<div class="ChildrenContainer" style="display: none">
""";
+
+ renderNodes(treeNode, portalUri, useAjax);
}
-
-
+
+
println """
</div>
</div>
@@ -89,24 +98,24 @@
</div>
</div>
</div>
-
+
""";
-
+
}
- }
- }
+ }
+ }
%>
<div id="UISiteMap" class="UISitemap" >
<div class="ClearFix">
- <div class="CollapseAll FloatLeft" onclick="eXo.portal.UIPortal.collapseExpand(this);$actionCollapseAll">
+ <div class="CollapseAll FloatLeft" onclick="$actionCollapseAll">
<%=_ctx.appRes(siteMapPortlet.getName() + ".label.CollapseAll")%>
- </div>
- <div class="ExpandAll FloatLeft" onclick="{$actionExpandAll}">
- <%=_ctx.appRes(siteMapPortlet.getName() + ".label.ExpandAll")%>
</div>
+ <div class="ExpandAll FloatLeft" onclick="{$actionExpandAll}">
+ <%//_ctx.appRes(siteMapPortlet.getName() + ".label.ExpandAll")%>
</div>
+ </div>
<div class="SitemapContent">
<div class="UISiteTree">
<% TreeNode treeNodeRoot = uicomponent.getTreeNodes() ;%>
Modified: epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,10 +19,9 @@
package org.exoplatform.webui.core;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.util.ReflectionUtil;
import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
@@ -30,6 +29,7 @@
import org.exoplatform.webui.form.UIForm;
import java.lang.reflect.Method;
+import java.util.Collection;
import java.util.List;
/**
@@ -73,6 +73,12 @@
private String beanIdField_;
/**
+ * The bean field that holds the count number of the children
+ * This help to express the node have childs or not
+ */
+ private String beanChildCountField_;
+
+ /**
* The bean field that holds the label of the bean
*/
private String beanLabelField_;
@@ -90,12 +96,12 @@
/**
* A list of sibling nodes
*/
- private List<?> sibbling;
+ private Collection<?> sibbling;
/**
* A list of children nodes
*/
- private List<?> children;
+ private Collection<?> children;
/**
* The selected node
@@ -107,8 +113,6 @@
*/
private Object parentSelected;
- private NodeMetaDataManager nodeMetadataManager;
-
/**
* A right click popup menu
*/
@@ -135,6 +139,11 @@
this.beanLabelField_ = beanLabelField_;
}
+ public void setBeanChildCountField(String beanChildCountField)
+ {
+ this.beanChildCountField_ = beanChildCountField;
+ }
+
public Object getId(Object object) throws Exception
{
return getFieldValue(object, beanIdField_);
@@ -197,12 +206,12 @@
this.selectedIcon = selectedIcon;
}
- public List<?> getChildren()
+ public Collection<?> getChildren()
{
return children;
}
- public void setChildren(List<?> children)
+ public void setChildren(Collection<?> children)
{
this.children = children;
}
@@ -229,12 +238,12 @@
this.parentSelected = parentSelected;
}
- public List<?> getSibbling()
+ public Collection<?> getSibbling()
{
return sibbling;
}
- public void setSibbling(List<?> sibbling)
+ public void setSibbling(Collection<?> sibbling)
{
this.sibbling = sibbling;
}
@@ -271,9 +280,16 @@
iconGroup = selectedIcon;
note = " NodeSelected";
}
- if(obj instanceof PageNode && ((PageNode)obj).getChildren().size() == 0) {
- nodeIcon = nullItemIcon;
+
+ if(getBeanChildCountField() != null) {
+ Object childCount = getFieldValue(obj, getBeanChildCountField());
+ if (childCount != null && childCount.getClass().isAssignableFrom(Integer.class) &&
+ (Integer)childCount == 0)
+ {
+ nodeIcon = nullItemIcon;
+ }
}
+
if (beanIconField_ != null && beanIconField_.length() > 0)
{
if (getFieldValue(obj, beanIconField_) != null)
@@ -363,6 +379,11 @@
return beanIdField_;
}
+ public String getBeanChildCountField()
+ {
+ return beanChildCountField_;
+ }
+
public String getBeanLabelField()
{
return beanLabelField_;
@@ -397,34 +418,4 @@
{
this.colapseIcon = colapseIcon;
}
-
- public String getNodeMetaData(Object nodeObject, WebuiRequestContext context)
- {
- if (nodeMetadataManager == null)
- {
- return null;
- }
- else
- {
- return nodeMetadataManager.getNodeMetaData(nodeObject, context);
- }
- }
-
- public void setNodeMetaDataManager(NodeMetaDataManager _nodeMetadataManager)
- {
- this.nodeMetadataManager = _nodeMetadataManager;
- }
-
- /**
- * A node metadata manager. Node 's metadata is used for action informing/warning.
- *
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
- * @version $Id$
- *
- */
- public static interface NodeMetaDataManager
- {
- public String getNodeMetaData(Object nodeObject, WebuiRequestContext context);
- }
-
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -24,15 +24,19 @@
import org.exoplatform.commons.utils.PortalPrinter;
import org.exoplatform.commons.xml.DOMSerializer;
import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortalContext;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.resources.Orientation;
+import org.exoplatform.services.resources.ResourceBundleManager;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.application.URLBuilder;
import org.exoplatform.webui.application.WebuiApplication;
@@ -52,6 +56,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.ResourceBundle;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
@@ -208,13 +213,13 @@
UIPortal uiportal = Util.getUIPortal();
//
- PageNode node = uiportal.getSelectedNode();
+ UserNode node = uiportal.getSelectedUserNode();
if (node != null)
{
ExoContainer container = getApplication().getApplicationServiceContainer();
container.getComponentInstanceOfType(UserPortalConfigService.class);
UserPortalConfigService configService = (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- Page page = configService.getPage(node.getPageReference(), getRemoteUser());
+ Page page = configService.getPage(node.getPageRef(), getRemoteUser());
//
if (page != null)
@@ -480,5 +485,19 @@
this.extraMarkupHeaders.add(element);
}
+ final public static UserPortalContext USER_PORTAL_CONTEXT = new UserPortalContext()
+ {
+ public ResourceBundle getBundle(UserNavigation navigation)
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ ResourceBundleManager rbMgr = (ResourceBundleManager)container.getComponentInstanceOfType(ResourceBundleManager.class);
+ Locale locale = Util.getPortalRequestContext().getLocale();
+ return rbMgr.getNavigationResourceBundle(
+ locale.getLanguage(),
+ navigation.getKey().getTypeName(),
+ navigation.getKey().getName());
+ }
+ };
+
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -147,7 +147,7 @@
UserPortalConfigService service_ = (UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
String remoteUser = context.getRemoteUser();
String ownerUser = context.getPortalOwner();
- return service_.getUserPortalConfig(ownerUser, remoteUser);
+ return service_.getUserPortalConfig(ownerUser, remoteUser, PortalRequestContext.USER_PORTAL_CONTEXT);
}
private String getKey(WebuiRequestContext webuiRC)
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -41,12 +41,7 @@
import org.exoplatform.web.application.Phase;
import org.exoplatform.web.application.RequestFailure;
import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.core.UIApplication;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -54,6 +49,11 @@
import java.util.Locale;
import java.util.Set;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
/**
* This class takes care of loading / initializing / saving the current Locale.
* Current Locale is used to create properly localized response to current request.
@@ -205,10 +205,7 @@
if (refreshNeeded)
{
- UIApplication uiapp = context.getUIApplication();
- // we presume PortalRequestContext, and UIPortalApplication
resetOrientation(reqCtx, loc);
- ((UIPortalApplication) uiapp).localizeNavigations();
}
savePreviousLocale(reqCtx, loc);
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -18,17 +18,17 @@
*/
package org.exoplatform.portal.application.state;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
/**
* This plugin setup properties that are publicly supported, hence this is part of a public API
* and once published its contract must not change whatsoever.
@@ -79,13 +79,13 @@
try
{
UIPortal currentSite = Util.getUIPortalApplication().getShowedUIPortal();
- PageNode currentNode = currentSite.getSelectedNode();
+ UserNode currentNode = currentSite.getSelectedUserNode();
// Navigation related properties
- addProperty(properties, navigationURIQName, currentNode.getUri());
+ addProperty(properties, navigationURIQName, currentNode.getURI());
// Page related properties
- UIPage currentPage = currentSite.getUIPage(currentNode.getPageReference());
+ UIPage currentPage = currentSite.getUIPage(currentNode.getPageRef());
if(currentPage != null)
{
addProperty(properties, pageNameQName, currentPage.getTitle());
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,485 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.navigation;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.services.resources.ResourceBundleManager;
-import org.exoplatform.webui.application.WebuiRequestContext;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * Created by The eXo Platform SARL
- * Author : Nhu Dinh Thuan
- * nhudinhthuan(a)exoplatform.com
- * Jun 27, 2007
- */
-public class PageNavigationUtils
-{
-
- public static void removeNode(List<PageNode> list, String uri)
- {
- if (list == null)
- return;
- for (PageNode pageNode : list)
- {
- if (pageNode.getUri().equalsIgnoreCase(uri))
- {
- list.remove(pageNode);
- return;
- }
- }
- }
-
- /**
- * This method returns a pair of PageNode, one is the PageNode specified by the uri,
- * another is its parent. Value return is 2-element array
- *
- * 1. The element indexed 1 is the page node specified by the uri
- *
- * 2. The element indexed 0 is its parent
- *
- * @deprecated Returning 2-element array would makes it difficult to understand, handle the code.
- * Method searchParentChildPairByUri should be used instead.
- *
- * @param node
- * @param uri
- * @return
- */
- @Deprecated
- public static PageNode[] searchPageNodesByUri(PageNode node, String uri)
- {
- if (node.getUri().equals(uri))
- return new PageNode[]{null, node};
- if (node.getChildren() == null)
- return null;
- List<PageNode> children = node.getChildren();
- for (PageNode ele : children)
- {
- PageNode[] returnNodes = searchPageNodesByUri(ele, uri);
- if (returnNodes != null)
- {
- if (returnNodes[0] == null)
- returnNodes[0] = node;
- return returnNodes;
- }
- }
- return null;
- }
-
- @Deprecated
- public static PageNode[] searchPageNodesByUri(PageNavigation nav, String uri)
- {
- if (nav.getNodes() == null)
- return null;
- List<PageNode> nodes = nav.getNodes();
- for (PageNode ele : nodes)
- {
- PageNode[] returnNodes = searchPageNodesByUri(ele, uri);
- if (returnNodes != null)
- return returnNodes;
- }
- return null;
- }
-
- /**
- * This method returns a pair of a node matching the parsed uri and the parent of this node.
- *
- * @param nav
- * @param uri
- * @return
- */
- public static ParentChildPair searchParentChildPairByUri(PageNavigation nav, String uri)
- {
- List<PageNode> nodes = nav.getNodes();
-
- if(nodes == null)
- {
- return null;
- }
-
- for(PageNode ele : nodes)
- {
- ParentChildPair parentChildPair = searchParentChildPairUnderNode(ele, uri);
- if(parentChildPair != null)
- {
- return parentChildPair;
- }
- }
-
- return null;
- }
-
- //TODO: Split the uri and use optimzed method <code>searchParentChildPairByPath</code>
- public static ParentChildPair searchParentChildPairUnderNode(PageNode rootNode, String uri)
- {
- if(uri.equals(rootNode.getUri()))
- {
- return new ParentChildPair(null, rootNode);
- }
-
- List<PageNode> nodes = rootNode.getNodes();
- if(nodes == null)
- {
- return null;
- }
-
- for(PageNode node : nodes)
- {
- ParentChildPair parentChildPair = searchParentChildPairUnderNode(node, uri);
- if(parentChildPair != null)
- {
- if(parentChildPair.getParentNode() == null)
- {
- parentChildPair.setParentNode(rootNode);
- }
- return parentChildPair;
- }
- }
-
- return null;
- }
-
- /**
- * Search a pair of page node (specified by the path) and its parent
- *
- * @param rootNode
- * @param path
- * @return
- */
- public static ParentChildPair searchParentChildPairByPath(PageNode rootNode, String[] path)
- {
- if(path.length == 0)
- {
- throw new IllegalArgumentException("The input path must have unzero length");
- }
-
- if(!rootNode.getName().equals(path[0]))
- {
- return null;
- }
- else
- {
- if(path.length == 1)
- {
- return new ParentChildPair(null, rootNode);
- }
-
- PageNode tempNode = rootNode;
-
- PageNode parentNode = null;
- PageNode childNode = null;
- for(int i = 1; i< path.length; i++)
- {
- childNode = tempNode.getChild(path[i]);
- if(childNode == null)
- {
- return null;
- }
- else
- {
- parentNode = tempNode;
- }
- }
-
- return new ParentChildPair(parentNode, childNode);
- }
- }
-
- public static PageNode searchPageNodeByUri(PageNode node, String uri)
- {
- if (node.getUri().equals(uri))
- return node;
- if (node.getChildren() == null)
- return null;
- List<PageNode> children = node.getChildren();
- for (PageNode ele : children)
- {
- PageNode returnNode = searchPageNodeByUri(ele, uri);
- if (returnNode != null)
- return returnNode;
- }
- return null;
- }
-
- public static PageNode searchPageNodeByUri(PageNavigation nav, String uri)
- {
- if (nav.getNodes() == null)
- return null;
- List<PageNode> nodes = nav.getNodes();
- for (PageNode ele : nodes)
- {
- PageNode returnNode = searchPageNodeByUri(ele, uri);
- if (returnNode != null)
- return returnNode;
- }
- return null;
- }
-
- public static Object searchParentNode(PageNavigation nav, String uri)
- {
- if (nav.getNodes() == null)
- return null;
- int last = uri.lastIndexOf("/");
- String parentUri = "";
- if (last > -1)
- parentUri = uri.substring(0, uri.lastIndexOf("/"));
- for (PageNode ele : nav.getNodes())
- {
- if (ele.getUri().equals(uri))
- return nav;
- }
- if (parentUri.equals(""))
- return null;
- return searchPageNodeByUri(nav, parentUri);
- }
-
- // Still keep this method to have compatibility with legacy code
- public static PageNavigation filter(PageNavigation nav, String userName) throws Exception
- {
- return filterNavigation(nav, userName, false, false);
- }
-
- /**
- *
- * @param nav
- * @param userName
- * @param acceptNonDisplayedNode
- * @param acceptNodeWithoutPage
- * @return
- * @throws Exception
- */
- public static PageNavigation filterNavigation(PageNavigation nav, String userName, boolean acceptNonDisplayedNode, boolean acceptNodeWithoutPage) throws Exception
- {
- PageNavigation filter = nav.clone();
- filter.setNodes(new ArrayList<PageNode>());
-
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- ExoContainer container = context.getApplication().getApplicationServiceContainer();
- UserPortalConfigService userService =
- (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- UserACL userACL = (UserACL)container.getComponentInstanceOfType(UserACL.class);
-
- for (PageNode node : nav.getNodes())
- {
- PageNode newNode = filterNodeNavigation(node, userName, acceptNonDisplayedNode, acceptNodeWithoutPage, userService, userACL);
- if (newNode != null)
- filter.addNode(newNode);
- }
- return filter;
- }
-
- /**
- * use {@link #filterNavigation(PageNavigation, String, boolean, boolean)}
- *
- * @param nav
- * @param userName
- * @param acceptNonDisplayedNode
- * @return
- * @throws Exception
- */
- @Deprecated
- public static PageNavigation filterNavigation(PageNavigation nav, String userName, boolean acceptNonDisplayedNode) throws Exception
- {
- return filterNavigation(nav, userName, acceptNonDisplayedNode, true);
- }
-
- /**
- * Use {@link #filterNodeNavigation(PageNode, String, boolean, boolean, UserPortalConfigService, UserACL)}
- * @param startNode
- * @param userName
- * @param acceptNonDisplayedNode
- * @param userService
- * @param userACL
- * @return
- * @throws Exception
- */
- @Deprecated
- private static PageNode filterNodeNavigation(PageNode startNode, String userName, boolean acceptNonDisplayedNode,
- UserPortalConfigService userService, UserACL userACL) throws Exception {
- PageNode cloneStartNode = filterNodeNavigation(startNode, userName, acceptNonDisplayedNode, false, userService, userACL);
- return cloneStartNode;
- }
-
- /**
- * PageNode won't be processed in following cases:
- *
- * Case 1: Node 's visibility is SYSTEM and the user is not superuser or he is superuser but acceptNonDisplayNode = false
- *
- * Case 2: Node 's visibility is not SYSTEM but the node is not display and the acceptNonDisplayedNode = false
- *
- * Case 3: Node has non null pageReference but the associated Page does not exist and not accept this node is without page
- *
- *
- * @param startNode
- * @param userName
- * @param acceptNonDisplayedNode
- * @param acceptNodeWithoutPage
- * @param userService
- * @param userACL
- * @return
- * @throws Exception
- */
- private static PageNode filterNodeNavigation(PageNode startNode, String userName, boolean acceptNonDisplayedNode, boolean acceptNodeWithoutPage,
- UserPortalConfigService userService, UserACL userACL) throws Exception
- {
-
- Visibility nodeVisibility = startNode.getVisibility();
- String pageReference = startNode.getPageReference();
-
- boolean doNothingCase_1 = nodeVisibility == Visibility.SYSTEM && (!userACL.getSuperUser().equals(userName) || !acceptNonDisplayedNode);
- boolean doNothingCase_2 = nodeVisibility != Visibility.SYSTEM && !startNode.isDisplay() && !acceptNonDisplayedNode;
- boolean doNothingCase_3 = (pageReference != null) && (userService.getPage(pageReference, userName) == null) && !acceptNodeWithoutPage;
-
-
-
- if (doNothingCase_1 || doNothingCase_2 || doNothingCase_3)
- {
- return null;
- }
-
- PageNode cloneStartNode = startNode.clone();
-
- // Check if page reference isn't existing, page reference value of node is setted null too.
- if (pageReference != null && userService.getPage(pageReference) == null)
- {
- cloneStartNode.setPageReference(null);
- }
- ArrayList<PageNode> filteredChildren = new ArrayList<PageNode>();
-
- List<PageNode> children = startNode.getChildren();
-
- if (children != null)
- {
- for (PageNode child : children)
- {
- PageNode filteredChildNode = filterNodeNavigation(child, userName, acceptNonDisplayedNode, acceptNodeWithoutPage, userService, userACL);
- if (filteredChildNode != null)
- {
- filteredChildren.add(filteredChildNode);
- }
- }
- }
-
- //If are only accepting displayed nodes and If the node has no child and it does not point to any Page, then null is return
- if (!acceptNonDisplayedNode && filteredChildren.size() == 0 && cloneStartNode.getPageReference() == null)
- {
- return null;
- }
- cloneStartNode.setChildren(filteredChildren);
- return cloneStartNode;
- }
-
- public static PageNode filter(PageNode node, String userName, boolean acceptNonDisplayedNode) throws Exception
- {
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- ExoContainer container = context.getApplication().getApplicationServiceContainer();
- UserPortalConfigService userService =
- (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- UserACL userACL = (UserACL)container.getComponentInstanceOfType(UserACL.class);
-
- return filterNodeNavigation(node, userName, acceptNonDisplayedNode, userService, userACL);
- }
-
- public static void localizePageNavigation(PageNavigation nav, Locale locale, ResourceBundleManager i18nManager)
- {
- if (nav.getOwnerType().equals(PortalConfig.USER_TYPE))
- return;
- String localeLanguage = (locale.getCountry().length() > 0) ? locale.getLanguage() + "_" + locale.getCountry() : locale.getLanguage();
- ResourceBundle res =
- i18nManager.getNavigationResourceBundle(localeLanguage, nav.getOwnerType(), nav.getOwnerId());
- for (PageNode node : nav.getNodes())
- {
- resolveLabel(res, node);
- }
- }
-
- private static void resolveLabel(ResourceBundle res, PageNode node)
- {
- node.setResolvedLabel(res);
- if (node.getChildren() == null)
- return;
- for (PageNode childNode : node.getChildren())
- {
- resolveLabel(res, childNode);
- }
- }
-
- public static PageNavigation findNavigationByID(List<PageNavigation> all_Navigations, int id)
- {
- for (PageNavigation nav : all_Navigations)
- {
- if (nav.getId() == id)
- {
- return nav;
- }
- }
- return null;
- }
-
- public static void sortPageNavigation(List<PageNavigation> navigations)
- {
- Collections.sort(navigations, new PageNavigationComparator());
- }
-
- /**
- *
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
- * @version $Id$
- *
- */
- public static class PageNavigationComparator implements Comparator<PageNavigation>
- {
- public int compare(PageNavigation firstNav, PageNavigation secondNav)
- {
- int firstNavPriority = firstNav.getPriority();
- int secondNavPriority = secondNav.getPriority();
-
- if (firstNavPriority == secondNavPriority)
- {
- String firstNavId = firstNav.getOwnerId();
- String secondNavId = secondNav.getOwnerId();
- return firstNavId.compareTo(secondNavId);
- }
- else
- {
- if (firstNavPriority < secondNavPriority)
- {
- return -1;
- }
- else
- {
- return 1;
- }
- }
- }
- }
-}
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/ParentChildPair.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/ParentChildPair.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/ParentChildPair.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.webui.navigation;
-
-import org.exoplatform.portal.config.model.PageNode;
-
-/**
- * This class wrappes a pair of PageNode and its parent.
- *
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
- * @version $Id$
- *
- */
-public class ParentChildPair
-{
- private PageNode parentNode;
-
- private PageNode childNode;
-
- public ParentChildPair(PageNode _parentNode, PageNode _childNode)
- {
- this.parentNode = _parentNode;
- this.childNode = _childNode;
- }
-
- public PageNode getParentNode()
- {
- return parentNode;
- }
-
- public PageNode getChildNode()
- {
- return childNode;
- }
-
- public void setParentNode(PageNode _parentNode)
- {
- this.parentNode = _parentNode;
- }
-
- public void setChildNode(PageNode _childNode)
- {
- this.childNode = _childNode;
- }
-}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,13 +19,14 @@
package org.exoplatform.portal.webui.navigation;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-
-import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
-import javax.jcr.RepositoryException;
+import org.exoplatform.portal.mop.user.UserNode;
/**
* Created by The eXo Platform SARL
@@ -36,31 +37,28 @@
*/
public class TreeNode
{
- //TODO Need use this class for BC TreeNode
private boolean isExpanded_;
- private boolean hasChild_;
+ private UserNode node_;
- private String path_;
+ private List<TreeNode> children_ = Collections.emptyList();
- private PageNode node_;
+ private Map<String, TreeNode> cachedTreeNodes_;
- private PageNavigation navigation_;
+ private TreeNode rootNode;
- private List<TreeNode> children_ = new ArrayList<TreeNode>();
-
- public TreeNode(PageNode node, PageNavigation nav, boolean hasChild)
+ public TreeNode()
{
- this(node, node.getUri(), nav, hasChild);
+ cachedTreeNodes_ = new HashMap<String, TreeNode>();
+ rootNode = this;
}
- private TreeNode(PageNode node, String path, PageNavigation nav, boolean hasChild)
+ private TreeNode(UserNode node, TreeNode rootNode) throws Exception
{
node_ = node;
- navigation_ = nav;
isExpanded_ = false;
- path_ = path;
- hasChild_ = hasChild;
+ this.rootNode = rootNode;
+ setChildren(node.getChildren());
}
public boolean isExpanded()
@@ -73,31 +71,11 @@
isExpanded_ = isExpanded;
}
- public String getName() throws RepositoryException
- {
- return node_.getName();
- }
-
- public String getPath()
- {
- return path_;
- }
-
- public String getNodePath() throws RepositoryException
- {
- return node_.getUri();
- }
-
- public PageNode getNode()
- {
+ public UserNode getNode()
+ {
return node_;
}
- public void setNode(PageNode node)
- {
- node_ = node;
- }
-
public List<TreeNode> getChildren()
{
return children_;
@@ -108,61 +86,32 @@
return children_.size();
}
- public TreeNode getChildByPath(String path, TreeNode treeNode)
+ public void setChildren(Collection<UserNode> children) throws Exception
{
- TreeNode returnVal = null;
-
- for (TreeNode child : treeNode.getChildren())
+ if (children == null)
+ return;
+
+ children_ = new LinkedList<TreeNode>();
+ for (UserNode child : children)
{
-
- if (returnVal != null)
- continue;
-
- if (child.getPath().equals(path))
- {
- returnVal = child;
- }
- else if (child.getChildren() != null)
- {
- returnVal = child.getChildByPath(path, child);
- }
+ TreeNode node = new TreeNode(child, rootNode);
+ children_.add(node);
+ rootNode.cachedTreeNodes_.put(child.getId(), node);
}
-
- return returnVal;
}
- public void setChildren(List<PageNode> children, PageNavigation nav) throws Exception
+ public boolean hasChild()
{
- setExpanded(true);
- for (PageNode child : children)
- {
- boolean isHasChild = (child.getChildren().size() > 0);
- children_.add(new TreeNode(child, nav.getId() + "::" + child.getUri(), nav, isHasChild));
- }
+ return node_.getChildrenCount() > 0;
}
- public void addChildren(TreeNode treeNode)
+ /**
+ * Help to find nodes on the whole tree, not only in the childrens of this node
+ * @param nodeId - id of the UserNode
+ * @return null if not found
+ */
+ public TreeNode findNodes(String nodeId)
{
- children_.add(treeNode);
+ return rootNode.cachedTreeNodes_.get(nodeId);
}
-
- public void setNavigation(PageNavigation navigation_)
- {
- this.navigation_ = navigation_;
- }
-
- public PageNavigation getNavigation()
- {
- return navigation_;
- }
-
- public void setHasChild(boolean hasChild)
- {
- this.hasChild_ = hasChild;
- }
-
- public boolean isHasChild()
- {
- return hasChild_;
- }
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,15 +19,20 @@
package org.exoplatform.portal.webui.navigation;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
import org.exoplatform.commons.utils.ObjectPageList;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.portal.UIPortal;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -46,12 +51,6 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
/*
* Created by The eXo Platform SAS
* Author : tam.nguyen
@@ -108,9 +107,18 @@
listGroup = new ArrayList<String>();
}
- UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
- Set<String> groupIdsHavingNavigation = configService.findGroupHavingNavigation();
- listGroup.removeAll(groupIdsHavingNavigation);
+ //Filter all groups having navigation
+ NavigationService navigationService = getApplicationComponent(NavigationService.class);
+ List<String> groupsHavingNavigation = new ArrayList<String>();
+ for(String groupName : listGroup)
+ {
+ NavigationContext navigation = navigationService.loadNavigation(SiteKey.group(groupName));
+ if(navigation != null && navigation.getState() != null)
+ {
+ groupsHavingNavigation.add(groupName);
+ }
+ }
+ listGroup.removeAll(groupsHavingNavigation);
UIVirtualList virtualList = getChild(UIVirtualList.class);
virtualList.dataBind(new ObjectPageList<String>(listGroup, listGroup.size()));
@@ -127,40 +135,35 @@
String ownerId = event.getRequestContext().getRequestParameter(OBJECTID);
ownerId = URLDecoder.decode(ownerId);
- //Add navigation
- PageNavigation pageNav = new PageNavigation();
-
- // set properties for navigation
- pageNav.setPriority(1);
- pageNav.setModifiable(true);
- pageNav.setOwnerId(ownerId);
- pageNav.setOwnerType(PortalConfig.GROUP_TYPE);
- //UIPortalApplication uiPortalApp = uiForm.getAncestorOfType(UIPortalApplication.class);
UIPortalApplication uiPortalApp = Util.getUIPortal().getAncestorOfType(UIPortalApplication.class);
- // ensure this navigation is not exist
- DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
- if (dataService.getPageNavigation(pageNav.getOwnerType(), pageNav.getOwnerId()) != null)
+ // ensure this navigation does not exist
+ NavigationService navigationService = uicomp.getApplicationComponent(NavigationService.class);
+ NavigationContext navigation = navigationService.loadNavigation(SiteKey.group(ownerId));
+ if (navigation != null && navigation.getState() != null)
{
uiPortalApp.addMessage(new ApplicationMessage("UIPageNavigationForm.msg.existPageNavigation",
- new String[]{pageNav.getOwnerId()}));
- return;
+ new String[]{ownerId}));
}
+ else
+ {
+ // Create portal config of the group when it does not exist
+ DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
+ if (dataService.getPortalConfig("group", ownerId) == null)
+ {
+ UserPortalConfigService configService = uicomp.getApplicationComponent(UserPortalConfigService.class);
+ configService.createGroupSite(ownerId);
+ }
- // Create group when it does not exist
- if (dataService.getPortalConfig("group", ownerId) == null)
- {
- UserPortalConfigService configService = uicomp.getApplicationComponent(UserPortalConfigService.class);
- configService.createGroupSite(ownerId);
+ // create navigation for group
+ SiteKey key = SiteKey.group(ownerId);
+ NavigationContext existing = navigationService.loadNavigation(key);
+ if (existing == null)
+ {
+ navigationService.saveNavigation(new NavigationContext(key, new NavigationState(0)));
+ }
}
- // create navigation for group
- dataService.create(pageNav);
-
- uiPortalApp.getUserPortalConfig().getNavigations().add(0, pageNav);
- uiPortalApp.getNavigations().add(0, pageNav);
- uiPortalApp.localizeNavigations();
-
//Update group navigation list
ctx.addUIComponentToUpdateByAjax(uicomp);
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,208 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.navigation;
-
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.page.UIPageNodeForm;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
-import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIContainer;
-import org.exoplatform.webui.core.UIPopupWindow;
-import org.exoplatform.webui.core.UITree;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-
-import java.util.List;
-
-@ComponentConfig(template = "system:/groovy/portal/webui/navigation/UINavigationManagement.gtmpl", events = {
- @EventConfig(listeners = UINavigationManagement.SaveActionListener.class),
- @EventConfig(listeners = UINavigationManagement.AddRootNodeActionListener.class)})
-public class UINavigationManagement extends UIContainer
-{
-
- private String owner;
-
- private String ownerType;
-
- @SuppressWarnings("unused")
- public UINavigationManagement() throws Exception
- {
- addChild(UINavigationNodeSelector.class, null, null);
- }
-
- public void setOwner(String owner)
- {
- this.owner = owner;
- }
-
- public String getOwner()
- {
- return this.owner;
- }
-
- public <T extends UIComponent> T setRendered(boolean b)
- {
- return super.<T> setRendered(b);
- }
-
- public void loadView(Event<? extends UIComponent> event) throws Exception
- {
- UINavigationNodeSelector uiNodeSelector = getChild(UINavigationNodeSelector.class);
- UITree uiTree = uiNodeSelector.getChild(UITree.class);
- uiTree.createEvent("ChangeNode", event.getExecutionPhase(), event.getRequestContext()).broadcast();
- }
-
- public void setOwnerType(String ownerType)
- {
- this.ownerType = ownerType;
- }
-
- public String getOwnerType()
- {
- return this.ownerType;
- }
-
- static public class SaveActionListener extends EventListener<UINavigationManagement>
- {
-
- public void execute(Event<UINavigationManagement> event) throws Exception
- {
- PortalRequestContext prContext = Util.getPortalRequestContext();
- UINavigationManagement uiManagement = event.getSource();
- UINavigationNodeSelector uiNodeSelector = uiManagement.getChild(UINavigationNodeSelector.class);
- DataStorage dataService = uiManagement.getApplicationComponent(DataStorage.class);
- UserPortalConfigService portalConfigService = uiManagement.getApplicationComponent(UserPortalConfigService.class);
-
- PageNavigation navigation = uiNodeSelector.getEdittedNavigation();
- String editedOwnerType = navigation.getOwnerType();
- String editedOwnerId = navigation.getOwnerId();
- // Check existed
- PageNavigation persistNavigation = dataService.getPageNavigation(editedOwnerType, editedOwnerId);
- if (persistNavigation == null)
- {
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null));
- UIPopupWindow uiPopup = uiManagement.getParent();
- uiPopup.setShow(false);
- UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.ignoreAJAXUpdateOnPortlets(true);
- return;
- }
-
- if(PortalConfig.PORTAL_TYPE.equals(navigation.getOwnerType()))
- {
- UserPortalConfig portalConfig = portalConfigService.getUserPortalConfig(navigation.getOwnerId(), prContext.getRemoteUser());
- if(portalConfig != null)
- {
- dataService.save(navigation);
- }
- else
- {
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));
- UIPopupWindow uiPopup = uiManagement.getParent();
- uiPopup.setShow(false);
- UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.ignoreAJAXUpdateOnPortlets(true);
- return;
- }
- }
- else
- {
- dataService.save(navigation);
- }
-
- // Reload navigation here as some navigation could exist in the back end such as system navigations
- // that would not be in the current edited UI navigation
- navigation = dataService.getPageNavigation(navigation.getOwnerType(), navigation.getOwnerId());
-
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- setNavigation(uiPortalApp.getNavigations(), navigation);
-
- // Need to relocalize as it was loaded from storage
- uiPortalApp.localizeNavigations();
-
- //Update UIPortal corredponding to edited navigation
- UIPortal targetedUIPortal = uiPortalApp.getCachedUIPortal(editedOwnerType, editedOwnerId);
- if(targetedUIPortal != null)
- {
- targetedUIPortal.setNavigation(navigation);
- }
-
- UIPopupWindow uiPopup = uiManagement.getParent();
- uiPopup.setShow(false);
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.ignoreAJAXUpdateOnPortlets(true);
- }
-
- private void setNavigation(List<PageNavigation> navs, PageNavigation nav)
- {
- for (int i = 0; i < navs.size(); i++)
- {
- if (navs.get(i).getId() == nav.getId())
- {
- navs.set(i, nav);
- return;
- }
- }
- }
-
- }
-
- static public class AddRootNodeActionListener extends EventListener<UINavigationManagement>
- {
-
- @Override
- public void execute(Event<UINavigationManagement> event) throws Exception
- {
- UINavigationManagement uiManagement = event.getSource();
- UINavigationNodeSelector uiNodeSelector = uiManagement.getChild(UINavigationNodeSelector.class);
- UIPopupWindow uiManagementPopup = uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
- UIPageNodeForm uiNodeForm = uiManagementPopup.createUIComponent(UIPageNodeForm.class, null, null);
- uiNodeForm.setValues(null);
- uiManagementPopup.setUIComponent(uiNodeForm);
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- uiNodeForm.setSelectedParent(nav);
-
- uiNodeForm.setContextPageNavigation(nav);
-
- uiManagementPopup.setWindowSize(800, 500);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
- }
-
- }
-}
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,949 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.navigation;
-
-import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.page.UIPageNodeForm;
-import org.exoplatform.portal.webui.portal.UIPortalComposer;
-import org.exoplatform.portal.webui.util.PortalDataMapper;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIEditInlineWorkspace;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
-import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
-import org.exoplatform.services.resources.LocaleConfig;
-import org.exoplatform.services.resources.LocaleConfigService;
-import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
-import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIContainer;
-import org.exoplatform.webui.core.UIFilterableTree;
-import org.exoplatform.webui.core.UIPopupWindow;
-import org.exoplatform.webui.core.UIRightClickPopupMenu;
-import org.exoplatform.webui.core.UITree;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/** Copied by The eXo Platform SARL Author May 28, 2009 3:07:15 PM */
-@ComponentConfigs({
- @ComponentConfig(template = "system:/groovy/portal/webui/navigation/UINavigationNodeSelector.gtmpl", events = {@EventConfig(listeners = UINavigationNodeSelector.ChangeNodeActionListener.class)}),
- @ComponentConfig(id = "NavigationNodePopupMenu", type = UIRightClickPopupMenu.class, template = "system:/groovy/webui/core/UIRightClickPopupMenu.gtmpl", events = {
- @EventConfig(listeners = UINavigationNodeSelector.AddNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.EditPageNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.EditSelectedNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.CopyNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.CutNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.CloneNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.PasteNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.MoveUpActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.MoveDownActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.DeleteNodeActionListener.class, confirm = "UIPageNodeSelector.deleteNavigation")}),
- @ComponentConfig(id = "UINavigationNodeSelectorPopupMenu", type = UIRightClickPopupMenu.class, template = "system:/groovy/webui/core/UIRightClickPopupMenu.gtmpl", events = {
- @EventConfig(listeners = UINavigationNodeSelector.AddNodeActionListener.class),
- @EventConfig(listeners = UINavigationNodeSelector.PasteNodeActionListener.class)})})
-public class UINavigationNodeSelector extends UIContainer
-{
-
- //private List<PageNavigation> navigations;
-
- private PageNavigation edittedNavigation;
-
- private TreeNodeData edittedTreeNodeData;
-
- /** This field holds transient copy of edittedTreeNodeData, which is used when user pastes the content to a new tree node */
- private TreeNodeData copyOfTreeNodeData;
-
- private List<PageNavigation> deleteNavigations = new ArrayList<PageNavigation>();
-
- public UINavigationNodeSelector() throws Exception
- {
- UIRightClickPopupMenu rightClickPopup =
- addChild(UIRightClickPopupMenu.class, "UINavigationNodeSelectorPopupMenu", null).setRendered(true);
- rightClickPopup.setActions(new String[]{"AddNode", "PasteNode"});
-
- UIFilterableTree uiTree = addChild(UIFilterableTree.class, null, "TreeNodeSelector");
- uiTree.setIcon("DefaultPageIcon");
- uiTree.setSelectedIcon("DefaultPageIcon");
- uiTree.setBeanIdField("uri");
- uiTree.setBeanLabelField("encodedResolvedLabel");
- uiTree.setBeanIconField("icon");
-
- UIRightClickPopupMenu uiPopupMenu =
- createUIComponent(UIRightClickPopupMenu.class, "NavigationNodePopupMenu", null);
- uiPopupMenu.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode",
- "CutNode", "DeleteNode", "MoveUp", "MoveDown"});
- uiTree.setUIRightClickPopupMenu(uiPopupMenu);
- setupTreeFilter();
- }
-
- /**
- * Setup a filter on the tree node. In this case, SYSTEM node is not displayed if user is not super user
- *
- */
- private void setupTreeFilter()
- {
- UIFilterableTree.TreeNodeFilter nodeFilter = new UIFilterableTree.TreeNodeFilter()
- {
- public boolean filterThisNode(Object nodeObject, WebuiRequestContext context)
- {
- boolean isSystemNode = (((PageNode)nodeObject).getVisibility() == Visibility.SYSTEM );
- if(!isSystemNode)
- {
- return false;
- }else
- {
- UserACL userACL = context.getUIApplication().getApplicationComponent(UserACL.class);
- return !userACL.getSuperUser().equals(context.getRemoteUser());
- }
-
- }
- };
- this.getChild(UIFilterableTree.class).setTreeNodeFilter(nodeFilter);
- }
-
- public void setEdittedNavigation(PageNavigation _filteredEdittedNavigation) throws Exception
- {
- this.edittedNavigation = _filteredEdittedNavigation;
- }
-
- public PageNavigation getEdittedNavigation()
- {
- return this.edittedNavigation;
- }
-
- /**
- * Init the UITree wrapped in UINavigationNodeSelector and localize the label
- * @throws Exception
- */
- public void initTreeData() throws Exception
- {
- WebuiRequestContext requestContext = WebuiRequestContext.getCurrentInstance();
- localizeNavigation(requestContext.getLocale());
-
- initEdittedTreeNodeData();
- }
-
- /**
- * Init the edited node as well as its parent, navigation
- *
- */
- private void initEdittedTreeNodeData()
- {
- if(edittedNavigation == null)
- {
- return;
- }
- if (edittedTreeNodeData == null)
- {
- edittedTreeNodeData = new TreeNodeData(edittedNavigation);
- if(edittedTreeNodeData.getNode() != null)
- {
- selectPageNodeByUri(edittedTreeNodeData.getNode().getUri());
- }
- }
-
- UITree tree = getChild(UITree.class);
- tree.setSibbling(edittedNavigation.getNodes());
- }
-
-
- private void localizeNavigation(Locale locale)
- {
- String localeLanguage = (locale.getCountry().length() > 0) ? locale.getLanguage() + "_" + locale.getCountry() : locale.getLanguage();
- LocaleConfig localeConfig =
- getApplicationComponent(LocaleConfigService.class).getLocaleConfig(localeLanguage);
- String ownerType = edittedNavigation.getOwnerType();
- if (!PortalConfig.USER_TYPE.equals(ownerType))
- {
- String ownerId = edittedNavigation.getOwnerId();
- if (PortalConfig.GROUP_TYPE.equals(ownerType))
- {
- // Remove the trailing '/' for a group
- ownerId = ownerId.substring(1);
- }
- ResourceBundle res = localeConfig.getNavigationResourceBundle(ownerType, ownerId);
- for (PageNode node : edittedNavigation.getNodes())
- {
- resolveLabel(res, node);
- }
- }
- }
-
- private void resolveLabel(ResourceBundle res, PageNode node)
- {
- node.setResolvedLabel(res);
- if (node.getChildren() == null)
- {
- return;
- }
- for (PageNode childNode : node.getChildren())
- {
- resolveLabel(res, childNode);
- }
- }
-
- public void selectPageNodeByUri(String uri)
- {
- if (edittedTreeNodeData == null)
- {
- return;
- }
- UITree tree = getChild(UITree.class);
- List<?> sibbling = tree.getSibbling();
- tree.setSibbling(null);
- tree.setParentSelected(null);
- edittedTreeNodeData.setNode(searchPageNodeByUri(edittedTreeNodeData.getPageNavigation(), uri));
- if (edittedTreeNodeData.getNode() != null)
- {
- tree.setSelected(edittedTreeNodeData.getNode());
- tree.setChildren(edittedTreeNodeData.getNode().getChildren());
- return;
- }
- tree.setSelected(null);
- tree.setChildren(null);
- tree.setSibbling(sibbling);
- }
-
- public PageNode searchPageNodeByUri(PageNavigation pageNav, String uri)
- {
- if (pageNav == null || uri == null)
- {
- return null;
- }
- List<PageNode> pageNodes = pageNav.getNodes();
- UITree uiTree = getChild(UITree.class);
- for (PageNode ele : pageNodes)
- {
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, uiTree);
- if (returnPageNode == null)
- {
- continue;
- }
- if (uiTree.getSibbling() == null)
- {
- uiTree.setSibbling(pageNodes);
- }
- return returnPageNode;
- }
- return null;
- }
-
- private PageNode searchPageNodeByUri(PageNode pageNode, String uri, UITree tree)
- {
- if (pageNode.getUri().equals(uri))
- {
- return pageNode;
- }
- List<PageNode> children = pageNode.getChildren();
- if (children == null)
- {
- return null;
- }
- for (PageNode ele : children)
- {
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, tree);
- if (returnPageNode == null)
- {
- continue;
- }
- if (tree.getSibbling() == null)
- {
- tree.setSibbling(children);
- }
- if (tree.getParentSelected() == null)
- {
- tree.setParentSelected(pageNode);
- }
- edittedTreeNodeData.setParentNode(pageNode);
- return returnPageNode;
- }
- return null;
- }
-
- public void processRender(WebuiRequestContext context) throws Exception
- {
- UIRightClickPopupMenu uiPopupMenu = getChild(UIRightClickPopupMenu.class);
- if (uiPopupMenu != null)
- {
- if (edittedNavigation == null)
- {
- uiPopupMenu.setRendered(false);
- }
- else
- {
- uiPopupMenu.setRendered(true);
- }
- }
- super.processRender(context);
- }
-
- public TreeNodeData getCopyNode()
- {
- return copyOfTreeNodeData;
- }
-
- public void setCopyNode(TreeNodeData copyNode)
- {
- this.copyOfTreeNodeData = copyNode;
- }
-
- static public class ChangeNodeActionListener extends EventListener<UITree>
- {
- public void execute(Event<UITree> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UINavigationNodeSelector uiNodeSelector = event.getSource().getParent();
- uiNodeSelector.selectPageNodeByUri(uri);
-
- UINavigationManagement nodeManager = uiNodeSelector.getParent();
- event.getRequestContext().addUIComponentToUpdateByAjax(nodeManager);
-
- UIContainer uiParent = uiNodeSelector.getParent();
- Class<?>[] childrenToRender = {UINavigationNodeSelector.class};
- uiParent.setRenderedChildrenOfTypes(childrenToRender);
- }
- }
-
- static public class AddNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIRightClickPopupMenu uiPopupMenu = event.getSource();
-
- UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
- UIPopupWindow uiManagementPopup = uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
- UIPageNodeForm uiNodeForm = uiManagementPopup.createUIComponent(UIPageNodeForm.class, null, null);
- uiNodeForm.setValues(null);
- uiManagementPopup.setUIComponent(uiNodeForm);
-
- Object parent = null;
- PageNavigation edittedNavigation = uiNodeSelector.getEdittedNavigation();
- List<PageNode> pageNodes = edittedNavigation.getNodes();
- if (uri != null && uri.trim().length() > 0)
- {
- for (PageNode pageNode : pageNodes)
- {
- parent = PageNavigationUtils.searchPageNodeByUri(pageNode, uri);
- if (parent != null)
- {
- break;
- }
- }
- }
- if (parent == null)
- {
- parent = edittedNavigation;
- }
-
- uiNodeForm.setSelectedParent(parent);
-
- uiNodeForm.setContextPageNavigation(edittedNavigation);
- uiManagementPopup.setWindowSize(800, 500);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
- }
- }
-
- static public class EditPageNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- // get URI
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
-
- // get UINavigationNodeSelector
- UIRightClickPopupMenu uiPopupMenu = event.getSource();
-
- UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
-
- // get Selected PageNode
- PageNode selectedPageNode = null;
- List<PageNode> pageNodes = uiNodeSelector.getEdittedNavigation().getNodes();
- if (uri != null && uri.trim().length() > 0)
- {
- for (PageNode pageNode : pageNodes)
- {
- selectedPageNode = PageNavigationUtils.searchPageNodeByUri(pageNode, uri);
- if (selectedPageNode != null)
- {
- break;
- }
- }
- }
-
- UIPortalApplication uiApp = Util.getUIPortalApplication();
-
- if (selectedPageNode.getPageReference() == null)
- {
- uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
- return;
- }
-
- UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- UIPortalToolPanel uiToolPanel =
- uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
- UserPortalConfigService userService = uiToolPanel.getApplicationComponent(UserPortalConfigService.class);
-
- // get selected page
- String pageId = selectedPageNode.getPageReference();
- Page selectPage = (pageId != null) ? userService.getPage(pageId) : null;
- if (selectPage != null)
- {
- UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
- if (!userACL.hasEditPermission(selectPage))
- {
- uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId}, 1));
- return;
- }
-
- uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
- //uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
- //uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor", null);
-
- uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
-
- UIPortalComposer portalComposer =
- uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(true);
- portalComposer.setShowControl(true);
- portalComposer.setEditted(false);
- portalComposer.setCollapse(false);
- portalComposer.setId("UIPageEditor");
- portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");
-
- uiToolPanel.setShowMaskLayer(false);
- uiToolPanel.setWorkingComponent(UIPage.class, null);
- UIPage uiPage = (UIPage)uiToolPanel.getUIComponent();
-
- if(selectPage.getTitle() == null)
- selectPage.setTitle(selectedPageNode.getLabel());
-
- // convert Page to UIPage
- PortalDataMapper.toUIPage(uiPage, selectPage);
- Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
- Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
- }
- else
- {
- uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
- return;
- }
- }
- }
-
- static public class EditSelectedNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- WebuiRequestContext ctx = event.getRequestContext();
- UIRightClickPopupMenu popupMenu = event.getSource();
- UIApplication uiApp = ctx.getUIApplication();
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UINavigationNodeSelector uiNodeSelector = popupMenu.getAncestorOfType(UINavigationNodeSelector.class);
- PageNavigation edittedNav = uiNodeSelector.getEdittedNavigation();
- Object obj = PageNavigationUtils.searchParentNode(edittedNav, uri);
- PageNode selectedNode = PageNavigationUtils.searchPageNodeByUri(edittedNav, uri);
- String pageId = selectedNode.getPageReference();
-
- UserPortalConfigService service = uiApp.getApplicationComponent(UserPortalConfigService.class);
- Page node = (pageId != null) ? service.getPage(pageId) : null;
- if (node != null)
- {
- UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
- if (!userACL.hasPermission(node))
- {
- uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId}, 1));;
- return;
- }
- }
- UIPopupWindow uiManagementPopup = uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
- UIPageNodeForm uiNodeForm = uiApp.createUIComponent(UIPageNodeForm.class, null, null);
- uiManagementPopup.setUIComponent(uiNodeForm);
-
- uiNodeForm.setContextPageNavigation(edittedNav);
- uiNodeForm.setValues(selectedNode);
- uiNodeForm.setSelectedParent(obj);
- uiManagementPopup.setWindowSize(800, 500);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
- }
- }
-
- static public class CopyNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
- UINavigationManagement uiManagement = uiNodeSelector.getParent();
- Class<?>[] childrenToRender = new Class<?>[]{UINavigationNodeSelector.class};
- uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
-
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- if (nav == null)
- {
- return;
- }
- PageNode[] pageNodes = PageNavigationUtils.searchPageNodesByUri(nav, uri);
- if (pageNodes == null)
- {
- return;
- }
- TreeNodeData selectedNode = new TreeNodeData(nav, pageNodes[0], pageNodes[1]);
- selectedNode.setDeleteNode(false);
- uiNodeSelector.setCopyNode(selectedNode);
- event.getSource().setActions(
- new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode", "CutNode",
- "PasteNode", "DeleteNode", "MoveUp", "MoveDown"});
- }
- }
-
- static public class CutNodeActionListener extends UINavigationNodeSelector.CopyNodeActionListener
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- WebuiRequestContext pcontext = event.getRequestContext();
- UIApplication uiApp = pcontext.getUIApplication();
- UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
- UINavigationManagement uiManagement = uiNodeSelector.getParent();
- Class<?>[] childrenToRender = new Class<?>[]{UINavigationNodeSelector.class};
- uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
-
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- if (nav == null)
- {
- return;
- }
-
- ParentChildPair parentChildPair = PageNavigationUtils.searchParentChildPairByUri(nav, uri);
- if (parentChildPair == null)
- {
- return;
- }
-
- PageNode parentNode = parentChildPair.getParentNode();
- PageNode childNode = parentChildPair.getChildNode();
-
- if (childNode != null && childNode.isSystem())
- {
- uiApp.addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.systemnode-move", null));
- return;
- }
-
- TreeNodeData selectedNode = new TreeNodeData(nav, parentNode, childNode);
- selectedNode.setDeleteNode(false);
- uiNodeSelector.setCopyNode(selectedNode);
- event.getSource().setActions(
- new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode", "CutNode",
- "PasteNode", "DeleteNode", "MoveUp", "MoveDown"});
-
- if (uiNodeSelector.getCopyNode() == null)
- {
- return;
- }
- uiNodeSelector.getCopyNode().setDeleteNode(true);
- }
- }
-
- static public class CloneNodeActionListener extends UINavigationNodeSelector.CopyNodeActionListener
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- super.execute(event);
- UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
- uiNodeSelector.getCopyNode().setCloneNode(true);
- }
- }
-
- static public class PasteNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- String targetUri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIRightClickPopupMenu uiPopupMenu = event.getSource();
- UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
- UINavigationManagement uiManagement = uiNodeSelector.getParent();
- Class<?>[] childrenToRender = new Class<?>[]{UINavigationNodeSelector.class};
- uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
- TreeNodeData selectedNode = uiNodeSelector.getCopyNode();
- if (selectedNode == null)
- {
- return;
- }
-
- PageNode newNode = selectedNode.getNode().clone();
- PageNavigation targetNav = uiNodeSelector.getEdittedNavigation();
- PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(targetNav, targetUri);
-
- if (targetNode != null && newNode.getUri().equals(targetNode.getUri()))
- {
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameSrcAndDes", null));
- return;
- }
-
- if (isExistChild(targetNode, newNode) || (targetNode == null && isExitChild(targetNav, newNode)))
- {
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameName", null));
- return;
- }
- if (selectedNode.isDeleteNode())
- {
- if (selectedNode.getParentNode() != null)
- {
- selectedNode.getParentNode().getChildren().remove(selectedNode.getNode());
- }
- else
- {
- selectedNode.getPageNavigation().getNodes().remove(selectedNode.getNode());
- }
- }
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector);
- uiNodeSelector.setCopyNode(null);
- UITree uitree = uiNodeSelector.getChild(UITree.class);
- UIRightClickPopupMenu popup = uitree.getUIRightClickPopupMenu();
- popup.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CutNode",
- "CloneNode", "DeleteNode", "MoveUp", "MoveDown"});
-
- UserPortalConfigService service = uiPopupMenu.getApplicationComponent(UserPortalConfigService.class);
- if (targetNode == null)
- {
- newNode.setUri(newNode.getName());
- targetNav.addNode(newNode);
- if (selectedNode.isCloneNode())
- {
- clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
- }
- return;
- }
- setNewUri(targetNode, newNode);
- targetNode.getChildren().add(newNode);
- if (selectedNode.isCloneNode())
- {
- clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
- }
- uiNodeSelector.selectPageNodeByUri(targetNode.getUri());
- }
-
- private void clonePageFromNode(PageNode node, String ownerType, String ownerId, UserPortalConfigService service)
- throws Exception
- {
- String pageId = node.getPageReference();
- if (pageId != null)
- {
- Page page = service.getPage(pageId);
- if (page != null)
- {
- String newName = "page" + node.hashCode();
- page = service.renewPage(pageId, newName, ownerType, ownerId);
- node.setPageReference(page.getPageId());
- }
- }
- List<PageNode> children = node.getChildren();
- if (children == null || children.size() < 1)
- {
- return;
- }
- for (PageNode ele : children)
- {
- clonePageFromNode(ele, ownerType, ownerId, service);
- }
- }
-
- private void setNewUri(PageNode parent, PageNode child)
- {
- String newUri = (parent != null) ? parent.getUri() + "/" + child.getName() : child.getName();
- child.setUri(newUri);
- List<PageNode> children = child.getChildren();
- if (children != null)
- {
- for (PageNode node : children)
- {
- setNewUri(child, node);
- }
- }
- }
-
- private boolean isExistChild(PageNode parent, PageNode child)
- {
- if (parent == null)
- {
- return false;
- }
- List<PageNode> nodes = parent.getChildren();
- if (nodes == null)
- {
- parent.setChildren(new ArrayList<PageNode>());
- return false;
- }
- for (PageNode node : nodes)
- {
- if (node.getName().equals(child.getName()))
- {
- return true;
- }
- }
- return false;
- }
-
- private boolean isExitChild(PageNavigation nav, PageNode child)
- {
- List<PageNode> nodes = nav.getNodes();
- if (nodes.size() == 0)
- {
- return false;
- }
- for (PageNode node : nodes)
- {
- if (node.getName().equals(child.getName()))
- {
- return true;
- }
- }
- return false;
- }
- }
-
- static public class MoveUpActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- moveNode(event, -1);
- }
-
- protected void moveNode(Event<UIRightClickPopupMenu> event, int i)
- {
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector.getParent());
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(nav, uri);
- Object parentNode = PageNavigationUtils.searchParentNode(nav, uri);
- List<PageNode> children = new ArrayList<PageNode>();
- if (parentNode instanceof PageNavigation)
- {
- children = ((PageNavigation)parentNode).getNodes();
- }
- else if (parentNode instanceof PageNode)
- {
- children = ((PageNode)parentNode).getChildren();
- }
- int k = children.indexOf(targetNode);
- if (k < 0)
- {
- return;
- }
- if (k == 0 && i == -1)
- {
- return;
- }
- if (k == children.size() - 1 && i == 1)
- {
- return;
- }
- children.remove(k);
- children.add(k + i, targetNode);
- }
- }
-
- static public class MoveDownActionListener extends UINavigationNodeSelector.MoveUpActionListener
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- super.moveNode(event, 1);
- }
- }
-
- static public class DeleteNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- WebuiRequestContext pcontext = event.getRequestContext();
- UIApplication uiApp = pcontext.getUIApplication();
- UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
- pcontext.addUIComponentToUpdateByAjax(uiNodeSelector);
-
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- if (nav == null)
- {
- return;
- }
-
- ParentChildPair parentChildPair = PageNavigationUtils.searchParentChildPairByUri(nav, uri);
- if (parentChildPair == null)
- {
- return;
- }
-
- PageNode parentNode = parentChildPair.getParentNode();
- PageNode childNode = parentChildPair.getChildNode();
-
- if(childNode.isSystem()) {
- uiApp.addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.systemnode-delete", null));
- return;
- }
-
- if(parentNode == null)
- {
- nav.getNodes().remove(childNode);
- }
- else
- {
- parentNode.getNodes().remove(childNode);
- uiNodeSelector.selectPageNodeByUri(parentNode.getUri());
- }
- }
- }
-
- public TreeNodeData getSelectedNode()
- {
- return edittedTreeNodeData;
- }
-
- public PageNavigation getSelectedNavigation()
- {
- return edittedTreeNodeData == null ? null : edittedTreeNodeData.getPageNavigation();
- }
-
- public PageNode getSelectedPageNode()
- {
- return edittedTreeNodeData == null ? null : edittedTreeNodeData.getNode();
- }
-
- public String getUpLevelUri()
- {
- return edittedTreeNodeData.getParentNode().getUri();
- }
-
- public List<PageNavigation> getDeleteNavigations()
- {
- return deleteNavigations;
- }
-
- /**
- * This class encapsulate data bound to an editted tree node. It consists of a page node (to be added,
- * removed, moved) its parent node and its navigation
- *
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
- * @version $Id$
- *
- */
- public static class TreeNodeData
- {
-
- private PageNavigation nav;
-
- private PageNode parentNode;
-
- private PageNode node;
-
- private boolean deleteNode = false;
-
- private boolean cloneNode = false;
-
- public TreeNodeData(PageNavigation nav, PageNode parentNode, PageNode node)
- {
- this.nav = nav;
- this.parentNode = parentNode;
- this.node = node;
- }
-
- public TreeNodeData(PageNavigation nav)
- {
- this.nav = nav;
- List<PageNode> children = nav.getNodes();
- if(children != null && children.size() > 0)
- {
- this.node = children.get(0);
- }
- }
-
- public PageNavigation getPageNavigation()
- {
- return nav;
- }
-
- public void setPageNavigation(PageNavigation nav)
- {
- this.nav = nav;
- }
-
- public PageNode getParentNode()
- {
- return parentNode;
- }
-
- public void setParentNode(PageNode parentNode)
- {
- this.parentNode = parentNode;
- }
-
- public PageNode getNode()
- {
- return node;
- }
-
- public void setNode(PageNode node)
- {
- this.node = node;
- }
-
- public boolean isDeleteNode()
- {
- return deleteNode;
- }
-
- public void setDeleteNode(boolean deleteNode)
- {
- this.deleteNode = deleteNode;
- }
-
- public boolean isCloneNode()
- {
- return cloneNode;
- }
-
- public void setCloneNode(boolean b)
- {
- cloneNode = b;
- }
- }
-
-}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,16 +1,16 @@
/**
* Copyright (C) 2009 eXo Platform SAS.
- *
+ *
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -20,8 +20,11 @@
package org.exoplatform.portal.webui.navigation;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
@@ -29,28 +32,27 @@
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormSelectBox;
import org.exoplatform.webui.form.UIFormStringInput;
-
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
+import javax.portlet.ActionResponse;
+import javax.xml.namespace.QName;
+
/*
* Created by The eXo Platform SAS
* Author : tam.nguyen
* tamndrok(a)gmail.com
- * June 11, 2009
+ * June 11, 2009
*/
@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormWithTitle.gtmpl", events = {
@EventConfig(listeners = UIPageNavigationForm.SaveActionListener.class),
@@ -58,7 +60,7 @@
public class UIPageNavigationForm extends UIForm
{
- private PageNavigation pageNav_;
+ private UserNavigation userNav;
private String ownerId;
@@ -83,17 +85,17 @@
new UIFormSelectBox("priority", null, priorties).setValue(getPriority()));
}
- public void setValues(PageNavigation pageNavigation) throws Exception
+ public void setValues(UserNavigation userNavigation) throws Exception
{
- setPageNav(pageNavigation);
- invokeGetBindingBean(pageNavigation);
- removeChildById("ownerId");
- UIFormStringInput ownerId = new UIFormStringInput("ownerId", "ownerId", pageNavigation.getOwnerId());
+ setUserNav(userNavigation);
+ invokeGetBindingBean(userNavigation);
+ removeChildById("ownerId");
+ UIFormStringInput ownerId = new UIFormStringInput("ownerId", "ownerId", userNavigation.getKey().getName());
ownerId.setEditable(false);
ownerId.setParent(this);
getChildren().add(1, ownerId);
UIFormSelectBox uiSelectBox = findComponentById("priority");
- uiSelectBox.setValue(String.valueOf(pageNavigation.getPriority()));
+ uiSelectBox.setValue(String.valueOf(userNavigation.getPriority()));
}
public void setOwnerId(String ownerId)
@@ -126,14 +128,14 @@
return priority;
}
- public void setPageNav(PageNavigation pageNav_)
+ public void setUserNav(UserNavigation pageNav_)
{
- this.pageNav_ = pageNav_;
+ this.userNav = pageNav_;
}
- public PageNavigation getPageNav()
+ public UserNavigation getUserNav()
{
- return pageNav_;
+ return userNav;
}
static public class SaveActionListener extends EventListener<UIPageNavigationForm>
@@ -141,68 +143,45 @@
public void execute(Event<UIPageNavigationForm> event) throws Exception
{
UIPageNavigationForm uiForm = event.getSource();
- PageNavigation pageNav = uiForm.getPageNav();
+ UserNavigation userNav = uiForm.getUserNav();
// Check existed
PortalRequestContext prContext = Util.getPortalRequestContext();
- DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
- PageNavigation persistNavigation = dataService.getPageNavigation(pageNav.getOwnerType(), pageNav.getOwnerId());
- if (persistNavigation == null)
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+
+ userNav = userPortal.getNavigation(userNav.getKey());
+
+ if (userNav == null)
{
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null));
UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
+ uiPortalApp.addMessage(new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null));
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- UIPopupWindow uiPopup = uiForm.getParent();
- uiPopup.setShow(false);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ prContext.setFullRender(true);
+ UIPopupWindow uiPopup = uiForm.getParent();
+ uiPopup.setShow(false);
return;
}
- WebuiRequestContext pcontext = event.getRequestContext();
- uiForm.invokeSetBindingBean(pageNav);
UIFormSelectBox uiSelectBox = uiForm.findComponentById("priority");
int priority = Integer.parseInt(uiSelectBox.getValue());
- pageNav.setPriority(priority);
// update navigation
- dataService.save(pageNav);
+ NavigationService service = uiForm.getApplicationComponent(NavigationService.class);
+ NavigationContext ctx = service.loadNavigation(userNav.getKey());
+ ctx.setState(new NavigationState(priority));
+ service.saveNavigation(ctx);
- pageNav = dataService.getPageNavigation(pageNav.getOwnerType(), pageNav.getOwnerId());
-
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- updateNavPriority(uiPortalApp.getNavigations(), pageNav);
-
- uiPortalApp.localizeNavigations();
-
UIPopupWindow uiPopup = uiForm.getParent();
uiPopup.setShow(false);
UIComponent opener = uiPopup.getParent();
- UIWorkingWorkspace uiWorkingWS =
- Util.getUIPortal().getAncestorOfType(UIPortalApplication.class).getChild(UIWorkingWorkspace.class);
- uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
+
+ ActionResponse response = event.getRequestContext().getResponse();
+ response.setEvent(new QName("NavigationChange"), null);
+
+ WebuiRequestContext pcontext = event.getRequestContext();
pcontext.addUIComponentToUpdateByAjax(opener);
}
-
- private void updateNavPriority(List<PageNavigation> navs, PageNavigation nav)
- {
- for (int i = 0; i < navs.size(); i++)
- {
- if (navs.get(i).getId() == nav.getId())
- {
- navs.set(i, nav);
- break;
- }
- }
-
- Collections.sort(navs, new Comparator<PageNavigation>()
- {
- public int compare(PageNavigation nav1, PageNavigation nav2)
- {
- return nav1.getPriority() - nav2.getPriority();
- }
- });
- }
}
static public class CloseActionListener extends EventListener<UIPageNavigationForm>
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,172 +19,147 @@
package org.exoplatform.portal.webui.navigation;
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.page.UIPageBody;
+import java.util.Iterator;
+
+import org.exoplatform.portal.mop.navigation.NodeChange;
+import org.exoplatform.portal.mop.navigation.NodeChangeQueue;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
-import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UIRightClickPopupMenu;
import org.exoplatform.webui.core.UITree;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-import java.util.List;
-
-/** Created by The eXo Platform SARL Author : chungnv nguyenchung136(a)yahoo.com Jun 23, 2006 10:07:15 AM */
-@ComponentConfig(template = "system:/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl", events = {@EventConfig(listeners = UIPageNodeSelector.ChangeNodeActionListener.class)})
+@ComponentConfig(
+ template = "system:/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl"
+)
public class UIPageNodeSelector extends UIContainer
{
+ private UserNode rootNode;
+
+ private UserNode selectedNode;
+
+ private UserPortal userPortal;
- // private List<PageNavigation> navigations;
- private PageNavigation selectedNavigation;
-
- private SelectedNode selectedNode;
-
- private SelectedNode copyNode;
-
public UIPageNodeSelector() throws Exception
{
UITree uiTree = addChild(UITree.class, null, "TreePageSelector");
uiTree.setIcon("DefaultPageIcon");
uiTree.setSelectedIcon("DefaultPageIcon");
- uiTree.setBeanIdField("uri");
+ uiTree.setBeanIdField("URI");
uiTree.setBeanLabelField("encodedResolvedLabel");
uiTree.setBeanIconField("icon");
+ uiTree.setBeanChildCountField("childrenCount");
- loadNavigations();
- }
-
- private void loadNavigations() throws Exception
+ userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ }
+
+ public void configure(UserNode node) throws Exception
{
- PageNavigation portalSelectedNav = Util.getUIPortal().getSelectedNavigation();
- if (portalSelectedNav != null)
+ if (node == null)
{
- selectNavigation(portalSelectedNav);
- PageNode portalSelectedNode = Util.getUIPortal().getSelectedNode();
- if (portalSelectedNode != null)
- {
- selectPageNodeByUri(portalSelectedNode.getUri());
- }
- return;
+ throw new IllegalArgumentException("node can't be null");
}
- selectNavigation();
- }
-
- private void selectNavigation()
- {
- if (selectedNavigation == null)
+
+ this.rootNode = node;
+ while (rootNode.getParent() != null)
{
- return;
+ this.rootNode = rootNode.getParent();
}
- if (selectedNode == null || selectedNavigation.getId() != selectedNode.getPageNavigation().getId())
- {
- selectedNode = new SelectedNode(selectedNavigation, null, null);
- if (selectedNavigation.getNodes().size() > 0)
- {
- selectedNode.setNode(selectedNavigation.getNodes().get(0));
- }
- }
- selectNavigation(selectedNode.getPageNavigation());
- if (selectedNode.getNode() != null)
- {
- selectPageNodeByUri(selectedNode.getNode().getUri());
- }
+ setSelectedNode(node);
}
-
- public void selectNavigation(PageNavigation pageNav)
+
+ private void setSelectedNode(UserNode node) throws Exception
{
- selectedNavigation = pageNav;
- selectedNode = new SelectedNode(pageNav, null, null);
- selectPageNodeByUri(null);
- UITree uiTree = getChild(UITree.class);
- uiTree.setSibbling(pageNav.getNodes());
- }
-
- public void selectPageNodeByUri(String uri)
- {
- if (selectedNode == null || (selectedNavigation.getId() != selectedNode.getPageNavigation().getId()))
+ //If node is root node, and it's been deleted --> throw NavigationServiceException
+ node = updateNode(node);
+
+ //If node has been deleted --> select root node
+ if(node == null)
{
- return;
+ node = getRootNode();
}
+
UITree tree = getChild(UITree.class);
- List<?> sibbling = tree.getSibbling();
- tree.setSibbling(null);
- tree.setParentSelected(null);
- selectedNode.setNode(searchPageNodeByUri(selectedNode.getPageNavigation(), uri));
- if (selectedNode.getNode() != null)
+ tree.setSelected(node);
+ UserNode parent = node.getParent();
+ if (parent != null)
+ {
+ tree.setChildren(node.getChildren());
+ tree.setSibbling(parent.getChildren());
+ tree.setParentSelected(parent);
+ }
+ else
{
- tree.setSelected(selectedNode.getNode());
- tree.setChildren(selectedNode.getNode().getChildren());
- return;
+ tree.setChildren(null);
+ tree.setSibbling(node.getChildren());
+ tree.setParentSelected(node);
}
- tree.setSelected(null);
- tree.setChildren(null);
- tree.setSibbling(sibbling);
+ selectedNode = node;
}
-
- public PageNode searchPageNodeByUri(PageNavigation pageNav, String uri)
+
+ private UserNode updateNode(UserNode node) throws Exception
{
- if (pageNav == null || uri == null)
+ if (node == null)
{
return null;
}
- List<PageNode> pageNodes = pageNav.getNodes();
- UITree uiTree = getChild(UITree.class);
- for (PageNode ele : pageNodes)
+
+ NodeChangeQueue<UserNode> queue = new NodeChangeQueue<UserNode>();
+ userPortal.updateNode(node, Scope.GRANDCHILDREN, queue);
+ for (NodeChange<UserNode> change : queue)
{
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, uiTree);
- if (returnPageNode == null)
+ if (change instanceof NodeChange.Removed)
{
- continue;
+ UserNode deletedNode = ((NodeChange.Removed<UserNode>)change).getTarget();
+ if (findUserNodeByURI(deletedNode, node.getURI()) != null)
+ {
+ return null;
+ }
}
- if (uiTree.getSibbling() == null)
- {
- uiTree.setSibbling(pageNodes);
- }
- return returnPageNode;
}
- return null;
+ return node;
}
-
- private PageNode searchPageNodeByUri(PageNode pageNode, String uri, UITree tree)
+
+ public void setSelectedURI(String uri) throws Exception
{
- if (pageNode.getUri().equals(uri))
+ if (selectedNode == null)
{
- return pageNode;
+ throw new IllegalStateException("selectedNode is null, configure method must be called first");
}
- List<PageNode> children = pageNode.getChildren();
- if (children == null)
+
+ UserNode node;
+ if (selectedNode.getParent() != null)
{
- return null;
+ node = findUserNodeByURI(selectedNode.getParent(), uri);
}
- for (PageNode ele : children)
+ else
{
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, tree);
- if (returnPageNode == null)
+ node = findUserNodeByURI(selectedNode, uri);
+ }
+ setSelectedNode(node);
+ }
+
+ private UserNode findUserNodeByURI(UserNode rootNode, String uri)
+ {
+ if (rootNode.getURI().equals(uri))
+ {
+ return rootNode;
+ }
+ Iterator<UserNode> iterator = rootNode.getChildren().iterator();
+ while (iterator.hasNext())
+ {
+ UserNode next = iterator.next();
+ UserNode node = findUserNodeByURI(next, uri);
+ if (node == null)
{
continue;
}
- if (tree.getSibbling() == null)
- {
- tree.setSibbling(children);
- }
- if (tree.getParentSelected() == null)
- {
- tree.setParentSelected(pageNode);
- }
- selectedNode.setParentNode(pageNode);
- return returnPageNode;
+ return node;
}
return null;
}
@@ -198,173 +173,19 @@
}
super.processRender(context);
}
-
- public SelectedNode getCopyNode()
+
+ private UserNode getRootNode()
{
- return copyNode;
+ return this.rootNode;
}
-
- public void setCopyNode(SelectedNode copyNode)
+
+ public UserNode getSelectedNode()
{
- this.copyNode = copyNode;
- }
-
- public SelectedNode getSelectedNode()
- {
return selectedNode;
}
- public PageNavigation getSelectedNavigation()
+ public UserNavigation getNavigation()
{
- return selectedNavigation;
- }
-
- public PageNode getSelectedPageNode()
- {
- return selectedNode == null ? null : selectedNode.getNode();
- }
-
- public String getUpLevelUri()
- {
- return selectedNode.getParentNode().getUri();
- }
-
- // private List<PageNavigation> getExistedNavigation(List<PageNavigation> navis) throws Exception {
- // Iterator<PageNavigation> itr = navis.iterator() ;
- // UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
- // while(itr.hasNext()) {
- // PageNavigation nav = itr.next() ;
- // if(configService.getPageNavigation(nav.getOwnerType(), nav.getOwnerId()) == null) itr.remove() ;
- // }
- // return navis ;
- // }
-
- static public class ChangeNodeActionListener extends EventListener<UITree>
- {
- public void execute(Event<UITree> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UIPageNodeSelector uiPageNodeSelector = event.getSource().getParent();
- uiPageNodeSelector.selectPageNodeByUri(uri);
-
- PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
- UIPortalApplication uiPortalApp = uiPageNodeSelector.getAncestorOfType(UIPortalApplication.class);
- UIPortalToolPanel uiToolPanel = Util.getUIPortalToolPanel();
- uiToolPanel.setRenderSibling(UIPortalToolPanel.class);
- uiToolPanel.setShowMaskLayer(true);
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.ignoreAJAXUpdateOnPortlets(true);
-
- UIContainer uiParent = uiPageNodeSelector.getParent();
- PageNode node = null;
- if (uiPageNodeSelector.getSelectedNode() == null)
- {
- node = Util.getUIPortal().getSelectedNode();
- }
- else
- {
- node = uiPageNodeSelector.getSelectedNode().getNode();
- }
- if (node == null)
- {
- uiPageNodeSelector.selectNavigation(uiPageNodeSelector.getSelectedNavigation());
- uiToolPanel.setUIComponent(null);
- return;
- }
-
- UserPortalConfigService configService = uiParent.getApplicationComponent(UserPortalConfigService.class);
- Page page = null;
- if (node.getPageReference() != null)
- {
- page = configService.getPage(node.getPageReference(), event.getRequestContext().getRemoteUser());
- }
-
- if (page == null)
- {
- uiToolPanel.setUIComponent(null);
- return;
- }
-
- UIPage uiPage = Util.toUIPage(node, uiToolPanel);
- UIPageBody uiPageBody = uiPortalApp.findFirstComponentOfType(UIPageBody.class);
- if (uiPageBody.getUIComponent() != null)
- {
- uiPageBody.setUIComponent(null);
- }
- uiToolPanel.setUIComponent(uiPage);
- }
- }
-
- public static class SelectedNode
- {
-
- private PageNavigation nav;
-
- private PageNode parentNode;
-
- private PageNode node;
-
- private boolean deleteNode = false;
-
- private boolean cloneNode = false;
-
- public SelectedNode(PageNavigation nav, PageNode parentNode, PageNode node)
- {
- this.nav = nav;
- this.parentNode = parentNode;
- this.node = node;
- }
-
- public PageNavigation getPageNavigation()
- {
- return nav;
- }
-
- public void setPageNavigation(PageNavigation nav)
- {
- this.nav = nav;
- }
-
- public PageNode getParentNode()
- {
- return parentNode;
- }
-
- public void setParentNode(PageNode parentNode)
- {
- this.parentNode = parentNode;
- }
-
- public PageNode getNode()
- {
- return node;
- }
-
- public void setNode(PageNode node)
- {
- this.node = node;
- }
-
- public boolean isDeleteNode()
- {
- return deleteNode;
- }
-
- public void setDeleteNode(boolean deleteNode)
- {
- this.deleteNode = deleteNode;
- }
-
- public boolean isCloneNode()
- {
- return cloneNode;
- }
-
- public void setCloneNode(boolean b)
- {
- cloneNode = b;
- }
- }
-
+ return selectedNode.getNavigation();
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,21 +19,30 @@
package org.exoplatform.portal.webui.navigation;
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NodeChange;
+import org.exoplatform.portal.mop.navigation.NodeChangeQueue;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.web.application.JavascriptManager;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Created by The eXo Platform SARL Author : Dang Van Minh minhdv81(a)yahoo.com
* Jul 12, 2006
@@ -44,22 +53,26 @@
private boolean showUserNavigation = true;
- protected PageNode selectedNode_;
-
- protected Object selectedParent_;
-
private TreeNode treeNode_;
private String cssClassName = "";
private String template;
+
+ private final UserNodeFilterConfig NAVIGATION_FILTER_CONFIG;
- private final static String PORTAL_NAV = "portal";
+ private Scope navigationScope;
- private final static String GROUP_NAV = "group";
-
- private final static String USER_NAV = "user";
+ private Log log = ExoLogger.getExoLogger(UIPortalNavigation.class);
+ public UIPortalNavigation()
+ {
+ UserNodeFilterConfig.Builder filterConfigBuilder = UserNodeFilterConfig.builder();
+ filterConfigBuilder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED, Visibility.TEMPORAL);
+ filterConfigBuilder.withTemporalCheck();
+ NAVIGATION_FILTER_CONFIG = filterConfigBuilder.build();
+ }
+
@Override
public String getTemplate()
{
@@ -106,69 +119,157 @@
return cssClassName;
}
- public List<PageNavigation> getNavigations() throws Exception
+ public List<UserNode> getNavigations() throws Exception
{
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- List<PageNavigation> result = new ArrayList<PageNavigation>();
-
+ List<UserNode> nodes = new ArrayList<UserNode>();
if (context.getRemoteUser() != null)
{
- result.add(PageNavigationUtils.filterNavigation(getSelectedNavigation(), context.getRemoteUser(), false, true));
+ UserNode currRootNode = getCurrentNavigation();
+ if (currRootNode != null)
+ {
+ nodes.add(currRootNode);
+ }
}
else
{
- for (PageNavigation nav : Util.getUIPortalApplication().getNavigations())
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ List<UserNavigation> navigations = userPortal.getNavigations();
+ for (UserNavigation userNav : navigations)
{
- if (!showUserNavigation && nav.getOwnerType().equals("user"))
+ if (!showUserNavigation && userNav.getKey().getType().equals(SiteType.USER))
+ {
continue;
- result.add(PageNavigationUtils.filterNavigation(nav, null, false, true));
+ }
+
+ UserNode rootNode = userPortal.getNode(userNav, navigationScope, NAVIGATION_FILTER_CONFIG, null);
+ if (rootNode != null)
+ {
+ nodes.add(rootNode);
+ }
}
}
- return result;
+ return nodes;
}
public void loadTreeNodes() throws Exception
{
+ treeNode_ = new TreeNode();
+
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ List<UserNavigation> listNavigations = userPortal.getNavigations();
+
+ List<UserNode> childNodes = new LinkedList<UserNode>();
+ for (UserNavigation nav : rearrangeNavigations(listNavigations))
+ {
+ if (!showUserNavigation && nav.getKey().getTypeName().equals(PortalConfig.USER_TYPE))
+ {
+ continue;
+ }
+ try
+ {
+ UserNode rootNode = userPortal.getNode(nav, navigationScope, NAVIGATION_FILTER_CONFIG, null);
+ if (rootNode != null)
+ {
+ childNodes.addAll(rootNode.getChildren());
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error(ex.getMessage(), ex);
+ }
+ }
+ treeNode_.setChildren(childNodes);
+ }
+
+ public UserNode resolvePath(String path) throws Exception
+ {
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- treeNode_ = new TreeNode(new PageNode(), new PageNavigation(), true);
- List<PageNavigation> listNavigations = Util.getUIPortalApplication().getNavigations();
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
- for (PageNavigation nav : rearrangeNavigations(listNavigations))
+ UserNode node;
+ if (context.getRemoteUser() != null)
{
- if (!showUserNavigation && nav.getOwnerType().equals("user"))
+ node = userPortal.resolvePath(Util.getUIPortal().getUserNavigation(), NAVIGATION_FILTER_CONFIG, path);
+ }
+ else
+ {
+ node = userPortal.resolvePath(NAVIGATION_FILTER_CONFIG, path);
+ }
+
+ if (node != null && !node.getURI().equals(path))
+ {
+ //Node has been deleted
+ return null;
+ }
+ return updateNode(node);
+ }
+
+ public UserNode updateNode(UserNode node) throws Exception
+ {
+ if (node == null)
+ {
+ return null;
+ }
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ NodeChangeQueue<UserNode> queue = new NodeChangeQueue<UserNode>();
+ userPortal.updateNode(node, navigationScope, queue);
+ for (NodeChange<UserNode> change : queue)
+ {
+ if (change instanceof NodeChange.Removed)
{
- continue;
+ UserNode deletedNode = ((NodeChange.Removed<UserNode>)change).getTarget();
+ if (hasRelationship(deletedNode, node))
+ {
+ //Node has been deleted
+ return null;
+ }
}
- PageNavigation filterNav = PageNavigationUtils.filter(nav, context.getRemoteUser());
- treeNode_.setChildren(filterNav.getNodes(), filterNav);
}
+ return node;
}
+
+ private boolean hasRelationship(UserNode parent, UserNode userNode)
+ {
+ if (parent.getId().equals(userNode.getId()))
+ {
+ return true;
+ }
+ for (UserNode child : parent.getChildren())
+ {
+ if (hasRelationship(child, userNode))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
/**
*
* @param listNavigation
* @return
*/
- private List<PageNavigation> rearrangeNavigations(List<PageNavigation> listNavigation)
+ private List<UserNavigation> rearrangeNavigations(List<UserNavigation> listNavigation)
{
- List<PageNavigation> returnNavs = new ArrayList<PageNavigation>();
+ List<UserNavigation> returnNavs = new ArrayList<UserNavigation>();
- List<PageNavigation> portalNavs = new ArrayList<PageNavigation>();
- List<PageNavigation> groupNavs = new ArrayList<PageNavigation>();
- List<PageNavigation> userNavs = new ArrayList<PageNavigation>();
+ List<UserNavigation> portalNavs = new ArrayList<UserNavigation>();
+ List<UserNavigation> groupNavs = new ArrayList<UserNavigation>();
+ List<UserNavigation> userNavs = new ArrayList<UserNavigation>();
- for (PageNavigation nav : listNavigation)
+ for (UserNavigation nav : listNavigation)
{
- String ownerType = nav.getOwnerType();
- if (PORTAL_NAV.equals(ownerType))
+ String ownerType = nav.getKey().getTypeName();
+ if (PortalConfig.PORTAL_TYPE.equals(ownerType))
{
portalNavs.add(nav);
}
- else if (GROUP_NAV.equals(ownerType))
+ else if (PortalConfig.GROUP_TYPE.equals(ownerType))
{
groupNavs.add(nav);
}
- else if (USER_NAV.equals(ownerType))
+ else if (PortalConfig.USER_TYPE.equals(ownerType))
{
userNavs.add(nav);
}
@@ -186,190 +287,114 @@
return treeNode_;
}
- public PageNavigation getSelectedNavigation() throws Exception
+ public UserNode getSelectedNode() throws Exception
{
- PageNavigation nav = Util.getUIPortal().getSelectedNavigation();
- if (nav != null)
- return nav;
- if (Util.getUIPortal().getNavigations().size() < 1)
- return null;
- return Util.getUIPortal().getNavigations().get(0);
- }
-
- public Object getSelectedParent()
- {
- return selectedParent_;
- }
-
- public PageNode getSelectedPageNode() throws Exception
- {
- if (selectedNode_ != null)
- return selectedNode_;
- selectedNode_ = Util.getUIPortal().getSelectedNode();
- return selectedNode_;
- }
-
- public boolean isSelectedNode(PageNode node)
- {
- if (selectedNode_ != null && node.getUri().equals(selectedNode_.getUri()))
- return true;
- if (selectedParent_ == null || selectedParent_ instanceof PageNavigation)
- return false;
- PageNode pageNode = (PageNode)selectedParent_;
- return node.getUri().equals(pageNode.getUri());
- }
-
- public void processRender(WebuiRequestContext context) throws Exception
- {
UIPortal uiPortal = Util.getUIPortal();
- if ((uiPortal.getSelectedNode() != null) && (uiPortal.getSelectedNode() != selectedNode_))
+ if (uiPortal != null)
{
- setSelectedPageNode(uiPortal.getSelectedNode());
+ return uiPortal.getSelectedUserNode();
}
- super.processRender(context);
+ return null;
}
- private void setSelectedPageNode(PageNode selectedNode) throws Exception
+ private UserNode getCurrentNavigation() throws Exception
{
- selectedNode_ = selectedNode;
- selectedParent_ = null;
- String seletctUri = selectedNode.getUri();
- int index = seletctUri.lastIndexOf("/");
- String parentUri = null;
- if (index > 0)
- parentUri = seletctUri.substring(0, seletctUri.lastIndexOf("/"));
- List<PageNavigation> pageNavs = getNavigations();
- for (PageNavigation pageNav : pageNavs)
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ UserNavigation userNavigation = Util.getUIPortal().getUserNavigation();
+ try
{
- if (PageNavigationUtils.searchPageNodeByUri(pageNav, selectedNode.getUri()) != null)
- {
- if (parentUri == null || parentUri.length() < 1)
- selectedParent_ = pageNav;
- else
- selectedParent_ = PageNavigationUtils.searchPageNodeByUri(pageNav, parentUri);
- break;
- }
+ UserNode rootNode = userPortal.getNode(userNavigation, navigationScope, NAVIGATION_FILTER_CONFIG, null);
+ return rootNode;
+ }
+ catch (Exception ex)
+ {
+ log.error("Navigation has been deleted");
}
+ return null;
}
-
+
+ public void setScope(Scope scope)
+ {
+ this.navigationScope = scope;
+ }
+
static public class SelectNodeActionListener extends EventListener<UIPortalNavigation>
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- UIPortalNavigation uiNavigation = event.getSource();
UIPortal uiPortal = Util.getUIPortal();
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- int index = uri.lastIndexOf("::");
- String id = uri.substring(index + 2);
- PageNavigation selectNav = null;
- if (index <= 0)
+ String treePath = event.getRequestContext().getRequestParameter(OBJECTID);
+
+ TreeNode selectedNode = event.getSource().getTreeNodes().findNodes(treePath);
+ //There're may be interuption between browser and server
+ if (selectedNode == null)
{
- selectNav = uiPortal.getSelectedNavigation();
+ event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource());
+ return;
}
- else
- {
- String navId = uri.substring(0, index);
- //selectNav = uiPortal.getPageNavigation(Integer.parseInt(navId));
- selectNav = uiPortal.getSelectedNavigation();
- }
- PageNode selectNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
- uiNavigation.selectedNode_ = selectNode;
- String parentUri = null;
- index = uri.lastIndexOf("/");
- if (index > 0)
- parentUri = uri.substring(0, index);
- if (parentUri == null || parentUri.length() < 1)
- uiNavigation.selectedParent_ = selectNav;
- else
- uiNavigation.selectedParent_ = PageNavigationUtils.searchPageNodeByUri(selectNav, parentUri);
-
+
PageNodeEvent<UIPortal> pnevent;
- pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
+ pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, selectedNode.getNode().getURI());
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
}
}
+ //Now we use serveSource method to expand a node
+/*
static public class ExpandNodeActionListener extends EventListener<UIPortalNavigation>
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- UIPortalNavigation uiNavigation = event.getSource();
-
- TreeNode treeNode = uiNavigation.getTreeNodes();
- List<PageNavigation> all_Navigations = Util.getUIPortalApplication().getNavigations();
-
- // get URI
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- int index = uri.lastIndexOf("::");
- String id = uri.substring(index + 2);
-
- // get PageNavigation by uri
- PageNavigation selectNav = null;
-
- String navId = uri.substring(0, index);
- selectNav = PageNavigationUtils.findNavigationByID(all_Navigations, Integer.parseInt(navId));
- if(selectNav == null)
+ String treePath = event.getRequestContext().getRequestParameter(OBJECTID);
+
+ TreeNode treeNode = event.getSource().getTreeNodes();
+ TreeNode expandTree = treeNode.findNodes(treePath);
+ //There're may be interuption between browser and server
+ if (expandTree == null)
{
+ event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource());
return;
}
-
- // get PageNode by uri
- PageNode expandNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
- TreeNode expandTree = null;
- if (treeNode.getChildren() != null)
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+
+ UserNode node = expandTree.getNode();
+ userPortal.updateNode(node, event.getSource().navigationScope, null);
+ if (node == null)
{
- expandTree = treeNode.getChildByPath(uri, treeNode);
+ event.getSource().loadTreeNodes();
+ event.getRequestContext().getUIApplication().addMessage(new
+ ApplicationMessage("UIPortalNavigation.msg.staleData", null, ApplicationMessage.WARNING));
}
-
- if(expandTree != null)
+ else
{
- expandTree.setChildren(expandNode.getChildren(), selectNav);
+ node.filter(event.getSource().NAVIGATION_FILTER_CONFIG);
+ expandTree.setChildren(node.getChildren());
+ expandTree.setExpanded(true);
}
-
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigation);
+
+ event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource());
}
}
-
+*/
+
static public class CollapseNodeActionListener extends EventListener<UIPortalNavigation>
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- UIPortalNavigation uiNavigation = event.getSource();
-
- TreeNode treeNode = uiNavigation.getTreeNodes();
- UIPortal uiPortal = Util.getUIPortal();
-
// get URI
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
+ String treePath = event.getRequestContext().getRequestParameter(OBJECTID);
- int index = uri.lastIndexOf("::");
- String id = uri.substring(index + 2);
-
- // get PageNavigation by uri
- PageNavigation selectNav = null;
-
- String navId = uri.substring(0, index);
+ UIPortalNavigation uiNavigation = event.getSource();
+ TreeNode rootNode = uiNavigation.getTreeNodes();
- //TODO: Minh Hoang TO
- //selectNav = uiPortal.getPageNavigation(Integer.parseInt(navId));
- selectNav = uiPortal.getSelectedNavigation();
-
- // get PageNode by uri
- PageNode expandNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
-
- TreeNode expandTree = null;
- if (treeNode.getChildren() != null)
+ TreeNode collapseTree = rootNode.findNodes(treePath);
+ if (collapseTree != null)
{
- expandTree = treeNode.getChildByPath(uri, treeNode);
- }
+ collapseTree.setExpanded(false);
+ }
- if(expandTree != null)
- {
- expandTree.setExpanded(false);
- }
-
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigation);
+ Util.getPortalRequestContext().setResponseComplete(true);
}
}
@@ -377,20 +402,19 @@
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- PortalRequestContext prContext = Util.getPortalRequestContext();
UIPortalNavigation uiNavigation = event.getSource();
-
uiNavigation.loadTreeNodes();
event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigation);
}
}
+ //Expand all will not be allowed - The nodes are lazy loaded now
+/*
static public class ExpandAllNodeActionListener extends EventListener<UIPortalNavigation>
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- PortalRequestContext prContext = Util.getPortalRequestContext();
UIPortalNavigation uiNavigation = event.getSource();
// reload TreeNodes
uiNavigation.loadTreeNodes();
@@ -408,19 +432,21 @@
{
for (TreeNode child : treeNode.getChildren())
{
- PageNode expandNode = child.getNode();
- PageNavigation selectNav = child.getNavigation();
+// PageNode expandNode = child.getNode();
+// PageNavigation selectNav = child.getNavigation();
+//
+// // set node to child tree
+// if (expandNode.getChildren().size() > 0)
+// {
+// child.setChildren(expandNode.getChildren(), selectNav);
+// }
- // set node to child tree
- if (expandNode.getChildren().size() > 0)
- {
- child.setChildren(expandNode.getChildren(), selectNav);
- }
-
// expand child tree
expandAllNode(child);
}
}
}
}
+*/
+
}
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,187 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.navigation;
-
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.webui.portal.PageNodeEvent;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class UIPortalNavigation2 extends UIComponent
-{
- private boolean useAJAX = true;
-
- protected PageNode selectedNode_;
-
- protected Object selectedParent_;
-
- private String template;
-
- @Override
- public String getTemplate()
- {
- return template != null ? template : super.getTemplate();
- }
-
- public void setTemplate(String template)
- {
- this.template = template;
- }
-
- public UIComponent getViewModeUIComponent()
- {
- return null;
- }
-
- public void setUseAjax(boolean bl)
- {
- useAJAX = bl;
- }
-
- public boolean isUseAjax()
- {
- return useAJAX;
- }
-
- public List<PageNavigation> getNavigations() throws Exception
- {
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- List<PageNavigation> result = new ArrayList<PageNavigation>();
- for (PageNavigation nav : Util.getUIPortal().getNavigations())
- {
- result.add(PageNavigationUtils.filter(nav, context.getRemoteUser()));
- }
- return result;
- }
-
- public PageNavigation getSelectedNavigation() throws Exception
- {
- PageNavigation nav = Util.getUIPortal().getSelectedNavigation();
- if (nav != null)
- return nav;
- if (Util.getUIPortal().getNavigations().size() < 1)
- return null;
- return Util.getUIPortal().getNavigations().get(0);
- }
-
- public Object getSelectedParent()
- {
- return selectedParent_;
- }
-
- public PageNode getSelectedPageNode() throws Exception
- {
- if (selectedNode_ != null)
- return selectedNode_;
- selectedNode_ = Util.getUIPortal().getSelectedNode();
- return selectedNode_;
- }
-
- public boolean isSelectedNode(PageNode node)
- {
- if (selectedNode_ != null && node.getUri().equals(selectedNode_.getUri()))
- return true;
- if (selectedParent_ == null || selectedParent_ instanceof PageNavigation)
- return false;
- PageNode pageNode = (PageNode)selectedParent_;
- return node.getUri().equals(pageNode.getUri());
- }
-
- public void processRender(WebuiRequestContext context) throws Exception
- {
- UIPortal uiPortal = Util.getUIPortal();
- if ((uiPortal.getSelectedNode() != null) && (uiPortal.getSelectedNode() != selectedNode_))
- {
- setSelectedPageNode(uiPortal.getSelectedNode());
- }
- super.processRender(context);
- }
-
- private void setSelectedPageNode(PageNode selectedNode) throws Exception
- {
- selectedNode_ = selectedNode;
- selectedParent_ = null;
- String seletctUri = selectedNode.getUri();
- int index = seletctUri.lastIndexOf("/");
- String parentUri = null;
- if (index > 0)
- parentUri = seletctUri.substring(0, seletctUri.lastIndexOf("/"));
- List<PageNavigation> pageNavs = getNavigations();
- for (PageNavigation pageNav : pageNavs)
- {
- if (PageNavigationUtils.searchPageNodeByUri(pageNav, selectedNode.getUri()) != null)
- {
- if (parentUri == null || parentUri.length() < 1)
- selectedParent_ = pageNav;
- else
- selectedParent_ = PageNavigationUtils.searchPageNodeByUri(pageNav, parentUri);
- break;
- }
- }
- }
-
- static public class SelectNodeActionListener extends EventListener<UIPortalNavigation2>
- {
- public void execute(Event<UIPortalNavigation2> event) throws Exception
- {
- UIPortalNavigation2 uiNavigation = event.getSource();
- UIPortal uiPortal = Util.getUIPortal();
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- int index = uri.lastIndexOf("::");
- String id = uri.substring(index + 2);
- PageNavigation selectNav = null;
- if (index <= 0)
- {
- selectNav = uiPortal.getSelectedNavigation();
- }
- else
- {
- String navId = uri.substring(0, index);
-
- //TODO: Minh Hoang TO
- //selectNav = uiPortal.getPageNavigation(Integer.parseInt(navId));
- selectNav = uiPortal.getSelectedNavigation();
- }
- PageNode selectNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
- uiNavigation.selectedNode_ = selectNode;
- String parentUri = null;
- index = uri.lastIndexOf("/");
- if (index > 0)
- parentUri = uri.substring(0, index);
- if (parentUri == null || parentUri.length() < 1)
- uiNavigation.selectedParent_ = selectNav;
- else
- uiNavigation.selectedParent_ = PageNavigationUtils.searchPageNodeByUri(selectNav, parentUri);
-
- PageNodeEvent<UIPortal> pnevent;
- pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
- uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
- }
- }
-
-}
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNodeSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNodeSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNodeSelector.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,806 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.navigation;
-
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
-import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIContainer;
-import org.exoplatform.webui.core.UIRightClickPopupMenu;
-import org.exoplatform.webui.core.UITree;
-import org.exoplatform.webui.core.model.SelectItemOption;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Created by The eXo Platform SARL Author : chungnv nguyenchung136(a)yahoo.com
- * Jun 23, 2006 10:07:15 AM
- */
-@ComponentConfigs({
- @ComponentConfig(template = "system:/groovy/portal/webui/navigation/UIPortalNodeSelector.gtmpl", events = {@EventConfig(listeners = UIPortalNodeSelector.ChangeNodeActionListener.class)}),
- @ComponentConfig(id = "PortalNodePopupMenu", type = UIRightClickPopupMenu.class, template = "system:/groovy/webui/core/UIRightClickPopupMenu.gtmpl", events = {
- @EventConfig(listeners = UIPortalNodeSelector.AddNodeActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.EditPageNodeActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.EditSelectedNodeActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.CopyNodeActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.CutNodeActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.CloneNodeActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.PasteNodeActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.MoveUpActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.MoveDownActionListener.class),
- @EventConfig(listeners = UIPortalNodeSelector.DeleteNodeActionListener.class, confirm = "UIPageNodeSelector.deleteNavigation")}),
- @ComponentConfig(id = "UIPortalNodeSelectorPopupMenu", type = UIRightClickPopupMenu.class, template = "system:/groovy/webui/core/UIRightClickPopupMenu.gtmpl", events = {})})
-public class UIPortalNodeSelector extends UIContainer
-{
-
- private List<PageNavigation> navigations;
-
- private SelectedNode selectedNode;
-
- private SelectedNode copyNode;
-
- private String portalName;
-
- private List<PageNavigation> deleteNavigations = new ArrayList<PageNavigation>();
-
- public UIPortalNodeSelector() throws Exception
- {
- addChild(UIRightClickPopupMenu.class, "UIPortalNodeSelectorPopupMenu", null).setRendered(false);
-
- UITree uiTree = addChild(UITree.class, null, "TreeNodeSelector");
- uiTree.setIcon("DefaultPageIcon");
- uiTree.setSelectedIcon("DefaultPageIcon");
- uiTree.setBeanIdField("uri");
- uiTree.setBeanLabelField("encodedResolvedLabel");
- uiTree.setBeanIconField("icon");
-
- UIRightClickPopupMenu uiPopupMenu = createUIComponent(UIRightClickPopupMenu.class, "PortalNodePopupMenu", null);
- uiPopupMenu.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode",
- "CutNode", "DeleteNode", "MoveUp", "MoveDown"});
- uiTree.setUIRightClickPopupMenu(uiPopupMenu);
- }
-
- public void loadNavigations(String portalName, String ownerType) throws Exception
- {
- this.portalName = portalName;
- navigations = new ArrayList<PageNavigation>();
- List<PageNavigation> pnavigations = getExistedNavigation(portalName, ownerType);
- for (PageNavigation nav : pnavigations)
- {
- if (nav.isModifiable())
- navigations.add(nav);
- }
-
- updateUI();
-
- selectNavigation();
- }
-
- public void loadNavigationByNavId(Integer navId, List<PageNavigation> navigations) throws Exception
- {
- this.navigations = navigations;
-
- selectNavigation(navId);
- }
-
- private void updateUI()
- {
- if (navigations == null || navigations.size() < 1)
- {
- getChild(UITree.class).setSibbling(null);
- return;
- }
-
- List<SelectItemOption<String>> options = new ArrayList<SelectItemOption<String>>();
- for (PageNavigation navigation : navigations)
- { // navigation.getOwnerId()
- options.add(new SelectItemOption<String>(navigation.getOwnerType() + ":" + navigation.getOwnerId(), String
- .valueOf(navigation.getId())));
- }
- }
-
- private void selectNavigation()
- {
- if (navigations == null || navigations.size() < 1)
- return;
- if (selectedNode == null)
- {
- PageNavigation navigation = navigations.get(0);
- selectedNode = new SelectedNode(navigation, null, null);
- if (navigation.getNodes().size() > 0)
- selectedNode.setNode(navigation.getNodes().get(0));
- }
- selectNavigation(selectedNode.getPageNavigation().getId());
- if (selectedNode.getNode() != null)
- selectPageNodeByUri(selectedNode.getNode().getUri());
- }
-
- public void selectNavigation(int id)
- {
- for (int i = 0; i < navigations.size(); i++)
- {
- if (navigations.get(i).getId() != id)
- continue;
- selectedNode = new SelectedNode(navigations.get(i), null, null);
- selectPageNodeByUri(null);
- UITree uiTree = getChild(UITree.class);
- uiTree.setSibbling(navigations.get(i).getNodes());
- }
- }
-
- public void selectPageNodeByUri(String uri)
- {
- if (selectedNode == null)
- return;
- UITree tree = getChild(UITree.class);
- List<?> sibbling = tree.getSibbling();
- tree.setSibbling(null);
- tree.setParentSelected(null);
- selectedNode.setNode(searchPageNodeByUri(selectedNode.getPageNavigation(), uri));
- if (selectedNode.getNode() != null)
- {
- tree.setSelected(selectedNode.getNode());
- tree.setChildren(selectedNode.getNode().getChildren());
- return;
- }
- tree.setSelected(null);
- tree.setChildren(null);
- tree.setSibbling(sibbling);
- }
-
- public PageNode searchPageNodeByUri(PageNavigation pageNav, String uri)
- {
- if (pageNav == null || uri == null)
- return null;
- List<PageNode> pageNodes = pageNav.getNodes();
- UITree uiTree = getChild(UITree.class);
- for (PageNode ele : pageNodes)
- {
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, uiTree);
- if (returnPageNode == null)
- continue;
- if (uiTree.getSibbling() == null)
- uiTree.setSibbling(pageNodes);
- return returnPageNode;
- }
- return null;
- }
-
- private PageNode searchPageNodeByUri(PageNode pageNode, String uri, UITree tree)
- {
- if (pageNode.getUri().equals(uri))
- return pageNode;
- List<PageNode> children = pageNode.getChildren();
- if (children == null)
- return null;
- for (PageNode ele : children)
- {
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, tree);
- if (returnPageNode == null)
- continue;
- if (tree.getSibbling() == null)
- tree.setSibbling(children);
- if (tree.getParentSelected() == null)
- tree.setParentSelected(pageNode);
- selectedNode.setParentNode(pageNode);
- return returnPageNode;
- }
- return null;
- }
-
- public List<PageNavigation> getPageNavigations()
- {
- if (navigations == null)
- navigations = new ArrayList<PageNavigation>();
- return navigations;
- }
-
- public void addPageNavigation(PageNavigation navigation)
- {
- if (navigations == null)
- navigations = new ArrayList<PageNavigation>();
- navigations.add(navigation);
- updateUI();
- }
-
- public void deletePageNavigation(PageNavigation navigation)
- {
- if (navigations == null || navigations.size() < 1)
- return;
- navigations.remove(navigation);
- deleteNavigations.add(navigation);
- selectedNode = null;
- selectNavigation();
- updateUI();
- }
-
- public PageNavigation getPageNavigation(int id)
- {
- for (PageNavigation ele : getPageNavigations())
- {
- if (ele.getId() == id)
- return ele;
- }
- return null;
- }
-
- public void processRender(WebuiRequestContext context) throws Exception
- {
- UIRightClickPopupMenu uiPopupMenu = getChild(UIRightClickPopupMenu.class);
- if (uiPopupMenu != null)
- {
- if (navigations == null || navigations.size() < 1)
- uiPopupMenu.setRendered(false);
- else
- uiPopupMenu.setRendered(true);
- }
- super.processRender(context);
- }
-
- public SelectedNode getCopyNode()
- {
- return copyNode;
- }
-
- public void setCopyNode(SelectedNode copyNode)
- {
- this.copyNode = copyNode;
- }
-
- private List<PageNavigation> getExistedNavigation(String portalName, String ownerType) throws Exception
- {
- PortalRequestContext prContext = Util.getPortalRequestContext();
- UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
- UserPortalConfig config = configService.getUserPortalConfig(portalName, prContext.getRemoteUser());
- List<PageNavigation> navis = config.getNavigations();
- if (ownerType != null)
- {
- Iterator<PageNavigation> itr = navis.iterator();
- while (itr.hasNext())
- {
- PageNavigation nav = itr.next();
- if (!nav.getOwnerType().equals(ownerType))
- itr.remove();
- }
- }
-
- return navis;
- }
-
- static public class ChangeNodeActionListener extends EventListener<UITree>
- {
- public void execute(Event<UITree> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UIPortalNodeSelector uiPortalNodeSelector = event.getSource().getParent();
- uiPortalNodeSelector.selectPageNodeByUri(uri);
- }
- }
-
- static public class AddNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- // String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- // UIRightClickPopupMenu uiPopupMenu = event.getSource();
- // UIPortalNodeSelector uiPortalNodeSelector = uiPopupMenu.getAncestorOfType(UIPortalNodeSelector.class);
- // if (uiPortalNodeSelector.getSelectedNavigation() == null) {
- // UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- // uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.NoPageNavigation", null));
- //
- // event.getRequestContext().addUIComponentToUpdateByAjax(uiPortalNodeSelector.getParent());
- // return;
- // }
- //
- // UIPortalApplication uiApp = uiPortalNodeSelector.getAncestorOfType(UIPortalApplication.class);
- // UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
- // event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
- // event.getRequestContext().addUIComponentToUpdateByAjax(uiPortalNodeSelector.getParent());
- // UIPageNodeForm2 uiNodeForm = uiMaskWS.createUIComponent(UIPageNodeForm2.class, null, null);
- // uiNodeForm.setValues(null);
- // uiMaskWS.setUIComponent(uiNodeForm);
- // uiMaskWS.setShow(true);
- //
- // Object parent = null;
- // List<PageNode> pageNodes = uiPortalNodeSelector.getSelectedNavigation().getNodes();
- // if (uri != null && uri.trim().length() > 0) {
- // for (PageNode pageNode : pageNodes) {
- // parent = PageNavigationUtils.searchPageNodeByUri(pageNode, uri);
- // if (parent != null)
- // break;
- // }
- // }
- // if (parent == null)
- // parent = uiPortalNodeSelector.getSelectedNavigation();
- // uiNodeForm.setSelectedParent(parent);
- }
- }
-
- static public class EditPageNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- // UIRightClickPopupMenu uiPopupMenu = event.getSource();
- // String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- // PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
- // UIPortalNodeSelector uiPortalNodeSelector = uiPopupMenu.getAncestorOfType(UIPortalNodeSelector.class) ;
- // PageNavigation currentNav = uiPortalNodeSelector.getSelectedNavigation();
- // PageNode selectNode = PageNavigationUtils.searchPageNodeByUri(currentNav, uri);
- //
- // uiPortalNodeSelector.selectPageNodeByUri(uri);
- // UIPortalApplication uiPortalApp = Util.getUIPortalApplication() ;
- // UIPageManagement2 uiManagement = uiPortalNodeSelector.getParent();
- //
- // UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- // pcontext.addUIComponentToUpdateByAjax(uiWorkingWS) ;
- // pcontext.setFullRender(true);
- //
- // UserPortalConfigService portalConfigService = uiPopupMenu.getApplicationComponent(UserPortalConfigService.class);
- // Page page = null;
- // if(selectNode.getPageReference() != null) page = portalConfigService.getPage(selectNode.getPageReference(), pcontext.getRemoteUser());
- // if(page == null) {
- // Class<?> [] childrenToRender = {UIPortalNodeSelector.class, UIPortalNavigationControlBar.class };
- // uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- // if(selectNode.getPageReference() != null && portalConfigService.getPage(selectNode.getPageReference()) != null) {
- // uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.edit.NotEditPage", new String[]{})) ;
- // } else {
- // uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{})) ;
- // }
- // return;
- // }
- //
- // if(!page.isModifiable()){
- // Class<?> [] childrenToRender = {UIPortalNodeSelector.class, UIPortalNavigationControlBar.class};
- // uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- // uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.Invalid-editPermission", null)) ;
- // return;
- // }
- //
- // UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID) ;
- // UIPageForm2 uiPageForm = uiMaskWS.createUIComponent(UIPageForm2.class);
- // uiPageForm.removeChild(UIPageTemplateOptions.class);
- //
- // UIPage uiPage = Util.toUIPage(page, uiMaskWS);
- // uiPageForm.setValues(uiPage);
- // uiMaskWS.setUIComponent(uiPageForm);
- // uiMaskWS.setWindowSize(640, 400);
- // uiMaskWS.setShow(true);
- // pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
- // Class<?> [] childrenToRender = {UIPortalNodeSelector.class, UIPortalNavigationControlBar.class};
- // uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- }
- }
-
- static public class EditSelectedNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- // UIRightClickPopupMenu popupMenu = event.getSource();
- // UIComponent parent = popupMenu.getParent();
- // UIPortalNodeSelector uiPortalNodeSelector = parent.getParent();
- // UIPortalApplication uiApp = uiPortalNodeSelector.getAncestorOfType(UIPortalApplication.class);
- // UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID) ;
- // event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
- // event.getRequestContext().addUIComponentToUpdateByAjax(uiPortalNodeSelector.<UIPageManagement2>getParent());
- //
- // String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- // PageNavigation selectedNav = uiPortalNodeSelector.getSelectedNavigation();
- // Object obj = PageNavigationUtils.searchParentNode(selectedNav, uri);
- // PageNode selectedNode = PageNavigationUtils.searchPageNodeByUri(selectedNav, uri);
- // String pageId = selectedNode.getPageReference();
- // UserPortalConfigService service = parent.getApplicationComponent(UserPortalConfigService.class);
- // PortalRequestContext pcontext = Util.getPortalRequestContext();
- // UIPortalApplication uiPortalApp = parent.getAncestorOfType(UIPortalApplication.class);
- // Page node = (pageId != null) ? service.getPage(pageId) : null ;
- // if(node != null) {
- // UserACL userACL = parent.getApplicationComponent(UserACL.class) ;
- // if(!userACL.hasPermission(node, pcontext.getRemoteUser())) {
- // uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId}, 1)) ;;
- // return;
- // }
- // }
- //
- // UIPageNodeForm2 uiNodeForm = uiMaskWS.createUIComponent(UIPageNodeForm2.class, null, null);
- // uiMaskWS.setUIComponent(uiNodeForm);
- // uiNodeForm.setValues(selectedNode);
- // uiNodeForm.setSelectedParent(obj);
- }
- }
-
- static public class CopyNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIPortalNodeSelector uiPortalNodeSelector = event.getSource().getAncestorOfType(UIPortalNodeSelector.class);
- //UIPageManagement2 uiManagement = uiPortalNodeSelector.getParent();
- Class<?>[] childrenToRender = new Class<?>[]{UIPortalNodeSelector.class};
- //uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- //event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
-
- PageNavigation nav = uiPortalNodeSelector.getSelectedNavigation();
- if (nav == null)
- return;
- PageNode[] pageNodes = PageNavigationUtils.searchPageNodesByUri(nav, uri);
- if (pageNodes == null)
- return;
- SelectedNode selectedNode = new SelectedNode(nav, pageNodes[0], pageNodes[1]);
- selectedNode.setDeleteNode(false);
- uiPortalNodeSelector.setCopyNode(selectedNode);
- event.getSource().setActions(
- new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CloneNode", "CutNode",
- "PasteNode", "DeleteNode", "MoveUp", "MoveDown"});
- }
- }
-
- static public class CutNodeActionListener extends UIPortalNodeSelector.CopyNodeActionListener
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- super.execute(event);
- UIPortalNodeSelector uiPortalNodeSelector = event.getSource().getAncestorOfType(UIPortalNodeSelector.class);
- if (uiPortalNodeSelector.getCopyNode() == null)
- return;
- uiPortalNodeSelector.getCopyNode().setDeleteNode(true);
- }
- }
-
- static public class CloneNodeActionListener extends UIPortalNodeSelector.CopyNodeActionListener
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- super.execute(event);
- UIPortalNodeSelector uiPortalNodeSelector = event.getSource().getAncestorOfType(UIPortalNodeSelector.class);
- uiPortalNodeSelector.getCopyNode().setCloneNode(true);
- }
- }
-
- static public class PasteNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- String targetUri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIRightClickPopupMenu uiPopupMenu = event.getSource();
- UIPortalNodeSelector uiPortalNodeSelector = uiPopupMenu.getAncestorOfType(UIPortalNodeSelector.class);
- //UIPageManagement2 uiManagement = uiPortalNodeSelector.getParent();
- Class<?>[] childrenToRender = new Class<?>[]{UIPortalNodeSelector.class};
- //uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- //event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
- SelectedNode selectedNode = uiPortalNodeSelector.getCopyNode();
- if (selectedNode == null)
- return;
-
- PageNode newNode = selectedNode.getNode().clone();
- PageNavigation targetNav = uiPortalNodeSelector.getSelectedNavigation();
- PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(targetNav, targetUri);
-
- if (targetNode != null && newNode.getUri().equals(targetNode.getUri()))
- {
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameSrcAndDes", null));
- return;
- }
-
- if (isExistChild(targetNode, newNode) || (targetNode == null && isExitChild(targetNav, newNode)))
- {
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameName", null));
- return;
- }
- if (selectedNode.isDeleteNode())
- {
- if (selectedNode.getParentNode() != null)
- {
- selectedNode.getParentNode().getChildren().remove(selectedNode.getNode());
- }
- else
- {
- selectedNode.getPageNavigation().getNodes().remove(selectedNode.getNode());
- }
- }
- event.getRequestContext().addUIComponentToUpdateByAjax(uiPortalNodeSelector);
- uiPortalNodeSelector.setCopyNode(null);
- UITree uitree = uiPortalNodeSelector.getChild(UITree.class);
- UIRightClickPopupMenu popup = uitree.getUIRightClickPopupMenu();
- popup.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CutNode",
- "CloneNode", "DeleteNode", "MoveUp", "MoveDown"});
-
- UserPortalConfigService service = uiPopupMenu.getApplicationComponent(UserPortalConfigService.class);
- if (targetNode == null)
- {
- newNode.setUri(newNode.getName());
- targetNav.addNode(newNode);
- if (selectedNode.isCloneNode())
- {
- clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
- }
- return;
- }
- setNewUri(targetNode, newNode);
- targetNode.getChildren().add(newNode);
- if (selectedNode.isCloneNode())
- {
- clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
- }
- uiPortalNodeSelector.selectPageNodeByUri(targetNode.getUri());
- }
-
- private void clonePageFromNode(PageNode node, String ownerType, String ownerId, UserPortalConfigService service)
- throws Exception
- {
- String pageId = node.getPageReference();
- if (pageId != null)
- {
- Page page = service.getPage(pageId);
- if (page != null)
- {
- String newName = "page" + node.hashCode();
- page = service.renewPage(pageId, newName, ownerType, ownerId);
- node.setPageReference(page.getPageId());
- }
- }
- List<PageNode> children = node.getChildren();
- if (children == null || children.size() < 1)
- return;
- for (PageNode ele : children)
- {
- clonePageFromNode(ele, ownerType, ownerId, service);
- }
- }
-
- private void setNewUri(PageNode parent, PageNode child)
- {
- String newUri = (parent != null) ? parent.getUri() + "/" + child.getName() : child.getName();
- child.setUri(newUri);
- List<PageNode> children = child.getChildren();
- if (children != null)
- for (PageNode node : children)
- setNewUri(child, node);
- }
-
- private boolean isExistChild(PageNode parent, PageNode child)
- {
- if (parent == null)
- return false;
- List<PageNode> nodes = parent.getChildren();
- if (nodes == null)
- {
- parent.setChildren(new ArrayList<PageNode>());
- return false;
- }
- for (PageNode node : nodes)
- {
- if (node.getName().equals(child.getName()))
- return true;
- }
- return false;
- }
-
- private boolean isExitChild(PageNavigation nav, PageNode child)
- {
- List<PageNode> nodes = nav.getNodes();
- if (nodes.size() == 0)
- return false;
- for (PageNode node : nodes)
- {
- if (node.getName().equals(child.getName()))
- return true;
- }
- return false;
- }
- }
-
- static public class MoveUpActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- moveNode(event, -1);
- }
-
- protected void moveNode(Event<UIRightClickPopupMenu> event, int i)
- {
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIPortalNodeSelector uiPortalNodeSelector = event.getSource().getAncestorOfType(UIPortalNodeSelector.class);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiPortalNodeSelector.getParent());
- PageNavigation nav = uiPortalNodeSelector.getSelectedNavigation();
- PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(nav, uri);
- Object parentNode = PageNavigationUtils.searchParentNode(nav, uri);
- List<PageNode> children = new ArrayList<PageNode>();
- if (parentNode instanceof PageNavigation)
- {
- children = ((PageNavigation)parentNode).getNodes();
- }
- else if (parentNode instanceof PageNode)
- {
- children = ((PageNode)parentNode).getChildren();
- }
- int k = children.indexOf(targetNode);
- if (k < 0)
- return;
- if (k == 0 && i == -1)
- return;
- if (k == children.size() - 1 && i == 1)
- return;
- children.remove(k);
- children.add(k + i, targetNode);
- }
- }
-
- static public class MoveDownActionListener extends UIPortalNodeSelector.MoveUpActionListener
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- super.moveNode(event, 1);
- }
- }
-
- static public class DeleteNodeActionListener extends EventListener<UIRightClickPopupMenu>
- {
- public void execute(Event<UIRightClickPopupMenu> event) throws Exception
- {
- // String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- // PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext() ;
- // UIPortalNodeSelector uiPortalNodeSelector = event.getSource().getAncestorOfType(UIPortalNodeSelector.class);
- // UIPageManagement2 uiManagement = uiPortalNodeSelector.getParent();
- // Class<?> [] childrenToRender = new Class<?>[]{UIPortalNodeSelector.class, UIPortalNavigationControlBar.class };
- // uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- // pcontext.addUIComponentToUpdateByAjax(uiManagement);
- //
- // PageNavigation nav = uiPortalNodeSelector.getSelectedNavigation();
- // if(nav == null) return;
- //
- // PageNode [] pageNodes = PageNavigationUtils.searchPageNodesByUri(nav, uri);
- // if(pageNodes == null) return;
- //
- // UIPortalApplication uiPortalApp = event.getSource().getAncestorOfType(UIPortalApplication.class);
- // UIWorkingWorkspace uiWorkspace = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- // pcontext.setFullRender(true) ;
- // pcontext.addUIComponentToUpdateByAjax(uiWorkspace);
- // if(pageNodes[0] == null) {
- // nav.getNodes().remove(pageNodes[1]);
- // return;
- // }
- // pageNodes[0].getChildren().remove(pageNodes[1]);
- // uiPortalNodeSelector.selectPageNodeByUri(pageNodes[0].getUri());
- }
- }
-
- public SelectedNode getSelectedNode()
- {
- return selectedNode;
- }
-
- public PageNavigation getSelectedNavigation()
- {
- return selectedNode == null ? null : selectedNode.getPageNavigation();
- }
-
- public PageNode getSelectedPageNode()
- {
- return selectedNode == null ? null : selectedNode.getNode();
- }
-
- public String getUpLevelUri()
- {
- return selectedNode.getParentNode().getUri();
- }
-
- public List<PageNavigation> getDeleteNavigations()
- {
- return deleteNavigations;
- }
-
- public String getPortalName()
- {
- return portalName;
- }
-
- public void setPortalName(String portalName)
- {
- this.portalName = portalName;
- }
-
- public static class SelectedNode
- {
-
- private PageNavigation nav;
-
- private PageNode parentNode;
-
- private PageNode node;
-
- private boolean deleteNode = false;
-
- private boolean cloneNode = false;
-
- public SelectedNode(PageNavigation nav, PageNode parentNode, PageNode node)
- {
- this.nav = nav;
- this.parentNode = parentNode;
- this.node = node;
- }
-
- public PageNavigation getPageNavigation()
- {
- return nav;
- }
-
- public void setPageNavigation(PageNavigation nav)
- {
- this.nav = nav;
- }
-
- public PageNode getParentNode()
- {
- return parentNode;
- }
-
- public void setParentNode(PageNode parentNode)
- {
- this.parentNode = parentNode;
- }
-
- public PageNode getNode()
- {
- return node;
- }
-
- public void setNode(PageNode node)
- {
- this.node = node;
- }
-
- public boolean isDeleteNode()
- {
- return deleteNode;
- }
-
- public void setDeleteNode(boolean deleteNode)
- {
- this.deleteNode = deleteNode;
- }
-
- public boolean isCloneNode()
- {
- return cloneNode;
- }
-
- public void setCloneNode(boolean b)
- {
- cloneNode = b;
- }
- }
-
-}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -27,8 +27,6 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.Page;
-import java.util.Comparator;
-
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -46,12 +44,6 @@
{
ExoContainer container = PortalContainer.getInstance();
DataStorage service = (DataStorage)container.getComponentInstance(DataStorage.class);
- return service.find2(state, new Comparator<Page>()
- {
- public int compare(Page page1, Page page2)
- {
- return page1.getName().compareTo(page2.getName());
- }
- });
+ return service.find2(state);
}
}
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageUtils.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageUtils.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageUtils.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,97 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.page;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by The eXo Platform SAS
- * Author : Pham Thanh Tung
- * thanhtungty(a)gmail.com
- * Feb 19, 2008
- */
-public class PageUtils
-{
-
- /**
- * This method create new Page and PageNode from an existing page and add created PageNode to children of parentNode
- *
- */
- public static void createNodeFromPageTemplate(String nodeName, String nodeLabel, String pageId, PageNode parentNode)
- throws Exception
- {
-
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- UserPortalConfigService configService = uiPortalApp.getApplicationComponent(UserPortalConfigService.class);
- String accessUser = Util.getPortalRequestContext().getRemoteUser();
- PageNode node =
- configService.createNodeFromPageTemplate(nodeName, nodeLabel, pageId, PortalConfig.USER_TYPE, accessUser);
- node.setUri(parentNode.getUri() + "/" + node.getName());
- if (parentNode.getChildren() == null)
- parentNode.setChildren(new ArrayList<PageNode>());
- parentNode.getChildren().add(node);
- }
-
- /**
- * This method create new Page and PageNode from an existing page and add created PageNode to user PageNavigation.
- * It also saves changes to database and UIPortal
- *
- */
- public static void createNodeFromPageTemplate(String nodeName, String nodeLabel, String pageId, PageNavigation navi)
- throws Exception
- {
-
- UIPortal uiPortal = Util.getUIPortal();
- UserPortalConfigService configService = uiPortal.getApplicationComponent(UserPortalConfigService.class);
- String accessUser = Util.getPortalRequestContext().getRemoteUser();
- PageNode node =
- configService.createNodeFromPageTemplate(nodeName, nodeLabel, pageId, PortalConfig.USER_TYPE, accessUser);
-
- node.setUri(node.getName());
- navi.addNode(node);
-
- DataStorage dataService = uiPortal.getApplicationComponent(DataStorage.class);
- dataService.save(navi);
- setNavigation(uiPortal.getNavigations(), navi);
- }
-
- private static void setNavigation(List<PageNavigation> navs, PageNavigation nav)
- {
- for (int i = 0; i < navs.size(); i++)
- {
- if (navs.get(i).getId() == nav.getId())
- {
- navs.set(i, nav);
- return;
- }
- }
- }
-
-}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,17 +19,17 @@
package org.exoplatform.portal.webui.page;
-import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -52,331 +52,81 @@
*/
public class UIPageActionListener
{
-
static public class ChangePageNodeActionListener extends EventListener<UIPortal>
{
- @Override
public void execute(Event<UIPortal> event) throws Exception
{
UIPortal showedUIPortal = event.getSource();
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- //This code snippet is to make sure that Javascript/Skin is fully loaded at the first request
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- pcontext.ignoreAJAXUpdateOnPortlets(true);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ UserPortal userPortal = uiPortalApp.getUserPortalConfig().getUserPortal();
- PageNavigation currentNav = showedUIPortal.getSelectedNavigation();
- String currentUri = showedUIPortal.getSelectedNode().getUri();
- if(currentUri.startsWith("/"))
- {
- currentUri = currentUri.substring(1);
- }
+ String uri = ((PageNodeEvent<UIPortal>)event).getTargetNodeUri();
+ UserNode naviPath = userPortal.resolvePath(null, uri);
+ UserNavigation targetNav = naviPath.getNavigation();
- //This if branche is to make sure that the first time user logs in, showedUIPortal has selectedPaths
- //Otherwise, there will be NPE on BreadcumbsPortlet
- if(showedUIPortal.getSelectedPath() == null)
- {
- List<PageNode> currentSelectedPath = findPath(currentNav, currentUri.split("/"));
- showedUIPortal.setSelectedPath(currentSelectedPath);
- }
+ UserNode currentNavPath = showedUIPortal.getNavPath();
- String targetedUri = ((PageNodeEvent<UIPortal>)event).getTargetNodeUri();
- if(targetedUri.startsWith("/"))
+ if(currentNavPath != null && currentNavPath.getNavigation().getKey().equals(targetNav.getKey()))
{
- targetedUri = targetedUri.substring(1);
- }
-
- PageNavigation targetedNav = getTargetedNav(uiPortalApp, targetedUri);
-
- if(targetedNav == null)
- {
- return;
- }
-
- String formerNavType = currentNav.getOwnerType();
- String formerNavId = currentNav.getOwnerId();
- String newNavType = targetedNav.getOwnerType();
- String newNavId = targetedNav.getOwnerId();
-
- String[] targetPath = targetedUri.split("/");
- PageNode targetPageNode = getTargetedNode(targetedNav, targetPath);
- List<PageNode> targetedPathNodes = findPath(targetedNav, targetPath);
-
- if(formerNavType.equals(newNavType) && formerNavId.equals(newNavId))
- {
//Case 1: Both navigation type and id are not changed, but current page node is changed
- if(!currentUri.equals(targetedUri))
+ if(!currentNavPath.getURI().equals(naviPath.getURI()))
{
- showedUIPortal.setSelectedNode(targetPageNode);
- showedUIPortal.setSelectedPath(targetedPathNodes);
+ showedUIPortal.setNavPath(naviPath);
}
}
else
{
// Case 2: Either navigation type or id has been changed
// First, we try to find a cached UIPortal
+ UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
- showedUIPortal = uiPortalApp.getCachedUIPortal(newNavType, newNavId);
+ showedUIPortal = uiPortalApp.getCachedUIPortal(targetNav.getKey());
if (showedUIPortal != null)
{
- showedUIPortal.setSelectedNode(targetPageNode);
- showedUIPortal.setSelectedPath(targetedPathNodes);
+ showedUIPortal.setNavPath(naviPath);
uiPortalApp.setShowedUIPortal(showedUIPortal);
//Temporary solution to fix edit inline error while switching between navigations
DataStorage storageService = uiPortalApp.getApplicationComponent(DataStorage.class);
- PortalConfig associatedPortalConfig = storageService.getPortalConfig(newNavType, newNavId);
+ PortalConfig associatedPortalConfig = storageService.getPortalConfig(targetNav.getKey().getTypeName(), targetNav.getKey().getName());
UserPortalConfig userPortalConfig = uiPortalApp.getUserPortalConfig();
//Update layout-related data on UserPortalConfig
userPortalConfig.setPortal(associatedPortalConfig);
-
- //Update selected navigation on UserPortalConfig, that is mandatory as at the moment the PortalConfig
- //does not hold any navigation data.
- userPortalConfig.updateSelectedNavigation(newNavType, newNavId);
}
else
{
- showedUIPortal = buildUIPortal(targetedNav, uiPortalApp, uiPortalApp.getUserPortalConfig());
+ showedUIPortal = buildUIPortal(targetNav.getKey(), uiPortalApp, uiPortalApp.getUserPortalConfig());
if(showedUIPortal == null)
{
return;
}
- showedUIPortal.setSelectedNode(targetPageNode);
- showedUIPortal.setSelectedPath(targetedPathNodes);
+ showedUIPortal.setNavPath(naviPath);
uiPortalApp.setShowedUIPortal(showedUIPortal);
uiPortalApp.putCachedUIPortal(showedUIPortal);
}
}
+
showedUIPortal.refreshUIPage();
}
-
- /**
- * Get the targeted <code>PageNavigation</code>
- *
- * @param uiPortalApp
- * @param targetedUri
- * @return
- */
- private PageNavigation getTargetedNav(UIPortalApplication uiPortalApp, String targetedUri)
- {
- List<PageNavigation> allNavs = uiPortalApp.getUserPortalConfig().getNavigations();
-
- //That happens when user browses to an empty-nodeUri URL like ../portal/public/classic/
- //In this case, we returns default navigation
- if(targetedUri.length() == 0)
- {
- return uiPortalApp.getNavigations().get(0);
- }
-
- String[] pathNodes = targetedUri.split("/");
-
- return getBestMatchNavigation(allNavs, pathNodes);
- }
-
- /**
- * Get the navigation containing longest subpath of 'pathNodes'
- *
- * @param listNav
- * @param pathNodes
- * @return
- */
- private PageNavigation getBestMatchNavigation(List<PageNavigation> listNav, String[] pathNodes)
- {
- int temporalMaximalMatching = 0;
- PageNavigation temporalBestNavigation = listNav.get(0);
-
- for(PageNavigation nav : listNav)
- {
- int currentNumberOfMatching = countNumberOfMatchedPathNodes(nav, pathNodes);
-
- //The whole pathNodes matches current navigation
- if(currentNumberOfMatching == pathNodes.length)
- {
- return nav;
- }
-
- if(currentNumberOfMatching > temporalMaximalMatching)
- {
- temporalMaximalMatching = currentNumberOfMatching;
- temporalBestNavigation = nav;
- }
- }
- return temporalBestNavigation;
- }
-
- /**
- * Count the maximal number of nodes matching the pathNodes while descending the navigation 'nav'
- *
- * @param nav
- * @param pathNodes
- * @return
- */
- private int countNumberOfMatchedPathNodes(PageNavigation nav, String[] pathNodes)
- {
- if(pathNodes.length == 0)
- {
- return 0;
- }
-
- PageNode currentNode = nav.getNode(pathNodes[0]);
- int numberOfMatch = (currentNode != null)? 1 : 0 ;
-
- for(int i = 1; i < pathNodes.length; i++)
- {
- if(currentNode == null)
- {
- break;
- }
- currentNode = currentNode.getChild(pathNodes[i]);
- }
- return numberOfMatch;
- }
-
- /**
- * Fetch the currently selected pageNode under a PageNavigation. It is the last node encountered
- * while descending the pathNodes
- *
- * This method returns <code>null</code> iff only 'notfound' node remains in the navigation
- *
- * @param targetedNav
- * @param pathNodes
- * @return
- */
- private PageNode getTargetedNode(PageNavigation targetedNav, String[] pathNodes)
- {
- //Case users browses to a URL of the form */portal/public/classic
- if(pathNodes.length == 0)
- {
- return getDefaultNode(targetedNav);
- }
-
- PageNode currentNode = targetedNav.getNode(pathNodes[0]);
- if(currentNode == null)
- {
- return getDefaultNode(targetedNav);
- }
-
- PageNode tempNode = null;
-
- for(int i = 1; i < pathNodes.length; i++)
- {
- tempNode = currentNode.getChild(pathNodes[i]);
- if (tempNode == null)
- {
- break;
- }
- else
- {
- currentNode = tempNode;
- }
- }
- return currentNode;
- }
-
- /**
- * Default node of a navigation. This method returns
- *
- * 1. The first node in the list of 'nav' 's children if the list contains
- * at least one child other than 'notfound'
- *
- * 2. <code>null</code> otherwise
- *
- * @param nav
- * @return
- */
- private PageNode getDefaultNode(PageNavigation nav)
- {
- PageNode defaultNode = null;
- try
- {
- if (nav != null && nav.getNodes().size() > 0)
- {
- WebuiRequestContext context = Util.getPortalRequestContext();
- ExoContainer appContainer = context.getApplication().getApplicationServiceContainer();
- UserPortalConfigService userPortalConfigService = (UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
-
- for (PageNode pageNode : nav.getNodes())
- {
- Page page = userPortalConfigService.getPage(pageNode.getPageReference(), context.getRemoteUser());
- if (page != null)
- {
- defaultNode = pageNode;
- break;
- }
- }
- }
- else
- {
- return null;
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
- if (defaultNode != null && !("notfound".equals(defaultNode.getName())))
- {
- return defaultNode;
- }
- else
- {
- return null;
- }
- }
-
- private List<PageNode> findPath(PageNavigation nav, String[] pathNodes)
- {
- List<PageNode> nodes = new ArrayList<PageNode>(4);
-
- //That happens when user browses to a URL like /portal/public/classic
- if(pathNodes.length == 0)
- {
- nodes.add(getDefaultNode(nav));
- return nodes;
- }
- PageNode startNode = nav.getNode(pathNodes[0]);
- if (startNode == null)
- {
- nodes.add(getDefaultNode(nav));
- return nodes;
- }
- nodes.add(startNode);
- for (int i = 1; i < pathNodes.length; i++)
- {
- startNode = startNode.getChild(pathNodes[i]);
- if(startNode == null)
- {
- break;
- }
- else
- {
- nodes.add(startNode);
- }
- }
- return nodes;
- }
-
- private UIPortal buildUIPortal(PageNavigation newPageNav, UIPortalApplication uiPortalApp, UserPortalConfig userPortalConfig) throws Exception
+ private UIPortal buildUIPortal(SiteKey newPageNav, UIPortalApplication uiPortalApp, UserPortalConfig userPortalConfig) throws Exception
{
DataStorage storage = uiPortalApp.getApplicationComponent(DataStorage.class);
if(storage == null){
return null;
}
- PortalConfig portalConfig = storage.getPortalConfig(newPageNav.getOwnerType(), newPageNav.getOwnerId());
+ PortalConfig portalConfig = storage.getPortalConfig(newPageNav.getTypeName(), newPageNav.getName());
Container layout = portalConfig.getPortalLayout();
if(layout != null)
{
userPortalConfig.setPortal(portalConfig);
}
UIPortal uiPortal = uiPortalApp.createUIComponent(UIPortal.class, null, null);
+
//Reset selected navigation on userPortalConfig
- userPortalConfig.setSelectedNavigation(newPageNav);
PortalDataMapper.toUIPortal(uiPortal, userPortalConfig);
return uiPortal;
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -23,7 +23,7 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComponent;
import org.exoplatform.portal.webui.util.PortalDataMapper;
@@ -69,7 +69,7 @@
setId("UIPageBody");
}
- public void setPageBody(PageNode pageNode, UIPortal uiPortal) throws Exception
+ public void setPageBody(UserNode pageNode, UIPortal uiPortal) throws Exception
{
WebuiRequestContext context = Util.getPortalRequestContext();
uiPortal.setMaximizedUIComponent(null);
@@ -110,7 +110,7 @@
* @param uiPortal
* @return
*/
- private UIPage getUIPage(PageNode pageNode, UIPortal uiPortal, WebuiRequestContext context)
+ private UIPage getUIPage(UserNode pageNode, UIPortal uiPortal, WebuiRequestContext context)
throws Exception
{
Page page = null;
@@ -118,7 +118,7 @@
if (pageNode != null)
{
- pageReference = pageNode.getPageReference();
+ pageReference = pageNode.getPageRef();
if (pageReference != null)
{
ExoContainer appContainer = context.getApplication().getApplicationServiceContainer();
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -35,9 +35,12 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -54,6 +57,7 @@
import org.exoplatform.webui.config.annotation.ParamConfig;
import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.UIRepeater;
import org.exoplatform.webui.core.UISearch;
@@ -66,6 +70,7 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInputItemSelector;
import org.exoplatform.webui.form.UIFormInputSet;
+import org.exoplatform.webui.form.UIFormRadioBoxInput;
import org.exoplatform.webui.form.UIFormSelectBox;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.UISearchForm;
@@ -75,7 +80,6 @@
@EventConfig(listeners = UIPageBrowser.DeleteActionListener.class, confirm = "UIPageBrowse.deletePage"),
@EventConfig(listeners = UIPageBrowser.EditInfoActionListener.class),
@EventConfig(listeners = UIPageBrowser.AddNewActionListener.class)
- // @EventConfig(listeners = UIPageBrowser.BackActionListener.class)
}),
@ComponentConfig(id = "UIBrowserPageForm", type = UIPageForm.class, lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(listeners = UIPageBrowser.SavePageActionListener.class, name = "Save"),
@@ -85,7 +89,7 @@
@EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class, phase = Phase.DECODE)}, initParams = @ParamConfig(name = "PageTemplate", value = "system:/WEB-INF/conf/uiconf/portal/webui/page/PageTemplate.groovy")),
@ComponentConfig(type = UIFormInputSet.class, id = "PermissionSetting", template = "system:/groovy/webui/core/UITabSelector.gtmpl", events = {@EventConfig(listeners = UIFormInputSet.SelectComponentActionListener.class)})})
@Serialized
-public class UIPageBrowser extends UISearch
+public class UIPageBrowser extends UIContainer
{
public static final String[] BEAN_FIELD = {"pageId", "title", "accessPermissions", "editPermission"};
@@ -96,27 +100,29 @@
protected String pageSelectedId_;
- private static List<SelectItemOption<String>> OPTIONS = new ArrayList<SelectItemOption<String>>(3);
+ private static List<SelectItemOption<String>> OPTIONS = new ArrayList<SelectItemOption<String>>(2);
static
{
WebuiRequestContext contextui = WebuiRequestContext.getCurrentInstance();
ResourceBundle res = contextui.getApplicationResourceBundle();
- OPTIONS.add(new SelectItemOption<String>(res.getString("UIPageSearch.label.option.ownerType"), "ownerType"));
- OPTIONS.add(new SelectItemOption<String>(res.getString("UIPageSearch.label.option.ownerId"), "ownerId"));
- OPTIONS.add(new SelectItemOption<String>(res.getString("UIPageSearch.label.option.title"), "title"));
+ OPTIONS.add(new SelectItemOption<String>(res.getString("UIPageSearchForm.label.option.portal"), "portal"));
+ OPTIONS.add(new SelectItemOption<String>(res.getString("UIPageSearchForm.label.option.group"), "group"));
}
private Query<Page> lastQuery_;
public UIPageBrowser() throws Exception
{
- super(OPTIONS);
-
- getChild(UISearchForm.class).setId("UIPageSearch");
+ UIPageSearchForm uiSearchForm = addChild(UIPageSearchForm.class, null, null);
+ uiSearchForm.setOptions(OPTIONS);
+ uiSearchForm.setId("UIPageSearchForm");
UIRepeater uiRepeater = createUIComponent(UIRepeater.class, null, null);
uiRepeater.configure("pageId", BEAN_FIELD, ACTIONS);
+ lastQuery_ = new Query<Page>(null, null, null, null, Page.class);
+ lastQuery_.setOwnerType(OPTIONS.get(0).getValue());
+
UIVirtualList virtualList = addChild(UIVirtualList.class, null, null);
virtualList.setPageSize(10);
virtualList.setUIComponent(uiRepeater);
@@ -127,6 +133,27 @@
return lastQuery_;
}
+ public Query<Page> getQuery(UIFormInputSet searchInputs)
+ {
+ Query<Page> query = new Query<Page>(null, null, null, null, Page.class);
+ UIFormStringInput titleInput = (UIFormStringInput)searchInputs.getChild(0);
+ UIFormStringInput siteNameInput = (UIFormStringInput)searchInputs.getChild(1);
+ UIFormSelectBox select = (UIFormSelectBox)searchInputs.getChild(2);
+
+ String siteName = siteNameInput.getValue();
+ String title = titleInput.getValue();
+ String ownerType = select.getValue();
+ if (title != null && title != "")
+ query.setTitle(title);
+ if (siteName != null && siteName != "")
+ query.setOwnerId(siteName);
+
+ query.setOwnerType(ownerType);
+ query.setName(null);
+
+ return query;
+ }
+
/**
* Update data feed in UIRepeater with a given query.
* Returns false if no result is found, true other wise
@@ -172,20 +199,7 @@
public void quickSearch(UIFormInputSet quickSearchInput) throws Exception
{
- UIFormStringInput input = (UIFormStringInput)quickSearchInput.getChild(0);
- UIFormSelectBox select = (UIFormSelectBox)quickSearchInput.getChild(1);
- String value = input.getValue();
- String selectBoxValue = select.getValue();
- Query<Page> query = new Query<Page>(null, null, null, null, Page.class);
- if (selectBoxValue.equals("title"))
- query.setTitle(value);
- else if (selectBoxValue.equals("ownerType"))
- query.setOwnerType(value);
- else if (selectBoxValue.equals("ownerId"))
- query.setOwnerId(value);
- query.setName(null);
-
- lastQuery_ = query;
+ lastQuery_ = this.getQuery(quickSearchInput);
boolean dataAvailable = feedDataWithQuery(lastQuery_);
if (!dataAvailable)
{
@@ -233,21 +247,6 @@
{
}
- /*
- public void reset() throws Exception
- {
- UIVirtualList virtualList = getChild(UIVirtualList.class);
- UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
- LazyPageList datasource = (LazyPageList)repeater.getDataSource();
- int currentPage = datasource.getCurrentPage();
- feedDataWithQuery(null);
- if (currentPage > datasource.getAvailablePage())
- currentPage = datasource.getAvailablePage();
- if (currentPage > 0)
- datasource.getPage(currentPage);
- }
- */
-
static public class DeleteActionListener extends EventListener<UIPageBrowser>
{
public void execute(Event<UIPageBrowser> event) throws Exception
@@ -276,7 +275,8 @@
}
UIPortal uiPortal = Util.getUIPortal();
- boolean isDeleteCurrentPage = uiPortal.getSelectedNode().getPageReference().equals(page.getPageId());
+ UserNode userNode = uiPortal.getSelectedUserNode();
+ boolean isDeleteCurrentPage = userNode.getPageRef().equals(page.getPageId());
if (isDeleteCurrentPage && page.getOwnerType().equals(PortalConfig.USER_TYPE))
{
ApplicationMessage msg = new ApplicationMessage("UIPageBrowser.msg.delete.DeleteCurrentUserPage", null, ApplicationMessage.WARNING);
@@ -289,6 +289,11 @@
PageListAccess datasource = (PageListAccess)repeater.getDataSource();
int currentPage = datasource.getCurrentPage();
+ //Update navigation and UserToolbarGroupPortlet if deleted page is dashboard page
+ if(page.getOwnerType().equals(PortalConfig.USER_TYPE)){
+ removePageNode(page, event);
+ }
+
dataService.remove(page);
//Minh Hoang TO: The cached UIPage objects corresponding to removed Page should be removed here.
//As we have multiple UIPortal, which means multiple caches of UIPage. It 's unwise to garbage
@@ -298,8 +303,7 @@
if (isDeleteCurrentPage)
{
PageNodeEvent<UIPortal> pnevent =
- new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uiPortal.getSelectedNode()
- .getUri());
+ new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, userNode.getURI());
uiPortal.broadcast(pnevent, Phase.PROCESS);
}
else
@@ -314,17 +318,6 @@
datasource.getPage(currentPage);
event.getRequestContext().addUIComponentToUpdateByAjax(uiPageBrowser);
}
-
- //Update navigation and UserToolbarGroupPortlet if deleted page is dashboard page
- if(page.getOwnerType().equals(PortalConfig.USER_TYPE)){
- removePageNode(page, event);
- }
-
- UIWorkingWorkspace uiWorkingWorkspace = uiPortalApp.getChild(UIWorkingWorkspace.class);
- uiWorkingWorkspace.updatePortletsByName("UserToolbarSitePortlet");
- uiWorkingWorkspace.updatePortletsByName("UserToolbarGroupPortlet");
- uiWorkingWorkspace.updatePortletsByName("UserToolbarDashboardPortlet");
- uiWorkingWorkspace.updatePortletsByName("NavigationPortlet");
}
/**
@@ -339,57 +332,39 @@
*/
private void removePageNode(Page page, Event<UIPageBrowser> event) throws Exception
{
- UIPageBrowser uiPageBrowser = event.getSource();
- DataStorage dataService = uiPageBrowser.getApplicationComponent(DataStorage.class);
-
- PageNavigation pageNavigation = null;
UIPortalApplication portalApplication = Util.getUIPortalApplication();
+ UserPortal userPortal = portalApplication.getUserPortalConfig().getUserPortal();
- List<PageNavigation> listPageNavigation = portalApplication.getNavigations();
-
- for (PageNavigation pageNvg : listPageNavigation)
+ UserNavigation userNav = userPortal.getNavigation(SiteKey.user(event.getRequestContext().getRemoteUser()));
+ UserNode rootNode = userPortal.getNode(userNav, Scope.CHILDREN, null, null);
+ if (rootNode == null)
{
- if (pageNvg.getOwnerType().equals(PortalConfig.USER_TYPE))
- {
- pageNavigation = pageNvg;
- break;
- }
+ return;
}
- UIPortal uiPortal = Util.getUIPortal();
- PageNode tobeRemoved = null;
- List<PageNode> nodes = pageNavigation.getNodes();
- for (PageNode pageNode : nodes)
+ for (UserNode userNode : rootNode.getChildren())
{
- String pageReference = pageNode.getPageReference();
- String pageId = page.getPageId();
-
- if (pageReference != null && pageReference.equals(pageId))
+ if (page.getPageId().equals(userNode.getPageRef()))
{
- tobeRemoved = pageNode;
- break;
- }
- }
+ // Remove pageNode
+ rootNode.removeChild(userNode.getName());
+ userPortal.saveNode(rootNode, null);
- if (tobeRemoved != null)
- {
- // Remove pageNode
- pageNavigation.getNodes().remove(tobeRemoved);
+ // Update navigation and UserToolbarGroupPortlet
- // Update navigation and UserToolbarGroupPortlet
+ String pageRef = page.getPageId();
+ if (pageRef != null && pageRef.length() > 0)
+ {
+ // Remove from cache
+ UIPortal uiPortal = Util.getUIPortal();
+ uiPortal.clearUIPage(pageRef);
+ }
- String pageRef = tobeRemoved.getPageReference();
- if (pageRef != null && pageRef.length() > 0)
- {
- // Remove from cache
- uiPortal.clearUIPage(pageRef);
+ //Update UserToolbarDashboardPortlet
+ ActionResponse actResponse = event.getRequestContext().getResponse();
+ actResponse.setEvent(new QName("NavigationChange"), userNode.getName());
+ return;
}
-
- dataService.save(pageNavigation);
-
- //Update UserToolbarDashboardPortlet
- ActionResponse actResponse = event.getRequestContext().getResponse();
- actResponse.setEvent(new QName("UserPageNodeDeleted"), tobeRemoved.getName());
}
}
}
@@ -439,23 +414,6 @@
}
}
- // TODO: Tan Pham Dinh: No need back action in portal 2.6
- // static public class BackActionListener extends EventListener<UIPageBrowser> {
- //
- // public void execute(Event<UIPageBrowser> event) throws Exception {
- // UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- // uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
- // UIPortal uiPortal = Util.getUIPortal();
- // String uri = uiPortal.getSelectedNavigation().getId() + "::"
- // + uiPortal.getSelectedNode().getUri();
- // PageNodeEvent<UIPortal> pnevent = new PageNodeEvent<UIPortal>(uiPortal,
- // PageNodeEvent.CHANGE_PAGE_NODE,
- // uri);
- // uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
- // }
- //
- // }
-
static public class SavePageActionListener extends UIPageForm.SaveActionListener
{
public void execute(Event<UIPageForm> event) throws Exception
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,18 +19,18 @@
package org.exoplatform.portal.webui.page;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.List;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
@@ -46,6 +46,7 @@
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.form.UIFormStringInput;
/** Created by The eXo Platform SARL Author : Dang Van Minh minhdv81(a)yahoo.com Jun 23, 2006 */
@ComponentConfigs(@ComponentConfig(template = "system:/groovy/webui/core/UIWizard.gtmpl", events = {
@@ -67,81 +68,44 @@
public UIPageCreationWizard() throws Exception
{
- UIWizardPageSetInfo uiPageInfo = addChild(UIWizardPageSetInfo.class, null, null).setRendered(false);
+ addChild(UIWizardPageSetInfo.class, null, null).setRendered(false);
addChild(UIWizardPageSelectLayoutForm.class, null, null).setRendered(false);
addChild(UIPagePreview.class, null, null).setRendered(false);
setNumberSteps(NUMBER_OF_STEPs);
viewStep(FIRST_STEP);
setShowWelcomeComponent(false);
- boolean isUserNav = Util.getUIPortal().getSelectedNavigation().getOwnerType().equals(PortalConfig.USER_TYPE);
- if (isUserNav)
+ }
+
+ public void configure(UserNode node) throws Exception
+ {
+ UIPageNodeSelector nodeSelector = findFirstComponentOfType(UIPageNodeSelector.class);
+ nodeSelector.configure(node);
+ if (node.getNavigation().getKey().getTypeName().equals(PortalConfig.USER_TYPE))
{
- uiPageInfo.getChild(UIPageNodeSelector.class).setRendered(false);
+ nodeSelector.setRendered(false);
}
}
-
- private void saveData() throws Exception
+
+ private UserNode saveData() throws Exception
{
UIPagePreview uiPagePreview = getChild(UIPagePreview.class);
UIPage uiPage = (UIPage)uiPagePreview.getUIComponent();
-
UIWizardPageSetInfo uiPageInfo = getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
- PageNavigation pageNav = uiNodeSelector.getSelectedNavigation();
-
- // reload page navigation
- DataStorage dataService = getApplicationComponent(DataStorage.class);
- pageNav = dataService.getPageNavigation(pageNav.getOwnerType(), pageNav.getOwnerId());
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- setNavigation(uiPortalApp.getNavigations(), pageNav);
- uiPortalApp.localizeNavigations();
- UIPortal uiPortal = Util.getUIPortal();
- uiPortal.setNavigation(pageNav);
- uiNodeSelector.selectNavigation(pageNav);
- if (selectedNode != null)
- {
- uiNodeSelector.selectPageNodeByUri(selectedNode.getUri());
- selectedNode = uiNodeSelector.getSelectedPageNode();
- }
-
- if (PortalConfig.USER_TYPE.equals(pageNav.getOwnerType()))
- selectedNode = null;
+ UserNode selectedNode = uiNodeSelector.getSelectedNode();
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
- PageNode pageNode = uiPageInfo.getPageNode();
- pageNode.setPageReference(page.getPageId());
- if (selectedNode != null)
- {
- List<PageNode> children = selectedNode.getChildren();
- if (children == null)
- {
- children = new ArrayList<PageNode>();
- }
- children.add(pageNode);
- selectedNode.setChildren((ArrayList<PageNode>)children);
- }
- else
- {
- pageNav.addNode(pageNode);
- }
- uiNodeSelector.selectPageNodeByUri(pageNode.getUri());
-
+ UserNode createdNode = uiPageInfo.createUserNode(selectedNode);
+
+ createdNode.setPageRef(page.getPageId());
+ DataStorage dataService = getApplicationComponent(DataStorage.class);
dataService.create(page);
- dataService.save(pageNav);
- }
- private void setNavigation(List<PageNavigation> navs, PageNavigation nav)
- {
- for (int i = 0; i < navs.size(); i++)
- {
- if (navs.get(i).getId() == nav.getId())
- {
- navs.set(i, nav);
- return;
- }
- }
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ userPortal.saveNode(selectedNode, null);
+ return createdNode;
+
}
/**
@@ -154,29 +118,12 @@
private boolean isSelectedNodeExist() throws Exception
{
UIWizardPageSetInfo uiPageSetInfo = getChild(UIWizardPageSetInfo.class);
- PageNavigation navigation = uiPageSetInfo.getChild(UIPageNodeSelector.class).getSelectedNavigation();
- PageNode pageNode = uiPageSetInfo.getPageNode();
- PageNode selectedPageNode = uiPageSetInfo.getSelectedPageNode();
- List<PageNode> sibbling = null;
- if (selectedPageNode != null)
+ String pageName = uiPageSetInfo.getUIStringInput(UIWizardPageSetInfo.PAGE_NAME).getValue();
+ UserNode selectedPageNode = uiPageSetInfo.getSelectedPageNode();
+ if (selectedPageNode.getChild(pageName) != null)
{
- sibbling = selectedPageNode.getChildren();
+ return true;
}
- else
- {
- sibbling = navigation.getNodes();
- }
- if (sibbling != null)
- {
- for (PageNode ele : sibbling)
- {
- if (ele.getUri().equals(pageNode.getUri()))
- {
- return true;
- }
- }
- }
-
return false;
}
@@ -226,7 +173,7 @@
UIWizardPageSetInfo uiPageSetInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageSetInfo.getChild(UIPageNodeSelector.class);
uiWizard.updateWizardComponent();
- PageNavigation navigation = uiNodeSelector.getSelectedNavigation();
+ UserNavigation navigation = uiNodeSelector.getNavigation();
if (navigation == null)
{
uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.notSelectedPageNavigation",
@@ -329,14 +276,14 @@
UIWizardPageSetInfo uiPageInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
- PageNavigation pageNavi = uiNodeSelector.getSelectedNavigation();
- String ownerType = pageNavi.getOwnerType();
- String ownerId = pageNavi.getOwnerId();
+ UserNavigation pageNavi = uiNodeSelector.getNavigation();
+ String ownerType = pageNavi.getKey().getTypeName();
+ String ownerId = pageNavi.getKey().getName();
- PageNode pageNode = uiPageInfo.getPageNode();
+ UIFormStringInput pageName = uiPageInfo.getUIStringInput(UIWizardPageSetInfo.PAGE_NAME);
Page page = uiPageTemplateOptions.createPageFromSelectedOption(ownerType, ownerId);
page.setName("page" + page.hashCode());
- String pageId = pageNavi.getOwnerType() + "::" + pageNavi.getOwnerId() + "::" + page.getName();
+ String pageId = ownerType + "::" + ownerId + "::" + page.getName();
DataStorage storage = uiWizard.getApplicationComponent(DataStorage.class);
if (storage.getPage(pageId) != null)
{
@@ -351,7 +298,7 @@
if (page.getTitle() == null || page.getTitle().trim().length() == 0)
{
- page.setTitle(pageNode.getName());
+ page.setTitle(pageName.getValue());
}
UIPagePreview uiPagePreview = uiWizard.getChild(UIPagePreview.class);
@@ -385,16 +332,24 @@
}
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- uiWizard.saveData();
- UIPortalToolPanel toolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
- toolPanel.setUIComponent(null);
- uiWizard.updateUIPortal(event);
- UIWizardPageSetInfo uiPageInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
- UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
PortalRequestContext pcontext = Util.getPortalRequestContext();
- String uri = pcontext.getPortalURI() + selectedNode.getUri();
+ String uri = pcontext.getPortalURI();
+
+ try
+ {
+ UserNode newNode = uiWizard.saveData();
+ uri += newNode.getURI();
+ }
+ catch (NavigationServiceException ex)
+ {
+ pcontext.getUIApplication().addMessage(
+ new ApplicationMessage("UIPageCreationWizard.msg." + ex.getError().name(), null));
+ }
+
+ UIPortalToolPanel toolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
+ toolPanel.setUIComponent(null);
+ uiWizard.updateUIPortal(event);
pcontext.getResponse().sendRedirect(uri);
}
}
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,507 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.page;
-
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
-import org.exoplatform.portal.webui.navigation.ParentChildPair;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIPopupWindow;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.webui.event.Event.Phase;
-import org.exoplatform.webui.exception.MessageException;
-import org.exoplatform.webui.form.UIFormCheckBoxInput;
-import org.exoplatform.webui.form.UIFormDateTimeInput;
-import org.exoplatform.webui.form.UIFormInputBase;
-import org.exoplatform.webui.form.UIFormInputIconSelector;
-import org.exoplatform.webui.form.UIFormInputSet;
-import org.exoplatform.webui.form.UIFormStringInput;
-import org.exoplatform.webui.form.UIFormTabPane;
-import org.exoplatform.webui.form.validator.DateTimeValidator;
-import org.exoplatform.webui.form.validator.IdentifierValidator;
-import org.exoplatform.webui.form.validator.MandatoryValidator;
-import org.exoplatform.webui.form.validator.StringLengthValidator;
-import org.exoplatform.webui.form.validator.Validator;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-/**
- * Author : Dang Van Minh, Pham Tuan minhdv81(a)yahoo.com Jun 14, 2006
- */
-public class UIPageNodeForm extends UIFormTabPane
-{
-
- private PageNode pageNode_;
-
- private String owner_;
-
- private String ownerType_;
-
- private Object selectedParent;
-
- /**
- * Wrapper of editted PageNode and its parent
- */
- private ParentChildPair contextParentChildPair;
-
- /**
- * PageNavigation to which editted PageNode belongs
- */
- private PageNavigation contextPageNavigation;
-
- final private static String SHOW_PUBLICATION_DATE = "showPublicationDate";
-
- final private static String START_PUBLICATION_DATE = "startPublicationDate";
-
- final private static String END_PUBLICATION_DATE = "endPublicationDate";
-
- final private static String VISIBLE = "visible";
-
- public UIPageNodeForm() throws Exception
- {
- super("UIPageNodeForm");
-
- UIFormInputSet uiSettingSet = new UIFormInputSet("PageNodeSetting");
- UIFormCheckBoxInput<Boolean> uiDateInputCheck =
- new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, SHOW_PUBLICATION_DATE, false);
- UIFormCheckBoxInput<Boolean> uiVisibleCheck = new UIFormCheckBoxInput<Boolean>(VISIBLE, VISIBLE, true);
-
- uiDateInputCheck.setOnChange("SwitchPublicationDate");
- uiVisibleCheck.setOnChange("SwitchVisible");
- uiSettingSet.addUIFormInput(new UIFormStringInput("uri", "uri", null).setEditable(false))
- .addUIFormInput(new UIFormStringInput("name", "name", null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class))
- .addUIFormInput(new UIFormStringInput("label", "label", null).addValidator(StringLengthValidator.class, 3, 120))
- .addUIFormInput(uiVisibleCheck.setChecked(true))
- .addUIFormInput(uiDateInputCheck)
- .addUIFormInput(new UIFormDateTimeInput(START_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class))
- .addUIFormInput(new UIFormDateTimeInput(END_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class));
-
- addUIFormInput(uiSettingSet);
- setSelectedTab(uiSettingSet.getId());
-
- UIPageSelector2 uiPageSelector = createUIComponent(UIPageSelector2.class, null, null);
- uiPageSelector.configure("UIPageSelector2", "pageReference");
- addUIFormInput(uiPageSelector);
-
- UIFormInputIconSelector uiIconSelector = new UIFormInputIconSelector("Icon", "icon");
- addUIFormInput(uiIconSelector);
- setActions(new String[]{"Save", "Back"});
- }
-
- public PageNode getPageNode()
- {
- return pageNode_;
- }
-
- public void setValues(PageNode pageNode) throws Exception
- {
- pageNode_ = pageNode;
- if (pageNode == null)
- {
- getUIStringInput("name").setEditable(UIFormStringInput.ENABLE);
- getChild(UIFormInputIconSelector.class).setSelectedIcon("Default");
- setShowPublicationDate(false);
- return;
- }
- getUIStringInput("name").setEditable(UIFormStringInput.DISABLE);
- invokeGetBindingBean(pageNode_);
- }
-
- public void invokeGetBindingBean(Object bean) throws Exception
- {
- super.invokeGetBindingBean(bean);
- PageNode pageNode = (PageNode)bean;
- String icon = pageNode_.getIcon();
- if (icon == null || icon.length() < 0)
- icon = "Default";
- getChild(UIFormInputIconSelector.class).setSelectedIcon(icon);
- getUIStringInput("label").setValue(pageNode_.getLabel());
- if(pageNode.getVisibility() == Visibility.SYSTEM)
- {
- UIFormInputSet uiSettingSet = getChildById("PageNodeSetting");
- uiSettingSet.removeChildById(VISIBLE);
- uiSettingSet.removeChildById(SHOW_PUBLICATION_DATE);
- uiSettingSet.removeChildById(START_PUBLICATION_DATE);
- uiSettingSet.removeChildById(END_PUBLICATION_DATE);
- }
- else
- {
- getUIFormCheckBoxInput(VISIBLE).setChecked(pageNode_.isVisible());
- getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).setChecked(pageNode.isShowPublicationDate());
- setShowCheckPublicationDate(pageNode_.isVisible());
- Calendar cal = Calendar.getInstance();
- if (pageNode.getStartPublicationDate() != null)
- {
- cal.setTime(pageNode.getStartPublicationDate());
- getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
- }
- else
- getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
- if (pageNode.getEndPublicationDate() != null)
- {
- cal.setTime(pageNode.getEndPublicationDate());
- getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
- }
- else
- getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
- }
-
- }
-
- public void invokeSetBindingBean(Object bean) throws Exception
- {
- super.invokeSetBindingBean(bean);
- PageNode node = (PageNode) bean;
- if (node.getVisibility() != Visibility.SYSTEM)
- {
- Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
- Date date = (cal != null) ? cal.getTime() : null;
- node.setStartPublicationDate(date);
- cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
- date = (cal != null) ? cal.getTime() : null;
- node.setEndPublicationDate(date);
- }
- }
-
- public void setShowCheckPublicationDate(boolean show)
- {
- getUIFormCheckBoxInput(VISIBLE).setChecked(show);
- UIFormCheckBoxInput<Boolean> uiForm = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
- uiForm.setRendered(show);
- setShowPublicationDate(show && uiForm.isChecked());
- }
-
- public void setShowPublicationDate(boolean show)
- {
- getUIFormDateTimeInput(START_PUBLICATION_DATE).setRendered(show);
- getUIFormDateTimeInput(END_PUBLICATION_DATE).setRendered(show);
- }
-
- public Object getSelectedParent()
- {
- return selectedParent;
- }
-
- public void setSelectedParent(Object obj)
- {
- this.selectedParent = obj;
- }
-
- public void setContextParentChildPair(ParentChildPair _contextParentChildPair)
- {
- this.contextParentChildPair = _contextParentChildPair;
- }
-
- public ParentChildPair getContextParentChildPair()
- {
- return this.contextParentChildPair;
- }
-
- public void processRender(WebuiRequestContext context) throws Exception
- {
- super.processRender(context);
-
- UIPageSelector2 uiPageSelector = getChild(UIPageSelector2.class);
- if (uiPageSelector == null)
- return;
- UIPopupWindow uiPopupWindowPage = uiPageSelector.getChild(UIPopupWindow.class);
- if (uiPopupWindowPage == null)
- return;
- uiPopupWindowPage.processRender(context);
- }
-
- public String getOwner()
- {
- return contextPageNavigation.getOwnerId();
- }
-
- public String getOwnerType()
- {
- return contextPageNavigation.getOwnerType();
- }
-
- public void setContextPageNavigation(PageNavigation _contextPageNav)
- {
- this.contextPageNavigation = _contextPageNav;
- }
-
- public PageNavigation getContextPageNavigation()
- {
- return this.contextPageNavigation;
- }
-
- static public class SaveActionListener extends EventListener<UIPageNodeForm>
- {
- public void execute(Event<UIPageNodeForm> event) throws Exception
- {
- WebuiRequestContext ctx = event.getRequestContext();
- UIPageNodeForm uiPageNodeForm = event.getSource();
- UIApplication uiPortalApp = ctx.getUIApplication();
- PageNode pageNode = uiPageNodeForm.getPageNode();
- if (pageNode == null)
- pageNode = new PageNode();
-
- if (pageNode.getVisibility() != Visibility.SYSTEM && uiPageNodeForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked())
- {
- Calendar currentCalendar = Calendar.getInstance();
- currentCalendar.set(currentCalendar.get(Calendar.YEAR), currentCalendar.get(Calendar.MONTH), currentCalendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
- Date currentDate = currentCalendar.getTime();
-
- Calendar startCalendar =
- uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.START_PUBLICATION_DATE).getCalendar();
- Date startDate = startCalendar != null ? startCalendar.getTime() : currentDate;
- Calendar endCalendar =
- uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.END_PUBLICATION_DATE).getCalendar();
- Date endDate = endCalendar != null ? endCalendar.getTime() : null;
-
- // Case 1: current date after start date
- if (currentDate.after(startDate))
- {
- Object[] args = {};
- uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeStartDate", args, ApplicationMessage.WARNING));
- return;
- }
- // Case 2: start date after end date
- else if ((endCalendar != null) && (startCalendar != null) && (startDate.after(endDate)))
- {
- Object[] args = {};
- uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.startDateBeforeEndDate", args, ApplicationMessage.WARNING));
- return;
- }
- // Case 3: start date is null and current date after end date
- else if((endCalendar != null) && (currentDate.after(endDate)))
- {
- Object[] args = {};
- uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeEndDate", args, ApplicationMessage.WARNING));
- return;
- }
-
- }
-
- uiPageNodeForm.invokeSetBindingBean(pageNode);
- UIPageSelector2 pageSelector = uiPageNodeForm.getChild(UIPageSelector2.class);
- if (pageSelector.getPage() == null)
- pageNode.setPageReference(null);
- UIFormInputIconSelector uiIconSelector = uiPageNodeForm.getChild(UIFormInputIconSelector.class);
- if (uiIconSelector.getSelectedIcon().equals("Default"))
- pageNode.setIcon(null);
- else
- pageNode.setIcon(uiIconSelector.getSelectedIcon());
- if (pageNode.getLabel() == null)
- pageNode.setLabel(pageNode.getName());
-
- Object selectedParent = uiPageNodeForm.getSelectedParent();
- PageNavigation pageNav = null;
-
- if (selectedParent instanceof PageNavigation)
- {
- pageNav = (PageNavigation)selectedParent;
- pageNode.setUri(pageNode.getName());
- if (!pageNav.getNodes().contains(pageNode))
- {
- if (PageNavigationUtils.searchPageNodeByUri(pageNav, pageNode.getUri()) != null)
- {
- uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.SameName", null));
- return;
- }
- pageNav.addNode(pageNode);
- }
- }
- else if (selectedParent instanceof PageNode)
- {
- PageNode parentNode = (PageNode)selectedParent;
- List<PageNode> children = parentNode.getChildren();
- if (children == null)
- {
- children = new ArrayList<PageNode>();
- parentNode.setChildren((ArrayList<PageNode>)children);
- }
- pageNode.setUri(parentNode.getUri() + "/" + pageNode.getName());
- if (!children.contains(pageNode))
- {
- if (PageNavigationUtils.searchPageNodeByUri(parentNode, pageNode.getUri()) != null)
- {
- uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.SameName", null));
- return;
- }
- children.add(pageNode);
- }
- }
- uiPageNodeForm.createEvent("Back", Phase.DECODE, ctx).broadcast();
- }
- }
-
- static public class BackActionListener extends EventListener<UIPageNodeForm>
- {
-
- public void execute(Event<UIPageNodeForm> event) throws Exception
- {
- }
-
- }
-
- static public class SwitchPublicationDateActionListener extends EventListener<UIPageNodeForm>
- {
- public void execute(Event<UIPageNodeForm> event) throws Exception
- {
- UIPageNodeForm uiForm = event.getSource();
- boolean isCheck = uiForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked();
- uiForm.setShowPublicationDate(isCheck);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
- }
- }
-
- static public class SwitchVisibleActionListener extends EventListener<UIPageNodeForm>
- {
- @Override
- public void execute(Event<UIPageNodeForm> event) throws Exception
- {
- UIPageNodeForm uiForm = event.getSource();
- boolean isCheck = uiForm.getUIFormCheckBoxInput(VISIBLE).isChecked();
- uiForm.setShowCheckPublicationDate(isCheck);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
- }
- }
-
- static public class ClearPageActionListener extends EventListener<UIPageNodeForm>
- {
- public void execute(Event<UIPageNodeForm> event) throws Exception
- {
- UIPageNodeForm uiForm = event.getSource();
- UIPageSelector2 pageSelector = uiForm.findFirstComponentOfType(UIPageSelector2.class);
- pageSelector.setPage(null);
- event.getRequestContext().addUIComponentToUpdateByAjax(pageSelector);
- }
- }
-
- static public class CreatePageActionListener extends EventListener<UIPageNodeForm>
- {
- public void execute(Event<UIPageNodeForm> event) throws Exception
- {
- UIPageNodeForm uiForm = event.getSource();
- UIPageSelector2 pageSelector = uiForm.findFirstComponentOfType(UIPageSelector2.class);
-
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
-
- UIFormInputSet uiInputSet = pageSelector.getChild(UIFormInputSet.class);
- List<UIComponent> children = uiInputSet.getChildren();
- /*********************************************************************/
- for (UIComponent uiChild : children)
- {
- if (uiChild instanceof UIFormInputBase)
- {
- UIFormInputBase uiInput = (UIFormInputBase)uiChild;
- if (!uiInput.isValid())
- continue;
- List<Validator> validators = uiInput.getValidators();
- if (validators == null)
- continue;
- try
- {
- for (Validator validator : validators)
- validator.validate(uiInput);
- }
- catch (MessageException ex)
- {
- uiPortalApp.addMessage(ex.getDetailMessage());
- return;
- }
- catch (Exception ex)
- {
- //TODO: This is a critical exception and should be handle in the UIApplication
- uiPortalApp.addMessage(new ApplicationMessage(ex.getMessage(), null));
- return;
- }
- }
- }
-
- UserACL userACL = uiForm.getApplicationComponent(UserACL.class);
-
- String ownerId = uiForm.getOwner();
- String[] accessPermission = new String[1];
- accessPermission[0] = "*:" + ownerId;
- String editPermission = userACL.getMakableMT() + ":" + ownerId;
-
- if (PortalConfig.PORTAL_TYPE.equals(uiForm.getOwnerType()))
- {
- UIPortal uiPortal = Util.getUIPortal();
- accessPermission = uiPortal.getAccessPermissions();
- editPermission = uiPortal.getEditPermission();
- }
-
-
- UIFormStringInput uiPageName = uiInputSet.getChildById("pageName");
- UIFormStringInput uiPageTitle = uiInputSet.getChildById("pageTitle");
-
- Page page = new Page();
- page.setOwnerType(uiForm.getOwnerType());
- page.setOwnerId(ownerId);
- page.setName(uiPageName.getValue());
- String title = uiPageTitle.getValue();;
- if (title == null || title.trim().length() < 1)
- title = page.getName();
- page.setTitle(title);
-
- page.setShowMaxWindow(false);
-
- page.setAccessPermissions(accessPermission);
- page.setEditPermission(editPermission);
-
- userACL.hasPermission(page);
-
- page.setModifiable(true);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
-
- // check page is exist
- DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
- Page existPage = dataService.getPage(page.getPageId());
- if (existPage != null)
- {
- uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));
- pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
- return;
- }
-
- // save page to database
- dataService.create(page);
- pageSelector.setValue(page.getPageId());
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSearchForm.java (from rev 6783, portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSearchForm.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSearchForm.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSearchForm.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -0,0 +1,79 @@
+/**
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.webui.page;
+
+import org.exoplatform.commons.serialization.api.annotations.Serialized;
+import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
+import org.exoplatform.webui.core.model.SelectItemOption;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.form.UIForm;
+import org.exoplatform.webui.form.UIFormInputSet;
+import org.exoplatform.webui.form.UIFormSelectBox;
+import org.exoplatform.webui.form.UIFormStringInput;
+
+import java.util.List;
+
+/**
+ * @author <a href="kienna(a)exoplatform.com">Kien Nguyen</a>
+ * @version $Revision$
+ */
+@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/portal/webui/page/UIPageSearchForm.gtmpl",
+ events = @EventConfig(listeners = UIPageSearchForm.QuickSearchActionListener.class))
+@Serialized
+public class UIPageSearchForm extends UIForm
+{
+ /**
+ * The name of the quick search set
+ */
+ final static public String QUICK_SEARCH_SET = "QuickSearchSet";
+
+ public UIPageSearchForm() throws Exception
+ {
+ UIFormInputSet uiQuickSearchSet = new UIFormInputSet(QUICK_SEARCH_SET);
+ uiQuickSearchSet.addUIFormInput(new UIFormStringInput("pageTitle", "pageTitle", null));
+ uiQuickSearchSet.addUIFormInput(new UIFormStringInput("siteName", "siteName", null));
+ uiQuickSearchSet.addUIFormInput(new UIFormSelectBox("searchOption", null, null));
+ addChild(uiQuickSearchSet);
+ }
+
+ public void setOptions(List<SelectItemOption<String>> options)
+ {
+ UIFormSelectBox uiSelect = (UIFormSelectBox)getQuickSearchInputSet().getChild(2);
+ uiSelect.setOptions(options);
+ }
+
+ public UIFormInputSet getQuickSearchInputSet()
+ {
+ return (UIFormInputSet)getChild(0);
+ }
+
+ static public class QuickSearchActionListener extends EventListener<UIPageSearchForm>
+ {
+ public void execute(Event<UIPageSearchForm> event) throws Exception
+ {
+ UIPageSearchForm uiForm = event.getSource();
+ UIPageBrowser uiSearch = uiForm.getParent();
+ uiSearch.quickSearch(uiForm.getQuickSearchInputSet());
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiSearch);
+ }
+ }
+}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -30,6 +30,8 @@
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.UIRepeater;
import org.exoplatform.webui.core.UIVirtualList;
import org.exoplatform.webui.event.Event;
@@ -37,16 +39,22 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
import org.exoplatform.webui.form.UIFormInputContainer;
+import org.exoplatform.webui.form.UIFormInputSet;
import org.exoplatform.webui.form.UIFormPopupWindow;
+import org.exoplatform.webui.form.UIFormStringInput;
+import org.exoplatform.webui.form.validator.IdentifierValidator;
+import org.exoplatform.webui.form.validator.MandatoryValidator;
+import org.exoplatform.webui.form.validator.StringLengthValidator;
+import java.util.List;
/**
- * Author : Dang Van Minh
- * minhdv81(a)yahoo.com
- * Jun 14, 2006
+ * Author : Dang Van Minh minhdv81(a)yahoo.com Jun 14, 2006
*/
@ComponentConfigs({
- @ComponentConfig(template = "system:/groovy/portal/webui/page/UIPageSelector.gtmpl"),
- @ComponentConfig(id = "SelectPage", type = UIPageBrowser.class, template = "system:/groovy/portal/webui/page/UIPageBrowser.gtmpl", events = @EventConfig(listeners = UIPageSelector.SelectPageActionListener.class))})
+ @ComponentConfig(template = "system:/groovy/portal/webui/page/UIPageSelector.gtmpl", events = @EventConfig(listeners = UIPageSelector.OpenSelectPagePopUp.class)),
+ @ComponentConfig(id = "SelectPage", type = UIPageBrowser.class, template = "system:/groovy/portal/webui/page/UIPageBrowser.gtmpl", events = @EventConfig(listeners = UIPageSelector.SelectPageActionListener.class)),
+ @ComponentConfig(type = UIFormPopupWindow.class, template = "system:/groovy/webui/core/UIPopupWindow.gtmpl",
+ events = @EventConfig(listeners = UIPageSelector.CloseActionListener.class, name = "CloseFormPopup", phase = Event.Phase.DECODE))})
public class UIPageSelector extends UIFormInputContainer<String>
{
@@ -57,15 +65,19 @@
public UIPageSelector() throws Exception
{
super("UIPageSelector", null);
- UIFormPopupWindow uiPopup = addChild(UIFormPopupWindow.class, null, "PopupPageSelector");
+ UIFormPopupWindow uiPopup = addChild(UIFormPopupWindow.class, null, "PopupPageSelector2");
uiPopup.setWindowSize(900, 400);
- uiPopup.setRendered(false);
- UIPageBrowser uiPageBrowser = createUIComponent(UIPageBrowser.class, "SelectPage", null);
- uiPopup.setUIComponent(uiPageBrowser);
- //UIGrid uiGrid = uiPageBrowser.getChild(UIGrid.class);
- //uiGrid.configure("pageId", UIPageBrowser.BEAN_FIELD, new String[]{"SelectPage"});
- UIVirtualList uiVirtualList = uiPageBrowser.getChild(UIVirtualList.class);
- configureVirtualList(uiVirtualList);
+ uiPopup.setShow(false);
+
+ UIFormInputSet uiInputSet = new UIFormInputSet("PageNodeSetting");
+
+ uiInputSet.addChild(new UIFormStringInput("pageId", "pageId", null));
+ uiInputSet.addChild(new UIFormStringInput("pageName", "pageName", null).addValidator(StringLengthValidator.class,
+ 3, 30).addValidator(IdentifierValidator.class).addValidator(MandatoryValidator.class));
+ uiInputSet.addChild(new UIFormStringInput("pageTitle", "pageTitle", null).addValidator(
+ StringLengthValidator.class, 3, 120));
+
+ addChild(uiInputSet);
}
private static void configureVirtualList(UIVirtualList vList)
@@ -118,9 +130,56 @@
{
super.processDecode(context);
UIPageBrowser uiPageBrowser = findFirstComponentOfType(UIPageBrowser.class);
- uiPageBrowser.processDecode(context);
+ if (uiPageBrowser != null)
+ {
+ uiPageBrowser.processDecode(context);
+ }
+
+ UIFormInputSet uiInputSet = getChild(UIFormInputSet.class);
+
+ List<UIComponent> children = uiInputSet.getChildren();
+ for (UIComponent ele : children)
+ {
+ ele.processDecode(context);
+ }
+ // UIFormStringInput uiPageId = getChildById("pageId");
+ // uiPageId.processDecode(context);
+ //
+ // UIFormStringInput uiPageName = getChildById("pageName");
+ // uiPageName.processDecode(context);
+ //
+ // UIFormStringInput uiPageTitle = getChildById("pageTitle");
+ // uiPageTitle.processDecode(context);
}
+ static public class OpenSelectPagePopUp extends EventListener<UIPageSelector>
+ {
+ @Override
+ public void execute(Event<UIPageSelector> event) throws Exception
+ {
+ UIPageSelector pageSelector = event.getSource();
+ UIFormPopupWindow uiPopup = pageSelector.getChild(UIFormPopupWindow.class);
+
+ UIPageBrowser uiPageBrowser = pageSelector.createUIComponent(UIPageBrowser.class, "SelectPage", null);
+ uiPopup.setUIComponent(uiPageBrowser);
+ uiPopup.setShow(true);
+
+ UIVirtualList uiVirtualList = uiPageBrowser.getChild(UIVirtualList.class);
+ configureVirtualList(uiVirtualList);
+ }
+ }
+
+ static public class CloseActionListener extends UIFormPopupWindow.CloseActionListener
+ {
+ @Override
+ public void execute(Event<UIPopupWindow> event) throws Exception
+ {
+ UIPopupWindow popWindow = event.getSource();
+ popWindow.setUIComponent(null);
+ super.execute(event);
+ }
+ }
+
static public class SelectPageActionListener extends EventListener<UIPageBrowser>
{
public void execute(Event<UIPageBrowser> event) throws Exception
@@ -137,7 +196,7 @@
uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.NoPermission", new String[]{id}));;
}
uiPageSelector.setValue(id);
- uiPageBrowser.feedDataWithQuery(null);
+// uiPageBrowser.feedDataWithQuery(null);
UIForm uiForm = uiPageSelector.getAncestorOfType(UIForm.class);
if (uiForm != null)
@@ -149,6 +208,7 @@
ctx.addUIComponentToUpdateByAjax(uiPageSelector.getParent());
}
UIFormPopupWindow uiPopup = uiPageSelector.getChild(UIFormPopupWindow.class);
+ uiPopup.setUIComponent(null);
uiPopup.setShow(false);
}
}
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -1,186 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.page;
-
-import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
-import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIRepeater;
-import org.exoplatform.webui.core.UIVirtualList;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.webui.form.UIForm;
-import org.exoplatform.webui.form.UIFormInput;
-import org.exoplatform.webui.form.UIFormInputContainer;
-import org.exoplatform.webui.form.UIFormInputSet;
-import org.exoplatform.webui.form.UIFormPopupWindow;
-import org.exoplatform.webui.form.UIFormStringInput;
-import org.exoplatform.webui.form.validator.IdentifierValidator;
-import org.exoplatform.webui.form.validator.MandatoryValidator;
-import org.exoplatform.webui.form.validator.StringLengthValidator;
-
-import java.util.List;
-
-/**
- * Author : Dang Van Minh minhdv81(a)yahoo.com Jun 14, 2006
- */
-@ComponentConfigs({
- @ComponentConfig(template = "system:/groovy/portal/webui/page/UIPageSelector2.gtmpl"),
- @ComponentConfig(id = "SelectPage", type = UIPageBrowser.class, template = "system:/groovy/portal/webui/page/UIPageBrowser.gtmpl", events = @EventConfig(listeners = UIPageSelector2.SelectPageActionListener.class))})
-public class UIPageSelector2 extends UIFormInputContainer<String>
-{
-
- private Page page_;
-
- private static Log logger = ExoLogger.getExoLogger(UIPageSelector2.class);
-
- public UIPageSelector2() throws Exception
- {
- super("UIPageSelector2", null);
- UIFormPopupWindow uiPopup = addChild(UIFormPopupWindow.class, null, "PopupPageSelector2");
- uiPopup.setWindowSize(900, 400);
- uiPopup.setRendered(false);
- UIPageBrowser uiPageBrowser = createUIComponent(UIPageBrowser.class, "SelectPage", null);
- uiPopup.setUIComponent(uiPageBrowser);
-
- UIFormInputSet uiInputSet = new UIFormInputSet("PageNodeSetting");
-
- uiInputSet.addChild(new UIFormStringInput("pageId", "pageId", null));
- uiInputSet.addChild(new UIFormStringInput("pageName", "pageName", null).addValidator(StringLengthValidator.class,
- 3, 30).addValidator(IdentifierValidator.class).addValidator(MandatoryValidator.class));
- uiInputSet.addChild(new UIFormStringInput("pageTitle", "pageTitle", null).addValidator(
- StringLengthValidator.class, 3, 120));
-
- addChild(uiInputSet);
- UIVirtualList uiVirtualList = uiPageBrowser.getChild(UIVirtualList.class);
- configureVirtualList(uiVirtualList);
- }
-
- private static void configureVirtualList(UIVirtualList vList)
- {
- UIRepeater repeater;
- try
- {
- repeater = (UIRepeater)vList.getUIComponent();
- repeater.configure("pageId", UIPageBrowser.BEAN_FIELD, new String[]{"SelectPage"});
- }
- catch (ClassCastException clCastEx)
- {
- logger.info("Could not upcast to UIRepeater", clCastEx);
- }
- }
-
- public void configure(String iname, String bfield)
- {
- setId(iname);
- setName(iname);
- setBindingField(bfield);
- }
-
- public UIFormInput<?> setValue(String value) throws Exception
- {
- WebuiRequestContext ctx = WebuiRequestContext.getCurrentInstance();
- UserPortalConfigService service = getApplicationComponent(UserPortalConfigService.class);
- Page page = service.getPage(value, ctx.getRemoteUser());
- page_ = page;
- super.setValue(value);
- return this;
- }
-
- public Page getPage()
- {
- return page_;
- }
-
- public void setPage(Page page)
- {
- page_ = page;
- }
-
- public Class<String> getTypeValue()
- {
- return String.class;
- }
-
- public void processDecode(WebuiRequestContext context) throws Exception
- {
- super.processDecode(context);
- UIPageBrowser uiPageBrowser = findFirstComponentOfType(UIPageBrowser.class);
- uiPageBrowser.processDecode(context);
-
- UIFormInputSet uiInputSet = getChild(UIFormInputSet.class);
-
- List<UIComponent> children = uiInputSet.getChildren();
- for (UIComponent ele : children)
- {
- ele.processDecode(context);
- }
- // UIFormStringInput uiPageId = getChildById("pageId");
- // uiPageId.processDecode(context);
- //
- // UIFormStringInput uiPageName = getChildById("pageName");
- // uiPageName.processDecode(context);
- //
- // UIFormStringInput uiPageTitle = getChildById("pageTitle");
- // uiPageTitle.processDecode(context);
- }
-
- static public class SelectPageActionListener extends EventListener<UIPageBrowser>
- {
- public void execute(Event<UIPageBrowser> event) throws Exception
- {
- UIPageBrowser uiPageBrowser = event.getSource();
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- WebuiRequestContext ctx = event.getRequestContext();
- UIApplication uiApp = ctx.getUIApplication();
- UIPageSelector2 uiPageSelector = uiPageBrowser.getAncestorOfType(UIPageSelector2.class);
- UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);
- UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
- if (!userACL.hasPermission(service.getPage(id)))
- {
- uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.NoPermission", new String[]{id}));;
- }
- uiPageSelector.setValue(id);
- uiPageBrowser.feedDataWithQuery(null);
-
- UIForm uiForm = uiPageSelector.getAncestorOfType(UIForm.class);
- if (uiForm != null)
- {
- ctx.addUIComponentToUpdateByAjax(uiForm.getParent());
- }
- else
- {
- ctx.addUIComponentToUpdateByAjax(uiPageSelector.getParent());
- }
- UIFormPopupWindow uiPopup = uiPageSelector.getChild(UIFormPopupWindow.class);
- uiPopup.setShow(false);
- }
- }
-
-}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,22 +19,18 @@
package org.exoplatform.portal.webui.page;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import java.util.Calendar;
+
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
-import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UITree;
import org.exoplatform.webui.core.UIWizard;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
@@ -43,25 +39,23 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormCheckBoxInput;
import org.exoplatform.webui.form.UIFormDateTimeInput;
+import org.exoplatform.webui.form.UIFormInputBase;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.validator.DateTimeValidator;
import org.exoplatform.webui.form.validator.IdentifierValidator;
import org.exoplatform.webui.form.validator.MandatoryValidator;
import org.exoplatform.webui.form.validator.StringLengthValidator;
-import java.util.Calendar;
-import java.util.Date;
-
/**
* Created by The eXo Platform SARL
* Author : Nguyen Thi Hoa
* hoa.nguyen(a)exoplatform.com
* Oct 31, 2006
*/
-@ComponentConfigs({@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl", events = {
+@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl", events = {
@EventConfig(listeners = UIWizardPageSetInfo.ChangeNodeActionListener.class, phase = Phase.DECODE),
@EventConfig(listeners = UIWizardPageSetInfo.SwitchVisibleActionListener.class, phase = Phase.DECODE),
- @EventConfig(listeners = UIWizardPageSetInfo.SwitchPublicationDateActionListener.class, phase = Phase.DECODE)})})
+ @EventConfig(listeners = UIWizardPageSetInfo.SwitchPublicationDateActionListener.class, phase = Phase.DECODE)})
public class UIWizardPageSetInfo extends UIForm
{
@@ -83,23 +77,35 @@
public UIWizardPageSetInfo() throws Exception
{
- UIFormCheckBoxInput<Boolean> uiDateInputCheck =
- new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, SHOW_PUBLICATION_DATE, false);
- UIFormCheckBoxInput<Boolean> uiVisibleCheck = new UIFormCheckBoxInput<Boolean>(VISIBLE, VISIBLE, false);
- uiDateInputCheck.setOnChange("SwitchPublicationDate");
- uiVisibleCheck.setOnChange("SwitchVisible");
-
+ UIFormCheckBoxInput<Boolean> uiDateInputCheck =
+ new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, null, false);
+ UIFormCheckBoxInput<Boolean> uiVisibleCheck = new UIFormCheckBoxInput<Boolean>(VISIBLE, null, false);
+ uiDateInputCheck.setOnChange("SwitchPublicationDate");
+ uiVisibleCheck.setOnChange("SwitchVisible");
+
addChild(UIPageNodeSelector.class, null, null);
addUIFormInput(new UIFormStringInput(PAGE_NAME, "name", null).addValidator(MandatoryValidator.class)
- .addValidator(StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class));
- addUIFormInput(new UIFormStringInput(PAGE_DISPLAY_NAME, "label", null)
- .setMaxLength(255).addValidator(StringLengthValidator.class, 3, 120));
+ .addValidator(StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class));
+ addUIFormInput(new UIFormStringInput(PAGE_DISPLAY_NAME, "label", null).setMaxLength(255).addValidator(
+ StringLengthValidator.class, 3, 120));
addUIFormInput(uiVisibleCheck.setChecked(true));
addUIFormInput(uiDateInputCheck);
- addUIFormInput(new UIFormDateTimeInput(START_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class));
- addUIFormInput(new UIFormDateTimeInput(END_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class));
+ UIFormInputBase<String> startPubDateInput = new UIFormDateTimeInput(START_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class);
+ UIFormInputBase<String> endPubDateInput = new UIFormDateTimeInput(END_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class);
+ addUIFormInput(startPubDateInput);
+ addUIFormInput(endPubDateInput);
+
+ boolean isUserNav = Util.getUIPortal().getOwnerType().equals(PortalConfig.USER_TYPE);
+ if (isUserNav)
+ {
+ uiVisibleCheck.setRendered(false);
+ uiDateInputCheck.setRendered(false);
+ startPubDateInput.setRendered(false);
+ endPubDateInput.setRendered(false);
+ }
}
+ //TODO: it looks like this method is not used
public void setEditMode() throws Exception
{
isEditMode = true;
@@ -114,56 +120,46 @@
public void invokeSetBindingBean(Object bean) throws Exception
{
+ UIFormStringInput nameTextBox = getUIStringInput(PAGE_NAME);
+ //this help to ignore name textbox
+ nameTextBox.setEditable(false);
super.invokeSetBindingBean(bean);
- PageNode node = (PageNode)bean;
- if(!getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked())
+ nameTextBox.setEditable(true);
+
+ UserNode node = (UserNode)bean;
+
+ Visibility visibility;
+ if (getUIFormCheckBoxInput(VISIBLE).isChecked())
{
- node.setVisible(getUIFormCheckBoxInput(VISIBLE).isChecked());
+ UIFormCheckBoxInput showPubDate = getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ visibility = showPubDate.isChecked() ? Visibility.TEMPORAL : Visibility.DISPLAYED;
}
+ else
+ {
+ visibility = Visibility.HIDDEN;
+ }
+ node.setVisibility(visibility);
+
Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
- Date date = (cal != null) ? cal.getTime() : null;
- node.setStartPublicationDate(date);
+ long time = (cal != null) ? cal.getTimeInMillis() : -1;
+ node.setStartPublicationTime(time);
cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
- date = (cal != null) ? cal.getTime() : null;
- node.setEndPublicationDate(date);
+ time = (cal != null) ? cal.getTimeInMillis() : -1;
+ node.setEndPublicationTime(time);
}
- public PageNode getPageNode() throws Exception
- {
- if (isEditMode)
+ public UserNode createUserNode(UserNode parent) throws Exception
+ {
+ UIFormStringInput nameTextBox = getUIStringInput(PAGE_NAME);
+ String nodeName = nameTextBox.getValue();
+
+ UserNode child = parent.addChild(nodeName);
+ invokeSetBindingBean(child);
+ if (child.getLabel() == null || child.getLabel().trim().length() == 0)
{
- PageNode pageNode = getSelectedPageNode();
- PageNode clonedNode = (pageNode != null) ? pageNode.clone() : null;
- invokeSetBindingBean(clonedNode);
- if (clonedNode.getLabel() == null || clonedNode.getLabel().trim().length() == 0)
- {
- clonedNode.setLabel(clonedNode.getName());
- }
- return clonedNode;
+ child.setLabel(child.getName());
}
-
- PageNode pageNode = new PageNode();
- invokeSetBindingBean(pageNode);
- if (pageNode.getLabel() == null || pageNode.getLabel().trim().length() == 0)
- {
- pageNode.setLabel(pageNode.getName());
- }
-
- UIPageNodeSelector uiNodeSelector = getChild(UIPageNodeSelector.class);
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
- PageNavigation nav = uiNodeSelector.getSelectedNavigation();
- if(nav.getOwnerType().equals(PortalConfig.USER_TYPE))
- pageNode.setUri(pageNode.getName());
- else
- {
- if (selectedNode != null)
- {
- pageNode.setUri(selectedNode.getUri() + "/" + pageNode.getName());
- }
- else
- pageNode.setUri(pageNode.getName());
- }
- return pageNode;
+ return child;
}
public void setShowCheckPublicationDate(boolean show)
@@ -173,63 +169,26 @@
uiForm.setRendered(show);
setShowPublicationDate(show && uiForm.isChecked());
}
-
+
public void setShowPublicationDate(boolean show)
{
getUIFormDateTimeInput(START_PUBLICATION_DATE).setRendered(show);
getUIFormDateTimeInput(END_PUBLICATION_DATE).setRendered(show);
}
- public void setPageNode(PageNode pageNode) throws Exception
+ public UserNode getSelectedPageNode()
{
- if (pageNode.getName() != null)
- getUIStringInput(PAGE_NAME).setValue(pageNode.getName());
- if (pageNode.getLabel() != null)
- getUIStringInput(PAGE_DISPLAY_NAME).setValue(pageNode.getLabel());
- getUIFormCheckBoxInput(VISIBLE).setChecked(pageNode.isVisible());
- setShowPublicationDate(pageNode.isShowPublicationDate());
- Calendar cal = Calendar.getInstance();
- if (pageNode.getStartPublicationDate() != null)
- {
- cal.setTime(pageNode.getStartPublicationDate());
- getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
- }
- else
- getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
- if (pageNode.getEndPublicationDate() != null)
- {
- cal.setTime(pageNode.getEndPublicationDate());
- getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
- }
- else
- getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
- }
-
- public PageNode getSelectedPageNode()
- {
UIPageNodeSelector uiPageNodeSelector = getChild(UIPageNodeSelector.class);
- PageNavigation nav = uiPageNodeSelector.getSelectedNavigation();
- if(nav.getOwnerType().equals(PortalConfig.USER_TYPE))
- return null;
- return uiPageNodeSelector.getSelectedPageNode();
+ return uiPageNodeSelector.getSelectedNode();
}
public void processRender(WebuiRequestContext context) throws Exception
{
- if (isEditMode && getChild(UIPageNodeSelector.class).getSelectedPageNode() == null)
+ if (isEditMode && getChild(UIPageNodeSelector.class).getSelectedNode() == null)
reset();
super.processRender(context);
}
- public void processDecode(WebuiRequestContext context) throws Exception
- {
- super.processDecode(context);
- String action = context.getRequestParameter(UIForm.ACTION);
- Event<UIComponent> event = createEvent(action, Event.Phase.DECODE, context);
- if (event != null)
- event.broadcast();
- }
-
public boolean isFirstTime()
{
return firstTime;
@@ -244,62 +203,28 @@
{
public void execute(Event<UIWizardPageSetInfo> event) throws Exception
{
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UIWizardPageSetInfo uiForm = event.getSource();
-
- UIPageNodeSelector uiPageNodeSelector = event.getSource().getChild(UIPageNodeSelector.class);
- UITree tree = uiPageNodeSelector.getChild(UITree.class);
-
- if (tree.getParentSelected() == null && (uri == null || uri.length() < 1))
+ WebuiRequestContext context = event.getRequestContext();
+ UIWizardPageSetInfo pageSetInfo = event.getSource();
+ UIPageCreationWizard uiWizard = (UIPageCreationWizard)pageSetInfo.getAncestorOfType(UIPageCreationWizard.class);
+
+ String uri = context.getRequestParameter(OBJECTID);
+ UIPageNodeSelector uiPageNodeSelector = pageSetInfo.getChild(UIPageNodeSelector.class);
+ try
{
- uiPageNodeSelector.selectNavigation(uiPageNodeSelector.getSelectedNavigation());
- }
- else
- {
- uiPageNodeSelector.selectPageNodeByUri(uri);
- }
-
- UIPortalApplication uiPortalApp = uiPageNodeSelector.getAncestorOfType(UIPortalApplication.class);
- UIWizard uiWizard = uiPortalApp.findFirstComponentOfType(UIWizard.class);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiWizard);
-
- if (!event.getSource().isEditMode())
- {
- return;
- }
- PageNode pageNode = uiPageNodeSelector.getSelectedPageNode();
-
- if (pageNode == null && uiForm.isFirstTime())
- {
- uiForm.setShowPublicationDate(false);
- uiForm.setFirstTime(false);
- UIPortal uiPortal = Util.getUIPortal();
- uiPageNodeSelector.selectNavigation(uiPortal.getSelectedNavigation());
- if (uiPortal.getSelectedNode() != null)
+ uiPageNodeSelector.setSelectedURI(uri);
+ if (!uiPageNodeSelector.getSelectedNode().getURI().equals(uri))
{
- uiPageNodeSelector.selectPageNodeByUri(uiPortal.getSelectedNode().getUri());
+ context.getUIApplication().addMessage(new ApplicationMessage("UIWizardPageSetInfo.msg.node.deleted", null));
}
- pageNode = uiPageNodeSelector.getSelectedPageNode();
}
-
- if (pageNode == null)
+ catch (NavigationServiceException ex)
{
- uiForm.setShowPublicationDate(false);
+ context.getUIApplication().addMessage(new ApplicationMessage("UIWizardPageSetInfo.msg.navigation.deleted", null));
+ uiWizard.createEvent("Abort", Phase.PROCESS, context).broadcast();
return;
}
- UserPortalConfigService configService = uiWizard.getApplicationComponent(UserPortalConfigService.class);
- String accessUser = event.getRequestContext().getRemoteUser();
- Page page = null;
- if (pageNode.getPageReference() != null)
- page = configService.getPage(pageNode.getPageReference(), accessUser);
- if (page == null)
- {
- uiPortalApp.addMessage(new ApplicationMessage("UIWizardPageSetInfo.msg.null", null));
- uiForm.reset();
- uiForm.setShowPublicationDate(false);
- return;
- }
- uiForm.setPageNode(pageNode);
+
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiWizard);
}
}
@@ -316,17 +241,17 @@
}
}
-
+
static public class SwitchVisibleActionListener extends EventListener<UIWizardPageSetInfo>
{
- @Override
- public void execute(Event<UIWizardPageSetInfo> event) throws Exception
- {
- UIWizardPageSetInfo uiForm = event.getSource();
- boolean isCheck = uiForm.getUIFormCheckBoxInput(VISIBLE).isChecked();
- uiForm.setShowCheckPublicationDate(isCheck);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
- }
+ @Override
+ public void execute(Event<UIWizardPageSetInfo> event) throws Exception
+ {
+ UIWizardPageSetInfo uiForm = event.getSource();
+ boolean isCheck = uiForm.getUIFormCheckBoxInput(VISIBLE).isChecked();
+ uiForm.setShowCheckPublicationDate(isCheck);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -178,8 +178,6 @@
localeConfig = localeConfigService.getDefaultLocaleConfig();
PortalRequestContext prqCtx = PortalRequestContext.getCurrentInstance();
prqCtx.setLocale(localeConfig.getLocale());
- //uiApp.setOrientation(localeConfig.getOrientation());
- //uiApp.localizeNavigations();
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -21,16 +21,16 @@
import org.exoplatform.portal.account.UIAccountSetting;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.PortalProperties;
import org.exoplatform.portal.config.model.Properties;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.page.UIPageActionListener.ChangePageNodeActionListener;
+import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ChangeApplicationListActionListener;
import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ChangeLanguageActionListener;
import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ChangeSkinActionListener;
@@ -43,7 +43,7 @@
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.User;
-import org.exoplatform.services.resources.ResourceBundleManager;
+import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.login.InitiateLoginServlet;
import org.exoplatform.web.login.LogoutControl;
import org.exoplatform.web.security.security.AbstractTokenService;
@@ -54,15 +54,10 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.web.application.JavascriptManager;
import java.net.URLEncoder;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
import java.util.Map;
-import java.util.ResourceBundle;
import javax.portlet.WindowState;
import javax.servlet.http.Cookie;
@@ -100,18 +95,19 @@
private Properties properties;
- private PageNavigation navigation;
-
- private List<PageNode> selectedPath;
+ private UserNode navPath;
- private PageNode selectedNode_;
-
private Map<String, UIPage> all_UIPages;
private Map<String, String[]> publicParameters_ = new HashMap<String, String[]>();
private UIComponent maximizedUIComponent;
+ public SiteKey getSiteKey()
+ {
+ return new SiteKey(ownerType, name_);
+ }
+
public String getOwner()
{
return owner;
@@ -171,13 +167,20 @@
{
publicParameters_ = publicParams;
}
+
+ public UserNode getNavPath() throws Exception
+ {
+ if (navPath == null)
+ {
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ navPath = uiApp.getUserPortalConfig().getUserPortal().getDefaultPath(null);
+ }
+ return navPath;
+ }
- /** At the moment, this method ensure compatibility with legacy code */
- public List<PageNavigation> getNavigations() throws Exception
+ public void setNavPath(UserNode nav)
{
- List<PageNavigation> listNavs = new ArrayList<PageNavigation>();
- listNavs.add(navigation);
- return listNavs;
+ this.navPath = nav;
}
/**
@@ -211,9 +214,11 @@
this.all_UIPages.remove(pageReference);
}
- public void setNavigation(PageNavigation _navigation)
+ public UserNavigation getUserNavigation() throws Exception
{
- this.navigation = _navigation;
+ UIPortalApplication uiPortalApp = getAncestorOfType(UIPortalApplication.class);
+ SiteKey siteKey = new SiteKey(ownerType, owner);
+ return uiPortalApp.getUserPortalConfig().getUserPortal().getNavigation(siteKey);
}
/**
@@ -223,11 +228,6 @@
*/
public void refreshUIPage() throws Exception
{
- if(selectedNode_ == null)
- {
- selectedNode_ = navigation.getNodes().get(0);
- }
-
UIPageBody uiPageBody = findFirstComponentOfType(UIPageBody.class);
if(uiPageBody == null)
{
@@ -240,84 +240,14 @@
currentPortlet.setCurrentWindowState(WindowState.NORMAL);
uiPageBody.setMaximizedUIComponent(null);
}
- uiPageBody.setPageBody(selectedNode_, this);
-
- //Refresh locale
- Locale locale = Util.getPortalRequestContext().getLocale();
- localizePageNavigation(navigation, locale);
+ uiPageBody.setPageBody(getSelectedUserNode(), this);
}
- public synchronized void setSelectedNode(PageNode node)
+ public UserNode getSelectedUserNode() throws Exception
{
- selectedNode_ = node;
+ return getNavPath();
}
- /*
- public PageNode getSelectedNode() throws Exception
- {
- if (selectedNode_ != null)
- return selectedNode_;
- if (getSelectedNavigation() == null || selectedNavigation_.getNodes() == null
- || selectedNavigation_.getNodes().size() < 1)
- return null;
- selectedNode_ = selectedNavigation_.getNodes().get(0);
- return selectedNode_;
- }
- */
-
- public PageNode getSelectedNode() throws Exception
- {
- if(selectedNode_ != null)
- {
- return selectedNode_;
- }
- if(navigation == null || navigation.getNodes() == null || navigation.getNodes().size() < 1)
- {
- return null;
- }
- return navigation.getNodes().get(0);
- }
-
- public List<PageNode> getSelectedPath()
- {
- return selectedPath;
- }
-
- public void setSelectedPath(List<PageNode> nodes)
- {
- selectedPath = nodes;
- }
-
- public PageNavigation getSelectedNavigation() throws Exception
- {
- return navigation;
- }
-
- public void setSelectedNavigation(PageNavigation _navigation)
- {
- this.navigation = _navigation;
- }
-
- /**
- public PageNavigation getPageNavigation(int id)
- {
- for (PageNavigation nav : navigations)
- {
- if (nav.getId() == id)
- return nav;
- }
- return null;
- }
-
-*/
- /*
- public void setSelectedNavigation(PageNavigation selectedNavigation)
- {
- selectedNavigation_ = selectedNavigation;
- }
-
- */
-
public UIComponent getMaximizedUIComponent()
{
return maximizedUIComponent;
@@ -402,30 +332,6 @@
this.description = description;
}
- private void localizePageNavigation(PageNavigation nav,Locale locale)
- {
- ResourceBundleManager mgr = getApplicationComponent(ResourceBundleManager.class);
- if (nav.getOwnerType().equals(PortalConfig.USER_TYPE))
- return;
- String localeLanguage = (locale.getCountry().length() > 0) ? locale.getLanguage() + "_" + locale.getCountry() : locale.getLanguage();
- ResourceBundle res = mgr.getNavigationResourceBundle(localeLanguage, nav.getOwnerType(), nav.getOwnerId());
- for (PageNode node : nav.getNodes())
- {
- resolveLabel(res, node);
- }
- }
-
- private void resolveLabel(ResourceBundle res, PageNode node)
- {
- node.setResolvedLabel(res);
- if (node.getChildren() == null)
- return;
- for (PageNode childNode : node.getChildren())
- {
- resolveLabel(res, childNode);
- }
- }
-
static public class LogoutActionListener extends EventListener<UIComponent>
{
public void execute(Event<UIComponent> event) throws Exception
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -482,10 +482,13 @@
UIPortal uiPortal = Util.getUIPortal();
UIPortalApplication uiApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
UserPortalConfigService service = uiApp.getApplicationComponent(UserPortalConfigService.class);
+ PortalRequestContext context = Util.getPortalRequestContext();
if (portalName != null
&& service.getUserPortalConfig(portalName, event.getRequestContext().getRemoteUser()) == null)
{
uiApp.addMessage(new ApplicationMessage("UISiteManagement.msg.portal-not-exist", new String[]{portalName}));
+ context.addUIComponentToUpdateByAjax(uiApp.findFirstComponentOfType(UIWorkingWorkspace.class));
+ context.setFullRender(true);
return;
}
@@ -494,8 +497,7 @@
portalForm.setPortalOwner(portalName);
portalForm.setBindingBean();
uiMaskWS.setWindowSize(700, -1);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
-
+ context.addUIComponentToUpdateByAjax(uiMaskWS);
}
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -57,8 +57,8 @@
import org.exoplatform.webui.core.UITabPane;
import org.exoplatform.webui.core.UIWizard;
import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.webui.event.Event.Phase;
import java.util.List;
import java.util.ResourceBundle;
@@ -415,7 +415,7 @@
UIPortal uiPortal = uiWorkingWS.getBackupUIPortal();
siteBody.setUIComponent(uiPortal);
- String uri = uiPortal.getSelectedNode() != null ? uiPortal.getSelectedNode().getUri() : null;
+ String uri = uiPortal.getSelectedUserNode() != null ? uiPortal.getSelectedUserNode().getURI() : null;
PageNodeEvent<UIPortal> pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
@@ -462,14 +462,13 @@
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
prContext.ignoreAJAXUpdateOnPortlets(true);
- String uri = (uiPortal.getSelectedNode() != null)? (uiPortal.getSelectedNode().getUri()) : null;
+ String uri = (uiPortal.getSelectedUserNode() != null)? (uiPortal.getSelectedUserNode().getURI()) : null;
if (uiComposer.isPortalExist(editPortal))
{
DataStorage storage = uiPortalApp.getApplicationComponent(DataStorage.class);
PortalConfig pConfig =
- storage.getPortalConfig(uiPortal.getSelectedNavigation().getOwnerType(), uiPortal
- .getSelectedNavigation().getOwnerId());
+ storage.getPortalConfig(uiPortal.getSiteKey().getTypeName(), uiPortal.getSiteKey().getName());
if (pConfig != null)
{
uiPortalApp.getUserPortalConfig().setPortal(pConfig);
@@ -656,7 +655,8 @@
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.ignoreAJAXUpdateOnPortlets(true);
UIPortal uiPortal = uiPortalApp.getShowedUIPortal();
uiPortal.setRenderSibling(UIPortal.class);
@@ -666,9 +666,10 @@
uiPortal.refreshUIPage();
PageNodeEvent<UIPortal> pnevent =
- new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, (uiPortal.getSelectedNode() != null
- ? uiPortal.getSelectedNode().getUri() : null));
+ new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, (uiPortal.getSelectedUserNode() != null
+ ? uiPortal.getSelectedUserNode().getURI() : null));
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
+ prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");
}
@@ -689,7 +690,8 @@
UIEditInlineWorkspace editInlineWS = event.getSource().getParent();
UIWorkingWorkspace uiWorkingWS = editInlineWS.getParent();
UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
-
+ Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
+
UIPage uiPage = uiToolPanel.findFirstComponentOfType(UIPage.class);
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
String pageId = page.getPageId();
@@ -708,7 +710,7 @@
Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
PageNodeEvent<UIPortal> pnevent =
new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
- (uiPortal.getSelectedNode() != null ? uiPortal.getSelectedNode().getUri() : null));
+ (uiPortal.getSelectedUserNode() != null ? uiPortal.getSelectedUserNode().getURI() : null));
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");
@@ -764,8 +766,8 @@
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
PageNodeEvent<UIPortal> pnevent =
- new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, (uiPortal.getSelectedNode() != null
- ? uiPortal.getSelectedNode().getUri() : null));
+ new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, (uiPortal.getSelectedUserNode() != null
+ ? uiPortal.getSelectedUserNode().getURI() : null));
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -17,7 +17,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.exoplatform.portal.webui.portal;
+package org.exoplatform.portal.webui.portal;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
@@ -25,7 +25,6 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.PortalProperties;
import org.exoplatform.portal.resource.SkinService;
@@ -53,8 +52,8 @@
import org.exoplatform.webui.core.model.SelectItemCategory;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIFormInputItemSelector;
import org.exoplatform.webui.form.UIFormInputSet;
import org.exoplatform.webui.form.UIFormSelectBox;
@@ -64,8 +63,8 @@
import org.exoplatform.webui.form.validator.MandatoryValidator;
import org.exoplatform.webui.form.validator.StringLengthValidator;
import org.exoplatform.webui.organization.UIListPermissionSelector;
-import org.exoplatform.webui.organization.UIPermissionSelector;
import org.exoplatform.webui.organization.UIListPermissionSelector.EmptyIteratorValidator;
+import org.exoplatform.webui.organization.UIPermissionSelector;
import java.util.ArrayList;
import java.util.Collection;
@@ -74,8 +73,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
-import java.util.ResourceBundle;
import java.util.MissingResourceException;
+import java.util.ResourceBundle;
@ComponentConfigs({
@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@@ -321,7 +320,7 @@
{
PortalConfig portalConfig = (PortalConfig)PortalDataMapper.buildModelObject(uiPortal);
dataService.save(portalConfig);
- prContext.setAttribute(UserPortalConfig.class, service.getUserPortalConfig(uiForm.getPortalOwner(), prContext.getRemoteUser()));
+ prContext.setAttribute(UserPortalConfig.class, service.getUserPortalConfig(uiForm.getPortalOwner(), prContext.getRemoteUser(), PortalRequestContext.USER_PORTAL_CONTEXT));
uiPortalApp.reloadSkinPortal(prContext);
// We should use IPC to update some portlets in the future instead of
@@ -344,6 +343,7 @@
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ prContext.setFullRender(true);
}
UIMaskWorkspace uiMaskWorkspace = uiForm.getParent();
@@ -374,9 +374,7 @@
UserPortalConfig userPortalConfig = service.getUserPortalConfig(portalName, pcontext.getRemoteUser());
PortalConfig pconfig = userPortalConfig.getPortalConfig();
uiForm.invokeSetBindingBean(pconfig);
- PageNavigation navigation = dataService.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
dataService.save(pconfig);
- dataService.save(navigation);
UIPortalApplication uiPortalApp = event.getSource().getAncestorOfType(UIPortalApplication.class);
UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
uiMaskWS.setUIComponent(null);
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -365,7 +365,7 @@
}
}
//uiPortal.setNavigation(userPortalConfig.getNavigations());
- uiPortal.setNavigation(userPortalConfig.getSelectedNavigation());
+// uiPortal.setNavigation(userPortalConfig.getSelectedNavigation());
}
private static void buildUIContainer(UIContainer uiContainer, Object model, boolean dashboard) throws Exception
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -213,10 +213,24 @@
}
}
+ /**
+ * @deprecated use {@link #toUIPage(String, UIComponent)} instead
+ *
+ * @param node
+ * @param uiParent
+ * @return
+ * @throws Exception
+ */
+ @Deprecated
static public UIPage toUIPage(PageNode node, UIComponent uiParent) throws Exception
{
+ return toUIPage(node.getPageReference(), uiParent);
+ }
+
+ static public UIPage toUIPage(String pageRef, UIComponent uiParent) throws Exception
+ {
UserPortalConfigService configService = uiParent.getApplicationComponent(UserPortalConfigService.class);
- Page page = configService.getPage(node.getPageReference(), getPortalRequestContext().getRemoteUser());
+ Page page = configService.getPage(pageRef, getPortalRequestContext().getRemoteUser());
return toUIPage(page, uiParent);
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -26,8 +26,12 @@
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.page.UIPageCreationWizard;
@@ -110,17 +114,38 @@
static public class PageCreationWizardActionListener extends EventListener<UIWorkingWorkspace>
{
public void execute(Event<UIWorkingWorkspace> event) throws Exception
- {
+ {
UIPortalApplication uiApp = Util.getUIPortalApplication();
- uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
+ UIPortal uiPortal = Util.getUIPortal();
UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- if (!hasPageCreationPermission())
+ UserNavigation currNav = uiPortal.getUserNavigation();
+ if (currNav == null)
{
+ uiApp.addMessage(new ApplicationMessage("UIPortalManagement.msg.navigation.deleted", null));
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
+ return;
+ }
+
+ if (!currNav.isModifiable())
+ {
uiApp.addMessage(new ApplicationMessage("UIPortalManagement.msg.Invalid-CreatePage-Permission", null));
return;
}
+
+ //Should renew the selectedNode. Don't reuse the cached selectedNode
+ UserNode selectedNode = Util.getUIPortal().getSelectedUserNode();
+ UserNodeFilterConfig filterConfig = createFilterConfig();
+ UserNode resolvedNode = resolveNode(selectedNode, filterConfig);
+ if (resolvedNode == null)
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ context.getUIApplication().addMessage(new ApplicationMessage("UIPortalManagement.msg.node.deleted", null));
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
+ return;
+ }
+ uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
UIPortalComposer portalComposer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class);
@@ -135,23 +160,33 @@
uiToolPanel.setShowMaskLayer(false);
uiToolPanel.setWorkingComponent(UIPageCreationWizard.class, null);
UIPageCreationWizard uiWizard = (UIPageCreationWizard)uiToolPanel.getUIComponent();
+ uiWizard.configure(resolvedNode);
+
UIWizardPageSetInfo uiPageSetInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
uiPageSetInfo.setShowPublicationDate(false);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
}
-
- private boolean hasPageCreationPermission() throws Exception
- {
- UIPortal currentPortal = Util.getUIPortal();
- UserACL userACL = Util.getUIPortalApplication().getApplicationComponent(UserACL.class);
- PageNavigation selectedNavigation = currentPortal.getSelectedNavigation();
- if (PortalConfig.PORTAL_TYPE.equals(selectedNavigation.getOwnerType()))
+
+ private UserNode resolveNode(UserNode selectedNode, UserNodeFilterConfig filterConfig) throws Exception
+ {
+ UserNavigation currNav = selectedNode.getNavigation();
+ UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ if (currNav.getKey().getTypeName().equals(PortalConfig.USER_TYPE))
+ {
+ return userPortal.getNode(currNav, Scope.CHILDREN, filterConfig, null);
+ }
+ else
{
- return userACL.hasEditPermissionOnPortal(currentPortal.getOwnerType(), currentPortal.getOwner(), currentPortal.getEditPermission());
+ return userPortal.resolvePath(currNav, filterConfig, selectedNode.getURI());
}
-
- return userACL.hasEditPermission(selectedNavigation);
}
+
+ private UserNodeFilterConfig createFilterConfig()
+ {
+ UserNodeFilterConfig.Builder filterConfigBuilder = UserNodeFilterConfig.builder();
+ filterConfigBuilder.withAuthorizationCheck();
+ return filterConfigBuilder.build();
+ }
}
static public class EditInlineActionListener extends EventListener<UIWorkingWorkspace>
@@ -189,9 +224,10 @@
UIPortal newPortal = uiWorkingWS.createUIComponent(UIPortal.class, null, null);
PortalDataMapper.toUIPortal(newPortal, userConfig);
- newPortal.setSelectedNode(uiPortal.getSelectedNode());
- newPortal.setSelectedNavigation(uiPortal.getSelectedNavigation());
- newPortal.setSelectedPath(uiPortal.getSelectedPath());
+// newPortal.setSelectedNode(uiPortal.getSelectedNode());
+// newPortal.setNavigation(uiPortal.getNavigation());
+// newPortal.setSelectedPath(uiPortal.getSelectedPath());
+ newPortal.setNavPath(uiPortal.getNavPath());
newPortal.refreshUIPage();
UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -28,14 +28,13 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.resource.Skin;
import org.exoplatform.portal.resource.SkinConfig;
import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.portal.resource.SkinURL;
import org.exoplatform.portal.webui.application.UIPortlet;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
import org.exoplatform.portal.webui.page.UISiteBody;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -48,7 +47,6 @@
import org.exoplatform.services.resources.LocaleConfigService;
import org.exoplatform.services.resources.LocaleContextInfo;
import org.exoplatform.services.resources.Orientation;
-import org.exoplatform.services.resources.ResourceBundleManager;
import org.exoplatform.web.application.javascript.JavascriptConfigService;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -111,10 +109,8 @@
private boolean isSessionOpen = false;
- private Map<UIPortalKey, UIPortal> all_UIPortals;
+ private Map<SiteKey, UIPortal> all_UIPortals;
- private List<PageNavigation> all_Navigations;
-
private UIPortal showedUIPortal;
/**
@@ -168,15 +164,13 @@
// -------------------------------------------------------------------------------
context.setUIApplication(this);
- this.all_UIPortals = new HashMap<UIPortalKey, UIPortal>(5);
+ this.all_UIPortals = new HashMap<SiteKey, UIPortal>(5);
addWorkingWorkspace();
setOwner(context.getPortalOwner());
//Minh Hoang TO: Localizes navigations, need to put this code snippet below 'setLocale' block
- this.all_Navigations = userPortalConfig_.getNavigations();
- localizeNavigations();
}
/**
@@ -219,9 +213,18 @@
{
return null;
}
- return this.all_UIPortals.get(new UIPortalKey(ownerType, ownerId));
+ return this.all_UIPortals.get(new SiteKey(ownerType, ownerId));
}
+ public UIPortal getCachedUIPortal(SiteKey key)
+ {
+ if(key == null)
+ {
+ return null;
+ }
+ return this.all_UIPortals.get(key);
+ }
+
/**
* Associates the specified UIPortal to a cache map with specified key which bases on OwnerType and OwnerId
*
@@ -234,7 +237,7 @@
if(ownerType != null && ownerId != null)
{
- this.all_UIPortals.put(new UIPortalKey(ownerType, ownerId), uiPortal);
+ this.all_UIPortals.put(new SiteKey(ownerType, ownerId), uiPortal);
}
}
@@ -250,7 +253,7 @@
{
return;
}
- this.all_UIPortals.remove(new UIPortalKey(ownerType, ownerId));
+ this.all_UIPortals.remove(new SiteKey(ownerType, ownerId));
}
public boolean isSessionOpen()
@@ -672,14 +675,14 @@
UserPortalConfigService userPortalConfigService =
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
Page page = null;
- PageNode pageNode = Util.getUIPortal().getSelectedNode();
+ UserNode pageNode = Util.getUIPortal().getSelectedUserNode();
if (pageNode != null)
{
try
{
- if (pageNode.getPageReference() != null)
+ if (pageNode.getPageRef() != null)
{
- page = userPortalConfigService.getPage(pageNode.getPageReference(), context.getRemoteUser());
+ page = userPortalConfigService.getPage(pageNode.getPageRef(), context.getRemoteUser());
}
}
catch (NoSuchDataException nsde)
@@ -690,17 +693,6 @@
return (page != null);
}
- public void localizeNavigations()
- {
- ResourceBundleManager i18nManager = getApplicationComponent(ResourceBundleManager.class);
- Locale locale = getLocale();
-
- for(PageNavigation nav : this.getNavigations())
- {
- PageNavigationUtils.localizePageNavigation(nav, locale, i18nManager);
- }
- }
-
/**
* Get portal skin from {@link UserProfile} or from {@link UserPortalConfig}
*
@@ -741,65 +733,4 @@
skin_ = userPortalConfigSkin;
}
}
-
- public void setNavigations(List<PageNavigation> navs)
- {
- this.all_Navigations = navs;
- }
-
- public List<PageNavigation> getNavigations()
- {
- return this.all_Navigations;
- }
-
- private class UIPortalKey
- {
-
- /** . */
- private final String ownerType;
-
- /** . */
- private final String ownerId;
-
- UIPortalKey(String _ownerType, String _ownerId)
- {
- if (_ownerType == null)
- {
- throw new NullPointerException();
- }
- if (_ownerId == null)
- {
- throw new NullPointerException();
- }
- this.ownerType = _ownerType;
- this.ownerId = _ownerId;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == null || obj == null)
- {
- return this == null && obj == null;
- }
- if (!(obj instanceof UIPortalKey))
- {
- return false;
- }
- return this.ownerType.equals(((UIPortalKey)obj).ownerType) && this.ownerId.equals(((UIPortalKey)obj).ownerId);
- }
-
- @Override
- public int hashCode()
- {
- return this.ownerType.hashCode() * 2 + this.ownerId.hashCode();
- }
-
- @Override
- public String toString()
- {
- return "OWNERTYPE: " + ownerType + " OWNERID: " + ownerId;
- }
- }
-
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -50,6 +50,8 @@
import javax.portlet.PortletResponse;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
/**
* May 26, 2006
@@ -214,6 +216,50 @@
WebuiRequestContext.setCurrentInstance(parentAppRequestContext);
}
}
+
+ /**
+ * This method is called when a JSR 286 serveResource lifecycle method is targeting the current portlet.
+ *
+ * 1) The current instance of the WebuiRequestContext (stored in a ThreadLocal in the class) is referenced
+ * 2) A new request context of type PortletRequestContext (which extends the class WebuiRequestContext) is
+ * created as a child of the current context instance
+ * 3) The new context is place inside the ThreadLocal and hence overides its parent one there,
+ * only for the portlet request lifecycle
+ * 4) The method onStartRequest() is called in all the ApplicationLifecycle objects referenced in the webui
+ * configuration XML file
+ * 5) The StateManager object (in case of portlet it is an object of type ParentAppStateManager) is used to get the RootComponent
+ * also referenced in the XML configuration file
+ * 6) The method serveResource of UIPortletApplication is called
+ * 7) Finally, the method onEndRequest() is called on every ApplicationLifecycle referenced in the portlet
+ * configuration XML file and the parent WebuiRequestContext is restored
+ */
+ public void serveResource(ResourceRequest req, ResourceResponse res) throws Exception
+ {
+ WebuiRequestContext parentAppRequestContext = WebuiRequestContext.getCurrentInstance();
+ PortletRequestContext context = createRequestContext(req, res, parentAppRequestContext);
+ WebuiRequestContext.setCurrentInstance(context);
+ try
+ {
+ for (ApplicationLifecycle<RequestContext> lifecycle : getApplicationLifecycle())
+ {
+ lifecycle.onStartRequest(this, context);
+ }
+ StateManager sm = getStateManager();
+ UIApplication uiApp = sm.restoreUIRootComponent(context);
+ context.setUIApplication(uiApp);
+ if (uiApp instanceof UIPortletApplication)
+ {
+ ((UIPortletApplication)uiApp).serveResource(context);
+ }
+
+ // Store ui root
+ sm.storeUIRootComponent(context);
+ }
+ finally
+ {
+ WebuiRequestContext.setCurrentInstance(parentAppRequestContext);
+ }
+ }
/**
* The render method business logic is quite similar to the processAction() one.
@@ -313,5 +359,4 @@
context.setParentAppRequestContext(parentAppRequestContext);
return context;
}
-
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -38,6 +38,8 @@
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
/**
* Created by The eXo Platform SAS
@@ -84,6 +86,7 @@
log.error("Error while processing action in the porlet", ex);
}
}
+
/**
* Delegate the action to the PortletApplication object
@@ -99,6 +102,21 @@
log.error("Error while processing event in the porlet", ex);
}
}
+
+ /**
+ * Delegate the action to the PortletApplication object
+ */
+ public void serveResource(ResourceRequest req, ResourceResponse res) throws PortletException, IOException
+ {
+ try
+ {
+ getPortletApplication().serveResource(req, res);
+ }
+ catch (Exception ex)
+ {
+ log.error("Error while serving resource in the porlet", ex);
+ }
+ }
/**
* Delegate the render to the PortletApplication object
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletRequestContext.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -19,24 +19,24 @@
package org.exoplatform.webui.application.portlet;
-import org.exoplatform.commons.utils.WriterPrinter;
-import org.exoplatform.services.resources.Orientation;
-import org.exoplatform.web.application.URLBuilder;
-import org.exoplatform.webui.application.WebuiApplication;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-
import java.io.Writer;
import javax.portlet.ActionResponse;
+import javax.portlet.MimeResponse;
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
-import javax.portlet.RenderResponse;
import javax.portlet.StateAwareResponse;
+import org.exoplatform.commons.utils.WriterPrinter;
+import org.exoplatform.services.resources.Orientation;
+import org.exoplatform.web.application.URLBuilder;
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.core.UIApplication;
+import org.exoplatform.webui.core.UIComponent;
+
/**
* The request context of a portlet
*
@@ -195,7 +195,7 @@
public URLBuilder<UIComponent> getURLBuilder()
{
- RenderResponse renderRes = (RenderResponse)response_;
+ MimeResponse renderRes = (MimeResponse)response_;
urlBuilder.setBaseURL(renderRes.createActionURL().toString());
return urlBuilder;
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java 2011-07-18 22:13:58 UTC (rev 6884)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java 2011-07-18 22:48:36 UTC (rev 6885)
@@ -23,7 +23,10 @@
import java.util.Map;
import java.util.Set;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
import javax.portlet.WindowState;
+import javax.resource.spi.IllegalStateException;
import org.apache.commons.collections.map.HashedMap;
import org.exoplatform.commons.serialization.api.annotations.Serialized;
@@ -145,4 +148,16 @@
}
super.processRender(context);
}
+
+ /**
+ * Root uicomponent of a portlet should override this method to leverage serveResource that JSR286 offers
+ * @param context - WebUI context
+ */
+ public void serveResource(WebuiRequestContext context) throws Exception
+ {
+ if (!(context.getRequest() instanceof ResourceRequest))
+ {
+ throw new IllegalStateException("serveSource can only be called in portlet context");
+ }
+ }
}
\ No newline at end of file
13 years, 5 months
gatein SVN: r6884 - in epp/portal/branches/EPP_5_2_Branch: component and 10 other directories.
by do-not-reply@jboss.org
Author: theute
Date: 2011-07-18 18:13:58 -0400 (Mon, 18 Jul 2011)
New Revision: 6884
Added:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIColumnContainer.java
Modified:
epp/portal/branches/EPP_5_2_Branch/
epp/portal/branches/EPP_5_2_Branch/component/
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/ToolbarUtils.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplicationLifecycle.java
Log:
JBEPP-1014
Rename the confusing methods setFullRender/getFullRender in PortalRequestContext
Property changes on: epp/portal/branches/EPP_5_2_Branch
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5622,5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
Property changes on: epp/portal/branches/EPP_5_2_Branch/component
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5622,5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -325,7 +325,7 @@
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_EDITTING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.setFullRender(true);
+ prContext.ignoreAJAXUpdateOnPortlets(true);
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIUserInfo.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -140,7 +140,7 @@
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(
uiApp.findFirstComponentOfType(UIWorkingWorkspace.class));
- Util.getPortalRequestContext().setFullRender(true);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
}
UIUserManagement userManagement = uiUserInfo.getParent();
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -402,11 +402,30 @@
* 2) Portlets will be fully rendered if are inner of the portal ui components being updated
*
* @param forceFullUpdate
+ *
+ * This method is deprecated, ignoreAJAXUpdateOnPortlets should be used instead
*/
+ @Deprecated()
final public void setFullRender(boolean forceFullUpdate)
{
this.forceFullUpdate = forceFullUpdate;
}
+
+ /**
+ * Call to this method makes sense only in the scope of an AJAX request.
+ *
+ * Invoking ignoreAJAXUpdateOnPortlets(true) as there is need to update only UI components
+ * of portal (ie: the components outside portlet windows) are updated by AJAX. In the request
+ * response, all the blocks <PortletRespond > are empty. The content displayed in portlet
+ * windows are retrieved by non-AJAX render request to associated portlet object.
+ *
+ *
+ * @param ignoreAJAXUpdateOnPortlets
+ */
+ final public void ignoreAJAXUpdateOnPortlets(boolean ignoreAJAXUpdateOnPortlets)
+ {
+ this.forceFullUpdate = ignoreAJAXUpdateOnPortlets;
+ }
final public void sendRedirect(String url) throws IOException
{
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -526,7 +526,7 @@
{
log
.info("Events were generated outside the scope of an AJAX call, hence will make a full render of the page");
- context.setFullRender(true);
+ context.ignoreAJAXUpdateOnPortlets(true);
}
if (newEvents != null && !newEvents.isEmpty())
{
@@ -751,7 +751,7 @@
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
String windowState = event.getRequestContext().getRequestParameter(Constants.PORTAL_WINDOW_STATE);
if (windowState == null)
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -152,7 +152,7 @@
try
{
PortalRequestContext prcontext = (PortalRequestContext)WebuiRequestContext.getCurrentInstance();
- prcontext.setFullRender(true);
+ prcontext.ignoreAJAXUpdateOnPortlets(true);
StatefulPortletContext portletContext = uiPortlet_.getPortletContext();
ExoPortletInvocationContext portletInvocationContext = new ExoPortletInvocationContext(prcontext, uiPortlet_);
@@ -401,7 +401,7 @@
UIPortalApplication uiPortalApp = uiPortlet.getAncestorOfType(UIPortalApplication.class);
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
Util.showComponentLayoutMode(UIPortlet.class);
}
}
@@ -423,7 +423,7 @@
uiMaskWorkspace.setUIComponent(null);
uiMaskWorkspace.setWindowSize(-1, -1);
pcontext.addUIComponentToUpdateByAjax(uiMaskWorkspace);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
Util.showComponentLayoutMode(UIPortlet.class);
}
}
Added: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIColumnContainer.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIColumnContainer.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIColumnContainer.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -0,0 +1,108 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.portal.webui.container;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.webui.container.UIContainerActionListener.EditContainerActionListener;
+import org.exoplatform.portal.webui.portal.UIPortalComponent;
+import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.DeleteComponentActionListener;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
+import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : Nguyen Duc Khoi
+ * khoi.nguyen(a)exoplatform.com
+ * Jul 29, 2010
+ */
+
+@ComponentConfig(template = "system:/groovy/portal/webui/container/UIColumnContainer.gtmpl", events =
+{
+ @EventConfig(listeners = UIColumnContainer.InsertColumnActionListener.class),
+ @EventConfig(listeners = DeleteComponentActionListener.class, confirm = "UIColumnContainer.deleteColumnContainer"),
+ @EventConfig(listeners = EditContainerActionListener.class)})
+public class UIColumnContainer extends UIContainer
+{
+ public static final String COLUMN_CONTAINER = "ColumnContainer";
+
+ public static final String INSERT_AFTER = "insertColumnAfter";
+
+ public static final String INSERT_BEFORE = "insertColumnBefore";
+
+ public UIColumnContainer()
+ {
+ super();
+ }
+
+ public static class InsertColumnActionListener extends EventListener<UIColumnContainer>
+ {
+ @Override
+ public void execute(Event<UIColumnContainer> event) throws Exception
+ {
+ String insertPosition = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ UIColumnContainer uiSelectedColumn = event.getSource();
+ UIPortalComponent uiParent = (UIPortalComponent) uiSelectedColumn.getParent();
+ if (insertPosition.equals(INSERT_AFTER))
+ {
+ UIColumnContainer.insertColumn(uiSelectedColumn, true);
+ }
+ else if (insertPosition.equals(INSERT_BEFORE))
+ {
+ UIColumnContainer.insertColumn(uiSelectedColumn, false);
+ }
+
+ Util.showComponentLayoutMode(uiSelectedColumn.getClass());
+
+ PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
+ UIPortalApplication uiPortalApp = uiParent.getAncestorOfType(UIPortalApplication.class);
+ UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
+ }
+
+ }
+
+ private static void insertColumn(UIColumnContainer selectedColumn, boolean isInsertAfter) throws Exception
+ {
+ UIContainer uiParent = selectedColumn.getParent();
+ UIColumnContainer uiNewColumn = uiParent.addChild(UIColumnContainer.class, null, null);
+
+ uiNewColumn.setTemplate(selectedColumn.getTemplate());
+ uiNewColumn.setFactoryId(selectedColumn.getFactoryId());
+ uiNewColumn.setId(String.valueOf(uiNewColumn.hashCode()));
+
+ List<UIComponent> listColumn = uiParent.getChildren();
+ int position = listColumn.indexOf(selectedColumn);
+ if (isInsertAfter)
+ {
+ position += 1;
+ }
+ Collections.rotate(listColumn.subList(position, listColumn.size()), 1);
+ }
+
+}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -144,7 +144,7 @@
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
Util.showComponentLayoutMode(UIContainer.class);
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -116,7 +116,7 @@
UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.setFullRender(true);
+ prContext.ignoreAJAXUpdateOnPortlets(true);
return;
}
@@ -136,7 +136,7 @@
UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.setFullRender(true);
+ prContext.ignoreAJAXUpdateOnPortlets(true);
return;
}
}
@@ -166,7 +166,7 @@
uiPopup.setShow(false);
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.setFullRender(true);
+ prContext.ignoreAJAXUpdateOnPortlets(true);
}
private void setNavigation(List<PageNavigation> navs, PageNavigation nav)
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -453,7 +453,7 @@
// convert Page to UIPage
PortalDataMapper.toUIPage(uiPage, selectPage);
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
- Util.getPortalRequestContext().setFullRender(true);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
}
else
{
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -254,7 +254,7 @@
uiToolPanel.setShowMaskLayer(true);
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
UIContainer uiParent = uiPageNodeSelector.getParent();
PageNode node = null;
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -64,7 +64,7 @@
//This code snippet is to make sure that Javascript/Skin is fully loaded at the first request
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
PortalRequestContext pcontext = Util.getPortalRequestContext();
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
PageNavigation currentNav = showedUIPortal.getSelectedNavigation();
@@ -422,7 +422,7 @@
}
}
PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
- pcontext.setFullRender(false);
+ pcontext.ignoreAJAXUpdateOnPortlets(false);
pcontext.setResponseComplete(true);
pcontext.getWriter().write(EventListener.RESULT_OK);
}
@@ -445,7 +445,7 @@
}
DataStorage dataService = uiPage.getApplicationComponent(DataStorage.class);
dataService.save(page);
- pcontext.setFullRender(false);
+ pcontext.ignoreAJAXUpdateOnPortlets(false);
pcontext.setResponseComplete(true);
pcontext.getWriter().write(EventListener.RESULT_OK);
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -100,7 +100,7 @@
UIPortal uiPortal = Util.getUIPortal();
uiPortal.setRenderSibling(UIPortal.class);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
}
void updateWizardComponent()
@@ -111,7 +111,7 @@
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
}
static public class AbortActionListener extends EventListener<UIPageWizard>
@@ -124,7 +124,7 @@
UIPortal uiPortal = Util.getUIPortal();
uiPortal.setRenderSibling(UIPortal.class);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -168,7 +168,7 @@
UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
uiMaskWS.setUIComponent(null);
// event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS) ;
- Util.getPortalRequestContext().setFullRender(false);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(false);
if (language == null || language.trim().length() < 1)
return;
// if(!uiPortal.isModifiable()) return;
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalActionListener.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -73,7 +73,7 @@
{
PortalRequestContext pContext = (PortalRequestContext)event.getRequestContext();
HttpServletRequest request = pContext.getRequest();
- pContext.setFullRender(false);
+ pContext.ignoreAJAXUpdateOnPortlets(false);
pContext.setResponseComplete(true);
pContext.getWriter().write("" + request.getSession().getMaxInactiveInterval());
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -231,7 +231,7 @@
if (newComponent)
{
portalComposer.updateWorkspaceComponent();
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
}
UIWorkingWorkspace uiWorkingWS = uiApp.getChild(UIWorkingWorkspace.class);
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -409,7 +409,7 @@
uiEditWS.getComposer().setEditted(false);
uiEditWS.setRendered(false);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- prContext.setFullRender(true);
+ prContext.ignoreAJAXUpdateOnPortlets(true);
UISiteBody siteBody = uiWorkingWS.findFirstComponentOfType(UISiteBody.class);
UIPortal uiPortal = uiWorkingWS.getBackupUIPortal();
@@ -460,7 +460,7 @@
uiPortalApp.setSessionOpen(PortalProperties.SESSION_ALWAYS.equals(uiPortal.getSessionAlive()));
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- prContext.setFullRender(true);
+ prContext.ignoreAJAXUpdateOnPortlets(true);
String uri = (uiPortal.getSelectedNode() != null)? (uiPortal.getSelectedNode().getUri()) : null;
@@ -583,7 +583,7 @@
}
event.getSource().updateWorkspaceComponent();
- Util.getPortalRequestContext().setFullRender(true);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
}
}
@@ -656,7 +656,7 @@
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- Util.getPortalRequestContext().setFullRender(true);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
UIPortal uiPortal = uiPortalApp.getShowedUIPortal();
uiPortal.setRenderSibling(UIPortal.class);
@@ -705,7 +705,7 @@
uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{pageId}, 1));
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- Util.getPortalRequestContext().setFullRender(true);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
PageNodeEvent<UIPortal> pnevent =
new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
(uiPortal.getSelectedNode() != null ? uiPortal.getSelectedNode().getUri() : null));
@@ -762,7 +762,7 @@
}
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- Util.getPortalRequestContext().setFullRender(true);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
PageNodeEvent<UIPortal> pnevent =
new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, (uiPortal.getSelectedNode() != null
? uiPortal.getSelectedNode().getUri() : null));
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -100,7 +100,7 @@
UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
uiMaskWS.setUIComponent(null);
//event.getRequestContext().addUIComponentToUpdateByAjax(uiApp) ;
- Util.getPortalRequestContext().setFullRender(false);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(false);
if (skin == null || skin.trim().length() < 1)
return;
uiApp.setSkin(skin);
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/ToolbarUtils.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/ToolbarUtils.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/ToolbarUtils.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -67,7 +67,7 @@
PortalRequestContext portalRequestContext = (PortalRequestContext)context.getParentAppRequestContext();
UIWorkingWorkspace uiWorkingWS = portalApplication.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
portalRequestContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- portalRequestContext.setFullRender(true);
+ portalRequestContext.ignoreAJAXUpdateOnPortlets(true);
}
/**
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -311,7 +311,7 @@
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
return uiWorkingWS;
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -103,7 +103,7 @@
pageBody.setUIComponent(null);
event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
- Util.getPortalRequestContext().setFullRender(true);
+ Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
}
}
@@ -208,7 +208,7 @@
uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ pcontext.ignoreAJAXUpdateOnPortlets(true);
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplicationLifecycle.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplicationLifecycle.java 2011-07-18 21:12:51 UTC (rev 6883)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplicationLifecycle.java 2011-07-18 22:13:58 UTC (rev 6884)
@@ -47,7 +47,7 @@
{
context.addUIComponentToUpdateByAjax(uicomponent.<UIComponent>getChildById(UIPortalApplication.UI_WORKING_WS_ID));
context.addUIComponentToUpdateByAjax(uicomponent.getChild(UIMaskWorkspace.class));
- ((PortalRequestContext)context).setFullRender(true);
+ ((PortalRequestContext)context).ignoreAJAXUpdateOnPortlets(true);
return;
}
if (uiTarget == uicomponent)
13 years, 5 months
gatein SVN: r6883 - in epp/portal/branches/EPP_5_2_Branch: component and 25 other directories.
by do-not-reply@jboss.org
Author: theute
Date: 2011-07-18 17:12:51 -0400 (Mon, 18 Jul 2011)
New Revision: 6883
Added:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/BaseUIPageFactory.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageFactory.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory
Removed:
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/background/AddApplicationButton.gif
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/background/AddToStartup.gif
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIAddNewApplication.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIDesktopPage.gtmpl
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory
Modified:
epp/portal/branches/EPP_5_2_Branch/
epp/portal/branches/EPP_5_2_Branch/component/
epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentRegistry.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java
epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/UIToolbarContainer/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/pom.xml
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ar.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_de.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_en.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_es.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_it.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ja.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ko.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ne.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_nl.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_pt_BR.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ru.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_uk.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_vi.properties
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh_TW.xml
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/skin/portal/webui/component/UIIFramePortlet/DefaultStylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIWindow/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/PortletThemes/Stylesheet.css
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalToolPanel.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java
Log:
JBEPP-1012: Decouple WebOS
Property changes on: epp/portal/branches/EPP_5_2_Branch
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/decoupled-webos:6214-6243
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
Property changes on: epp/portal/branches/EPP_5_2_Branch/component
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6449,6452,6573
Modified: epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentRegistry.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentRegistry.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentRegistry.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -21,8 +21,8 @@
import org.chromattic.api.annotations.Create;
import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.NamingPrefix;
+import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.PrimaryType;
-import org.chromattic.api.annotations.OneToMany;
import org.chromattic.ext.format.BaseEncodingObjectFormatter;
import java.util.List;
@@ -49,8 +49,8 @@
public CategoryDefinition getCategory(String categoryName)
{
- Map<String, CategoryDefinition> categoryMap = getCategoryMap();
- return categoryMap.get(categoryName);
+ Map<String, CategoryDefinition> categories = getCategoryMap();
+ return categories.get(categoryName);
}
public CategoryDefinition createCategory(String categoryName)
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -31,9 +31,6 @@
**/
public class Page extends Container
{
-
- final static public String DESKTOP_PAGE = "Desktop";
-
final static public String DEFAULT_PAGE = "Default";
private String ownerType;
@@ -203,5 +200,5 @@
public String toString()
{
return "Page[ownerType=" + ownerType + ",ownerId=" + ownerId + ",name=" + name + "]";
- }
+ }
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -23,6 +23,7 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.config.POMTask;
import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.data.NavigationData;
@@ -30,11 +31,7 @@
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
import org.exoplatform.portal.pom.config.POMSession;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-import org.gatein.mop.api.workspace.WorkspaceObject;
+import org.gatein.mop.api.workspace.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -64,7 +61,7 @@
super(query);
}
- public LazyPageList<T> run(final POMSession session) throws Exception
+ public final LazyPageList<T> run(final POMSession session) throws Exception
{
Iterator<W> ite;
try
@@ -80,22 +77,24 @@
}
catch (IllegalArgumentException e)
{
- ite = Collections.<W> emptyList().iterator();
+ ite = Collections.<W>emptyList().iterator();
}
//
- final ArrayList<W> array = new ArrayList<W>();
+ final ArrayList<String> array = new ArrayList<String>();
while (ite.hasNext())
{
- array.add(ite.next());
+ array.add(ite.next().getObjectId());
}
//
- final Iterator<W> it = array.iterator();
+ final POMSessionManager manager = session.getManager();
+ final Iterator<String> it = array.iterator();
ListAccess<T> la = new ListAccess<T>()
{
public T[] load(int index, int length) throws Exception, IllegalArgumentException
{
+ POMSession session = manager.getSession();
T[] result = createT(length);
for (int i = 0; i < length; i++)
{
@@ -120,7 +119,7 @@
protected abstract T[] createT(int length);
- protected abstract T loadT(POMSession session, W w);
+ protected abstract T loadT(POMSession session, String id);
}
@@ -143,9 +142,10 @@
return new PageData[length];
}
- protected PageData loadT(POMSession session, org.gatein.mop.api.workspace.Page w)
+ protected PageData loadT(POMSession session, String id)
{
- return new Mapper(session).load(w);
+ Page page = session.getManager().getPOMService().getModel().findObjectById(ObjectType.PAGE, id);
+ return new Mapper(session).load(page);
}
}
@@ -168,9 +168,10 @@
return new NavigationData[length];
}
- protected NavigationData loadT(POMSession session, Navigation w)
+ protected NavigationData loadT(POMSession session, String id)
{
- return new Mapper(session).load(w);
+ Navigation nav = session.getManager().getPOMService().getModel().findObjectById(ObjectType.NAVIGATION, id);
+ return new Mapper(session).load(nav);
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -97,4 +97,26 @@
assertNotFound("foo");
assertNotFound("foo bar");
}
+
+ public void testSearchPageByOwnerID() throws Exception
+ {
+ Query<Page> q = new Query<Page>(null, "foo", Page.class);
+ List<Page> res = storage.find(q).getAll();
+ assertEquals(0, res.size());
+
+ q.setOwnerId("test");
+ res = storage.find(q).getAll();
+ int pageNum = res.size();
+ assertTrue(pageNum > 0);
+
+ //Test trim ownerID
+ q.setOwnerId(" test ");
+ res = storage.find(q).getAll();
+ assertEquals(pageNum, res.size());
+
+ //This should returns all pages
+ q.setOwnerId(null);
+ res = storage.find(q).getAll();
+ assertTrue(res.size() > 0);
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/UIToolbarContainer/Stylesheet.css
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/UIToolbarContainer/Stylesheet.css 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/examples/skins/simpleskin/src/main/webapp/skin/SimpleSkin/UIToolbarContainer/Stylesheet.css 2011-07-18 21:12:51 UTC (rev 6883)
@@ -135,6 +135,7 @@
padding: 0px 10px 0px 25px; /* orientation=lt */
padding: 0px 25px 0px 10px; /* orientation=rt */
color: #fff;
+ line-height: 30px;
}
.UIToolbarContainer .Name a:hover {
Modified: epp/portal/branches/EPP_5_2_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -862,6 +862,12 @@
<include>**/*.xsd</include>
</includes>
</resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.*</include>
+ </includes>
+ </resource>
</resources>
<testResources>
<testResource>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -40,9 +40,6 @@
@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl")
public class UIAdminToolbarPortlet extends UIPortletApplication
{
- // Minh Hoang TO
- // TODO: Add a ThreadLocal cache to avoid double invocation of editPermission
- // check ( one in processRender method, and one in Groovy template )
public UIAdminToolbarPortlet() throws Exception
{
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -38,6 +38,7 @@
import org.exoplatform.webui.event.EventListener;
import java.util.List;
+import javax.portlet.EventRequest;
/**
* Created by The eXo Platform SAS
@@ -45,7 +46,9 @@
* thanhtungty(a)gmail.com
* May 26, 2009
*/
-@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl", events = {@EventConfig(name = "AddDefaultDashboard", listeners = UIUserToolBarDashboardPortlet.AddDashboardActionListener.class)})
+@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template = "app:/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl",
+ events = {@EventConfig(name = "AddDefaultDashboard", listeners = UIUserToolBarDashboardPortlet.AddDashboardActionListener.class),
+ @EventConfig(listeners = UIUserToolBarDashboardPortlet.UserPageNodeDeletedActionListener.class)})
public class UIUserToolBarDashboardPortlet extends UIPortletApplication
{
@@ -78,6 +81,17 @@
return Util.getUIPortal().getSelectedNode();
}
+ static public class UserPageNodeDeletedActionListener extends EventListener<UIUserToolBarDashboardPortlet>
+ {
+ private Log log = ExoLogger.getExoLogger(UserPageNodeDeletedActionListener.class);
+
+ @Override
+ public void execute(Event<UIUserToolBarDashboardPortlet> event) throws Exception
+ {
+ log.debug("PageNode : " + ((EventRequest)event.getRequestContext().getRequest()).getEvent().getValue() + " is deleted");
+ }
+ }
+
static public class AddDashboardActionListener extends EventListener<UIUserToolBarDashboardPortlet>
{
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -22,6 +22,12 @@
<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+
+ <public-render-parameter>
+ <identifier>navigation_uri</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:navigation_uri</qname>
+ </public-render-parameter>
+
<portlet>
<description xml:lang="EN">Organization Portlet</description>
<portlet-name>OrganizationPortlet</portlet-name>
@@ -191,6 +197,9 @@
<short-title>Page Management Portlet</short-title>
<keywords>Administration</keywords>
</portlet-info>
+ <supported-publishing-event>
+ <name>UserPageNodeDeleted</name>
+ </supported-publishing-event>
</portlet>
<portlet>
@@ -250,6 +259,8 @@
<short-title>Administration Toolbar</short-title>
<keywords>gatein_internal</keywords>
</portlet-info>
+
+ <supported-public-render-parameter>navigation_uri</supported-public-render-parameter>
</portlet>
<portlet>
@@ -340,6 +351,9 @@
<role-name>admin</role-name>
<role-link>admin</role-link>
</security-role-ref>
+ <supported-processing-event>
+ <name>UserPageNodeDeleted</name>
+ </supported-processing-event>
</portlet>
<portlet>
@@ -399,4 +413,7 @@
<event-definition>
<name>NewAccountAdded</name>
</event-definition>
+ <event-definition>
+ <name>UserPageNodeDeleted</name>
+ </event-definition>
</portlet-app>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ar.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ar.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ar.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -24,7 +24,6 @@
<UIHomePagePortlet>
<Label>
<Title>حاول بوابة إكزو0.2 المتاحة مع حسابات المستخدمين التالية</Title>
- <intro><l1>اصدار جديد مع واجهة المستخدم ثورية</l1><l2> مخططات المكتب: Classic و WebOS </l2><l3> مخططات سحب واسقاط. معالج انشاء الصفحات. </l3><l4> وكثير من المزيد... </l4></intro>
<Username>اسم المستخدم</Username>
<Password>كلمة السر</Password>
<Demo>تجربة</Demo>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_de.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_de.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_de.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -20,7 +20,7 @@
#####################################################################################
# EXCEPTION MAPPINGS #
#####################################################################################
-UIGroovyPortlet.note.Text=Die ist ein Beispiel f�r ein Groovy-Portlet. Es kann in einer Webapplikation installiert werden.
+UIGroovyPortlet.note.Text=Die ist ein Beispiel f�r ein Groovy-Portlet. Es kann in einer Webapplikation installiert werden.
UIIFrameEditMode.title=URL \u00e4ndern
UIIFrameEditMode.label.iframeUrl=URL
UIIFrameEditMode.label.editmode=Bearbeitungsmodus
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Testen Sie GateIn 3.1 mit einem dieser Benutzerkonten:
-UIHomePagePortlet.Label.Intro=Die neue Version verf\u00fcgt \u00fcber eine revolution\u00e4re Bedienoberfl\u00e4che<br/>Classic- und WebOS-Layouts<br/> Ziehen und Ablegen (Drag & Drop). Seitenerstellassistent<br/>Und viel mehr...
UIHomePagePortlet.Label.Slogan=Das Beste aus eXo und JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=Name:
UIHomePagePortlet.Label.Password=Passwort:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_en.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_en.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_en.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Try GateIn 3.1 with one of these user accounts:
-UIHomePagePortlet.Label.Intro=The new version comes with a revolutionary user interface<br/>Classic and WebOS Desktop Layouts<br/> Drag and Drop Features. Create Page Wizard<br/>And many more...
UIHomePagePortlet.Label.Slogan=The Best of eXo and JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.GuideText=For more information, please contact us.
UIHomePagePortlet.Label.IntroText=GateIn is the new generation of Open Source portal, jointly led by Red Hat and eXo Platform who partner to gather the best portal experts and communities around a robust and intuitive portal that brings rich administration functionalities to IT systems.
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_es.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_es.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_es.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Prueba GateIn 3.1 con uno de los siguientes usuarios:
-UIHomePagePortlet.Label.Intro=La nueva versi\u00f3n viene con un interfaz de usuario revolucionario<br/>Layouts Cl\u00e1sico y Escritorio WebOS <br/> Funcionalidad Drag and Drop. Asistente de Creaci\u00f3n de P\u00e1gina<br/>Y mucho m\u00e1s...
UIHomePagePortlet.Label.Slogan=Lo mejor de eXo y JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=Usuario:
UIHomePagePortlet.Label.Password=Contrase\u00f1a:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_it.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_it.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_it.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Prova GateIn 3.1 con uno di questi account utente:
-UIHomePagePortlet.Label.Intro=La nuova versione nasce con una moderna interfaccia utente<br/>Layout Classici e WebOS Desktop<br/> Funzionalit\u00E0 di Drag and Drop. Wizard di creazione della pagina<br/>E oltre...
UIHomePagePortlet.Label.Slogan=Il meglio di eXo e JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.GuideText=Contattaci per maggiori informazioni.
UIHomePagePortlet.Label.IntroText=GateIn \u00E8 la nuova generazione di portali Open Source, esclusivamente fornito da Red Hat ed eXo Platform ai sistemi IT che raccolgono i migliori partner esperti di tecnologie sui portali e una community che gira intorno ad un portale robusto ed intuitivo e ricco di funzionalit\u00E0 di amministrazione.
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ja.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ja.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ja.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -39,8 +39,6 @@
UIHomePagePortlet.Label.Title=\u3053\u308c\u3089\u30e6\u30fc\u30b6\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u4e00\u3064\u3067GateIn 3.1\u3092\u8a66\u3057\u3066\u304f\u3060\u3055\u3044:
-UIHomePagePortlet.Label.Intro=The new version comes with a revolutionary user interface<br/>Classic and WebOS Desktop Layouts<br/> Drag and Drop Features. Create Page Wizard<br/>And many more...
-
UIHomePagePortlet.Label.Slogan=The Best of eXo and JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=\u30e6\u30fc\u30b6\u30fc\u540d:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ko.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ko.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ko.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -25,7 +25,6 @@
<UIHomePagePortlet>
<Label>
<Title>사용자 계정들 중 하나와 함께 GateIn 3.1을 시도하십시오.</Title>
- <Intro>새로운 버전에 혁신적인 사용자 인터페이스가 추가됩니다. <br/>표준 및 WebOS 데스크탑 레이아웃<br/> 드래그 앤 드롭 기능들. 페이지 생성 마법사<br/>기타 부가 기능.</Intro>
<Slogan>최고의 eXo 및 JBoss Portal<div>GateIn 3.1</div></Slogan>
<Username>사용자이름:</Username>
<Password>비밀번호:</Password>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ne.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ne.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ne.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=\u092f\u0940 \u092e\u0927\u094d\u092f\u0947 \u0915\u0941\u0928\u0948 \u092a\u094d\u0930\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e \u0916\u093e\u0924\u093e\u0939\u0930\u0941\u0932\u0947 GateIn 3.1\u092e\u093e \u092a\u094d\u0930\u092f\u093e\u0938 \u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIHomePagePortlet.Label.Intro=The new version comes with a revolutionary user interface<br/>Classic and WebOS Desktop Layouts<br/> Drag and Drop Features. Create Page Wizard<br/>And many more...
UIHomePagePortlet.Label.Slogan=The Best of eXo and JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=\u092a\u094d\u0930\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e \u0928\u093e\u092e:
UIHomePagePortlet.Label.Password=\u092a\u093e\u0938\u094d\u0935\u094b\u0930\u094d\u0921:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_nl.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_nl.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_nl.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Probeer GateIn 3.1 met \u00E9\u00E9n van deze gebruikersaccounts:
-UIHomePagePortlet.Label.Intro=De nieuwe versie komt met een revolutionaire gebruikersinterface<br/>Klassieke en WebOS desktop lay-outs<br/> Drag and drop mogelijkheden. Pagina creatie wizard<br/>En nog veel meer ...
UIHomePagePortlet.Label.Slogan=Het beste van eXo en JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=Gebruikersnaam:
UIHomePagePortlet.Label.Password=Paswoord:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_pt_BR.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_pt_BR.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_pt_BR.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Experimente GateIn 3.1 com uma das contas:
-UIHomePagePortlet.Label.Intro=A nova versão vem com uma revolucionárioa interface<br/>Layouts Classic e WebOS Desktop<br/>Recursos de Drag and Drop. Wizard de criação de páginas<br/>E muito mais...
UIHomePagePortlet.Label.Slogan=O melhor de eXo e JBoss Portal <div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=Usuário:
UIHomePagePortlet.Label.Password=Senha:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ru.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ru.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_ru.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -15,7 +15,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Используйте GateIn 3.1 с одной из учётных записей:
-UIHomePagePortlet.Label.Intro=Новая версия представляет революционно новый пользовательский интерфейс<br/>Класический и WebOS макеты<br/> Поддержка перетаскивания. Мастера создания страниц<br/>И многое другое...
UIHomePagePortlet.Label.Slogan=The Best of eXo and JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=Имя:
UIHomePagePortlet.Label.Password=Пароль:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_uk.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_uk.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_uk.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -16,7 +16,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Спробуй GateIn 3.1 з користувачем серед таких облікових записів:
-UIHomePagePortlet.Label.Intro=Нова версія з прогресивним інтерфейсом користувача<br/>схема класичного та WebOS робочого столу<br/> Можливість "Перетягни-відпусти". Wizard-створювач сторінок<br/>Та багато іншого...
UIHomePagePortlet.Label.Slogan=The Best of eXo and JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.Username=Ім'я користувача:
UIHomePagePortlet.Label.Password=Пароль:
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_vi.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_vi.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_vi.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -34,7 +34,6 @@
#############################################################################
UIHomePagePortlet.Label.Title=Dùng thử GateIn 3.1 với một trong những tài khoản sau:
-UIHomePagePortlet.Label.Intro=The new version comes with a revolutionary user interface<br/>Classic and WebOS Desktop Layouts<br/> Drag and Drop Features. Create Page Wizard<br/>And many more...
UIHomePagePortlet.Label.Slogan=The Best of eXo and JBoss Portal<div>GateIn 3.1</div>
UIHomePagePortlet.Label.GuideText=Để biết thêm thông tin xin hãy liên lạc với chúng tôi.
UIHomePagePortlet.Label.IntroText=GateIn là cổng thông tin thế hệ mới kết hợp giữa Red Hat và eXo Platform, tập trung những chuyên gia về cổng thông tin và cộng đồng tốt nhất, mang lại cho các hệ thống thông tin những tính năng đầy đủ nhất.
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -25,7 +25,6 @@
<UIHomePagePortlet>
<Label>
<Title>用一个用户帐户尝试GateIn 3.1:</Title>
- <Intro>新版本增加了新的用户界面<br/>经典和WebOS桌面布局<br/>拖放功能,创建页向导<br/>等等。。。</Intro>
<Slogan>eXo和JBoss Portal最好的门户平台<div>GateIn 3.1</div></Slogan>
<Username>用户名:</Username>
<Password>密码:</Password>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh_TW.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh_TW.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/WEB-INF/classes/locale/portlet/web/GroovyPortlet_zh_TW.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -24,7 +24,6 @@
<UIHomePagePortlet>
<Label>
<Title>讓你感受全新體驗的 JBoss GateIn 3.1:</Title>
-<Intro>新版本增加了新的Web 2.0界面<br/>經典和WebOS桌面佈局<br/>拖放功能,頁面導覽<br/>等等。 。 。</Intro>
<Slogan>eXo和JBoss Portal最好的Portal平台<div>GateIn 3.1</div></Slogan>
<Username>用戶名:</Username>
<Password>密碼:</Password>
Modified: epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/skin/portal/webui/component/UIIFramePortlet/DefaultStylesheet.css
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/skin/portal/webui/component/UIIFramePortlet/DefaultStylesheet.css 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/skin/portal/webui/component/UIIFramePortlet/DefaultStylesheet.css 2011-07-18 21:12:51 UTC (rev 6883)
@@ -5,10 +5,6 @@
margin: 7px;
height: auto;
}
-
-.UIPageDesktop .UIIFramePortlet {
- min-height: 0;
-}
*html .UIFormTabPane .UIIFramePortlet {
height: auto;
@@ -19,10 +15,6 @@
width: 97.5%;
}
-*html .UIPageDesktop .UIIFramePortlet {
- height: auto;
-}
-
.UIIFramePortlet iframe {
border: none;
width: 100%; height: 100%;
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/Stylesheet.css
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/Stylesheet.css 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/Stylesheet.css 2011-07-18 21:12:51 UTC (rev 6883)
@@ -110,167 +110,6 @@
overflow: hidden;
}
-/**************************** UIAddApplication ******************************************/
-
-.UIAddApplication {
- padding: 10px;
-}
-
-.UIAddApplication .TitleBarContainer {
- background: #f6f6f6;
-}
-
-.UIAddApplication .UITabContent {
- overflow: hidden;
-}
-
-.UIAddApplication .UITabContentContainer {
- padding-bottom: 5px;
- border: none;
-}
-
-.UIAddApplication .UITabContentContainer .NoneAppsMessage{
- padding: 10px;
- text-align: center;
- color: gray;
- width: 300px;
- margin: 40px auto 0px auto;
-}
-
-.UIAddApplication .ContentContainerDetail {
- border: 1px solid #d4d4d4;
- border-top: none;
-}
-
-.UIAddApplication .ContentContainerDetail .CategoryContainer {
- border: 1px solid white;
- border-top: none;
-}
-
-.UIAddApplication .ApplicationListContainer {
- height: 240px; width: 449px;
- border: 1px solid #c3c3c3;
- background: white;
- overflow-y: auto;
- overflow-x: hidden;
- padding: 0px 10px;
-}
-
-.UIAddApplication .Application {
- margin: 10px 0px 0px 0px;
- border: solid 1px #e4e4e4;
- padding: 10px;
-}
-
-.UIAddApplication .ApplicationContent {
- margin-left: 85px; /* orientation=lt */
- margin-right: 85px; /* orientation=rt */
-}
-
-.UIAddApplication .PortletIcon {
- background: none;
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- width: 80px; height: 80px;
- cursor: pointer;
- margin-top: 2px;
-}
-
-.UIAddApplication .TitleBarApplication {
- background: none;
- width: 93%; height: 20px;
- color: #1553B9; font-weight: bold;
- border-bottom: 1px solid #dfdfdf;
- padding: 0px 1px 3px 1px;
- margin: 0px auto 5px auto;
-}
-
-.UIAddApplication .TitleBarApplication .Title {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- margin-top: 4px;
- font-weight: bold; font-size: 13px; color: #1553B9; font-family: arial;
-}
-
-.UIAddApplication .AddButton {
- width: 20px; height: 24px;
- background: url('background/AddApplicationButton.gif') no-repeat top;
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- cursor: pointer;
- margin: 0px 3px;
-}
-
-.UIAddApplication .AddToStartUp {
- width: 20px; height: 24px;
- background: url('background/AddToStartup.gif') no-repeat top;
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- cursor: pointer;
- margin: 0px 3px;
-}
-
-.UIAddApplication .SelectButton {
- width: 20px; height: 24px;
- background: url('background/AddApplicationButton.gif') no-repeat left -22px;
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- cursor: pointer;
- margin: 0px 3px;
-}
-
-.UIAddApplication .ApplicationContentLabel {
- line-height: 16px;
- width: 93%; margin: auto;
-}
-
-.UIAddApplication .ApplicationContentLabel .RightLabel {
- color: #058ee6;
-}
-
-.UIAddApplication .UIItemSelector .LeftColumnStyle {
- width: auto;
-}
-
-.UIAddApplication .UIItemSelector .ItemListContainer .ItemList {
- height: 240px;
- overflow: auto;
- background: #ffffff;
- border: 1px solid #c3c3c3;
- text-transform: capitalize;
-}
-
-.UIAddApplication .UIItemSelector .ItemDetailList .ItemDetail {
- background: none;
- border: none;
- height: auto;
-}
-
-.UIAddApplication .UIItemSelector {
- padding: 7px 5px 8px 7px; /* orientation=lt */
- padding: 7px 7px 8px 5px; /* orientation=rt */
- margin: 0px;
- background: #f7f7f7;
-}
-
-.UIAddApplication .ApplicationItemIcon {
- width: 16px; height: 16px;
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/DarkBlueNextArrow.gif') no-repeat;
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- margin: 3px 5px 0px 5px;
-}
-
-.UIAddApplication .LeftColumnStyle .ItemListIcon {
- background: none;
- width: 0px;
-}
-
-.UIAddApplication .LeftColumnStyle .ViewListIcon {
- background: none;
- width: 0px;
-}
-
/************************************ Select Permission *******************************/
.UIGroupSelector {
Deleted: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/background/AddApplicationButton.gif
===================================================================
(Binary files differ)
Deleted: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIMaskWorkspace/background/AddToStartup.gif
===================================================================
(Binary files differ)
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIWindow/Stylesheet.css
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIWindow/Stylesheet.css 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIWindow/Stylesheet.css 2011-07-18 21:12:51 UTC (rev 6883)
@@ -1,7 +1,3 @@
-
-.UIPageDesktop .UIWindow .WindowBarCenter .WindowPortletInfo {
- cursor: move;
-}
/*##########################################################*/
Modified: epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/PortletThemes/Stylesheet.css
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/PortletThemes/Stylesheet.css 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/skin/PortletThemes/Stylesheet.css 2011-07-18 21:12:51 UTC (rev 6883)
@@ -55,16 +55,6 @@
background-position: center 188px;
}
-
-.UIPageDesktop .DefaultTheme .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 18px; height: 18px;
- cursor: nw-resize;
- background: url('background/ResizeArea18x18.gif') no-repeat left top; /* orientation=lt */
- background: url('background/ResizeArea18x18-rt.gif') no-repeat right top; /* orientation=rt */
-}
-
.DefaultTheme .Information {
height: 18px; line-height: 18px;
vertical-align: middle; font-size: 10px;
@@ -236,15 +226,6 @@
margin: 4px 2px 0px 2px;
}
-.UIPageDesktop .MacTheme .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 15px;
- cursor: nw-resize;
- background: url('background/ResizeArea17x15.png') no-repeat right top; /* orientation=lt */
- background: url('background/ResizeArea17x15-rt.png') no-repeat left top; /* orientation=rt */
-}
-
.MacTheme .Information {
height: 16px; line-height: 14px; vertical-align: middle;
font-size: 10px;
@@ -402,14 +383,6 @@
margin: 4px 2px 0px 2px;
}
-.UIPageDesktop .MacGray .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 15px;
- cursor: nw-resize;
- background: url('background/ResizeArea17x15.png') no-repeat;
-}
-
.MacGray .Information {
height: 16px; line-height: 14px; vertical-align: middle;
font-size: 10px;
@@ -568,14 +541,6 @@
margin: 4px 2px 0px 2px;
}
-.UIPageDesktop .MacBlack .ResizeArea {
- float: left; /* orientation=rt */
- float: right; /* orientation=lt */
- width: 17px; height: 15px;
- cursor: nw-resize;
- background: url('background/ResizeArea17x15.png') no-repeat;
-}
-
.MacBlack .Information {
height: 16px; line-height: 14px; vertical-align: middle;
font-size: 10px;
@@ -734,14 +699,6 @@
margin: 4px 2px 0px 2px;
}
-.UIPageDesktop .MacGreenSteel .ResizeArea {
- float: left; /* orientation=rt */
- float: right; /* orientation=lt */
- width: 17px; height: 15px;
- cursor: nw-resize;
- background: url('background/ResizeArea17x15.png') no-repeat;
-}
-
.MacGreenSteel .Information {
height: 16px; line-height: 14px; vertical-align: middle;
font-size: 10px;
@@ -903,15 +860,6 @@
border: solid 1px #717171;
}
-.UIPageDesktop .VistaTheme .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 9px; height: 12px;
- cursor: nw-resize;
- background: url('/eXoSkinVista/skin/VistaSkin/skinIcons/16x16/icons/ResizeBG.gif') no-repeat bottom right; /* orientation=lt */
- background: url('/eXoSkinVista/skin/VistaSkin/skinIcons/16x16/icons/ResizeBG-rt.gif') no-repeat bottom left; /* orientation=rt */
-}
-
.VistaTheme .MiddleDecoratorLeft {
padding-left:12px;
background: url('background/MVistaTheme.png') repeat-y left;
@@ -1077,14 +1025,6 @@
height: 100%;
}
-.UIPageDesktop .VistaBlue .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 9px; height: 12px;
- cursor: nw-resize;
- background: url('/eXoSkinVista/skin/VistaSkin/skinIcons/16x16/icons/ResizeBG.gif') no-repeat bottom right;
-}
-
.VistaBlue .MiddleDecoratorLeft {
padding-left: 15px;
background: url('background/MVistaBlue.png') repeat-y left;
@@ -1183,14 +1123,6 @@
height: 16px;
}
-.UIPageDesktop .RoundConerBlue .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.RoundConerBlue .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -1338,14 +1270,6 @@
height: 16px;
}
-.UIPageDesktop .RoundConerViolet .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.RoundConerViolet .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -1498,14 +1422,6 @@
height: 16px;
}
-.UIPageDesktop .RoundConerOrange .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.RoundConerOrange .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -1658,14 +1574,6 @@
height: 16px;
}
-.UIPageDesktop .RoundConerPink .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.RoundConerPink .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -1818,14 +1726,6 @@
height: 16px;
}
-.UIPageDesktop .RoundConerGreen .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.RoundConerGreen .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -1978,14 +1878,6 @@
height: 16px;
}
-.UIPageDesktop .ShadowBlue .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.ShadowBlue .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -2136,14 +2028,6 @@
height: 16px;
}
-.UIPageDesktop .ShadowViolet .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.ShadowViolet .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -2294,14 +2178,6 @@
height: 16px;
}
-.UIPageDesktop .ShadowOrange .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.ShadowOrange .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -2453,14 +2329,6 @@
height: 16px;
}
-.UIPageDesktop .ShadowPink .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.ShadowPink .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -2612,14 +2480,6 @@
height: 16px;
}
-.UIPageDesktop .ShadowGreen .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.ShadowGreen .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -2769,14 +2629,6 @@
height: 16px;
}
-.UIPageDesktop .SimpleBlue .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.SimpleBlue .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -2916,14 +2768,6 @@
height: 16px;
}
-.UIPageDesktop .SimpleViolet .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.SimpleViolet .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -3065,14 +2909,6 @@
height: 16px;
}
-.UIPageDesktop .SimpleOrange .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.SimpleOrange .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -3214,14 +3050,6 @@
height: 16px;
}
-.UIPageDesktop .SimplePink .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.SimplePink .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
@@ -3364,14 +3192,6 @@
height: 16px;
}
-.UIPageDesktop .SimpleGreen .ResizeArea {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 17px; height: 19px;
- cursor: nw-resize;
- background: url('background/Resize17x19.png') no-repeat;
-}
-
.SimpleGreen .WindowBarCenter .PortletName {
font-weight: bold;
color: #333333;
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -345,9 +345,6 @@
<left>
<title>عرض وحدد الجلد</title>
</left>
- <Desktop>
- <label> تخطيط سطح المكتب</label>
- </Desktop>
<AccountTemplate>
<left>
<title>نموذج حساب قالب معاينة</title>
@@ -870,8 +867,6 @@
</Invalid-editPermission>
<Invalid-deletePermission> {0} لا يسمح لك لحذف صفحة .
</Invalid-deletePermission>
- <Invalid-Preview>هذه هي صفحة سطح المكتب. يمكنك معاينة صفحات ليست من
- هذا النوع. </Invalid-Preview>
<NotViewPage> لديك لا حقوق لعرض هذه الصفحة.</NotViewPage>
<edit>
<NotEditPage>لم تقم في ذلك الحق في تعديل هذه الصفحة. </NotEditPage>
@@ -1354,7 +1349,6 @@
<normalPage>
<EmptyLayout>تخطيط فارغ </EmptyLayout>
<CurrentLayout> تخطيط الحالي</CurrentLayout>
- <DesktopImage>تخطيط سطح المكتب </DesktopImage>
<DashboardLayout> لوحة القيادة تخطيط</DashboardLayout>
</normalPage>
<columnPage>
@@ -1678,9 +1672,6 @@
<ClassicPortal>
<label> بوابة الكلاسيكية</label>
</ClassicPortal>
- <WebOSPortal>
- <label> نظام التشغيل ويب بوابة </label>
- </WebOSPortal>
<!--
#############################################################################
-->
@@ -1906,61 +1897,6 @@
</UIPage>
<!--
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
- -->
- <UIPageDesktop>
- <Default>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
- </location>
- </img>
- </Default>
- <Mac>
- <img>
- <location>
- /eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
- </location>
- </img>
- </Mac>
- <Vista>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
- </location>
- </img>
- </Vista>
- <label>
- <pagebody> الهيئة صفحة من البوابة</pagebody>
- <PageContent> محتويات الصفحة</PageContent>
- <View>منظر </View>
- <Edit> عدل</Edit>
- <Done> عمله</Done>
- </label>
- <title>
- <PortalPage>صفحة البوابة </PortalPage>
- <SaveToDatabase>حفظ إلى قاعدة البيانات </SaveToDatabase>
- <AddApplication>إضافة تطبيقات </AddApplication>
- <PageNavigation> الصفحة الملاحة</PageNavigation>
- <eXoBrowser> متصفح</eXoBrowser>
- <ShowPortletDesktop> إظهار / إخفاء المداخل</ShowPortletDesktop>
- <ShowWidgetDesktop>إظهار / إخفاء الأدوات </ShowWidgetDesktop>
- <SignIn> تسجيل الدخول</SignIn>
- <SignOut> تسجيل الخروج</SignOut>
- <pageNavigation>الصفحة تنقلات </pageNavigation>
- </title>
- <msg>
- <hasNotPermission> لديك إذن لا عدل في هذه الصفحة.</hasNotPermission>
- </msg>
- <action>
- <Close>إزالة التطبيق من شريط العرض </Close>
- <Quit> ترك</Quit>
- <action>
- <Open>فتح</Open>
- </action>
- </action>
- </UIPageDesktop>
- <!--
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
-->
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -200,7 +200,6 @@
Template.title=Skin-Liste
Template.left.title=Skins ansehen und ausw\u00e4hlen
-Desktop.label=Arbeitsfl\u00e4chen-Layout
AccountTemplate.left.title=Vorschau anhand des Konto-Templates
AccountTemplate.title=Konto-Templates
DefaultAccount.label=Standard-Konto
@@ -412,7 +411,6 @@
UIPageBrowser.msg.Invalid-viewPermission=Ihnen fehlt die Berechtigung, um die Seite {0} zuzugreifen.
UIPageBrowser.msg.Invalid-editPermission=Ihnen fehlt die Berechtigung, um die Seite {0} zu bearbeiten.
UIPageBrowser.msg.Invalid-deletePermission=Ihnen fehlt die Berechtigung, um die Seite {0} zu l\u00f6schen.
-UIPageBrowser.msg.Invalid-Preview=Dies eine Seite der Arbeitsfl\u00e4che. F\u00fcr diesen Seitentyp kann keine Vorschau angesehen werden.
UIPageBrowser.msg.NotViewPage=Ihnen fehlt die Berechtigung, um diese Seite anzusehen.
UIPageBrowser.msg.edit.NotEditPage=Ihnen fehlt die Berechtigung, um diese Seite zu bearbeiten.
UIPageBrowser.msg.delete.NotDelete=Ihnen fehlt die Berechtigung, um diese Seite zu l\u00f6schen.
@@ -678,7 +676,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Seitenvorlagen-Optionen
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Leeres Layout
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Aktuelles Layout
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Arbeitsfl\u00e4chen-Layout
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Dashboard-Layout
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Zwei-Spalten-Layout
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Drei-Spalten-Layout
@@ -819,7 +816,6 @@
UIPortalBrowser.deletePortal=Sind Sie sicher, dass Sie dieses Portal l\u00f6schen m\u00f6chten?
SitePortal.label=Site Portal
ClassicPortal.label=Classic Portal
-WebOSPortal.label=WebOS Portal
############################################################################
@@ -950,33 +946,6 @@
UIPage.msg.EditPermission.null=Ihnen fehlt die Berechtigung, um diese Seite zu bearbeiten.
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=Portalstrukturseite
-UIPageDesktop.label.PageContent=Seiteninhalt
-UIPageDesktop.label.View=Ansehen
-UIPageDesktop.label.Edit=Bearbeiten
-UIPageDesktop.label.Done=Beenden
-UIPageDesktop.title.PortalPage=Portalstrukturseite
-UIPageDesktop.title.SaveToDatabase=In der Datenbank speichern
-UIPageDesktop.title.AddApplication=Applikationen hinzuf\u00fcgen
-UIPageDesktop.title.PageNavigation=Seitennavigation
-UIPageDesktop.title.eXoBrowser=Browser.
-UIPageDesktop.title.ShowPortletDesktop=Portlets Zeigen/Ausblenden
-UIPageDesktop.title.ShowWidgetDesktop=Gadgets Zeigen/Ausblenden
-UIPageDesktop.title.SignIn=Anmelden
-UIPageDesktop.title.SignOut=Abmelden
-UIPageDesktop.title.pageNavigation=Seitennavigation
-UIPageDesktop.msg.hasNotPermission=Ihnen fehlt die Berechtigung, um diese Seite zu bearbeiten.
-UIPageDesktop.action.Close=Diese Applikation von der Leiste entfernen.
-UIPageDesktop.action.Quit=Verlassen
-UIPageDesktop.action.action.Open=Öffnen
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -208,7 +208,6 @@
Template.title=Skins List
Template.left.title=View and select a skin
-Desktop.label=Desktop Layout
AccountTemplate.left.title=Sample Account Template Preview
AccountTemplate.title=Account Templates
DefaultAccount.label=Default Account
@@ -430,10 +429,10 @@
UIPageBrowser.msg.Invalid-viewPermission=You are not allowed to access page {0}.
UIPageBrowser.msg.Invalid-editPermission=You are not allowed to edit page {0}.
UIPageBrowser.msg.Invalid-deletePermission=You are not allowed to delete page {0}.
-UIPageBrowser.msg.Invalid-Preview=This is a desktop page. You cannot preview pages of this type.
UIPageBrowser.msg.NotViewPage=You have not the rights to view this page.
UIPageBrowser.msg.edit.NotEditPage=You have not the rights to edit this page.
UIPageBrowser.msg.delete.NotDelete=You have not the rights to delete this page.
+UIPageBrowser.msg.delete.DeleteCurrentUserPage=You have to switch to other page to delete this page
UIPageBrowser.selectItem.ownerType=Owner Type
UIPageBrowser.selectItem.ownerId=Owner Id
UIPageBrowser.selectItem.name=Name
@@ -710,7 +709,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Page template options
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Empty Layout
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Current Layout
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Desktop Layout
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Dashboard Layout
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Two Columns Layout
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Three Columns Layout
@@ -849,7 +847,6 @@
UIPortalBrowser.deletePortal=Are you sure you want to delete this portal?
SitePortal.label=Site Portal
ClassicPortal.label=Classic Portal
-WebOSPortal.label=WebOS Portal
BasicPortal.label=Basic Portal
############################################################################
@@ -983,33 +980,6 @@
UIPage.msg.EditPermission.null=You do not have the rights to edit this page.
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=The page body of the portal
-UIPageDesktop.label.PageContent=Page Content
-UIPageDesktop.label.View=View
-UIPageDesktop.label.Edit=Edit
-UIPageDesktop.label.Done=Done
-UIPageDesktop.title.PortalPage=Portal Page
-UIPageDesktop.title.SaveToDatabase=Save to database
-UIPageDesktop.title.AddApplication=Add Applications
-UIPageDesktop.title.PageNavigation=Page Navigation
-UIPageDesktop.title.eXoBrowser=Browser.
-UIPageDesktop.title.ShowPortletDesktop=Show/Hide Portlets
-UIPageDesktop.title.ShowWidgetDesktop=Show/Hide Gadgets
-UIPageDesktop.title.SignIn=Sign In
-UIPageDesktop.title.SignOut=Sign Out
-UIPageDesktop.title.pageNavigation=Page Navigations
-UIPageDesktop.msg.hasNotPermission=You have no edit permission on this page.
-UIPageDesktop.action.Close=Remove this application from dockbar
-UIPageDesktop.action.Quit=Quit
-UIPageDesktop.action.action.Open=Open
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -200,7 +200,6 @@
Template.title=Lista de Skins
Template.left.title=Ver y seleccionar un skin
-Desktop.label=Distribuci\u00f3n de Escritorio
AccountTemplate.left.title=Previsualizaci\u00f3n del ejemplo de Plantilla Cuenta
AccountTemplate.title=Plantilas Cuenta
DefaultAccount.label=Cuenta por Defecto
@@ -410,7 +409,6 @@
UIPageBrowser.msg.Invalid-viewPermission=No tienes permisos para acceder a la p\u00e1gina {0}.
UIPageBrowser.msg.Invalid-editPermission=No tienes permisos para editar la p\u00e1gina {0}.
UIPageBrowser.msg.Invalid-deletePermission=No tienes permisos para borrar la p\u00e1gina {0}.
-UIPageBrowser.msg.Invalid-Preview=Esta es una p\u00e1gina de escritorio. No puedes previsualizar p\u00e1ginas de este tipo.
UIPageBrowser.msg.NotViewPage=No tienes permisos para ver esta p\u00e1gina.
UIPageBrowser.msg.edit.NotEditPage=No tienes permisos para editar esta p\u00e1gina.
UIPageBrowser.msg.delete.NotDelete=No tienes permisos para borrar esta p\u00e1gina.
@@ -676,7 +674,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Opciones de la Plantilla de P\u00e1gina
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Distribuci\u00f3n Vac\u00eda
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Distribuci\u00f3n actual
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Distribuci\u00f3n del Escritorio
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Distribuci\u00f3n del Tabl\u00f3n
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Distribuci\u00f3n a dos Columnas
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Distribuci\u00f3n a tres Columnas
@@ -815,7 +812,6 @@
UIPortalBrowser.deletePortal=\u00bfEst\u00e1s seguro de que deseas borrar este portal?
SitePortal.label=Portal del Sitio Web
ClassicPortal.label=Portal Classic
-WebOSPortal.label=Portal WebOS
############################################################################
@@ -943,33 +939,6 @@
UIPage.msg.EditPermission.null=No tienes permisos para editar esta p\u00e1gina.
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=El cuerpo de la p\u00e1gina del portal
-UIPageDesktop.label.PageContent=Contenido de la P\u00e1gina
-UIPageDesktop.label.View=Ver
-UIPageDesktop.label.Edit=Editar
-UIPageDesktop.label.Done=Hecho
-UIPageDesktop.title.PortalPage=P\u00e1gina del Portal
-UIPageDesktop.title.SaveToDatabase=Guardar en la Base de Datos
-UIPageDesktop.title.AddApplication=A\u00f1adir Aplicaciones
-UIPageDesktop.title.PageNavigation=Navegaci\u00f3n de P\u00e1gina
-UIPageDesktop.title.eXoBrowser=Browser eXo.
-UIPageDesktop.title.ShowPortletDesktop=Mostrar/Ocultar Portlets
-UIPageDesktop.title.ShowWidgetDesktop=Mostrar/Ocultar Gadgets
-UIPageDesktop.title.SignIn=Ingresar
-UIPageDesktop.title.SignOut=Salir
-UIPageDesktop.title.pageNavigation=Navegaciones de P\u00e1gina
-UIPageDesktop.msg.hasNotPermission=No tienes permisos de edici\u00f3n en esta P\u00e1gina.
-UIPageDesktop.action.Close=Eliminar esta aplicaci\u00f3n del dockbar
-UIPageDesktop.action.Quit=Salir
-UIPageDesktop.action.action.Open=Abrir
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -187,7 +187,6 @@
Template.title=Liste des styles
Template.left.title=Voir et sélectionner un style
-Desktop.label=Mode Desktop
AccountTemplate.left.title=Exemple de Pré-visualisation de template de compte
AccountTemplate.title=Templates de comptes
DefaultAccount.label=Compte par défaut
@@ -401,7 +400,6 @@
UIPageBrowser.msg.Invalid-viewPermission=Accès non autorisé à la page {0}
UIPageBrowser.msg.Invalid-editPermission=Edition de la page {0} non autorisée
UIPageBrowser.msg.Invalid-deletePermission=Suppression de la page {0} non autorisée
-UIPageBrowser.msg.Invalid-Preview=Cette page est de type "bureau". Il n'est pas possible de la Pré-visualiser !
UIPageBrowser.msg.NotViewPage=Vous n'avez pas les droits pour voir cette page.
UIPageBrowser.msg.edit.NotEditPage=Vous n'avez pas les droits pour éditer cette page.
UIPageBrowser.msg.delete.NotDelete=Vous n'avez pas les droits pour supprimer cette page.
@@ -657,7 +655,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Options du modèle de page
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Modèle de page vide
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Modèle de page courant
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Desktop Layout
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Modèle 'Dashboard'
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Deux Colonnes
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Trois Colonnes
@@ -806,7 +803,6 @@
UIPortalBrowser.deletePortal=Confirmez-vous la suppression de ce portail ?
SitePortal.label=Portail Site
ClassicPortal.label=Portal Classique
-WebOSPortal.label=Portail WebOS
############################################################################
@@ -933,33 +929,6 @@
UIPage.msg.EditPermission.null=Vous n'avez pas le droit d'éditer cette page !
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=la page principale du portail
-UIPageDesktop.label.PageContent=Page de contenus
-UIPageDesktop.label.View=Visualiser
-UIPageDesktop.label.Edit=Editer
-UIPageDesktop.label.Done=Terminer
-UIPageDesktop.title.PortalPage=Page principale du portail
-UIPageDesktop.title.SaveToDatabase=Sauvez en base
-UIPageDesktop.title.AddApplication=Ajouter une application
-UIPageDesktop.title.PageNavigation=Navigation
-UIPageDesktop.title.eXoBrowser=Navigateur eXo !
-UIPageDesktop.title.ShowPortletDesktop=Afficher/Cacher les portlets
-UIPageDesktop.title.ShowWidgetDesktop=Afficher/Cacher les gadgets
-UIPageDesktop.title.SignIn=Connexion
-UIPageDesktop.title.SignOut=Déconnexion
-UIPageDesktop.title.pageNavigation=Navigations
-UIPageDesktop.msg.hasNotPermission=Vous n'avez pas le droit d'éditer cette page !
-UIPageDesktop.action.Close=Supprimer l'application de la barre
-UIPageDesktop.action.Quit=Quitter
-UIPageDesktop.action.action.Open=Ouvrir
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -208,7 +208,6 @@
Template.title=Elenco degli Skin
Template.left.title=Visualizza e seleziona uno skin
-Desktop.label=Layout del Desktop
AccountTemplate.left.title=Anteprima del Template di un'Account di esempio
AccountTemplate.title=Template per l'Account
DefaultAccount.label=Account di Default
@@ -428,7 +427,6 @@
UIPageBrowser.msg.Invalid-viewPermission=Non ti \u00E8 permesso accedere alla pagina {0}.
UIPageBrowser.msg.Invalid-editPermission=Non ti \u00E8 permesso modificare la pagina {0}.
UIPageBrowser.msg.Invalid-deletePermission=Non ti \u00E8 permesso eliminare pagina {0}.
-UIPageBrowser.msg.Invalid-Preview=Questa \u00E8 una pagina del Desktop. Non puoi vedere l'anteprima di questi tipi.
UIPageBrowser.msg.NotViewPage=Non hai i permessi per vedere la pagina.
UIPageBrowser.msg.edit.NotEditPage=Non hai i permessi per modificare la pagina.
UIPageBrowser.msg.delete.NotDelete=Non hai i permessi per eliminare la pagina.
@@ -708,7 +706,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Opzioni del template della pagina
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Layout Vuoto
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Layout Corrente
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Layout del Desktop
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Layout della Dashboard
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Layout a Due Colonne
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Layout a Tre Colonne
@@ -847,7 +844,6 @@
UIPortalBrowser.deletePortal=Sicuro di voler eliminare il portale?
SitePortal.label=Portale del Sito
ClassicPortal.label=Portale Classico
-WebOSPortal.label=Portale WebOS
BasicPortal.label=Portale di Base
############################################################################
@@ -1005,33 +1001,6 @@
UIPage.msg.EditPermission.null=Non hai i permessi per modificare la pagina.
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=Il corpo della pagina del portale
-UIPageDesktop.label.PageContent=Contenuto della Pagina
-UIPageDesktop.label.View=Visualizza
-UIPageDesktop.label.Edit=Modifica
-UIPageDesktop.label.Done=Fatto
-UIPageDesktop.title.PortalPage=Pagina del Portale
-UIPageDesktop.title.SaveToDatabase=Salva nel database
-UIPageDesktop.title.AddApplication=Aggiungi Applicazioni
-UIPageDesktop.title.PageNavigation=Navigazione della Pagina
-UIPageDesktop.title.eXoBrowser=Browser.
-UIPageDesktop.title.ShowPortletDesktop=Mostra/Nascondi le Portlet
-UIPageDesktop.title.ShowWidgetDesktop=Mostra/Nascondi i Gadget
-UIPageDesktop.title.SignIn=Ingresso
-UIPageDesktop.title.SignOut=Uscita
-UIPageDesktop.title.pageNavigation=Navigazioni della Pagina
-UIPageDesktop.msg.hasNotPermission=Non devi modificare i permessi di questa pagina.
-UIPageDesktop.action.Close=Elimina l'applicazione dalla dockbar
-UIPageDesktop.action.Quit=Esci
-UIPageDesktop.action.action.Open=Apri
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -200,7 +200,6 @@
Template.title=\u30b9\u30ad\u30f3\u30ea\u30b9\u30c8
Template.left.title=\u30b9\u30ad\u30f3\u3092\u8868\u793a\u3057\u3066\u9078\u629e
-Desktop.label=\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30ec\u30a4\u30a2\u30a6\u30c8
AccountTemplate.left.title=\u30b5\u30f3\u30d7\u30eb\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30d7\u30ec\u30d3\u30e5\u30fc
AccountTemplate.title=\u30a2\u30ab\u30a6\u30f3\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8
DefaultAccount.label=\u30c7\u30d5\u30a9\u30eb\u30c8\u30a2\u30ab\u30a6\u30f3\u30c8
@@ -413,7 +412,6 @@
UIPageBrowser.msg.Invalid-viewPermission=\u30da\u30fc\u30b8 {0} \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
UIPageBrowser.msg.Invalid-editPermission=\u30da\u30fc\u30b8 {0} \u3092\u7de8\u96c6\u3059\u308b\u3053\u3068\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
UIPageBrowser.msg.Invalid-deletePermission=\u30da\u30fc\u30b8 {0} \u3092\u524a\u9664\u3059\u308b\u3053\u3068\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
-UIPageBrowser.msg.Invalid-Preview=\u3053\u308c\u306f\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u3067\u3059\u3002\u3053\u306e\u30bf\u30a4\u30d7\u306e\u30da\u30fc\u30b8\u3092\u30d7\u30ec\u30d3\u30e5\u30fc\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002
UIPageBrowser.msg.NotViewPage=\u3053\u306e\u30da\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002
UIPageBrowser.msg.edit.NotEditPage=\u3053\u306e\u30da\u30fc\u30b8\u3092\u7de8\u96c6\u3059\u308b\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002
UIPageBrowser.msg.delete.NotDelete=\u3053\u306e\u30da\u30fc\u30b8\u3092\u524a\u9664\u3059\u308b\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002
@@ -679,7 +677,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=\u30da\u30fc\u30b8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30aa\u30d7\u30b7\u30e7\u30f3
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=\u7a7a\u30ec\u30a4\u30a2\u30a6\u30c8
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=\u73fe\u5728\u306e\u30ec\u30a4\u30a2\u30a6\u30c8
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30ec\u30a4\u30a2\u30a6\u30c8
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u30ec\u30a4\u30a2\u30a6\u30c8
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=2\u30ab\u30e9\u30e0\u30ec\u30a4\u30a2\u30a6\u30c8
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=3\u30ab\u30e9\u30e0\u30ec\u30a4\u30a2\u30a6\u30c8
@@ -820,7 +817,6 @@
UIPortalBrowser.deletePortal=\u3053\u306e\u30dd\u30fc\u30bf\u30eb\u3092\u524a\u9664\u3057\u307e\u3059\u304b?
SitePortal.label=\u30b5\u30a4\u30c8\u30dd\u30fc\u30bf\u30eb
ClassicPortal.label=\u30af\u30e9\u30b7\u30c3\u30af\u306a\u30dd\u30fc\u30bf\u30eb
-WebOSPortal.label=WebOS \u30dd\u30fc\u30bf\u30eb
############################################################################
@@ -955,33 +951,6 @@
UIPage.msg.EditPermission.null=\u3042\u306a\u305f\u306f\u3053\u306e\u30da\u30fc\u30b8\u3092\u7de8\u96c6\u3059\u308b\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=\u30dd\u30fc\u30bf\u30eb\u306e\u30da\u30fc\u30b8\u672c\u4f53
-UIPageDesktop.label.PageContent=\u30da\u30fc\u30b8\u30fb\u30b3\u30f3\u30c6\u30f3\u30c4
-UIPageDesktop.label.View=\u95b2\u89a7
-UIPageDesktop.label.Edit=\u7de8\u96c6
-UIPageDesktop.label.Done=\u5b8c\u4e86
-UIPageDesktop.title.PortalPage=\u30dd\u30fc\u30bf\u30eb\u30fb\u30da\u30fc\u30b8
-UIPageDesktop.title.SaveToDatabase=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58
-UIPageDesktop.title.AddApplication=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8ffd\u52a0
-UIPageDesktop.title.PageNavigation=\u30da\u30fc\u30b8\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3
-UIPageDesktop.title.eXoBrowser=\u30d6\u30e9\u30a6\u30b6\u30fc\u3002
-UIPageDesktop.title.ShowPortletDesktop=\u30dd\u30fc\u30c8\u30ec\u30c3\u30c8\u3092\u898b\u305b\u308b/\u96a0\u3059
-UIPageDesktop.title.ShowWidgetDesktop=\u30ac\u30b8\u30a7\u30c3\u30c8\u3092\u898b\u305b\u308b/\u96a0\u3059
-UIPageDesktop.title.SignIn=\u30b5\u30a4\u30f3\u30fb\u30a4\u30f3
-UIPageDesktop.title.SignOut=\u30b5\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8
-UIPageDesktop.title.pageNavigation=\u30da\u30fc\u30b8\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3
-UIPageDesktop.msg.hasNotPermission=\u3042\u306a\u305f\u306f\u3053\u306e\u30da\u30fc\u30b8\u3092\u7de8\u96c6\u3059\u308b\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002
-UIPageDesktop.action.Close=\u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c9\u30c3\u30af\u30d0\u30fc\u304b\u3089\u53d6\u308a\u9664\u304f
-UIPageDesktop.action.Quit=\u7d42\u4e86
-UIPageDesktop.action.action.Open=\u30aa\u30fc\u30d7\u30f3
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -309,9 +309,6 @@
<title>스킨 보기 및 선택</title>
</left>
</Template>
- <Desktop>
- <label>데스크탑 레이아웃</label>
- </Desktop>
<AccountTemplate>
<left>
<title>계정 템플릿 예제 미리보기</title>
@@ -644,7 +641,6 @@
<Invalid-viewPermission>{0} 페이지 접근이 허용되지 않습니다.</Invalid-viewPermission>
<Invalid-editPermission>{0} 페이지 수정이 허용되지 않습니다.</Invalid-editPermission>
<Invalid-deletePermission>{0} 페이지 삭제가 허용되지 않습니다.</Invalid-deletePermission>
- <Invalid-Preview>데스크탑 유형의 페이지는 미리보기 하실 수 없습니다.</Invalid-Preview>
<NotViewPage>이 페이지를 볼 수 있는 권한이 없습니다.</NotViewPage>
<edit>
<NotEditPage>이 페이지를 수정할 수 있는 권한이 없습니다.</NotEditPage>
@@ -1050,7 +1046,6 @@
<normalPage>
<EmptyLayout>빈 레이아웃</EmptyLayout>
<CurrentLayout>현재 레이아웃</CurrentLayout>
- <DesktopImage>데스크탑 레이아웃</DesktopImage>
<DashboardLayout>대시보드 레이아웃</DashboardLayout>
</normalPage>
<columnPage>
@@ -1300,9 +1295,6 @@
<ClassicPortal>
<label>기본 포탈</label>
</ClassicPortal>
- <WebOSPortal>
- <label>WebOS 포탈</label>
- </WebOSPortal>
<!-- ############################################################################-->
<!-- # org.exoplatform.webui.form.UIPopupWindow #-->
<!-- ############################################################################-->
@@ -1469,52 +1461,6 @@
</EditPermission>
</msg>
</UIPage>
- <UIPageDesktop>
- <Default>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80</location>
- </img>
- </Default>
- <Mac>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80</location>
- </img>
- </Mac>
- <Vista>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80</location>
- </img>
- </Vista>
- <label>
- <pagebody>포탈 페이지 몸체</pagebody>
- <PageContent>페이지 내용</PageContent>
- <View>보기</View>
- <Edit>편집</Edit>
- <Done>완료</Done>
- </label>
- <title>
- <PortalPage>포탈 페이지</PortalPage>
- <SaveToDatabase>데이터베이스로 저장</SaveToDatabase>
- <AddApplication>애플리케이션 추가</AddApplication>
- <PageNavigation>페이지 내비게이션</PageNavigation>
- <eXoBrowser>브라우저</eXoBrowser>
- <ShowPortletDesktop>포틀릿 보이기/감추기</ShowPortletDesktop>
- <ShowWidgetDesktop>가젯 보이기/감추기</ShowWidgetDesktop>
- <SignIn>로그인</SignIn>
- <SignOut>로그아웃</SignOut>
- <pageNavigation>페이지 내비게이션</pageNavigation>
- </title>
- <msg>
- <hasNotPermission>이 페이지를 수정할 수 있는 권한이 없습니다.</hasNotPermission>
- </msg>
- <action>
- <Close>작업 표시줄에서 이 애플리케이션 삭제</Close>
- <Quit>끝내기</Quit>
- <action>
- <Open>열기</Open>
- </action>
- </action>
- </UIPageDesktop>
<!-- ############################################################################-->
<!-- # org.exoplatform.portal.component.view.UIPageBody #-->
<!-- ############################################################################-->
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -200,7 +200,6 @@
Template.title=\u0938\u094d\u0915\u093f\u0928s \u0932\u093f\u0938\u094d\u091f
Template.left.title=\u0938\u094d\u0915\u093f\u0928 \u0939\u0947\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d \u0930 \u091b\u093e\u0928\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-Desktop.label=\u0921\u0947\u0938\u094d\u0915\u091f\u092a \u0922\u093e\u091a\u093e
AccountTemplate.left.title=\u0916\u093e\u0924\u093e \u0909\u0926\u093e\u0939\u0930\u0923 \u0922\u093e\u0901\u091a\u093e\u0915\u094b \u092a\u0941\u0930\u094d\u0935\u0926\u094d\u0930\u093f\u0936\u094d\u092f
AccountTemplate.title=\u0916\u093e\u0924\u093e\u0915\u094b \u0922\u093e\u091a\u093e
DefaultAccount.label=\u0921\u093f\u092b\u094c\u0932\u094d\u091f \u0916\u093e\u0924\u093e
@@ -412,7 +411,6 @@
UIPageBrowser.msg.Invalid-viewPermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b {0} \u092a\u0947\u091c \u0939\u0947\u0930\u094d\u0928\u0947 \u0905\u0928\u0941\u092e\u0924\u0940 \u091b\u0948\u0928\u0964
UIPageBrowser.msg.Invalid-editPermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b {0} \u092a\u0947\u091c \u0938\u092e\u094d\u092a\u093e\u0926\u0928 \u0917\u0930\u094d\u0928\u0947 \u0938\u094d\u0935\u093f\u0915\u094d\u0930\u093f\u0924\u0940 \u091b\u0948\u0928\u0964
UIPageBrowser.msg.Invalid-deletePermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b {0} \u092a\u0947\u091c \u092e\u0947\u091f\u093e\u0909\u0928\u0947 \u0938\u094d\u0935\u093f\u0915\u094d\u0930\u093f\u0924\u0940 \u091b\u0948\u0928\u0964
-UIPageBrowser.msg.Invalid-Preview=\u092f\u094b \u0921\u0947\u0938\u094d\u0915\u094d\u091f\u092a \u092a\u0947\u091c \u0939\u094b\u0964 \u092f\u0938 \u0915\u093f\u0938\u093f\u092e\u094d\u0915 \u092a\u0947\u091c\u0939\u0930\u0941 \u092a\u0941\u0930\u094d\u0935\u0926\u094d\u0930\u093f\u0936\u094d\u092f \u0917\u0930\u094d\u0928 \u092a\u093e\u0909\u0928\u0941\u0939\u0941\u0928\u094d\u0928\u0964
UIPageBrowser.msg.NotViewPage=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b \u092a\u0947\u091c \u0939\u0947\u0930\u094d\u0928\u0947 \u0905\u0927\u093f\u0915\u093e\u0930 \u091b\u0948\u0928\u0964
UIPageBrowser.msg.edit.NotEditPage=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b \u092a\u0947\u091c \u0938\u092e\u094d\u092a\u093e\u0926\u0928 \u0917\u0930\u094d\u0928\u0947 \u0905\u0927\u093f\u0915\u093e\u0930 \u091b\u0948\u0928\u0964
UIPageBrowser.msg.delete.NotDelete=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b \u092a\u0947\u091c \u092e\u0947\u091f\u093e\u0909\u0928\u0947 \u0905\u0927\u093f\u0915\u093e\u0930 \u091b\u0948\u0928\u0964
@@ -677,7 +675,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=\u092a\u0947\u091c \u091f\u0947\u092e\u094d\u092a\u094d\u0932\u0947\u091f \u0909\u092a\u093e\u092f\u0939\u0930\u0941
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=\u0916\u093e\u0932\u0940 \u0932\u0947\u0906\u0909\u091f
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=\u091a\u093e\u0932\u0941 \u0932\u0947\u0906\u0909\u091f
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=\u0921\u0947\u0938\u094d\u0915\u094d\u091f\u092a \u0932\u0947\u0906\u0909\u091f
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=\u0921\u094d\u092f\u0938\u094d\u092c\u094b\u0930\u094d\u0921 \u0932\u0947\u0906\u0909\u091f
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=\u0968 \u0915\u094b\u0932\u0941\u092e \u0932\u0947\u0906\u0909\u091f
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=\u0969 \u0915\u094b\u0932\u0941\u092e \u0932\u0947\u0906\u0909\u091f
@@ -819,7 +816,6 @@
UIPortalBrowser.deletePortal=\u0915\u0947 \u0924\u092a\u093e\u0908\u0902 \u092a\u0915\u094d\u0915\u093e \u092f\u094b \u092a\u094b\u0930\u094d\u091f\u0932 \u092e\u0947\u091f\u093e\u0909\u0928 \u091a\u0939\u0928\u0941\u0939\u0941\u0928\u094d\u091b?
SitePortal.label=\u0938\u093e\u0908\u091f \u092a\u094b\u0930\u094d\u091f\u0932
ClassicPortal.label=\u0915\u094d\u0932\u093e\u0938\u093f\u0915 \u092a\u094b\u0930\u094d\u091f\u0932
-WebOSPortal.label=WebOS \u092a\u094b\u0930\u094d\u091f\u0932
############################################################################
@@ -951,33 +947,6 @@
UIPage.msg.EditPermission.null=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b \u092a\u0947\u091c \u0938\u092e\u094d\u092a\u093e\u0926\u0928 \u0917\u0930\u094d\u0928\u0947 \u0905\u0927\u093f\u0915\u093e\u0930 \u091b\u0948\u0928\u0964
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=\u092a\u094b\u0930\u094d\u091f\u0932\u0915\u094b \u092a\u0947\u091c \u092c\u0921\u0940
-UIPageDesktop.label.PageContent=\u092a\u0947\u091c \u092a\u0930\u093f\u092e\u093e\u0923
-UIPageDesktop.label.View=\u0905\u0935\u0932\u094b\u0915\u0928
-UIPageDesktop.label.Edit=\u0938\u092e\u094d\u092a\u093e\u0926\u0928
-UIPageDesktop.label.Done=\u0938\u0915\u093f\u092f\u094b
-UIPageDesktop.title.PortalPage=\u092a\u094b\u0930\u094d\u091f\u0932 \u092a\u0947\u091c
-UIPageDesktop.title.SaveToDatabase=\u0921\u093e\u091f\u093e\u092c\u0947\u0938\u092e\u093e \u0938\u0941\u0930\u091b\u093f\u0924 \u0930\u0916\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.title.AddApplication=\u090f\u092a\u094d\u0932\u0940\u0915\u0947\u0938\u0928\u0939\u0930\u0941 \u0925\u092a\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.title.PageNavigation=\u092a\u0947\u091c \u0928\u094d\u092f\u093e\u092d\u093f\u0917\u0947\u0938\u0928
-UIPageDesktop.title.eXoBrowser=\u092c\u094d\u0930\u093e\u0909\u091c\u0930\u0964
-UIPageDesktop.title.ShowPortletDesktop=\u092a\u094b\u0930\u094d\u091f\u094d\u0932\u0947\u091f\u0939\u0930\u0941 \u0926\u0947\u0916\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d/\u0932\u0941\u0915\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.title.ShowWidgetDesktop=\u0917\u094d\u092f\u093e\u091c\u0947\u091f\u0939\u0930\u0941 \u0926\u0947\u0916\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d/\u0932\u0941\u0915\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.title.SignIn=\u092d\u093f\u0924\u094d\u0930\u093f\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.title.SignOut=\u092c\u0939\u093f\u0930\u093f\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.title.pageNavigation=\u092a\u0947\u091c \u0928\u094d\u092f\u093e\u092d\u093f\u0917\u0947\u0938\u0928\u0939\u0930\u0941
-UIPageDesktop.msg.hasNotPermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908 \u092f\u094b \u092a\u0947\u091c\u092e\u093e \u0938\u092e\u094d\u092a\u093e\u0926\u0928 \u0917\u0930\u094d\u0928\u0947 \u0905\u0928\u0941\u092e\u0924\u0940 \u091b\u0948\u0928\u0964
-UIPageDesktop.action.Close=\u092f\u094b \u090f\u092a\u094d\u0932\u0940\u0915\u0947\u0938\u0928 \u0921\u0915\u094d \u092c\u093e\u0930\u092c\u093e\u091f \u0939\u091f\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.action.Quit=\u091b\u093e\u0921\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageDesktop.action.action.Open=\u0916\u094b\u0932\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -200,7 +200,6 @@
Template.title=Lijst van stijlen
Template.left.title=Toon en selecteer een stijl
-Desktop.label=Bureaublad lay-out
AccountTemplate.left.title=Voorbeeld van de account sjabloon
AccountTemplate.title=Account sjablonen
DefaultAccount.label=Standaard account
@@ -412,7 +411,6 @@
UIPageBrowser.msg.Invalid-viewPermission=U heeft geen toestemming om pagina {0} te bekijken.
UIPageBrowser.msg.Invalid-editPermission=U heeft geen toestemming om pagina {0} te wijzigen.
UIPageBrowser.msg.Invalid-deletePermission=U heeft geen toestemming om pagina {0} te verwijderen.
-UIPageBrowser.msg.Invalid-Preview=Deze is een bureaublad pagina. Van dit type pagina kan U geen voorbeeld opvragen.
UIPageBrowser.msg.NotViewPage=U heeft geen rechten om deze pagina te bekijken.
UIPageBrowser.msg.edit.NotEditPage=U heeft geen rechten om deze pagina te wijzigen.
UIPageBrowser.msg.delete.NotDelete=U heeft geen rechten om deze pagina te verwijderen.
@@ -678,7 +676,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Pagina sjabloon opties
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Lege lay-out
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Huidige lay-out
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Bureaublad lay-out
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Dashboard lay-out
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Twee kolommen lay-out
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Drie kolommen lay-out
@@ -816,7 +813,6 @@
UIPortalBrowser.deletePortal=Weet U zeker dat U deze portaal wilt verwijderen?
SitePortal.label=Site portaal
ClassicPortal.label=Klassieke portaal
-WebOSPortal.label=WebOS portaal
############################################################################
@@ -944,30 +940,6 @@
UIPage.msg.EditPermission.null=U heeft geen voldoende rechten om deze pagina te wijzigen.
############################################################################
-# org.exoplatform.portal.component.view.UIPageDesktop #
-############################################################################
-
-UIPageDesktop.label.pagebody=De pagina inhoud van de portaal
-UIPageDesktop.label.PageContent=Pagina inhoud
-UIPageDesktop.label.View=Tonen
-UIPageDesktop.label.Edit=#{word.edit}
-UIPageDesktop.label.Done=#{word.done}
-UIPageDesktop.title.PortalPage=Portaal pagina
-UIPageDesktop.title.SaveToDatabase=Opslaan in database
-UIPageDesktop.title.AddApplication=Voeg applicatie toe
-UIPageDesktop.title.PageNavigation=Pagina navigatie
-UIPageDesktop.title.eXoBrowser=browser.
-UIPageDesktop.title.ShowPortletDesktop=Toon/verberg portlets
-UIPageDesktop.title.ShowWidgetDesktop=Toon/verberg gadgets
-UIPageDesktop.title.SignIn=Inloggen
-UIPageDesktop.title.SignOut=Uitloggen
-UIPageDesktop.title.pageNavigation=Pagina navigaties
-UIPageDesktop.msg.hasNotPermission=U heeft geen rechten om deze pagina te wijzigen.
-UIPageDesktop.action.Close=Verwijder deze applicatie van de werkbalk
-UIPageDesktop.action.Quit=#{word.quit}
-UIPageDesktop.action.action.Open=#{word.open}
-
-############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -196,7 +196,6 @@
Template.title=Lista de Skins
Template.left.title=Visualizar e selecionar skin
-Desktop.label=Layout da Área de Trabalho
AccountTemplate.left.title=Preview de Exemplo de Template de Conta
AccountTemplate.title=Template de Conta
DefaultAccount.label=Conta Padrão
@@ -408,7 +407,6 @@
UIPageBrowser.msg.Invalid-viewPermission=Usuário sem permissão para acessar página {0}.
UIPageBrowser.msg.Invalid-editPermission=Usuário sem permissão para editar página {0}.
UIPageBrowser.msg.Invalid-deletePermission=Usuário sem permissão para remover página {0}.
-UIPageBrowser.msg.Invalid-Preview=Esta é uma página da área de trabalho. Não é possível o preview desse tipo de página.
UIPageBrowser.msg.NotViewPage=Usuário sem permissão para acessar página.
UIPageBrowser.msg.edit.NotEditPage=Usuário sem permissão para editar página.
UIPageBrowser.msg.delete.NotDelete=Usuário sem permissão para remover página.
@@ -676,7 +674,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Opções de Template de Página
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Layout Vazio
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Layout Atual
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Layout de Área de Trabalho
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Layout de Dashboard
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Layout de Duas Colunas
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Layout de Três Colunas
@@ -816,7 +813,6 @@
UIPortalBrowser.deletePortal=Deseja remover este portal?
SitePortal.label=Portal de Site
ClassicPortal.label=Portal Clássico
-WebOSPortal.label=Portal WebOS
############################################################################
@@ -947,33 +943,6 @@
UIPage.msg.EditPermission.null=Usuário não possui privilégios para editar esta página.
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=Conteúdo da página do portal
-UIPageDesktop.label.PageContent=Conteúdo da página
-UIPageDesktop.label.View=Visualizar
-UIPageDesktop.label.Edit=Editar
-UIPageDesktop.label.Done=Finalizar
-UIPageDesktop.title.PortalPage=Página do Portal
-UIPageDesktop.title.SaveToDatabase=Salvar no banco de dados
-UIPageDesktop.title.AddApplication=Adicionar Aplicação
-UIPageDesktop.title.PageNavigation=Navegação de Página
-UIPageDesktop.title.eXoBrowser=Navegador.
-UIPageDesktop.title.ShowPortletDesktop=Mostrar/Ocultar Portlets
-UIPageDesktop.title.ShowWidgetDesktop=Mostrar/Ocultar Gadgets
-UIPageDesktop.title.SignIn=Login
-UIPageDesktop.title.SignOut=Logout
-UIPageDesktop.title.pageNavigation=Navegação de Páginas
-UIPageDesktop.msg.hasNotPermission=Usuário não possui privilégios para editar esta página.
-UIPageDesktop.action.Close=Fechar
-UIPageDesktop.action.Quit=Sair
-UIPageDesktop.action.action.Open=Abrir
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -177,7 +177,6 @@
Template.title=Список тем
Template.left.title=Просмотреть и выбрать тему оформления
-Desktop.label=Макет рабочего стола
AccountTemplate.left.title=Образцы шаблонов учётных записей
AccountTemplate.title=Шаблоны учётных записей
DefaultAccount.label=Учетная запись по умолчанию
@@ -396,7 +395,6 @@
UIPageBrowser.msg.Invalid-viewPermission=У Вас нету прав доступа к странице "{0}".
UIPageBrowser.msg.Invalid-editPermission=У Вас нету прав для изменения страницы "{0}".
UIPageBrowser.msg.Invalid-deletePermission=У Вас нету прав для удаления страницы "{0}".
-UIPageBrowser.msg.Invalid-Preview=Это страница рабочего стол. Предварительный просмотр для страниц этого типа невозможен.
UIPageBrowser.msg.NotViewPage=Вы не можете просматривать эту страницу.
UIPageBrowser.msg.edit.NotEditPage=Вы не можете изменять эту страницу.
UIPageBrowser.msg.delete.NotDelete=Вы не можете удалить эту страницу.
@@ -662,7 +660,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Опции шаблона страницы
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Пустой макет
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Текущий макет
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Рабочегий стол
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Доска
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=2 колонки
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=3 колонки
@@ -800,7 +797,6 @@
UIPortalBrowser.deletePortal=Вы действительно хотите удалить этот портал?
SitePortal.label=Сайт
ClassicPortal.label=Портал
-WebOSPortal.label=WebOS
############################################################################
@@ -928,33 +924,6 @@
UIPage.msg.EditPermission.null=У Вас нету прав для редактирования страницы.
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=Тело страницы портала
-UIPageDesktop.label.PageContent=Содержимое страницы
-UIPageDesktop.label.View=Посмотреть
-UIPageDesktop.label.Edit=Изменить
-UIPageDesktop.label.Done=Готово
-UIPageDesktop.title.PortalPage=Страница портала
-UIPageDesktop.title.SaveToDatabase=Сохранить
-UIPageDesktop.title.AddApplication=Добавить приложение
-UIPageDesktop.title.PageNavigation=Навигация страницы
-UIPageDesktop.title.eXoBrowser=eXo браузер.
-UIPageDesktop.title.ShowPortletDesktop=Скрыть/показать портлеты
-UIPageDesktop.title.ShowWidgetDesktop=Скрыть/показать гаджеты
-UIPageDesktop.title.SignIn=Войты
-UIPageDesktop.title.SignOut=Выйти
-UIPageDesktop.title.pageNavigation=Навигации страницы
-UIPageDesktop.msg.hasNotPermission=У Вас нету прав для редактирования страницы.
-UIPageDesktop.action.Close=Удалить это приложение из док-а
-UIPageDesktop.action.Quit=Закрыть
-UIPageDesktop.action.action.Open=Открыть
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -177,7 +177,6 @@
Template.title=Список тем
Template.left.title=Перегляд і вибір теми
-Desktop.label=Схема робочого столу
AccountTemplate.left.title=Перегляд зразку шаблону облікового запису
AccountTemplate.title=Шаблони облікових записів
DefaultAccount.label=Обліковий запис за замовчуванням
@@ -387,7 +386,6 @@
UIPageBrowser.msg.Invalid-viewPermission=Вам не дозволено відвідувати цю сторінку {0}.
UIPageBrowser.msg.Invalid-editPermission=Вам не дозволено редагувати цю сторінку {0}.
UIPageBrowser.msg.Invalid-deletePermission=Вам не дозволено видалити цю сторінку {0}.
-UIPageBrowser.msg.Invalid-Preview=Це сторінка робочого столу. Ви не можете переглядати сторінки такого типу.
UIPageBrowser.msg.NotViewPage=У Вас немає прав для перегляду цієї сторінки.
UIPageBrowser.msg.edit.NotEditPage=У Вас немає прав для редагування цієї сторінки.
UIPageBrowser.msg.delete.NotDelete=У Вас немає прав для видалення цієї сторінки.
@@ -653,7 +651,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Опції шаблону сторінки
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Пуста схема
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Поточна схема
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Схема робочого столу
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Схема панелі іннструментів
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=Схема двох колонок
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=Схема трьох колонок
@@ -791,7 +788,6 @@
UIPortalBrowser.deletePortal=Ви впевнені, що бажаєте видалити цей портал?
SitePortal.label=Сайт-портал
ClassicPortal.label=Класичний портал
-WebOSPortal.label=WebOS портал
############################################################################
@@ -919,33 +915,6 @@
UIPage.msg.EditPermission.null=У Вас немає прав, щоб редагувати цю сторінку.
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=Тіло сторінки порталу
-UIPageDesktop.label.PageContent=Контент сторінки
-UIPageDesktop.label.View=Перегляд
-UIPageDesktop.label.Edit=Редагування
-UIPageDesktop.label.Done=Виконано
-UIPageDesktop.title.PortalPage=Сторінка порталу
-UIPageDesktop.title.SaveToDatabase=Зберегти до бази даних
-UIPageDesktop.title.AddApplication=Додати програму
-UIPageDesktop.title.PageNavigation=Навігація сторінки
-UIPageDesktop.title.eXoBrowser=eXo Браузер.
-UIPageDesktop.title.ShowPortletDesktop=Показати/приховати властивості
-UIPageDesktop.title.ShowWidgetDesktop=Показати/приховати гаджети
-UIPageDesktop.title.SignIn=Вхід
-UIPageDesktop.title.SignOut=Вихід
-UIPageDesktop.title.pageNavigation=Навігація сторінки
-UIPageDesktop.msg.hasNotPermission=У Вас немає прав редагувати цю сторінку.
-UIPageDesktop.action.Close=Вилучити це застосування з панелі документів
-UIPageDesktop.action.Quit=Вихід
-UIPageDesktop.action.action.Open=Відкрити
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-07-18 21:12:51 UTC (rev 6883)
@@ -181,7 +181,6 @@
Template.title=Danh sách giao diện
Template.left.title=Tham khảo và chọn giao diện
-Desktop.label=Kiểu giao diện Desktop
AccountTemplate.left.title=Mẫu tài khoản tham khảo
AccountTemplate.title=Mẫu tài khoản
DefaultAccount.label=Tài khoản mặc định
@@ -397,7 +396,6 @@
UIPageBrowser.msg.Invalid-viewPermission=Bạn không có quyền truy cập trang {0}!
UIPageBrowser.msg.Invalid-editPermission=Bạn không có quyền chỉnh sửa trang {0}!
UIPageBrowser.msg.Invalid-deletePermission=Bạn không có quyền xóa trang {0}!
-UIPageBrowser.msg.Invalid-Preview=Trang này có kiểu giao diện Desktop. Bạn không thể xem mẫu !
UIPageBrowser.msg.NotViewPage=Bạn không có quyền truy cập trang này.
UIPageBrowser.msg.edit.NotEditPage=Bạn không có quyền chỉnh sửa trang này.
UIPageBrowser.msg.delete.NotDelete=Bạn không có quyền xóa trang này.
@@ -669,7 +667,6 @@
UIWizardPageSelectLayoutForm.tab.label.UIPageTemplateOptions=Tùy chọn trang mẫu
UIWizardPageSelectLayoutForm.label.normalPage.EmptyLayout=Mặc định
UIWizardPageSelectLayoutForm.label.normalPage.CurrentLayout=Giữ nguyên
-UIWizardPageSelectLayoutForm.label.normalPage.DesktopImage=Bố trí kiểu Desktop
UIWizardPageSelectLayoutForm.label.normalPage.DashboardLayout=Bố trí kiểu Dashboard
UIWizardPageSelectLayoutForm.label.columnPage.TwoColumnsLayout=2 cột
UIWizardPageSelectLayoutForm.label.columnPage.ThreeColumnsLayout=3 cột
@@ -807,7 +804,6 @@
UIPortalBrowser.deletePortal=Bạn có chắc chắn muốn xóa Portal này không?
SitePortal.label=Site Portal
ClassicPortal.label=Classic Portal
-WebOSPortal.label=WebOS Portal
############################################################################
@@ -937,33 +933,6 @@
UIPage.msg.EditPermission.null=Bạn không được quyền chỉnh sửa trang này!
############################################################################
- # org.exoplatform.portal.component.view.UIPageDesktop #
- ############################################################################
-
-UIPageDesktop.Default.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Mac.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.Vista.img.location=/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
-UIPageDesktop.label.pagebody=Phần thân của trang Portal.
-UIPageDesktop.label.PageContent=Vùng chứa nội dung của trang.
-UIPageDesktop.label.View=Xem
-UIPageDesktop.label.Edit=Chỉnh sửa
-UIPageDesktop.label.Done=Thực hiện xong
-UIPageDesktop.title.PortalPage=Trang Portal
-UIPageDesktop.title.SaveToDatabase=Lưu vào cơ sở dữ liệu
-UIPageDesktop.title.AddApplication=Thêm ứng dụng
-UIPageDesktop.title.PageNavigation=Trang danh mục chính
-UIPageDesktop.title.eXoBrowser=Trình duyệt eXo!
-UIPageDesktop.title.ShowPortletDesktop=Hiện/Ẩn các Portlet
-UIPageDesktop.title.ShowWidgetDesktop=Hiện/Ẩn các Gadget
-UIPageDesktop.title.SignIn=Đăng nhập
-UIPageDesktop.title.SignOut=Đăng xuất
-UIPageDesktop.title.pageNavigation=Trang danh mục chính
-UIPageDesktop.msg.hasNotPermission=Bạn không được quyền chỉnh sửa trang này!
-UIPageDesktop.action.Close=Loại bỏ ứng dụng khỏi Dockbar!
-UIPageDesktop.action.Quit=Thoát
-UIPageDesktop.action.action.Open=Mở
-
- ############################################################################
# org.exoplatform.portal.component.view.UIPageBody #
############################################################################
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -289,9 +289,6 @@
<title>查看和选择皮肤</title>
</left>
</Template>
- <Desktop>
- <label>桌面布局</label>
- </Desktop>
<AccountTemplate>
<left>
<title>示例帐户模板预览</title>
@@ -605,7 +602,6 @@
<Invalid-viewPermission>您不能访问页面{0}</Invalid-viewPermission>
<Invalid-editPermission>您不能编辑页面{0}.</Invalid-editPermission>
<Invalid-deletePermission>您不能删除页面{0}.</Invalid-deletePermission>
- <Invalid-Preview>这是桌面网页。您无法预览这种类型的网页。</Invalid-Preview>
<NotViewPage>您无权查看此页面。</NotViewPage>
<edit>
<NotEditPage>您无权编辑此页面。</NotEditPage>
@@ -1004,7 +1000,6 @@
<normalPage>
<EmptyLayout>空布局</EmptyLayout>
<CurrentLayout>当前布局</CurrentLayout>
- <DesktopImage>桌面布局</DesktopImage>
<DashboardLayout>控制面板布局</DashboardLayout>
</normalPage>
<columnPage>
@@ -1245,9 +1240,6 @@
<ClassicPortal>
<label>经典门户</label>
</ClassicPortal>
- <WebOSPortal>
- <label>WebOS 门户</label>
- </WebOSPortal>
<PopupPageSelector>
<title>
@@ -1404,52 +1396,6 @@
</EditPermission>
</msg>
</UIPage>
- <UIPageDesktop>
- <Default>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80</location>
- </img>
- </Default>
- <Mac>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80</location>
- </img>
- </Mac>
- <Vista>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80</location>
- </img>
- </Vista>
- <label>
- <pagebody>门户页面正文</pagebody>
- <PageContent>页面内容</PageContent>
- <View>查看</View>
- <Edit>编辑</Edit>
- <Done>完成</Done>
- </label>
- <title>
- <PortalPage>门户页面</PortalPage>
- <SaveToDatabase>保存到数据库</SaveToDatabase>
- <AddApplication>增加应用</AddApplication>
- <PageNavigation>页面导航</PageNavigation>
- <eXoBrowser>浏览器</eXoBrowser>
- <ShowPortletDesktop>显示/隐藏 Portlets</ShowPortletDesktop>
- <ShowWidgetDesktop>显示/隐藏 小工具</ShowWidgetDesktop>
- <SignIn>登录</SignIn>
- <SignOut>退出</SignOut>
- <pageNavigation>页面导航</pageNavigation>
- </title>
- <msg>
- <hasNotPermission>您无权编辑此页。</hasNotPermission>
- </msg>
- <action>
- <Close>从桌面导航删除这个应用</Close>
- <Quit>退出</Quit>
- <action>
- <Open>打开</Open>
- </action>
- </action>
- </UIPageDesktop>
<UIPageBody>
<msg>
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml 2011-07-18 21:12:51 UTC (rev 6883)
@@ -387,9 +387,6 @@
<title>查看和選擇外觀</title>
</left>
</Template>
- <Desktop>
- <label>桌面佈局</label>
- </Desktop>
<AccountTemplate>
<left>
<title>帳戶模板預覽</title>
@@ -750,7 +747,6 @@
<Invalid-editPermission>您不能編輯頁面{0}.</Invalid-editPermission>
<Invalid-deletePermission>您不能刪除頁面{0}.
</Invalid-deletePermission>
- <Invalid-Preview>這是桌面網頁。您無法預覽這種類型的網頁。</Invalid-Preview>
<NotViewPage>您無權查看此頁面。</NotViewPage>
<edit>
<NotEditPage>您無權編輯此頁面。</NotEditPage>
@@ -1152,7 +1148,6 @@
<normalPage>
<EmptyLayout>空佈局</EmptyLayout>
<CurrentLayout>當前佈局</CurrentLayout>
- <DesktopImage>桌面佈局</DesktopImage>
<DashboardLayout>控制面板佈局</DashboardLayout>
</normalPage>
<columnPage>
@@ -1398,9 +1393,6 @@
<ClassicPortal>
<label>經典Portal</label>
</ClassicPortal>
- <WebOSPortal>
- <label>WebOSPortal</label>
- </WebOSPortal>
<PopupPageSelector>
<title>
@@ -1573,55 +1565,6 @@
</EditPermission>
</msg>
</UIPage>
- <UIPageDesktop>
- <Default>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
- </location>
- </img>
- </Default>
- <Mac>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
- </location>
- </img>
- </Mac>
- <Vista>
- <img>
- <location>/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIPageDesktop/icons/80x80
- </location>
- </img>
- </Vista>
- <label>
- <pagebody>Portal頁面正文</pagebody>
- <PageContent>頁面內容</PageContent>
- <View>查看</View>
- <Edit>編輯</Edit>
- <Done>完成</Done>
- </label>
- <title>
- <PortalPage>Portal頁面</PortalPage>
- <SaveToDatabase>儲存到資料庫</SaveToDatabase>
- <AddApplication>新增儲存程式</AddApplication>
- <PageNavigation>頁面導覽器</PageNavigation>
- <eXoBrowser>瀏覽器</eXoBrowser>
- <ShowPortletDesktop>顯示/隱藏Portlets</ShowPortletDesktop>
- <ShowWidgetDesktop>顯示/隱藏小工具</ShowWidgetDesktop>
- <SignIn>登錄</SignIn>
- <SignOut>退出</SignOut>
- <pageNavigation>頁面導覽器</pageNavigation>
- </title>
- <msg>
- <hasNotPermission>您無權編輯此頁。</hasNotPermission>
- </msg>
- <action>
- <Close>從桌面導覽器刪除這個儲存</Close>
- <Quit>退出</Quit>
- <action>
- <Open>打開</Open>
- </action>
- </action>
- </UIPageDesktop>
<UIPageBody>
<msg>
Deleted: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIAddNewApplication.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIAddNewApplication.gtmpl 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIAddNewApplication.gtmpl 2011-07-18 21:12:51 UTC (rev 6883)
@@ -1,152 +0,0 @@
-<%
- import org.exoplatform.web.application.Parameter;
- List appCategories = uicomponent.getApplicationCategories();
-%>
-<div class="UIAddApplication" id="UIAddNewApplication">
- <div class="UIBarStyle">
- <div class="TitleBar">
- <div class="LeftBar">
- <div class="RightBar">
- <div class="MiddleBar"><%=_ctx.appRes("UIAddNewApplication.label.AddApplication")%></div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="ContentContainerDetail">
- <div class="CategoryContainer">
-
- <div class="UITabContentContainer">
- <div class="UITabContent" style="display: block">
- <div class="UIAddPortlet">
- <div class="UIItemSelector">
- <div class="LeftColumnStyle">
- <div class="ItemListContainer">
-
- <div class="ItemListTitle">
- <div class="TitleIcon ItemListIcon"><span></span></div>
- <div class="Title"><%=_ctx.appRes("UIAddNewApplication.label.Categories")%></div>
- <div class="ClearLeft"><span></span></div>
- </div>
- <div class="ItemList">
- <%
- boolean selected = true;
- for(category in appCategories){
- %>
- <div onmouseout="eXo.webui.UIItemSelector.onOver(this, false);" onmouseover="eXo.webui.UIItemSelector.onOver(this, true);" onclick="eXo.webui.UIItemSelector.onClick(this);" class="<%= selected ? "SelectedItem" : "" %> Item" title="<%=category.getDisplayName()%>">
- <div class="LeftItem">
- <div class="RightItem"><div id="<%=category.getName()%>" class="ItemTitle"><div class="CenterItemTitle"><%=category.getDisplayName()%></div></div></div>
- </div>
- </div>
- <%
- selected = false;
- }
- %>
- </div>
-
- </div>
-
- <div class="ItemDetailList">
- <div class="ItemDetailTitle">
- <div class="TitleIcon ViewListIcon"><span></span></div>
- <div class="Title"><%=_ctx.appRes("UIAddNewApplication.label.Select")%></div>
- <div class="ClearLeft"><span></span></div>
- </div>
- <div class="ApplicationListContainer">
- <% if(appCategories==null || appCategories.isEmpty()){ %>
- <div class="ItemDetail" style="display:block">
- <div class="NoneAppsMessage" style="display:block">
- <%=_ctx.appRes("UIAddNewApplication.label.NoneApp")%>
- </div>
- </div>
- <% } %>
- <%
- selected = true;
- for(category in appCategories) {
- List listApplication = category.getApplications();
- %>
- <div class="ItemDetail" style="display: <%= selected ? "block" : "none" %>">
-
- <%
- for(application in listApplication) {
- String srcBG = application.getApplicationGroup() + "/skin/DefaultSkin/portletIcons/" + application.getApplicationName()+ ".png";
- String srcNormalBG = "/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png";
-
- //Create add Application Ajax request URL
- String callingAction = "AddApplication";
- String addApplicationURL = uicomponent.event(callingAction, application.getId());
- String addToStartup = uicomponent.event("AddToStartup", application.getId());
- %>
- <div class="Application">
- <div class="ApplicationDescription">
- <div onclick="$addApplicationURL" title="<%= application.getDisplayName() %>" class="PortletIcon">
- <span><img src="/$srcBG" alt="" onError="src='$srcNormalBG'" /></span>
- </div>
- <div class="ApplicationContent">
- <div class="TitleBarApplication">
- <div class="Title"><%= application.getDisplayName() %></div>
- <div class="ApplicationButton">
- <% if (org.exoplatform.web.application.Application.EXO_PORTLET_TYPE.equals(application.getApplicationType())) { %>
- <div title="<%=_ctx.appRes("UIAddNewApplication.label.AddToStartup")%>" class="AddToStartUp" onclick="$addToStartup" ><span></span></div>
- <%}%>
- <div title="<%=_ctx.appRes("UIAddNewApplication.label.Add")%>" class="AddButton" onclick="$addApplicationURL" ><span></span></div>
- </div>
- </div>
- <div class="ApplicationContentLabel">
- <div class="ContentLabel">
- <span class="LeftLabel"><%=_ctx.appRes("UIAddNewApplication.label.Type")%></span>
- <span class="RightLabel"><%=application.getApplicationType()%></span>
- </div>
- <div class="ContentLabel">
- <span class="LeftLabel"><%=_ctx.appRes("UIAddNewApplication.label.Created")%></span>
- <span class="RightLabel">eXo Platform SAS.</span>
- </div>
- <div class="ContentLabel">
- <span class="LeftLabel"><%=_ctx.appRes("UIAddNewApplication.label.Description")%></span>
- <span class="RightLabel"><%= application.getDescription() %></span>
- </div>
- </div>
- </div>
- </div>
- <div class="ClearRight"><span ></span></div>
- </div>
- <%
- }
- %>
-
- </div>
- <%
- selected = false;
- }
- %>
- </div>
- </div>
- <div class="ClearLeft"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
-
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div class="ActionButton LightBlueStyle" onclick="<%= uicomponent.event("Close") %>" >
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes("UIAddNewApplication.label.Close")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
-
-</div>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2011-07-18 21:12:51 UTC (rev 6883)
@@ -18,10 +18,9 @@
String onControlOver = "eXo.webui.UIPortlet.onControlOver(this, true);";
String onControlOut = "eXo.webui.UIPortlet.onControlOver(this, false);";
- WindowState windowState = uicomponent.getCurrentWindowState();
- boolean isDesktop = "Window".equals(uicomponent.getPortletStyle());
+ WindowState windowState = uicomponent.getCurrentWindowState();
String portletId = uicomponent.getId();
- if(!isDesktop && uiPortalApp.isEditing()) {
+ if(uiPortalApp.isEditing()) {
%>
<div class="UIPortlet <%=hasPermission?"":"ProtectedPortlet"%>" id="UIPortlet-$portletId" onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);" onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);"
style="top: 0px; left:0px;">
@@ -66,20 +65,6 @@
if(windowWidth!= null && !windowWidth.contains("%") && !windowWidth.contains("px")) windowWidth += "px";
String windowHeight = uicomponent.getHeight();
if(windowHeight != null && !windowHeight.contains("%") && !windowHeight.contains("px")) windowHeight += "px";
- if(isDesktop) {
- appDisplay = "";
- visibility = "hidden";
-
- /*###################################################################*/
- String appStatus = uicomponent.getProperties().get("appStatus");
- if("SHOW".equals(appStatus)) {
- appDisplay = "block";
- appZIndex = uicomponent.getProperties().get("zIndex");
- windowWidth = (String)uicomponent.getProperties().getIntValue("windowWidth") + "px";
- windowHeight = (String)uicomponent.getProperties().getIntValue("windowHeight") + "px";
- }
- /*###################################################################*/
- }
String cssStyle = "style=\"";
cssStyle += "visibility: "+ visibility +";";
cssStyle += "display: "+ appDisplay +";";
@@ -107,15 +92,7 @@
} else if(windowState == WindowState.MINIMIZED) {
renderMini = restore;
}
- if(isDesktop) {%>
- <div class="ControlIcon MaximizedIcon" title="$renderMaxi" onmouseover="$onControlOver" onmouseout="$onControlOut"><span></span>
- <div style="display:none">{"normalTitle":"$maxiTooltip","modeTitle":"$restoreDown"}</div>
- </div>
- <div class="ControlIcon MinimizedIcon" title="$renderMini" onmouseover="$onControlOver" onmouseout="$onControlOut"><span></span>
- <div style="display:none">{"normalTitle":"$miniTooltip","modeTitle":"$restore"}</div>
- </div>
- <%
- } else if(uicomponent.getShowWindowState()) {
+ if(uicomponent.getShowWindowState()) {
String maximizedAction = "eXo.portal.UIPortalControl.changeWindowState('"+portletId+"', 'maximized');";
String minimizedAction = "eXo.portal.UIPortalControl.changeWindowState('"+portletId+"', 'minimized');";
String maximizedMode = "Maximized";
@@ -255,7 +232,7 @@
}
}
}
- if(!isDesktop && uiPortalApp.isEditing()) {
+ if(uiPortalApp.isEditing()) {
if(portalMode != uiPortalApp.CONTAINER_BLOCK_EDIT_MODE && portalMode != uiPortalApp.APP_BLOCK_EDIT_MODE) {
%>
<div class="UIPortletMaskParent" style="height: 0px;position:relative;">
Deleted: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIDesktopPage.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIDesktopPage.gtmpl 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIDesktopPage.gtmpl 2011-07-18 21:12:51 UTC (rev 6883)
@@ -1,307 +0,0 @@
-<%
- import org.exoplatform.portal.webui.application.UIPortlet;
- import org.exoplatform.web.application.JavascriptManager;
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
- def rcontext = _ctx.getRequestContext();
- JavascriptManager jsmanager = rcontext.getJavascriptManager();
-
- jsmanager.importJavascript('eXo.desktop.UIDesktop');
- jsmanager.importJavascript('eXo.webui.UIPopupSelectCategory');
- jsmanager.importJavascript('eXo.desktop.UIWindow');
- jsmanager.importJavascript('eXo.webui.UIRightClickPopupMenu');
- jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.SaveTitle='" + _ctx.appRes("UIDashboardContainer.label.SaveTitle") + "';");
- jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.CancelTitle='" + _ctx.appRes("UIDashboardContainer.label.CancelTitle") + "';");
- jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.Cache='" + _ctx.appRes("UIDashboardContainer.label.Cache") + "';");
- jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.Debug='" + _ctx.appRes("UIDashboardContainer.label.Debug") + "';");
- jsmanager.addCustomizedOnLoadScript('eXo.desktop.UIDockbar.initNav();');
-
- String docBase = rcontext.getRequestContextPath();
- String comId = uicomponent.getId();
- boolean modifiable = uicomponent.isModifiable();
-
- void renderSinglePageNode(PageNavigation nav, PageNode node) {
- String href = uicomponent.event("ChangePage", nav.getId() + "::" + node.getUri());
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- print """
- <div class="MenuItem">
- <div class="LabelItem">
- <div class="Icon $icon" style="padding-left: 18px">
- <div class="LabelText"><a href="#" onclick="$href">$node.resolvedLabel</a></div>
- </div>
- </div>
- </div>
- """;
- }
-
- void renderPageNode(PageNavigation nav, PageNode node) {
- String href = uicomponent.event("ChangePage", nav.getId() + "::" + node.getUri());
- String icon = node.getIcon();
- String scrollUpTitle = _ctx.appRes("UIExoStart.tooltip.scrollUp");
- String scrollDownTitle = _ctx.appRes("UIExoStart.tooltip.scrollDown");
- if(icon == null) icon = "DefaultPageIcon";
- print """
- <div class="MenuItem">
- <div class="LabelItem">
- <div class="Icon $icon" style="padding-left: 18px">
- <div class="BlackArrowIcon">
- <div class="LabelText "><a href="#" onclick="$href">$node.resolvedLabel</a></div>
- </div>
- </div>
- </div>
- <div class="MenuItemContainer">
- <div class="StartMenuDecorator">
- <div class="StartMenuTL">
- <div class="StartMenuTR">
- <div class="StartMenuTC"><span></span></div>
- </div>
- </div>
- <div class="StartMenuML">
- <div class="StartMenuMR">
- <div class="StartMenuBG" style="padding-bottom: 6px">
- <div class="TopNavigator" style="display: none;" title="$scrollUpTitle">
- <div class="UpNavigatorIcon"><span></span></div>
- </div>
- <div class="BlockMenu">
- <div class="MenuContainer">
- """;
- for(child in node.getChildren()) {
- if(child.getChildren() != null && child.getChildren().size() > 0) renderPageNode(nav, child);
- else renderSinglePageNode(nav, child);
- }
- print """
- </div>
- </div>
- <div class="BottomNavigator" style="display: none;" title="$scrollDownTitle">
- <div class="DownNavigatorIcon"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- <div class="StartMenuBL">
- <div class="StartMenuBR">
- <div class="StartMenuBC"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- """;
- }
-
- void renderPageNavigation(PageNavigation navigation) {
- nodes = navigation.getNodes();
- if(nodes.size() < 1) return;
- String navTitle = _ctx.appRes("UIPageNavigation.label.titleBar");
- navTitle = navTitle.replace("{0}", navigation.ownerId);
- print """
- <div class="PageNavigationBlock">
- <div class="DecoratorBlock">
- <div class="PageOwnerContainer">
- <div class="TitleBar">$navTitle </div>
- """;
- for(node in nodes) {
- if(node.getChildren() != null && node.getChildren().size() > 0) {
- renderPageNode(navigation, node);
- }
- else renderSinglePageNode(navigation, node);
- }
- print """
- </div>
- </div>
- </div>
- """;
- }
-
- void renderNavigations() {
- String label = _ctx.appRes(uicomponent.getId() + ".item.PageNavigation");
- String scrollUpTitle = _ctx.appRes("UIExoStart.tooltip.scrollUp");
- String scrollDownTitle = _ctx.appRes("UIExoStart.tooltip.scrollDown");
- navigations = uicomponent.getNavigations();
- //if (navigations != null && navigations.size() > 0 && navigations.get(0).getNodes().size() > 0) {
- if (navigations != null && navigations.size() > 0) {
- print """
- <div class="MenuItemContainer NavigationContainer" style="position: absolute; top: -450px;">
- <div class="StartMenuDecorator">
- <div class="StartMenuTL">
- <div class="StartMenuTR">
- <div class="StartMenuTC"><span></span></div>
- </div>
- </div>
- <div class="StartMenuML">
- <div class="StartMenuMR">
- <div class="StartMenuBG" style="padding: 5px 0px;">
- <div class="TopNavigator" style="display: none;" title="$scrollUpTitle">
- <div class="UpNavigatorIcon"><span></span></div>
- </div>
- <div class="BlockMenu">
- <div class="MenuContainer">
- """;
- for(navigation in navigations) {
- renderPageNavigation(navigation);
- }
- print """
- </div>
- </div>
- <div class="BottomNavigator" style="display: none;" title="$scrollDownTitle">
- <div class="DownNavigatorIcon"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- <div class="StartMenuBL">
- <div class="StartMenuBR">
- <div class="StartMenuBC"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- """;
- }
- }
-
-%>
-
-
-<div class="UIPage" id="UIPage-${uicomponent.id}">
- <div class="META-DATA-BLOCK" style="display: none">
- <div class="id">$uicomponent.id</div>
- <div class="title"><%=_ctx.appRes("UIPage.label.title")%></div>
- <div class="description"><%=_ctx.appRes("UIPage.label.description")%></div>
- </div>
- <div class="VIEW-PAGE">
- <div id="UIPage">
- <div class="UIPageDesktop" id="UIPageDesktop">
- <%int x = 15; y = 15 %>
- <%for(uiChild in uicomponent.getChildren()) {
- if(!(uiChild instanceof UIPortlet)) {
- uicomponent.renderUIComponent(uiChild);
- continue;
- }
-
- String popupId = uiChild.getId();
- String title = uiChild.getTitle();
- if(title == null || title.trim().length() < 1) {
- title = popupId;
- uiChild.setTitle(title);
- }
- uiChild.setShowInfoBar(true);
- uiChild.setPortletStyle("Window");
- uicomponent.renderUIComponent(uiChild);
-
- String posX = uiChild.getProperties().get("locationX");
- String posY = uiChild.getProperties().get("locationY");
-
- if(posX == null) posX = (String)x;
- if(posY == null) posY = (String)y;
-
- jsmanager.addJavascript("eXo.desktop.UIWindow.init('UIWindow-${popupId}', true, ${posX}, ${posY});");
- %>
- <% x += 10; y += 20;%>
- <%}%>
-
- <%//String containerMouseOver = "eXo.desktop.UIDockbar.containerMouseOver();";%>
- <div class="UIDockBar" id="UIDockBar" onmouseover="eXo.desktop.UIDockbar.startDockBarEvt(event);">
- <div id="DockNavigation" class="UIExoStart" style="position: absolute; display: none; width: 0px;">
- <div class="StartMenuContainer">
- <% renderNavigations(); %>
- </div>
- </div>
- <div class="UIRightClickPopupMenu" id="DockbarContextMenu" onmousedown="event.cancelBubble = true;">
- <div class="UIContextMenuContainer" >
- <div class="TopLeftRightClickPopupMenu">
- <div class="TopRightRightClickPopupMenu">
- <div class="TopCenterRightClickPopupMenu"><span></span></div>
- </div>
- </div>
- <div class="MiddleLeftRightClickPopupMenu">
- <div class="MiddleRightRightClickPopupMenu">
- <div class="UIRightPopupMenuContainer">
- <div class="MenuItem">
- <a href="javascript:eXo.desktop.UIDesktop.removeApp('<%=uicomponent.url("RemoveChild", "_objectid_")%>')" onclick="return eXo.webui.UIRightClickPopupMenu.prepareObjectId(event, this);"
- class="ItemIcon CloseDockBarIcon"><%=_ctx.appRes("UIPageDesktop.action.Close")%></a>
- </div>
- <div class="MenuItem">
- <a class="ItemIcon QuitDockBarIcon" href="javascript:eXo.desktop.UIDesktop.removeWindowContent('_objectid_')" onclick="return eXo.webui.UIRightClickPopupMenu.prepareObjectId(event, this);" ><%=_ctx.appRes("UIPageDesktop.action.Quit")%></a>
- </div>
- <div class="RightClickCustomItem"><%=_ctx.appRes("UIPageDesktop.action.action.Open")%></div>
- </div>
- </div>
- </div>
- <div class="BottomLeftRightClickPopupMenu">
- <div class="BottomRightRightClickPopupMenu">
- <div class="BottomCenterRightClickPopupMenu">
- <div class="ClickCenterBottom"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="DockbarLeft">
- <div class="DockbarRight">
- <div class="DockbarCenter" id="DockbarCenter">
-
- <div class="IconContainer" id="IconContainer" style="text-align: center;">
- <img id="FixBug" alt="" src="/eXoResources/skin/sharedImages/Debug1x32.gif" />
-
- <%if(rcontext.getRemoteUser() == null) {%>
- <img id="SignInIcon" class="Icon" src="/eXoResources/skin/sharedImages/Icon80x80/Signin.png" alt="" title=""
- onclick="<%=uicomponent.event("ShowLoginForm", null);%>" /><span class="Tooltip" style="display: none;"><%=_ctx.appRes("UIPageDesktop.title.SignIn")%></span>
- <%} else {%>
- <img id="SignOutIcon" class="Icon" src="/eXoResources/skin/sharedImages/Icon80x80/Signout.png" alt="" title=""
- onclick="eXo.portal.logout()" /><span class="Tooltip" style="display: none;"><%=_ctx.appRes("UIPageDesktop.title.SignOut")%></span>
- <%} %>
- <img class="Separator" alt="" src="/webosResources/skin/Defaultskin/portal/webui/component/view/UIPageDesktop/background/Separator2x1.png"/>
-
- <% String changeLanguageAction = "if(document.getElementById('UIMaskWorkspace')) ajaxGet(eXo.env.server.createPortalURL('UIPortal', 'ChangeLanguage', true));"; %>
- <img id="ChangeLanguageIcon" class="Icon" src="/eXoResources/skin/sharedImages/Icon80x80/ChangeLanguage.png" alt="" title=""
- onclick="$changeLanguageAction" /><span class="Tooltip" style="display: none;"><%=_ctx.appRes("UIExoStart.item.ChangeLanguage")%></span>
-
- <img class="Icon" src="/eXoResources/skin/sharedImages/Icon80x80/NavigationIcon.png" alt="" title=""
- id="NavigationIcon"
- onclick="eXo.desktop.UIDockbar.showNavigation(event)"/><span class="Tooltip" style="display: none"><%=_ctx.appRes("UIPageDesktop.title.pageNavigation")%></span>
-
- <%if(modifiable) {%>
- <img class="Icon" src="/eXoResources/skin/sharedImages/Icon80x80/AddPortlet.png" alt="" title=""
- id="UIAddApplicationIcon"
- onclick="<%=uicomponent.event("ShowAddNewApplication")%>"/><span class="Tooltip" style="display: none"><%=_ctx.appRes("UIPageDesktop.title.AddApplication")%></span>
- <%}%>
- <img class="Separator" alt="" src="/webosResources/skin/Defaultskin/portal/webui/component/view/UIPageDesktop/background/Separator2x1.png"/>
- <%
- def res = rcontext.getApplicationResourceBundle();
- String skin = rcontext.getUIApplication().getSkin();
-
- for(uiChild in uicomponent.getChildren()) {
- if(!(uiChild instanceof UIPortlet)) continue;
- String imgLocation = uiChild.getExoWindowID().getPortletApplicationName() + "/skin/DefaultSkin/portletIcons/" + uiChild.getExoWindowID().getPortletName();
- String appStatus = uiChild.getProperties().get("appStatus");
- boolean isVisible = "SHOW".equals(appStatus) || "HIDE".equals(appStatus);
-
- if(rcontext.getRemoteUser() != null) {
- %>
- <img id="DockItem${uiChild.id}" class="Icon <%=isVisible ? "ShowIcon": ""%>" onmousedown="eXo.webui.UIRightClickPopupMenu.clickRightMouse(event, this, 'DockbarContextMenu', '${uiChild.id}', null, 1)" src="/${imgLocation}.png" alt=""
- onerror="this.src='/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png'" onclick="eXo.desktop.UIDesktop.showHideWindow('UIWindow-${uiChild.id}', this);" /><span class="Tooltip" style="display: none"><%=uiChild.getTitle();%></span>
- <%}else{%>
- <img id="DockItem${uiChild.id}" class="Icon <%=isVisible ? "ShowIcon": ""%>" src="/${imgLocation}.png" alt=""
- onerror="this.src='/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png'" onclick="eXo.desktop.UIDesktop.showHideWindow('UIWindow-${uiChild.id}', this);" /><span class="Tooltip" style="display: none"><%=uiChild.getTitle();%></span>
- <%}}%>
-
- <img class="Separator" alt="" src="/webosResources/skin/Defaultskin/portal/webui/component/view/UIPageDesktop/background/Separator2x1.png" />
- <img id="PortletsViewer" class="Icon" src="/eXoResources/skin/sharedImages/Icon80x80/ShowPortletsViewer.png" alt="" title=""/><span class="Tooltip" style="display: none;"><%=_ctx.appRes("UIPageDesktop.title.ShowPortletDesktop")%></span>
- <img id="GadgetsViewer" class="Icon" src="/eXoResources/skin/sharedImages/Icon80x80/HideWidgetsViewer.png" alt="" title=""/><span class="Tooltip" style="display: none;"><%=_ctx.appRes("UIPageDesktop.title.ShowWidgetDesktop")%></span>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </div>
- </div>
-</div>
-
-<%
- jsmanager.addOnLoadJavascript('eXo.desktop.UIDesktop.init');
- jsmanager.addOnResizeJavascript('eXo.desktop.UIDesktop.fixDesktop');
-%>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -71,6 +71,26 @@
service.addUploadLimit(uploadId_, Integer.valueOf(limit)); // Use the limit set by constructor.
setComponentConfig(UIFormUploadInput.class, null);
}
+
+ public UIFormUploadInput(String name, String bindingExpression, boolean isAutoUpload)
+ {
+ super(name, bindingExpression, String.class);
+ uploadId_ = Integer.toString(Math.abs(hashCode()));
+ this.isAutoUpload = isAutoUpload;
+ UploadService service = getApplicationComponent(UploadService.class);
+ service.addUploadLimit(uploadId_, null);
+ setComponentConfig(UIFormUploadInput.class, null);
+ }
+
+ public UIFormUploadInput(String name, String bindingExpression, int limit, boolean isAutoUpload)
+ {
+ super(name, bindingExpression, String.class);
+ uploadId_ = Integer.toString(Math.abs(hashCode()));
+ this.isAutoUpload = isAutoUpload;
+ UploadService service = getApplicationComponent(UploadService.class);
+ service.addUploadLimit(uploadId_, Integer.valueOf(limit)); // Use the limit set by constructor.
+ setComponentConfig(UIFormUploadInput.class, null);
+ }
public void decode(Object input, WebuiRequestContext context) throws Exception
{
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -1,289 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.application;
-
-import org.exoplatform.application.registry.Application;
-import org.exoplatform.application.registry.ApplicationCategory;
-import org.exoplatform.application.registry.ApplicationRegistryService;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.CloneApplicationState;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Portlet;
-import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.util.PortalDataMapper;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
-import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIContainer;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/** Created by The eXo Platform SARL Author : Anh Nguyen ntuananh.vn(a)gmail.com Oct 18, 2007 */
-@ComponentConfig(template = "system:/groovy/portal/webui/application/UIAddNewApplication.gtmpl", events = {
- @EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class),
- @EventConfig(listeners = UIAddNewApplication.AddApplicationActionListener.class),
- @EventConfig(listeners = UIAddNewApplication.AddToStartupActionListener.class)})
-public class UIAddNewApplication extends UIContainer
-{
-
- private List<ApplicationCategory> listAppCategories;
-
- private UIComponent uiComponentParent;
-
- private boolean isInPage;
-
- public List<ApplicationCategory> getApplicationCategories() throws Exception
- {
- return listAppCategories;
- }
-
- public List<ApplicationCategory> getApplicationCategories(String remoteUser,
- ApplicationType[] applicationType) throws Exception
- {
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- ApplicationRegistryService prService = (ApplicationRegistryService)container.getComponentInstanceOfType(ApplicationRegistryService.class);
-
- if (applicationType == null)
- {
- applicationType = new ApplicationType[0];
- }
-
- List<ApplicationCategory> appCategories = prService.getApplicationCategories(remoteUser,
- applicationType);
-
- if (appCategories == null)
- {
- appCategories = new ArrayList();
- }
- else
- {
- Iterator<ApplicationCategory> cateItr = appCategories.iterator();
- while (cateItr.hasNext())
- {
- ApplicationCategory cate = cateItr.next();
- List<Application> applications = cate.getApplications();
- if (applications.size() < 1)
- {
- cateItr.remove();
- }
- }
- }
- listAppCategories = appCategories;
-
- return listAppCategories;
-
- }
-
- public UIComponent getUiComponentParent()
- {
- return uiComponentParent;
- }
-
- public void setUiComponentParent(UIComponent uiComponentParent)
- {
- this.uiComponentParent = uiComponentParent;
- }
-
- public boolean isInPage()
- {
- return isInPage;
- }
-
- public void setInPage(boolean isInPage)
- {
- this.isInPage = isInPage;
- }
-
- private Application getApplication(String id) throws Exception
- {
-
- List<ApplicationCategory> pCategories = getApplicationCategories();
-
- for (ApplicationCategory pCategory : pCategories)
- {
- List<Application> applications = pCategory.getApplications();
- for (Application application : applications)
- {
- if (application.getId().equals(id))
- {
- return application;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Add Application to UiPage
- *
- * @param event
- * @throws Exception
- */
- private static void addApplicationToPage(Event<UIAddNewApplication> event, boolean atStartup) throws Exception
- {
- UIPortal uiPortal = Util.getUIPortal();
-
- UIPortalApplication uiPortalApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
- UIPage uiPage;
- if (uiPortal.isRendered())
- {
- uiPage = uiPortal.findFirstComponentOfType(UIPage.class);
- }
- else
- {
- UIPortalToolPanel uiPortalToolPanel = uiPortalApp.findFirstComponentOfType(UIPortalToolPanel.class);
- uiPage = uiPortalToolPanel.findFirstComponentOfType(UIPage.class);
- }
-
- String applicationId = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
-
- Application application = event.getSource().getApplication(applicationId);
- ApplicationType appType = application.getType();
- String portletName = application.getApplicationName();
-// String appGroup = application.getApplicationGroup();
-
- // TODO review windowId for eXoWidget and eXoApplication
- UIComponent component = null;
- if (ApplicationType.GADGET.equals(appType))
- {
- UIGadget uiGadget = uiPage.createUIComponent(event.getRequestContext(), UIGadget.class, null, null);
-
- uiGadget.setState(new TransientApplicationState<Gadget>(portletName));
-
- // Set Properties For gadget
- int posX = (int)(Math.random() * 400);
- int posY = (int)(Math.random() * 200);
-
- uiGadget.getProperties().put(UIApplication.locationX, String.valueOf(posX));
- uiGadget.getProperties().put(UIApplication.locationY, String.valueOf(posY));
-
- component = uiGadget;
- }
- else
- {
- boolean remote = ApplicationType.WSRP_PORTLET.equals(appType);
-
- UIPortlet uiPortlet = uiPage.createUIComponent(UIPortlet.class, null, null);
-
- CloneApplicationState appState;
- Object appId;
- if (!remote)
- {
- appState = new CloneApplicationState<Portlet>(application.getId());
- }
- else
- {
- appState = new CloneApplicationState<WSRPState>(application.getId());
- }
-
- ApplicationType applicationType = remote ? ApplicationType.WSRP_PORTLET : ApplicationType.PORTLET;
- PortletState portletState = new PortletState(appState, applicationType);
-
- uiPortlet.setState(portletState);
- uiPortlet.setPortletInPortal(false);
-
- if (atStartup)
- {
- uiPortlet.getProperties().setProperty("appStatus", "HIDE");
- }
-
- if (application != null)
- {
- String displayName = application.getDisplayName();
- if (displayName != null)
- {
- uiPortlet.setTitle(displayName);
- }
- else if (portletName != null)
- {
- uiPortlet.setTitle(portletName);
- }
- uiPortlet.setDescription(application.getDescription());
- List<String> accessPers = application.getAccessPermissions();
- String[] accessPermissions = accessPers.toArray(new String[accessPers.size()]);
- uiPortlet.setAccessPermissions(accessPermissions);
-
- component = uiPortlet;
- }
- }
-
- // Add component to page
- uiPage.addChild(component);
-
- // Save all changes
- if (uiPage.isModifiable())
- {
- Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
- if (page.getChildren() == null)
- {
- page.setChildren(new ArrayList<ModelObject>());
- }
- DataStorage dataService = uiPortalApp.getApplicationComponent(DataStorage.class);
- dataService.save(page);
- }
-
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
- }
-
- static public class AddApplicationActionListener extends EventListener<UIAddNewApplication>
- {
- public void execute(Event<UIAddNewApplication> event) throws Exception
- {
- if (event.getSource().isInPage())
- {
- addApplicationToPage(event, false);
- }
- }
- }
-
- static public class AddToStartupActionListener extends EventListener<UIAddNewApplication>
- {
- public void execute(Event<UIAddNewApplication> event) throws Exception
- {
- if (event.getSource().isInPage())
- {
- addApplicationToPage(event, true);
- }
- }
- }
-}
Copied: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/BaseUIPageFactory.java (from rev 6449, portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/BaseUIPageFactory.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/BaseUIPageFactory.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/BaseUIPageFactory.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.webui.page;
+
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+
+/**
+ * This factory is used to create the base UIPage component
+ *
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class BaseUIPageFactory extends UIPageFactory
+{
+ @Override
+ public String getType()
+ {
+ return DEFAULT_FACTORY_ID;
+ }
+
+ @Override
+ public UIPage createUIPage(WebuiRequestContext context) throws Exception
+ {
+ if (context == null)
+ {
+ context = WebuiRequestContext.getCurrentInstance();
+ }
+ WebuiApplication app = (WebuiApplication)context.getApplication();
+ UIPage uiPage = app.createUIComponent(UIPage.class, null, null, context);
+ return uiPage;
+ }
+}
\ No newline at end of file
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -1,235 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.page;
-
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.webui.application.UIAddNewApplication;
-import org.exoplatform.portal.webui.application.UIApplication;
-import org.exoplatform.portal.webui.application.UIGadget;
-import org.exoplatform.portal.webui.application.UIPortlet;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
-import org.exoplatform.portal.webui.page.UIPageActionListener.DeleteGadgetActionListener;
-import org.exoplatform.portal.webui.page.UIPageActionListener.RemoveChildActionListener;
-import org.exoplatform.portal.webui.portal.PageNodeEvent;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ShowLoginFormActionListener;
-import org.exoplatform.portal.webui.util.PortalDataMapper;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.portlet.WindowState;
-
-/**
- * May 19, 2006
- */
-
-@ComponentConfig(lifecycle = UIPageLifecycle.class, template = "system:/groovy/portal/webui/page/UIDesktopPage.gtmpl", events = {
- @EventConfig(listeners = ShowLoginFormActionListener.class),
- @EventConfig(listeners = DeleteGadgetActionListener.class),
- @EventConfig(listeners = RemoveChildActionListener.class),
- @EventConfig(listeners = UIDesktopPage.SaveGadgetPropertiesActionListener.class),
- @EventConfig(listeners = UIDesktopPage.SaveWindowPropertiesActionListener.class),
- @EventConfig(listeners = UIDesktopPage.ShowAddNewApplicationActionListener.class),
- @EventConfig(listeners = UIDesktopPage.ChangePageActionListener.class),
- @EventConfig(listeners = UIDesktopPage.ShowPortletActionListener.class)})
-public class UIDesktopPage extends UIPage
-{
-
- public UIDesktopPage()
- {
- setChildren((List<UIComponent>)new CopyOnWriteArrayList<UIComponent>());
- }
-
- public boolean isShowMaxWindow()
- {
- return true;
- }
-
- public List<PageNavigation> getNavigations() throws Exception
- {
- List<PageNavigation> allNav = Util.getUIPortal().getNavigations();
- String removeUser = Util.getPortalRequestContext().getRemoteUser();
- List<PageNavigation> result = new ArrayList<PageNavigation>();
- for (PageNavigation nav : allNav)
- {
- result.add(PageNavigationUtils.filter(nav, removeUser));
- }
- return result;
- }
-
- static public class SaveGadgetPropertiesActionListener extends EventListener<UIPage>
- {
- public void execute(Event<UIPage> event) throws Exception
- {
- UIPage uiPage = event.getSource();
- String objectId = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- List<UIGadget> uiGadgets = new ArrayList<UIGadget>();
- uiPage.findComponentOfType(uiGadgets, UIGadget.class);
- UIGadget uiGadget = null;
- for (UIGadget ele : uiGadgets)
- {
- if (ele.getId().equals(objectId))
- {
- uiGadget = ele;
- break;
- }
- }
- if (uiGadget == null)
- return;
- String posX = event.getRequestContext().getRequestParameter("posX");
- String posY = event.getRequestContext().getRequestParameter("posY");
- String zIndex = event.getRequestContext().getRequestParameter(UIApplication.zIndex);
-
- uiGadget.getProperties().put(UIApplication.locationX, posX);
- uiGadget.getProperties().put(UIApplication.locationY, posY);
- uiGadget.getProperties().put(UIApplication.zIndex, zIndex);
-
- if (!uiPage.isModifiable())
- return;
- Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
- DataStorage dataService = uiPage.getApplicationComponent(DataStorage.class);
- dataService.save(page);
- }
- }
-
- static public class SaveWindowPropertiesActionListener extends EventListener<UIPage>
- {
- public void execute(Event<UIPage> event) throws Exception
- {
- UIPage uiPage = event.getSource();
- String objectId = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
-
- UIApplication uiApp = uiPage.getChildById(objectId);
- if (uiApp == null)
- return;
-
- /*########################## Save Position ##########################*/
- String posX = event.getRequestContext().getRequestParameter("posX");
- String posY = event.getRequestContext().getRequestParameter("posY");
-
- if (posX != null)
- uiApp.getProperties().put(UIApplication.locationX, posX);
- if (posY != null)
- uiApp.getProperties().put(UIApplication.locationY, posY);
-
- //System.out.println("\n\n\n\n\n\n\n\n\n\n\n SAVE POSX: "+posX+"\n SAVE POSY: "+posY+"\n\n\n\n\n\n\n\n\n");
- /*########################## Save ZIndex ##########################*/
- String zIndex = event.getRequestContext().getRequestParameter(UIApplication.zIndex);
-
- if (zIndex != null)
- uiApp.getProperties().put(UIApplication.zIndex, zIndex);
-
- /*########################## Save Dimension ##########################*/
- String windowWidth = event.getRequestContext().getRequestParameter("windowWidth");
- String windowHeight = event.getRequestContext().getRequestParameter("windowHeight");
-
- if (windowWidth != null)
- uiApp.getProperties().put("windowWidth", windowWidth);
- if (windowHeight != null)
- uiApp.getProperties().put("windowHeight", windowHeight);
-
- // if(appWidth != null) uiComponent.getProperties().put(UIApplication.appWidth, appWidth);
- // if(appHeight != null) uiComponent.getProperties().put(UIApplication.appHeight, appHeight);
-
- // String applicationHeight = event.getRequestContext().getRequestParameter("applicationHeight");
- // if(applicationHeight != null) uiComponent.getProperties().put("applicationHeight", applicationHeight);
-
- /*########################## Save Window status (SHOW / HIDE) ##########################*/
- String appStatus = event.getRequestContext().getRequestParameter(UIApplication.appStatus);
- if (appStatus != null)
- uiApp.getProperties().put(UIApplication.appStatus, appStatus);
-
- // if(!uiPage.isModifiable()) return;
- // Page page = PortalDataMapper.toPageModel(uiPage);
- // UserPortalConfigService configService = uiPage.getApplicationComponent(UserPortalConfigService.class);
- // if(page.getChildren() == null) page.setChildren(new ArrayList<Object>());
- // configService.update(page);
- }
- }
-
- static public class ShowAddNewApplicationActionListener extends EventListener<UIPage>
- {
- public void execute(Event<UIPage> event) throws Exception
- {
- UIPage uiPage = event.getSource();
- UIPortalApplication uiPortalApp = uiPage.getAncestorOfType(UIPortalApplication.class);
- UIMaskWorkspace uiMaskWorkspace = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
-
- UIAddNewApplication uiAddApplication = uiPage.createUIComponent(UIAddNewApplication.class, null, null);
- uiAddApplication.setInPage(true);
- uiAddApplication.setUiComponentParent(uiPage);
- uiAddApplication.getApplicationCategories(event.getRequestContext().getRemoteUser(), null);
-
- uiMaskWorkspace.setWindowSize(700, 375);
- uiMaskWorkspace.setUIComponent(uiAddApplication);
- uiMaskWorkspace.setShow(true);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWorkspace);
- }
- }
-
- static public class ChangePageActionListener extends EventListener<UIPage>
- {
- public void execute(Event<UIPage> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UIPortal uiPortal = Util.getUIPortal();
- UIPageBody uiPageBody = uiPortal.findFirstComponentOfType(UIPageBody.class);
- if (uiPageBody != null)
- {
- if (uiPageBody.getMaximizedUIComponent() != null)
- {
- UIPortlet currentPortlet = (UIPortlet)uiPageBody.getMaximizedUIComponent();
- currentPortlet.setCurrentWindowState(WindowState.NORMAL);
- uiPageBody.setMaximizedUIComponent(null);
- }
- }
- PageNodeEvent<UIPortal> pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
- uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
- }
- }
-
- static public class ShowPortletActionListener extends EventListener<UIPage>
- {
- public void execute(Event<UIPage> event) throws Exception
- {
- UIPage uiPage = event.getSource();
- String portletId = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIPortlet uiPortlet = uiPage.getChildById(portletId);
- uiPortlet.getProperties().setProperty("appStatus", "SHOW");
- event.getRequestContext().addUIComponentToUpdateByAjax(uiPortlet);
- }
- }
-
-}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -19,19 +19,33 @@
package org.exoplatform.portal.webui.page;
+import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.MoveChildActionListener;
+import org.exoplatform.portal.webui.portal.UIPortalComposer;
+import org.exoplatform.portal.webui.util.PortalDataMapper;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIEditInlineWorkspace;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
+import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
+import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
/**
* May 19, 2006
*/
-@ComponentConfig(lifecycle = UIPageLifecycle.class, template = "system:/groovy/portal/webui/page/UIPage.gtmpl", events = {@EventConfig(listeners = MoveChildActionListener.class)})
+@ComponentConfig(lifecycle = UIPageLifecycle.class, template = "system:/groovy/portal/webui/page/UIPage.gtmpl", events = {@EventConfig(listeners = MoveChildActionListener.class),
+ @EventConfig(name = "EditCurrentPage", listeners = UIPage.EditCurrentPageActionListener.class)})
public class UIPage extends UIContainer
{
-
/** . */
private String pageId;
@@ -45,6 +59,8 @@
private UIPortlet maximizedUIPortlet;
+ public static String DEFAULT_FACTORY_ID = "Default";
+
public String getOwnerId()
{
return ownerId;
@@ -104,4 +120,64 @@
{
this.maximizedUIPortlet = maximizedUIPortlet;
}
+
+ public void switchToEditMode() throws Exception
+ {
+ Page page = PortalDataMapper.toPageModel(this);
+ switchToEditMode(page);
+ }
+
+ public void switchToEditMode(Page page) throws Exception
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+
+ // check edit permission for page
+ UserACL userACL = getApplicationComponent(UserACL.class);
+ if (!userACL.hasEditPermission(page)) {
+ context.getUIApplication().addMessage(new ApplicationMessage(
+ "UIPortalManagement.msg.Invalid-EditPage-Permission", null));
+ return;
+ }
+
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ UIWorkingWorkspace uiWorkingWS = uiApp
+ .getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
+
+ UIPortalComposer portalComposer = uiWorkingWS.findFirstComponentOfType(
+ UIPortalComposer.class).setRendered(true);
+ portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");
+ portalComposer.setId("UIPageEditor");
+ portalComposer.setShowControl(true);
+ portalComposer.setEditted(false);
+ portalComposer.setCollapse(false);
+
+ UIPortalToolPanel uiToolPanel = uiWorkingWS
+ .findFirstComponentOfType(UIPortalToolPanel.class);
+ uiToolPanel.setShowMaskLayer(false);
+ uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
+
+ // We clone the edited UIPage object, that is required for Abort action
+ UIPage newUIPage = uiWorkingWS.createUIComponent(UIPage.class, null, null);
+ PortalDataMapper.toUIPage(newUIPage, page);
+ uiToolPanel.setWorkingComponent(newUIPage);
+
+ // Remove current UIPage from UIPageBody
+ UIPageBody pageBody = uiWorkingWS
+ .findFirstComponentOfType(UIPageBody.class);
+ pageBody.setUIComponent(null);
+
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ prContext.setFullRender(true);
+ }
+
+ public static class EditCurrentPageActionListener extends EventListener<UIPage>
+ {
+ @Override
+ public void execute(Event<UIPage> event) throws Exception
+ {
+ event.getSource().switchToEditMode();
+ }
+ }
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -28,8 +28,6 @@
import org.exoplatform.portal.webui.portal.UIPortalComponent;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIComponent;
@@ -46,7 +44,6 @@
private String storageId;
- @SuppressWarnings("unused")
public UIPageBody(PageBody model) throws Exception
{
setId("UIPageBody");
@@ -67,7 +64,6 @@
setId("UIPageBody");
}
- @SuppressWarnings("unused")
public void init(PageBody model) throws Exception
{
setId("UIPageBody");
@@ -145,15 +141,10 @@
{
return uiPage;
}
+
+ UIPageFactory clazz = UIPageFactory.getInstance(page.getFactoryId());
+ uiPage = clazz.createUIPage(context);
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- {
- uiPage = createUIComponent(context, UIDesktopPage.class, null, null);
- }
- else
- {
- uiPage = createUIComponent(context, UIPage.class, null, null);
- }
PortalDataMapper.toUIPage(uiPage, page);
uiPortal.setUIPage(page.getId(), uiPage);
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -19,13 +19,19 @@
package org.exoplatform.portal.webui.page;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import javax.portlet.ActionResponse;
+import javax.xml.namespace.QName;
+
import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.commons.utils.PageListAccess;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
@@ -35,10 +41,8 @@
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIEditInlineWorkspace;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
@@ -57,8 +61,8 @@
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInputItemSelector;
import org.exoplatform.webui.form.UIFormInputSet;
@@ -66,10 +70,6 @@
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.UISearchForm;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ResourceBundle;
-
@ComponentConfigs({
@ComponentConfig(template = "system:/groovy/portal/webui/page/UIPageBrowser.gtmpl", events = {
@EventConfig(listeners = UIPageBrowser.DeleteActionListener.class, confirm = "UIPageBrowse.deletePage"),
@@ -266,13 +266,24 @@
return;
}
Page page = service.getPage(id, pcontext.getRemoteUser());
- if (page == null || !page.isModifiable())
+
+ if (page == null || !page.isModifiable() ||
+ (page.getOwnerType().equals(PortalConfig.USER_TYPE) && !page.getOwnerId().equals(pcontext.getRemoteUser())))
{
uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[]{id}, 1));
pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
return;
}
-
+
+ UIPortal uiPortal = Util.getUIPortal();
+ boolean isDeleteCurrentPage = uiPortal.getSelectedNode().getPageReference().equals(page.getPageId());
+ if (isDeleteCurrentPage && page.getOwnerType().equals(PortalConfig.USER_TYPE))
+ {
+ ApplicationMessage msg = new ApplicationMessage("UIPageBrowser.msg.delete.DeleteCurrentUserPage", null, ApplicationMessage.WARNING);
+ event.getRequestContext().getUIApplication().addMessage(msg);
+ return;
+ }
+
UIVirtualList virtualList = uiPageBrowser.getChild(UIVirtualList.class);
UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
PageListAccess datasource = (PageListAccess)repeater.getDataSource();
@@ -283,9 +294,8 @@
//As we have multiple UIPortal, which means multiple caches of UIPage. It 's unwise to garbage
// all UIPage caches at once. Better solution is to clear UIPage on browsing to PageNode having Page
//removed
-
- UIPortal uiPortal = Util.getUIPortal();
- if (uiPortal.getSelectedNode().getPageReference().equals(page.getPageId()))
+
+ if (isDeleteCurrentPage)
{
PageNodeEvent<UIPortal> pnevent =
new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uiPortal.getSelectedNode()
@@ -377,10 +387,9 @@
dataService.save(pageNavigation);
- //Update UserToolbarGroupPortlet
- UIWorkingWorkspace uiWorkingWS = portalApplication.getChild(UIWorkingWorkspace.class);
- uiWorkingWS.updatePortletsByName("UserToolbarDashboardPortlet");
-
+ //Update UserToolbarDashboardPortlet
+ ActionResponse actResponse = event.getRequestContext().getResponse();
+ actResponse.setEvent(new QName("UserPageNodeDeleted"), tobeRemoved.getName());
}
}
}
@@ -391,70 +400,22 @@
public void execute(Event<UIPageBrowser> event) throws Exception
{
UIPageBrowser uiPageBrowser = event.getSource();
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- UIPortalApplication uiPortalApp = (UIPortalApplication)pcontext.getUIApplication();
- String id = pcontext.getRequestParameter(OBJECTID);
- UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);
+ WebuiRequestContext context = event.getRequestContext();
+ String pageID = context.getRequestParameter(OBJECTID);
+ DataStorage service = uiPageBrowser.getApplicationComponent(DataStorage.class);
//Check existence of the page
- Page page = service.getPage(id);
+ Page page = service.getPage(pageID);
if (page == null)
{
- uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{id}, 1));
- pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
+ context.getUIApplication().addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{pageID}, 1));
return;
}
-
- //Check current user 's permissions on the page
- UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
- if (!userACL.hasEditPermission(page))
- {
- uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.edit.NotEditPage", new String[]{id}, 1));
- pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
- return;
- }
-
- //Switch portal application to edit mode
- uiPortalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.findFirstComponentOfType(UIWorkingWorkspace.class);
- UIEditInlineWorkspace editInlineWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
- //Clone a UIPage object, that is required for Abort action
- UIPage uiPage = editInlineWS.createUIComponent(UIPage.class, null, null);
- PortalDataMapper.toUIPage(uiPage, page);
-
- UIPageBody uiPageBody = uiPortalApp.findFirstComponentOfType(UIPageBody.class);
- if (uiPageBody.getUIComponent() != null)
- uiPageBody.setUIComponent(null);
-
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- {
- UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
- UIPageForm uiPageForm = uiMaskWS.createUIComponent(UIPageForm.class, "UIBrowserPageForm", "UIPageForm");
- uiPageForm.setValues(uiPage);
- uiMaskWS.setUIComponent(uiPageForm);
- uiMaskWS.setShow(true);
- pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
- return;
- }
-
- editInlineWS.setRendered(true);
- editInlineWS.setUIComponent(uiPage);
-
- UIPortalComposer portalComposer = editInlineWS.getChild(UIPortalComposer.class).setRendered(true);
- portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");
- portalComposer.setShowControl(true);
- portalComposer.setEditted(false);
- portalComposer.setCollapse(false);
- portalComposer.setId("UIPageEditor");
-
- //toolPanel.setUIComponent(uiPage);
- //toolPanel.setShowMaskLayer(false);
- //uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
- //uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor", null);
- uiWorkingWS.setRenderedChild(UIPortalApplication.UI_EDITTING_WS_ID);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
+ //Need this code to override editpage action in extension project
+ UIPageFactory clazz = UIPageFactory.getInstance(page.getFactoryId());
+ UIPage uipage = clazz.createUIPage(null);
+ uipage.switchToEditMode(page);
}
}
@@ -525,6 +486,7 @@
}
page.setOwnerType(uiPage.getOwnerType());
+
List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
findAllPortlet(uiPortlets, uiPage);
ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
@@ -533,21 +495,6 @@
applications.add(PortalDataMapper.buildModelObject(uiPortlet));
}
- if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- {
- page.setShowMaxWindow(false);
- uiPage.getChildren().clear();
- page.setChildren(applications);
- PortalDataMapper.toUIPage(uiPage, page);
- // if (page.getTemplate() == null)
- // page.setTemplate(uiPage.getTemplate());
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
- dataService.save(page);
- postSave(uiPortalApp, pcontext);
- return;
- }
-
List<UIComponent> uiChildren = uiPage.getChildren();
if (uiChildren == null)
return;
@@ -562,14 +509,10 @@
uiPage.getChildren().clear();
PortalDataMapper.toUIPage(uiPage, page);
+
// if (page.getTemplate() == null) page.setTemplate(uiPage.getTemplate());
if (page.getChildren() == null)
page.setChildren(new ArrayList<ModelObject>());
- if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()))
- {
- dataService.save(page);
- postSave(uiPortalApp, pcontext);
- }
}
private void postSave(UIPortalApplication uiPortalApp, WebuiRequestContext context) throws Exception
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -19,6 +19,11 @@
package org.exoplatform.portal.webui.page;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
@@ -27,7 +32,6 @@
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
-import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
@@ -43,11 +47,6 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
/** Created by The eXo Platform SARL Author : Dang Van Minh minhdv81(a)yahoo.com Jun 23, 2006 */
@ComponentConfigs(@ComponentConfig(template = "system:/groovy/webui/core/UIWizard.gtmpl", events = {
@EventConfig(listeners = UIPageCreationWizard.ViewStep1ActionListener.class),
@@ -355,37 +354,14 @@
page.setTitle(pageNode.getName());
}
- boolean isDesktopPage = Page.DESKTOP_PAGE.equals(page.getFactoryId());
- if (isDesktopPage)
- {
- page.setShowMaxWindow(true);
- }
-
UIPagePreview uiPagePreview = uiWizard.getChild(UIPagePreview.class);
- UIPage uiPage;
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- {
- uiPage = uiWizard.createUIComponent(context, UIDesktopPage.class, null, null);
- }
- else
- {
- uiPage = uiWizard.createUIComponent(context, UIPage.class, null, null);
- }
-
+
+ UIPageFactory clazz = UIPageFactory.getInstance(page.getFactoryId());
+ UIPage uiPage = clazz.createUIPage(context);
+
PortalDataMapper.toUIPage(uiPage, page);
uiPagePreview.setUIComponent(uiPage);
- if (isDesktopPage)
- {
- uiWizard.saveData();
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
- UIPortal uiPortal = Util.getUIPortal();
- PageNodeEvent<UIPortal> pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, selectedNode.getUri());
- uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
- uiWizard.updateUIPortal(event);
- return;
- }
-
uiWizard.updateWizardComponent();
uiPageTemplateOptions.setSelectedOption(null);
}
Copied: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageFactory.java (from rev 6449, portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageFactory.java)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageFactory.java (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageFactory.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -0,0 +1,72 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.webui.page;
+
+import org.exoplatform.webui.application.WebuiRequestContext;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ServiceLoader;
+
+/**
+ * An UIPage abstract factory
+ *
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public abstract class UIPageFactory
+{
+ public static String DEFAULT_FACTORY_ID = "Default";
+
+ protected static Map<String, UIPageFactory> pageFactory = new HashMap<String, UIPageFactory>();
+
+ static
+ {
+ ServiceLoader<UIPageFactory> loader = ServiceLoader.load(UIPageFactory.class);
+ for (UIPageFactory factory : loader)
+ {
+ pageFactory.put(factory.getType(), factory);
+ }
+ }
+
+ public static UIPageFactory getInstance(String type)
+ {
+ UIPageFactory factory;
+
+ if (type == null)
+ {
+ factory = pageFactory.get(DEFAULT_FACTORY_ID);
+ }
+ else
+ {
+ factory = pageFactory.get(type);
+ }
+
+ if (factory == null)
+ {
+ throw new UnsupportedOperationException("The " + type + " page factory is not supported or not loaded");
+ }
+ return factory;
+ }
+
+ public abstract UIPage createUIPage(WebuiRequestContext context) throws Exception;
+
+ public abstract String getType();
+}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -19,10 +19,13 @@
package org.exoplatform.portal.webui.page;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfig;
@@ -32,29 +35,23 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
-import org.exoplatform.portal.webui.portal.UIPortalComponent;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
-import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.InitParams;
-import org.exoplatform.webui.config.Param;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.config.annotation.ParamConfig;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
-import org.exoplatform.webui.core.model.SelectItemCategory;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIFormCheckBoxInput;
import org.exoplatform.webui.form.UIFormInputItemSelector;
import org.exoplatform.webui.form.UIFormInputSet;
@@ -67,13 +64,9 @@
import org.exoplatform.webui.form.validator.StringLengthValidator;
import org.exoplatform.webui.organization.UIGroupMembershipSelector;
import org.exoplatform.webui.organization.UIListPermissionSelector;
-import org.exoplatform.webui.organization.UIPermissionSelector;
import org.exoplatform.webui.organization.UIListPermissionSelector.EmptyIteratorValidator;
+import org.exoplatform.webui.organization.UIPermissionSelector;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
@ComponentConfigs({
@ComponentConfig(lifecycle = UIFormLifecycle.class, template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(listeners = UIPageForm.SaveActionListener.class),
@@ -254,8 +247,6 @@
{
page.setFactoryId(itemOption.getIcon());
// page.setTemplate((String)itemOption.getValue());
- if (page.getFactoryId().equals(Page.DESKTOP_PAGE))
- page.setShowMaxWindow(true);
}
}
UIPageTemplateOptions uiConfigOptions = getChild(UIPageTemplateOptions.class);
@@ -266,9 +257,6 @@
return;
page.setChildren(selectedPage.getChildren());
page.setFactoryId(selectedPage.getFactoryId());
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- page.setShowMaxWindow(true);
-
}
static public class SaveActionListener extends EventListener<UIPageForm>
@@ -299,49 +287,6 @@
applications.add(PortalDataMapper.buildModelObject(uiPortlet));
}
- if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- {
- page.setShowMaxWindow(false);
- uiPage.getChildren().clear();
- page.setChildren(applications);
-
- PortalDataMapper.toUIPage(uiPage, page);
- // if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
-
- // uiEditBar.setUIPage(uiPage);
- // Class<?> [] childrenToRender = {UIPageEditBar.class,
- // UIPageNodeSelector.class, UIPageNavigationControlBar.class};
- // uiManagement.setRenderedChildrenOfTypes(childrenToRender);
-
- pcontext.setFullRender(true);
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
-
- return;
- }
-
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- {
- uiPage.getChildren().clear();
- page.setChildren(applications);
-
- PortalDataMapper.toUIPage(uiPage, page);
- // if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
-
- UIPortalToolPanel toolPanel = Util.getUIPortalToolPanel();
- toolPanel.setShowMaskLayer(true);
- pcontext.setFullRender(true);
- UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- DataStorage dataService = uiPageForm.getApplicationComponent(DataStorage.class);
- dataService.save(page);
- return;
- }
-
List<UIComponent> uiChildren = uiPage.getChildren();
if (uiChildren == null)
{
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -25,8 +25,8 @@
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
-import org.exoplatform.portal.webui.page.UIDesktopPage;
import org.exoplatform.portal.webui.page.UIPage;
+import org.exoplatform.portal.webui.page.UIPageFactory;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComponent;
import org.exoplatform.portal.webui.workspace.UIEditInlineWorkspace;
@@ -226,14 +226,10 @@
if (uiPage != null && uiPage.getId().equals(page.getId()))
return uiPage;
WebuiRequestContext context = Util.getPortalRequestContext();
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- {
- uiPage = uiParent.createUIComponent(context, UIDesktopPage.class, null, null);
- }
- else
- {
- uiPage = uiParent.createUIComponent(context, UIPage.class, null, null);
- }
+
+ UIPageFactory clazz = UIPageFactory.getInstance(page.getFactoryId());
+ uiPage = clazz.createUIPage(context);
+
PortalDataMapper.toUIPage(uiPage, page);
return uiPage;
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.webui.workspace;
+import java.lang.reflect.Method;
+
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfig;
@@ -29,6 +31,7 @@
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.page.UIPageCreationWizard;
+import org.exoplatform.portal.webui.page.UIPageFactory;
import org.exoplatform.portal.webui.page.UISiteBody;
import org.exoplatform.portal.webui.page.UIWizardPageSetInfo;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -36,7 +39,10 @@
import org.exoplatform.portal.webui.portal.UIPortalForm;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -88,8 +94,8 @@
uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
// We clone the edited UIPage object, that is required for Abort action
- //UIPage newUIPage = new UIPage();
- UIPage newUIPage = uiWorkingWS.createUIComponent(UIPage.class, null, null);
+ UIPageFactory clazz = UIPageFactory.getInstance(page.getFactoryId());
+ UIPage newUIPage = clazz.createUIPage(null);
PortalDataMapper.toUIPage(newUIPage, page);
uiToolPanel.setWorkingComponent(newUIPage);
@@ -225,5 +231,36 @@
prContext.addUIComponentToUpdateByAjax(uiMaskWS);
}
}
+
+ public static class EditBackgroundActionListener extends EventListener<UIWorkingWorkspace>
+ {
+ private Log log = ExoLogger.getExoLogger(this.getClass());
+
+ @Override
+ public void execute(Event<UIWorkingWorkspace> event) throws Exception
+ {
+
+ UIWorkingWorkspace workingWorkspace = event.getSource();
+ UIPage uiPage = workingWorkspace.findFirstComponentOfType(UIPage.class);
+
+ Method showEditBackgroundPopupMethod = null;
+ try
+ {
+ if (uiPage == null)
+ {
+ return;
+ }
+ showEditBackgroundPopupMethod = uiPage.getClass().getDeclaredMethod("showEditBackgroundPopup", WebuiRequestContext.class);
+ }
+ catch (NoSuchMethodException ex)
+ {
+ log.warn(ex.getMessage(), ex);
+ }
+ if(showEditBackgroundPopupMethod != null)
+ {
+ showEditBackgroundPopupMethod.invoke(uiPage, event.getRequestContext());
+ }
+ }
+ }
}
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalToolPanel.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalToolPanel.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalToolPanel.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -19,8 +19,6 @@
package org.exoplatform.portal.webui.workspace;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -56,22 +54,6 @@
public void processRender(WebuiRequestContext context) throws Exception
{
JavascriptManager jsmanager = context.getJavascriptManager();
- UIComponent uiComponent = getUIComponent();
- if (uiComponent instanceof UIPage)
- {
- UIPage uiPage = (UIPage)uiComponent;
- //if(uiPage.isShowMaxWindow()){
- if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()))
- {
- uiComponent.processRender(context);
- if (showMaskLayer)
- {
- jsmanager.importJavascript("eXo.core.UIMaskLayer");
- jsmanager.addCustomizedOnLoadScript("eXo.core.UIMaskLayer.createMask('UIPage', null, 10) ;");
- }
- return;
- }
- }
super.processRender(context);
if (showMaskLayer)
Modified: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java 2011-07-18 18:32:56 UTC (rev 6882)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java 2011-07-18 21:12:51 UTC (rev 6883)
@@ -42,6 +42,7 @@
@EventConfig(listeners = UIMainActionListener.CreatePortalActionListener.class),
@EventConfig(listeners = UIMainActionListener.EditCurrentPageActionListener.class),
@EventConfig(listeners = UIMainActionListener.PageCreationWizardActionListener.class),
+ @EventConfig(listeners = UIMainActionListener.EditBackgroundActionListener.class),
@EventConfig(listeners = UIMainActionListener.EditInlineActionListener.class)})
public class UIWorkingWorkspace extends UIContainer
{
Deleted: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory
===================================================================
--- portal/trunk/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory 2011-05-06 09:37:15 UTC (rev 6449)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory 2011-07-18 21:12:51 UTC (rev 6883)
@@ -1 +0,0 @@
-org.exoplatform.portal.webui.page.BaseUIPageFactory
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory (from rev 6449, portal/trunk/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory)
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/resources/META-INF/services/org.exoplatform.portal.webui.page.UIPageFactory 2011-07-18 21:12:51 UTC (rev 6883)
@@ -0,0 +1 @@
+org.exoplatform.portal.webui.page.BaseUIPageFactory
\ No newline at end of file
13 years, 5 months
gatein SVN: r6882 - in epp/portal/branches/EPP_5_2_Branch: component and 2 other directories.
by do-not-reply@jboss.org
Author: theute
Date: 2011-07-18 14:32:56 -0400 (Mon, 18 Jul 2011)
New Revision: 6882
Modified:
epp/portal/branches/EPP_5_2_Branch/
epp/portal/branches/EPP_5_2_Branch/component/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
Log:
JBEPP-1011
Option to override portal metadata at startup
Property changes on: epp/portal/branches/EPP_5_2_Branch
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
Property changes on: epp/portal/branches/EPP_5_2_Branch/component
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
Modified: epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-07-18 14:10:08 UTC (rev 6881)
+++ epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-07-18 18:32:56 UTC (rev 6882)
@@ -83,6 +83,12 @@
/** . */
private boolean isUseTryCatch;
+ /**
+ * If true the portal clear portal metadata from data storage and replace
+ * it with new data created from .xml files
+ */
+ private boolean overrideExistingData;
+
/** . */
private Logger log = LoggerFactory.getLogger(getClass());
@@ -127,6 +133,16 @@
isUseTryCatch = true;
}
+ valueParam = params.getValueParam("override");
+ if(valueParam != null)
+ {
+ overrideExistingData = "true".equals(valueParam.getValue());
+ }
+ else
+ {
+ overrideExistingData = false;
+ }
+
}
public void run() throws Exception
@@ -134,7 +150,9 @@
RequestLifeCycle.begin(PortalContainer.getInstance());
try
{
- if (dataStorage_.getPortalConfig(defaultPortal) != null)
+ //DANGEROUS! If the user delete the defaultPortal (ie: classic), the next time he restarts
+ //the server. Data of predefined owners would be overriden
+ if (dataStorage_.getPortalConfig(defaultPortal) != null && !overrideExistingData)
return;
}
finally
@@ -320,6 +338,10 @@
result.addAll(other.templateConfigs);
this.templateConfigs = Collections.unmodifiableList(result);
}
+
+ //The override is true if and only if one of the plugin NewPortalConfigListener configures its
+ //override param as true
+ overrideExistingData = overrideExistingData || other.overrideExistingData;
}
public void initPortalConfigDB(NewPortalConfig config) throws Exception
@@ -436,8 +458,16 @@
}
else
{
- navigation.merge(currentNavigation);
- dataStorage_.save(navigation);
+ if(overrideExistingData)
+ {
+ dataStorage_.remove(currentNavigation);
+ dataStorage_.create(navigation);
+ }
+ else
+ {
+ navigation.merge(currentNavigation);
+ dataStorage_.save(navigation);
+ }
}
}
Modified: epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-18 14:10:08 UTC (rev 6881)
+++ epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-18 18:32:56 UTC (rev 6882)
@@ -113,6 +113,11 @@
<description>the path to the location that contains Page templates</description>
<value>war:/conf/portal/template/pages</value>
</value-param>
+ <value-param>
+ <name>override</name>
+ <description>The flag parameter to decide if portal metadata is overriden on restarting server</description>
+ <value>false</value>
+ </value-param>
<object-param>
<name>site.templates.location</name>
<description>description</description>
13 years, 5 months