gatein SVN: r6529 - in components/mop/trunk: api/src/main/java/org/gatein/mop/api/workspace and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2011-05-23 17:20:03 -0400 (Mon, 23 May 2011)
New Revision: 6529
Modified:
components/mop/trunk/
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java
Log:
GTNMOP-39 : Preserve navigation index when renaming
GTNMOP-38 : Navigation index method to ease client
Property changes on: components/mop/trunk
___________________________________________________________________
Added: svn:mergeinfo
+ /components/mop/branches/1.0.x:6520-6521
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java 2011-05-23 17:56:55 UTC (rev 6528)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java 2011-05-23 21:20:03 UTC (rev 6529)
@@ -49,6 +49,13 @@
void setName(String name);
/**
+ * Returns the index of this navigation.
+ *
+ * @return the navigation index
+ */
+ int getIndex();
+
+ /**
* Extends the object type to navigation.
*
* @return the object type
@@ -95,6 +102,19 @@
Navigation addChild(String name) throws NullPointerException, IllegalArgumentException;
/**
+ * Adds a child navigation that will be added to the specified position among the ordered children list. When
+ * the the index is not specified, the child is appended at the last position.
+ *
+ * @param index the child index
+ * @param name the child name
+ * @return the child navigation
+ * @throws NullPointerException when a null name is provided
+ * @throws IndexOutOfBoundsException if the index is out of bounds
+ * @throws IllegalArgumentException when an illegal name is provided
+ */
+ Navigation addChild(Integer index, String name) throws NullPointerException, IndexOutOfBoundsException, IllegalArgumentException;
+
+ /**
* Destroys this navigation.
*/
void destroy();
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java 2011-05-23 17:56:55 UTC (rev 6528)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java 2011-05-23 21:20:03 UTC (rev 6529)
@@ -53,11 +53,19 @@
@Create
public abstract NavigationImpl createNavigation();
- public NavigationImpl addNavigation(String name)
+ public NavigationImpl addNavigation(Integer index, String name)
{
NavigationImpl page = createNavigation();
page.setNodeName(name);
- getNavigationList().add(page);
+ List<NavigationImpl> list = getNavigationList();
+ if (index != null)
+ {
+ list.add(index, page);
+ }
+ else
+ {
+ list.add(page);
+ }
return page;
}
}
\ No newline at end of file
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2011-05-23 17:56:55 UTC (rev 6528)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2011-05-23 21:20:03 UTC (rev 6529)
@@ -88,12 +88,30 @@
public void setName(String name)
{
- // todo: change to setNodeName when it is fixed
- NavigationContainer parent = getParentContainer();
- Map<String, NavigationImpl> map = parent.getNavigationMap();
- map.put(name, this);
+ // Capture the current index
+ int index = getIndex();
+
+ // Rename (will change the index to the last / JCR move)
+ setNodeName(name);
+
+ // Set index back to original value
+ List<NavigationImpl> siblings = getParentContainer().getNavigationList();
+ siblings.add(index, this);
}
+ public int getIndex()
+ {
+ NavigationImpl parent = getParent();
+ if (parent == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return parent.getChildren().indexOf(this);
+ }
+ }
+
public ObjectType<? extends Navigation> getObjectType()
{
return ObjectType.NAVIGATION;
@@ -131,12 +149,17 @@
return childrenContainer.getNavigationMap().get(name);
}
- public NavigationImpl addChild(String name)
+ public NavigationImpl addChild(Integer index, String name) throws NullPointerException, IndexOutOfBoundsException, IllegalArgumentException
{
NavigationContainer childrenContainer = getChildrenContainer();
- return childrenContainer.addNavigation(name);
+ return childrenContainer.addNavigation(index, name);
}
+ public NavigationImpl addChild(String name)
+ {
+ return addChild(null, name);
+ }
+
public <L extends Link> L linkTo(ObjectType<L> linkType)
{
setLink(null);
Modified: components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java
===================================================================
--- components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java 2011-05-23 17:56:55 UTC (rev 6528)
+++ components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java 2011-05-23 21:20:03 UTC (rev 6529)
@@ -32,14 +32,18 @@
*/
public class NavigationTestCase extends AbstractPOMTestCase
{
- public void testNavigationOrder()
+ public void testOrder()
{
ModelImpl model = pomService.getModel();
Site portal = model.getWorkspace().addSite(ObjectType.PORTAL_SITE, "portal_for_navigation");
Navigation root = portal.getRootNavigation();
+ assertEquals(0, root.getIndex());
Navigation n1 = root.addChild("1");
+ assertEquals(0, n1.getIndex());
Navigation n2 = root.addChild("2");
+ assertEquals(1, n2.getIndex());
Navigation n3 = root.addChild("3");
+ assertEquals(2, n3.getIndex());
List<? extends Navigation> ns = root.getChildren();
assertEquals(3, ns.size());
assertSame(n1, ns.get(0));
@@ -47,14 +51,31 @@
assertSame(n3, ns.get(2));
}
+ public void testIndexAdd()
+ {
+ ModelImpl model = pomService.getModel();
+ Site portal = model.getWorkspace().addSite(ObjectType.PORTAL_SITE, "portal_for_navigation");
+ Navigation root = portal.getRootNavigation();
+ Navigation n1 = root.addChild("1");
+ Navigation n3 = root.addChild("3");
+ Navigation n2 = root.addChild(1, "2");
+ List<? extends Navigation> ns = root.getChildren();
+ assertEquals(3, ns.size());
+ assertSame(n1, ns.get(0));
+ assertSame(n2, ns.get(1));
+ assertSame(n3, ns.get(2));
+ }
+
public void testSetName()
{
ModelImpl model = pomService.getModel();
Site portal = model.getWorkspace().addSite(ObjectType.PORTAL_SITE, "portal_for_navigation");
Navigation root = portal.getRootNavigation();
Navigation n1 = root.addChild("1");
+ Navigation n2 = root.addChild("2");
assertEquals("1", n1.getName());
- n1.setName("2");
- assertEquals("2", n1.getName());
+ n1.setName("3");
+ assertEquals("3", n1.getName());
+ assertEquals(0, n1.getIndex());
}
}
13 years, 7 months
gatein SVN: r6528 - in portal/branches/stax-integration/component/portal/src: test/java/org/exoplatform/portal/stax and 1 other directories.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-05-23 13:56:55 -0400 (Mon, 23 May 2011)
New Revision: 6528
Modified:
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortalConfig.java
portal/branches/stax-integration/component/portal/src/test/resources/stax/portal.xml
Log:
GTNPORTAL-1905: Commit GateIn object StAX parser and JUnit tests
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java 2011-05-23 16:01:18 UTC (rev 6527)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java 2011-05-23 17:56:55 UTC (rev 6528)
@@ -50,7 +50,6 @@
}
container.setId(elementNavigator.getAttribute("id"));
- container.setDecorator(elementNavigator.getAttribute("decorator"));
container.setWidth(elementNavigator.getAttribute("width"));
container.setHeight(elementNavigator.getAttribute("height"));
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java 2011-05-23 16:01:18 UTC (rev 6527)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java 2011-05-23 17:56:55 UTC (rev 6528)
@@ -52,8 +52,6 @@
if(elementNavigator.next(StAXElement.properties))
{
Properties properties = new Properties();
- StaxNavigator<StAXElement> propertiesElement = elementNavigator.fork();
-
while(elementNavigator.next(StAXElement.entry))
{
String propertyName = elementNavigator.getAttribute("key");
@@ -69,6 +67,7 @@
final Set<StAXElement> modelElementSet = new HashSet<StAXElement>();
modelElementSet.add(StAXElement.container);
modelElementSet.add(StAXElement.portlet_application);
+ modelElementSet.add(StAXElement.gadget_application);
modelElementSet.add(StAXElement.page_body);
elementNavigator.next(modelElementSet);
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortalConfig.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortalConfig.java 2011-05-23 16:01:18 UTC (rev 6527)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortalConfig.java 2011-05-23 17:56:55 UTC (rev 6528)
@@ -24,8 +24,10 @@
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.Properties;
import org.exoplatform.portal.config.stax.PortalConfigStAXParser;
import org.exoplatform.portal.config.stax.StAXElement;
+import org.exoplatform.portal.pom.config.Utils;
import org.json.XML;
import org.staxnav.Naming;
import org.staxnav.StaxNavigator;
@@ -39,25 +41,26 @@
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/20/11
*/
-public class TestParsingPortalConfig extends TestCase
+public class TestParsingPortalConfig extends AbstractStaxTestCase
{
- private StaxNavigator<StAXElement> elementNavigator;
-
- protected void setUp() throws Exception
- {
- InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("./stax/portal.xml");
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- XMLStreamReader streamReader = inputFactory.createXMLStreamReader(in);
- elementNavigator = new StaxNavigatorImpl<StAXElement>(new Naming.Enumerated.Simple(StAXElement.class, StAXElement.NO_SUCH_ELEMENT), streamReader);
- }
-
public void testPortalConfig()
{
- PortalConfigStAXParser portalConfigParser = new PortalConfigStAXParser(elementNavigator);
+ PortalConfigStAXParser portalConfigParser = new PortalConfigStAXParser(createNavigator("/stax/portal.xml"));
PortalConfig portalConfig = portalConfigParser.parseXML();
+ assertNotNull(portalConfig);
+ assertEquals("classic", portalConfig.getName());
+ assertEquals("en", portalConfig.getLocale());
+ assertEquals("Everyone", Utils.join(";", portalConfig.getAccessPermissions()));
+ assertEquals("*:/platform/administrators", portalConfig.getEditPermission());
+ assertNotNull(portalConfig.getProperties());
+
+ Properties properties = new Properties();
+ properties.put("sessionAlive", "onDemand");
+ properties.put("foo", "bar");
+ assertEquals(properties, portalConfig.getProperties());
+
Container layout = portalConfig.getPortalLayout();
List<ModelObject> children = layout.getChildren();
Modified: portal/branches/stax-integration/component/portal/src/test/resources/stax/portal.xml
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/portal.xml 2011-05-23 16:01:18 UTC (rev 6527)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/portal.xml 2011-05-23 17:56:55 UTC (rev 6528)
@@ -30,6 +30,7 @@
<edit-permission>*:/platform/administrators</edit-permission>
<properties>
<entry key="sessionAlive">onDemand</entry>
+ <entry key="foo">bar</entry>
</properties>
<portal-layout>
13 years, 7 months
gatein SVN: r6527 - in portal/branches/stax-integration/component/portal/src: test/java/org/exoplatform/portal/stax and 1 other directories.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-05-23 12:01:18 -0400 (Mon, 23 May 2011)
New Revision: 6527
Added:
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ApplicationStAXParser.java
portal/branches/stax-integration/component/portal/src/test/resources/stax/loaded-page.xml
Modified:
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParserFactory.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/GadgetWindowStAXParer.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java
Log:
GTNPORTAL-1905: Commit GateIn object StAX parser and JUnit tests
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParserFactory.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParserFactory.java 2011-05-23 03:46:39 UTC (rev 6526)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParserFactory.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.portal.config.stax;
+import org.exoplatform.portal.config.model.ModelObject;
import org.staxnav.StaxNavigator;
/**
@@ -27,25 +28,25 @@
public class AbstractStAXParserFactory
{
- public static AbstractStAXParser getParser(StAXElement element, StaxNavigator<StAXElement> elementNavigator)
+ @SuppressWarnings("unchecked")
+ public static <T extends ModelObject> AbstractStAXParser<T> getParser(StAXElement element, StaxNavigator<StAXElement> elementNavigator)
{
switch(element)
{
case page:
- return new PageStAXParser(elementNavigator);
+ return (AbstractStAXParser<T>) new PageStAXParser(elementNavigator);
case page_body:
- return new PageBodyStAXParser(elementNavigator);
+ return (AbstractStAXParser<T>) new PageBodyStAXParser(elementNavigator);
case portal_config:
- return new PortalConfigStAXParser(elementNavigator);
+ return (AbstractStAXParser<T>) new PortalConfigStAXParser(elementNavigator);
case portlet_application:
- return new PortletWindowStAXParser(elementNavigator);
+ return (AbstractStAXParser<T>) new PortletWindowStAXParser(elementNavigator);
case gadget_application:
- return new GadgetWindowStAXParer(elementNavigator);
+ return (AbstractStAXParser<T>) new GadgetWindowStAXParer(elementNavigator);
case container:
- return new ContainerStAXParser(elementNavigator);
+ return (AbstractStAXParser<T>) new ContainerStAXParser(elementNavigator);
default:
throw new IllegalArgumentException("StAXElement " + element + " is not associated with any subclass of ModelObject");
}
-
}
}
Added: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ApplicationStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ApplicationStAXParser.java (rev 0)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ApplicationStAXParser.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.config.stax;
+
+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.pom.config.Utils;
+import org.staxnav.StaxNavException;
+import org.staxnav.StaxNavigator;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public abstract class ApplicationStAXParser<S> extends AbstractStAXParser<Application<S>>
+{
+ private Application<S> application;
+
+ public ApplicationStAXParser(ApplicationType<S> applicationType, StaxNavigator<StAXElement> elementNavigator) throws IllegalArgumentException
+ {
+ super(elementNavigator);
+ application = new Application<S>(applicationType);
+ }
+
+ @Override
+ public final Application<S> parseXML() throws StaxNavException
+ {
+ application.setState(parseApplicationState());
+
+ application.setTheme(getContent(elementNavigator, StAXElement.theme));
+ application.setTitle(getContent(elementNavigator, StAXElement.title));
+ application.setAccessPermissions(Utils.split(";", getContent(elementNavigator, StAXElement.access_permissions)));
+ application.setShowInfoBar("true".equals(getContent(elementNavigator, StAXElement.show_info_bar)));
+ application.setShowApplicationState("true".equals(getContent(elementNavigator, StAXElement.show_application_state)));
+ application.setShowApplicationMode("true".equals(getContent(elementNavigator, StAXElement.show_application_mode)));
+ application.setDescription(getContent(elementNavigator, StAXElement.description));
+ application.setIcon(getContent(elementNavigator, StAXElement.icon));
+ application.setWidth(getContent(elementNavigator, StAXElement.width));
+ application.setHeight(getContent(elementNavigator, StAXElement.height));
+
+ return application;
+ }
+
+ public abstract ApplicationState<S> parseApplicationState() throws StaxNavException;
+
+ public abstract boolean isElementOptional(StAXElement stAXElement) throws StaxNavException;
+
+ @Override
+ public final boolean isOptional(StAXElement staxElement)
+ {
+ switch (staxElement)
+ {
+ case theme:
+ case title:
+ case show_application_state:
+ case show_application_mode:
+ case description:
+ case icon:
+ case width:
+ case height:
+ return true;
+
+ default:
+ return isElementOptional(staxElement);
+ }
+ }
+}
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java 2011-05-23 03:46:39 UTC (rev 6526)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -62,6 +62,7 @@
final Set<StAXElement> childElementSet = new HashSet<StAXElement>();
childElementSet.add(StAXElement.portlet_application);
+ childElementSet.add(StAXElement.gadget_application);
childElementSet.add(StAXElement.container);
elementNavigator.next(childElementSet);
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/GadgetWindowStAXParer.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/GadgetWindowStAXParer.java 2011-05-23 03:46:39 UTC (rev 6526)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/GadgetWindowStAXParer.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.portal.config.stax;
-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.TransientApplicationState;
-import org.exoplatform.portal.config.serialize.GadgetApplication;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.staxnav.StaxNavException;
import org.staxnav.StaxNavigator;
@@ -29,36 +29,26 @@
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/19/11
*/
-public class GadgetWindowStAXParer extends AbstractStAXParser<Application<Gadget>>
+public class GadgetWindowStAXParer extends ApplicationStAXParser<Gadget>
{
public GadgetWindowStAXParer(StaxNavigator<StAXElement> elementNavigator)
{
- super(elementNavigator);
+ super(ApplicationType.GADGET, elementNavigator);
}
@Override
- public Application<Gadget> parseXML() throws StaxNavException
+ public ApplicationState<Gadget> parseApplicationState() throws StaxNavException
{
elementNavigator.next(StAXElement.gadget);
String gadgetName = getContent(elementNavigator, StAXElement.gadget_ref);
- TransientApplicationState<Gadget> state = new TransientApplicationState<Gadget>(gadgetName, null);
- Application<Gadget> app = Application.createGadgetApplication();
- app.setState(state);
-
- return app;
+ return new TransientApplicationState<Gadget>(gadgetName, null);
}
@Override
- public boolean isOptional(StAXElement staxElement)
+ public boolean isElementOptional(StAXElement staxElement)
{
- switch(staxElement)
- {
- case gadget_ref:
- return false;
- default:
- return true;
- }
+ return false;
}
}
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java 2011-05-23 03:46:39 UTC (rev 6526)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -18,42 +18,37 @@
*/
package org.exoplatform.portal.config.stax;
-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.TransientApplicationState;
-import org.exoplatform.portal.config.serialize.PortletApplication;
-import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
-import org.omg.CORBA.NamedValue;
import org.staxnav.StaxNavException;
import org.staxnav.StaxNavigator;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
/**
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/9/11
*/
-public class PortletWindowStAXParser extends AbstractStAXParser<Application<Portlet>>
+public class PortletWindowStAXParser extends ApplicationStAXParser<Portlet>
{
public PortletWindowStAXParser(StaxNavigator<StAXElement> elementNavigator)
{
- super(elementNavigator);
+ super(ApplicationType.PORTLET, elementNavigator);
}
@Override
- public Application<Portlet> parseXML() throws StaxNavException
+ public ApplicationState<Portlet> parseApplicationState() throws StaxNavException
{
elementNavigator.next(StAXElement.portlet);
String applicationName = getContent(elementNavigator, StAXElement.application_ref);
String portletName = getContent(elementNavigator, StAXElement.portlet_ref);
- TransientApplicationState<Portlet> state;
-
if(elementNavigator.next(StAXElement.preferences))
{
PortletBuilder builder = new PortletBuilder();
@@ -81,46 +76,22 @@
}
}
- state = new TransientApplicationState<Portlet>(applicationName + "/" + portletName, builder.build());
+ return new TransientApplicationState<Portlet>(applicationName + "/" + portletName, builder.build());
}
else
{
- state = new TransientApplicationState<Portlet>(applicationName + "/" + portletName, null);
+ return new TransientApplicationState<Portlet>(applicationName + "/" + portletName, null);
}
-
- Application<Portlet> application = Application.createPortletApplication();
- application.setState(state);
-
- application.setTheme(getContent(elementNavigator, StAXElement.theme));
- application.setTitle(getContent(elementNavigator, StAXElement.title));
- application.setAccessPermissions(Utils.split(";", getContent(elementNavigator, StAXElement.access_permissions)));
- application.setShowInfoBar("true".equals(getContent(elementNavigator, StAXElement.show_info_bar)));
- application.setShowApplicationState("true".equals(getContent(elementNavigator, StAXElement.show_application_state)));
- application.setShowApplicationMode("true".equals(getContent(elementNavigator, StAXElement.show_application_mode)));
- application.setDescription(getContent(elementNavigator, StAXElement.description));
- application.setIcon(getContent(elementNavigator, StAXElement.icon));
- application.setWidth(getContent(elementNavigator, StAXElement.width));
- application.setHeight(getContent(elementNavigator, StAXElement.height));
-
- return application;
}
@Override
- public boolean isOptional(StAXElement staxElement)
+ public boolean isElementOptional(StAXElement staxElement)
{
switch(staxElement)
{
case preferences:
- case theme:
- case show_application_state:
- case show_application_mode:
- case description:
- case icon:
- case width:
- case height:
case value:
case read_only:
- case title:
return true;
default:
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java 2011-05-23 03:46:39 UTC (rev 6526)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.exoplatform.portal.stax;
import junit.framework.TestCase;
@@ -14,7 +36,7 @@
* @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
* @version $Revision$
*/
-public class AbstractStaxTestCase extends TestCase
+public abstract class AbstractStaxTestCase extends TestCase
{
protected StaxNavigator<StAXElement> createNavigator(String resource) throws RuntimeException
{
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java 2011-05-23 03:46:39 UTC (rev 6526)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -21,14 +21,18 @@
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.ModelObject;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.stax.PageStAXParser;
import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.Preference;
+import java.util.List;
+
/**
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/11/11
@@ -50,4 +54,220 @@
assertNotNull(page.getChildren());
assertEquals(1, page.getChildren().size());
}
+
+ public void testLoadedPage() throws Exception
+ {
+ PageStAXParser parser = new PageStAXParser(createNavigator("/stax/loaded-page.xml"));
+ Page page = parser.parseXML();
+
+ assertNotNull(page);
+
+ // Verify page properties
+ assertEquals("loaded-page", page.getName());
+ assertEquals("Loaded Page", page.getTitle());
+ assertEquals("manager:/platform/administrators;manager:/platform/users", Utils.join(";", page.getAccessPermissions()));
+ assertEquals("*:/platform/administrators", page.getEditPermission());
+
+ // Verify page children
+ assertNotNull(page.getChildren());
+ assertEquals(1, page.getChildren().size());
+ ModelObject component = page.getChildren().get(0);
+ assertTrue(component instanceof Container);
+
+ // Verify root container
+ Container rootContainer = (Container) component;
+ assertEquals("rootContainer", rootContainer.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", rootContainer.getTemplate());
+ assertEquals("Everyone", Utils.join(";", rootContainer.getAccessPermissions()));
+
+ // Verify root container children
+ List<ModelObject> rootChildren = rootContainer.getChildren();
+ assertNotNull(rootChildren);
+ assertEquals(3, rootChildren.size());
+
+ // Verify container 1
+ ModelObject c1 = rootChildren.get(0);
+ assertNotNull(c1);
+ assertTrue(c1 instanceof Container);
+ Container container1 = (Container) c1;
+ assertEquals("c1", container1.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", container1.getTemplate());
+ assertEquals("*:/platform/users", Utils.join(";", container1.getAccessPermissions()));
+ {
+ // Verify homepage application
+ assertNotNull(container1.getChildren());
+ assertEquals(1, container1.getChildren().size());
+ ModelObject homeComponent = container1.getChildren().get(0);
+ assertTrue(homeComponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) homeComponent;
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/HomePagePortlet", tas.getContentId());
+ Portlet portlet = tas.getContentState();
+ int count = 0;
+ for (Preference pref : portlet)
+ {
+ count++;
+ }
+ assertEquals(3, count);
+ Preference pref = portlet.getPreference("template");
+ assertNotNull(pref);
+ assertEquals("template", pref.getName());
+ assertEquals("system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl", pref.getValue());
+ assertTrue(pref.isReadOnly());
+
+ pref = portlet.getPreference("empty-preference-value");
+ assertNotNull(pref);
+ assertEquals("empty-preference-value", pref.getName());
+ assertNull(pref.getValue());
+ assertFalse(pref.isReadOnly());
+
+ pref = portlet.getPreference("no-preference-value");
+ assertNotNull(pref);
+ assertEquals("no-preference-value", pref.getName());
+ assertNull(pref.getValue());
+ assertFalse(pref.isReadOnly());
+
+ assertEquals("Mac:MacTheme::Default:DefaultTheme::Vista:VistaTheme", application.getTheme());
+ assertEquals("Home Page portlet", application.getTitle());
+ assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
+ assertTrue(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertTrue(application.getShowApplicationMode());
+ assertNull(application.getDescription());
+ assertNull(application.getIcon());
+ assertNull(application.getWidth());
+ assertNull(application.getHeight());
+ }
+
+ // Verify container 2
+ ModelObject c2 = rootChildren.get(1);
+ assertNotNull(c2);
+ assertTrue(c2 instanceof Container);
+ Container container2 = (Container) c2;
+ assertEquals("c2", container2.getId());
+ assertEquals("system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl", container2.getTemplate());
+ assertEquals("*:/platform/guests", Utils.join(";", container2.getAccessPermissions()));
+ assertEquals("TableColumnContainer", container2.getFactoryId());
+ assertNotNull(container2.getChildren());
+ assertEquals(2, container2.getChildren().size());
+
+ {
+ // Verify column 1 of container 2
+ ModelObject appregComp = container2.getChildren().get(0);
+ assertTrue(appregComp instanceof Container);
+ Container appregContainer = (Container) appregComp;
+ assertEquals("c2-1", appregContainer.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", appregContainer.getTemplate());
+ assertEquals("300px", appregContainer.getWidth());
+ assertEquals("400px", appregContainer.getHeight());
+ assertEquals("Everyone", Utils.join(";", appregContainer.getAccessPermissions()));
+ {
+ // Verify app registry application
+ assertNotNull(appregContainer.getChildren());
+ assertEquals(1, appregContainer.getChildren().size());
+ ModelObject appregComponent = appregContainer.getChildren().get(0);
+ assertTrue(appregComponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) appregComponent;
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("exoadmin/ApplicationRegistryPortlet", tas.getContentId());
+ assertNull(tas.getContentState());
+
+ assertEquals("Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme", application.getTheme());
+ assertEquals("Application Registry", application.getTitle());
+ assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
+ assertFalse(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertEquals("Application Registry", application.getDescription());
+ assertEquals("PortletIcon", application.getIcon());
+ assertEquals("250px", application.getWidth());
+ assertEquals("350px", application.getHeight());
+ }
+
+ // Verify column 2 of container 2
+ ModelObject orgComp = container2.getChildren().get(1);
+ assertTrue(orgComp instanceof Container);
+ Container orgContainer = (Container) orgComp;
+ assertEquals("c2-2", orgContainer.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", orgContainer.getTemplate());
+ assertEquals("200px", orgContainer.getWidth());
+ assertEquals("300px", orgContainer.getHeight());
+ assertEquals("/platform/users", Utils.join(";", orgContainer.getAccessPermissions()));
+ {
+ // Verify calendar gadget application
+ assertNotNull(orgContainer.getChildren());
+ assertEquals(1, orgContainer.getChildren().size());
+ ModelObject gadgetComponent = orgContainer.getChildren().get(0);
+ assertTrue(gadgetComponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Gadget> application = (Application<Gadget>) gadgetComponent;
+ assertTrue(application.getType() == ApplicationType.GADGET);
+ ApplicationState<Gadget> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Gadget> tas = (TransientApplicationState<Gadget>) state;
+ assertEquals("Calendar", tas.getContentId());
+ assertNull(tas.getContentState());
+
+ assertEquals("Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme", application.getTheme());
+ assertEquals("Calendar Title", application.getTitle());
+ assertEquals("*:/platform/administrators;*:/organization/management/executive-board", Utils.join(";", application.getAccessPermissions()));
+ assertTrue(application.getShowInfoBar());
+ assertFalse(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertEquals("Calendar Description", application.getDescription());
+ assertEquals("StarAwardIcon", application.getIcon());
+ assertEquals("100px", application.getWidth());
+ assertEquals("200px", application.getHeight());
+ }
+ }
+
+ // Verify container 3
+ ModelObject c3 = rootChildren.get(2);
+ assertNotNull(c3);
+ assertTrue(c3 instanceof Container);
+ Container container3 = (Container) c3;
+ assertEquals("c3", container3.getId());
+ assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", container3.getTemplate());
+ assertEquals(container3.getTemplate(), "system:/groovy/portal/webui/container/UIContainer.gtmpl");
+ assertEquals("Everyone", Utils.join(";", container3.getAccessPermissions()));
+ assertNull(container3.getFactoryId());
+ {
+ // Verify site map application
+ assertNotNull(container3.getChildren());
+ assertEquals(1, container3.getChildren().size());
+ ModelObject sitemapcomponent = container3.getChildren().get(0);
+ assertTrue(sitemapcomponent instanceof Application);
+ @SuppressWarnings("unchecked")
+ Application<Portlet> application = (Application<Portlet>) sitemapcomponent;
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/SiteMapPortlet", tas.getContentId());
+ assertNull(tas.getContentState());
+
+ assertEquals("Default:DefaultTheme::Vista:VistaTheme::Mac:MacTheme", application.getTheme());
+ assertEquals("SiteMap", application.getTitle());
+ assertEquals("*:/platform/users", Utils.join(";", application.getAccessPermissions()));
+ assertTrue(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertEquals("SiteMap", application.getDescription());
+ assertNull(application.getIcon());
+ assertNull(application.getWidth());
+ assertNull(application.getHeight());
+ }
+ }
}
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java 2011-05-23 03:46:39 UTC (rev 6526)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java 2011-05-23 16:01:18 UTC (rev 6527)
@@ -103,8 +103,8 @@
assertEquals(4, count);
assertPreference(portlet, "single-value", "value1");
assertPreference(portlet, "multi-value", "multi-value1", "multi-value2", "multi-value3");
- assertPreference(portlet, "empty-value", null);
- assertPreference(portlet, "no-value", null);
+ assertPreference(portlet, "empty-value", (String) null);
+ assertPreference(portlet, "no-value", (String) null);
}
private void assertPreference(Portlet portlet, String name, String...values)
Added: portal/branches/stax-integration/component/portal/src/test/resources/stax/loaded-page.xml
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/loaded-page.xml (rev 0)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/loaded-page.xml 2011-05-23 16:01:18 UTC (rev 6527)
@@ -0,0 +1,118 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+<page>
+ <name>loaded-page</name>
+ <title>Loaded Page</title>
+ <access-permissions>manager:/platform/administrators;manager:/platform/users</access-permissions>
+ <edit-permission>*:/platform/administrators</edit-permission>
+ <show-max-window>false</show-max-window>
+ <container id="rootContainer" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ <container id="c1" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>*:/platform/users</access-permissions>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>HomePagePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>empty-preference-value</name>
+ <value></value>
+ </preference>
+ <preference>
+ <name>no-preference-value</name>
+ </preference>
+ </preferences>
+ </portlet>
+ <theme>Mac:MacTheme::Default:DefaultTheme::Vista:VistaTheme</theme>
+ <title>Home Page portlet</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>true</show-application-mode>
+ </portlet-application>
+ </container>
+ <container id="c2" template="system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl">
+ <access-permissions>*:/platform/guests</access-permissions>
+ <factory-id>TableColumnContainer</factory-id>
+ <container id="c2-1" template="system:/groovy/portal/webui/container/UIContainer.gtmpl" width="300px" height="400px">
+ <access-permissions>Everyone</access-permissions>
+ <portlet-application>
+ <portlet>
+ <application-ref>exoadmin</application-ref>
+ <portlet-ref>ApplicationRegistryPortlet</portlet-ref>
+ </portlet>
+ <theme>Default:DefaultTheme::Mac:MacTheme::Vista:VistaTheme</theme>
+ <title>Application Registry</title>
+ <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ <description>Application Registry</description>
+ <icon>PortletIcon</icon>
+ <width>250px</width>
+ <height>350px</height>
+ </portlet-application>
+ </container>
+ <container id="c2-2" template="system:/groovy/portal/webui/container/UIContainer.gtmpl" width="200px" height="300px">
+ <access-permissions>/platform/users</access-permissions>
+ <gadget-application>
+ <gadget>
+ <gadget-ref>Calendar</gadget-ref>
+ </gadget>
+ <theme>Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme</theme>
+ <title>Calendar Title</title>
+ <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>false</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ <description>Calendar Description</description>
+ <icon>StarAwardIcon</icon>
+ <width>100px</width>
+ <height>200px</height>
+ </gadget-application>
+ </container>
+ </container>
+ <container id="c3" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ <portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>SiteMapPortlet</portlet-ref>
+ </portlet>
+ <theme>Default:DefaultTheme::Vista:VistaTheme::Mac:MacTheme</theme>
+ <title>SiteMap</title>
+ <access-permissions>*:/platform/users</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>false</show-application-mode>
+ <description>SiteMap</description>
+ </portlet-application>
+ </container>
+ </container>
+</page>
\ No newline at end of file
13 years, 7 months
gatein SVN: r6526 - in portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp: gadgets/Todo and 1 other directories.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2011-05-22 23:46:39 -0400 (Sun, 22 May 2011)
New Revision: 6526
Added:
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ALL_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ar_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/de_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/es_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/fr_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ja_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/kr_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/vi_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_ALL.xml
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_TW_ALL.xml
Removed:
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/locale/
Modified:
portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/Todo.xml
Log:
GTNPORTAL-1900 TODO gadget has unlocalized button __MSG_Save__
Modified: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/Todo.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/Todo.xml 2011-05-22 23:14:08 UTC (rev 6525)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/Todo.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -36,10 +36,10 @@
description="ToDo Gadget, easily manage and track your daily to-do list."
thumbnail="http://localhost:8080/eXoGadgets/skin/DefaultSkin/portletIcons/Todo.png"
height="235">
- <Locale messages="http://localhost:8080/eXoGadgets/locale/Todo/ALL_ALL.xml" />
- <Locale lang="ar" messages="http://localhost:8080/eXoGadgets/locale/Todo/ar_ALL.xml" language_direction="rtl"/>
- <Locale lang="fr" messages="http://localhost:8080/eXoGadgets/locale/Todo/fr_ALL.xml" />
- <Locale lang="vi" messages="http://localhost:8080/eXoGadgets/locale/Todo/vi_ALL.xml" />
+ <Locale messages="locale/ALL_ALL.xml" />
+ <Locale lang="ar" messages="locale/ar_ALL.xml" language_direction="rtl"/>
+ <Locale lang="fr" messages="locale/fr_ALL.xml" />
+ <Locale lang="vi" messages="locale/vi_ALL.xml" />
<Require feature="setprefs"/>
</ModulePrefs>
<UserPref name="todoList" datatype="list"/>
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ALL_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ALL_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ALL_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ Save
+ </msg>
+ <msg name="type_here">
+ Type new task here
+ </msg>
+</messagebundle>
\ No newline at end of file
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ar_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ar_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ar_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ حفظ
+ </msg>
+ <msg name="type_here">
+ نوع المهمة الجديدة هنا
+ </msg>
+</messagebundle>
\ No newline at end of file
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/de_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/de_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/de_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ Speichern
+ </msg>
+ <msg name="type_here">
+ Hier neue Aufgabe eingeben
+ </msg>
+</messagebundle>
\ No newline at end of file
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/es_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/es_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/es_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ Guardar
+ </msg>
+ <msg name="type_here">
+ Introduce la nueva Tarea aquí
+ </msg>
+</messagebundle>
\ No newline at end of file
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/fr_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/fr_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/fr_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ Sauver
+ </msg>
+ <msg name="type_here">
+ Type de nouvelle tâche ici
+ </msg>
+</messagebundle>
\ No newline at end of file
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ja_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ja_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/ja_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ 保存
+ </msg>
+ <msg name="type_here">
+ 新しいタスクを入力してください。
+ </msg>
+</messagebundle>
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/kr_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/kr_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/kr_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ 저장
+ </msg>
+ <msg name="type_here">
+ 새로운 태스크를 입력하십시오
+ </msg>
+</messagebundle>
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/vi_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/vi_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/vi_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ Lưu
+ </msg>
+ <msg name="type_here">
+ Ghi chú công việc
+ </msg>
+</messagebundle>
\ No newline at end of file
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ 保存
+ </msg>
+ <msg name="type_here">
+ 在此增加新的任务
+ </msg>
+</messagebundle>
Added: portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_TW_ALL.xml
===================================================================
--- portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_TW_ALL.xml (rev 0)
+++ portal/branches/branch-GTNPORTAL-1872/gadgets/eXoGadgets/src/main/webapp/gadgets/Todo/locale/zh_TW_ALL.xml 2011-05-23 03:46:39 UTC (rev 6526)
@@ -0,0 +1,29 @@
+<!--
+
+ 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.
+
+-->
+
+<messagebundle>
+ <msg name="save">
+ Save
+ </msg>
+ <msg name="type_here">
+ Type new task here
+ </msg>
+</messagebundle>
\ No newline at end of file
13 years, 7 months
gatein SVN: r6525 - in portal/branches/stax-integration/component/portal/src: test/java/org/exoplatform/portal/stax and 1 other directories.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-05-22 19:14:08 -0400 (Sun, 22 May 2011)
New Revision: 6525
Added:
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java
portal/branches/stax-integration/component/portal/src/test/resources/stax/gadget-application.xml
portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application1.xml
portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application2.xml
portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-preferences.xml
Removed:
portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application.xml
Modified:
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParser.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PageStAXParser.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java
portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingContainer.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingGadgetWindow.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java
portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java
portal/branches/stax-integration/component/portal/src/test/resources/stax/container.xml
Log:
GTNPORTAL-1905: Commit GateIn object StAX parser and JUnit tests
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParser.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/AbstractStAXParser.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -55,7 +55,7 @@
}
else if(isOptional(staxElement))
{
- return "";
+ return null;
}
else
{
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/ContainerStAXParser.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -20,6 +20,7 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.pom.config.Utils;
import org.staxnav.StaxNavException;
import org.staxnav.StaxNavigator;
import java.util.HashSet;
@@ -48,13 +49,14 @@
container.setTemplate(templateName);
}
+ container.setId(elementNavigator.getAttribute("id"));
container.setDecorator(elementNavigator.getAttribute("decorator"));
container.setWidth(elementNavigator.getAttribute("width"));
container.setHeight(elementNavigator.getAttribute("height"));
container.setTitle(getContent(elementNavigator, StAXElement.title));
container.setIcon(getContent(elementNavigator, StAXElement.icon));
- container.setAccessPermissions(getContent(elementNavigator, StAXElement.access_permissions).split(","));
+ container.setAccessPermissions(Utils.split(";", getContent(elementNavigator, StAXElement.access_permissions)));
container.setFactoryId(getContent(elementNavigator, StAXElement.factory_id));
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PageStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PageStAXParser.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PageStAXParser.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -20,6 +20,7 @@
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.pom.config.Utils;
import org.staxnav.StaxNavException;
import org.staxnav.StaxNavigator;
import java.util.ArrayList;
@@ -46,19 +47,8 @@
page.setName(getContent(elementNavigator, StAXElement.name));
page.setTitle(getContent(elementNavigator, StAXElement.title));
-
- String factoryID = getContent(elementNavigator, StAXElement.factory_id);
- if(factoryID.length() > 0)
- {
- page.setFactoryId(factoryID);
- }
-
- String accessPermissions = getContent(elementNavigator, StAXElement.access_permissions);
- if(accessPermissions.length() > 0)
- {
- page.setAccessPermissions(accessPermissions.split(","));
- }
-
+ page.setFactoryId(getContent(elementNavigator, StAXElement.factory_id));
+ page.setAccessPermissions(Utils.split(";", getContent(elementNavigator, StAXElement.access_permissions)));
page.setEditPermission(getContent(elementNavigator, StAXElement.edit_permission));
page.setShowMaxWindow("true".equals(getContent(elementNavigator, StAXElement.show_max_window)));
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortalConfigStAXParser.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -21,6 +21,7 @@
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.Properties;
+import org.exoplatform.portal.pom.config.Utils;
import org.staxnav.StaxNavException;
import org.staxnav.StaxNavigator;
import java.util.HashSet;
@@ -45,7 +46,7 @@
portalConfig.setName(getContent(elementNavigator, StAXElement.portal_name));
portalConfig.setLocale(getContent(elementNavigator, StAXElement.locale));
- portalConfig.setAccessPermissions(getContent(elementNavigator, StAXElement.access_permissions).split(","));
+ portalConfig.setAccessPermissions(Utils.split(";", getContent(elementNavigator, StAXElement.access_permissions)));
portalConfig.setEditPermission(getContent(elementNavigator, StAXElement.edit_permission));
if(elementNavigator.next(StAXElement.properties))
Modified: portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/main/java/org/exoplatform/portal/config/stax/PortletWindowStAXParser.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -21,11 +21,17 @@
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.serialize.PortletApplication;
+import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
+import org.omg.CORBA.NamedValue;
import org.staxnav.StaxNavException;
import org.staxnav.StaxNavigator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
/**
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/9/11
@@ -55,10 +61,24 @@
while(elementNavigator.next(StAXElement.preference))
{
String preferenceName = getContent(elementNavigator, StAXElement.name);
- String preferenceValue = getContent(elementNavigator, StAXElement.value);
+ List<String> preferenceValues = new ArrayList<String>();
+ while (elementNavigator.sibling(StAXElement.value))
+ {
+ String content = elementNavigator.getContent();
+ if (content != null)
+ {
+ preferenceValues.add(content);
+ }
+ }
boolean readOnly = "true".equals(getContent(elementNavigator, StAXElement.read_only));
-
- builder.add(preferenceName, preferenceValue, readOnly);
+ if (preferenceValues.isEmpty())
+ {
+ builder.add(preferenceName, (String) null, readOnly);
+ }
+ else
+ {
+ builder.add(preferenceName, preferenceValues, readOnly);
+ }
}
state = new TransientApplicationState<Portlet>(applicationName + "/" + portletName, builder.build());
@@ -71,12 +91,12 @@
Application<Portlet> application = Application.createPortletApplication();
application.setState(state);
+ application.setTheme(getContent(elementNavigator, StAXElement.theme));
application.setTitle(getContent(elementNavigator, StAXElement.title));
- application.setTheme(getContent(elementNavigator, StAXElement.theme));
- application.setAccessPermissions(getContent(elementNavigator, StAXElement.access_permissions).split(","));
+ application.setAccessPermissions(Utils.split(";", getContent(elementNavigator, StAXElement.access_permissions)));
application.setShowInfoBar("true".equals(getContent(elementNavigator, StAXElement.show_info_bar)));
application.setShowApplicationState("true".equals(getContent(elementNavigator, StAXElement.show_application_state)));
- application.setShowApplicationMode("true".equals(getContent(elementNavigator, StAXElement.show_application_state)));
+ application.setShowApplicationMode("true".equals(getContent(elementNavigator, StAXElement.show_application_mode)));
application.setDescription(getContent(elementNavigator, StAXElement.description));
application.setIcon(getContent(elementNavigator, StAXElement.icon));
application.setWidth(getContent(elementNavigator, StAXElement.width));
@@ -93,10 +113,12 @@
case preferences:
case theme:
case show_application_state:
+ case show_application_mode:
case description:
case icon:
case width:
case height:
+ case value:
case read_only:
case title:
return true;
Added: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java (rev 0)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/AbstractStaxTestCase.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -0,0 +1,33 @@
+package org.exoplatform.portal.stax;
+
+import junit.framework.TestCase;
+import org.exoplatform.portal.config.stax.StAXElement;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavigator;
+import org.staxnav.StaxNavigatorImpl;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
+ * @version $Revision$
+ */
+public class AbstractStaxTestCase extends TestCase
+{
+ protected StaxNavigator<StAXElement> createNavigator(String resource) throws RuntimeException
+ {
+ try
+ {
+ InputStream in = getClass().getResourceAsStream(resource);
+ XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(in);
+
+ return new StaxNavigatorImpl<StAXElement>(new Naming.Enumerated.Simple<StAXElement>(StAXElement.class, StAXElement.NO_SUCH_ELEMENT), streamReader);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingContainer.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingContainer.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingContainer.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -18,54 +18,51 @@
*/
package org.exoplatform.portal.stax;
-import junit.framework.TestCase;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.stax.ContainerStAXParser;
import org.exoplatform.portal.config.stax.StAXElement;
-import org.staxnav.Naming;
import org.staxnav.StaxNavigator;
-import org.staxnav.StaxNavigatorImpl;
-import java.io.InputStream;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
/**
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/20/11
*/
-public class TestParsingContainer extends TestCase
+public class TestParsingContainer extends AbstractStaxTestCase
{
- private StaxNavigator<StAXElement> elementNavigator;
-
- protected void setUp() throws Exception
- {
- InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("./stax/container.xml");
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- XMLStreamReader streamReader = inputFactory.createXMLStreamReader(in);
- elementNavigator = new StaxNavigatorImpl<StAXElement>(new Naming.Enumerated.Simple(StAXElement.class, StAXElement.NO_SUCH_ELEMENT), streamReader);
- }
-
public void testContainer()
{
+ StaxNavigator<StAXElement> elementNavigator = createNavigator("/stax/container.xml");
+
ContainerStAXParser containerParser = new ContainerStAXParser(elementNavigator);
Container rootContainer = containerParser.parseXML();
+ assertEquals("root", rootContainer.getId());
assertEquals(4, rootContainer.getChildren().size());
Container firstChild = (Container)rootContainer.getChildren().get(0);
assertEquals("system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl", firstChild.getTemplate());
+ assertEquals("c0", firstChild.getId());
+ int j = 1;
for(ModelObject descendant : firstChild.getChildren())
{
assertEquals("system:/groovy/portal/webui/container/UIContainer.gtmpl", ((Container)descendant).getTemplate());
+ assertEquals("c0-" + j++, ((Container)descendant).getId());
}
for(int i = 1; i < 4; i++)
{
- assertEquals("system:/groovy/portal/webui/container/UIContainer" + i + ".gtmpl", ((Container)rootContainer.getChildren().get(i)).getTemplate());
+ Container container = (Container) rootContainer.getChildren().get(i);
+ assertEquals("system:/groovy/portal/webui/container/UIContainer" + i + ".gtmpl", container.getTemplate());
+ assertEquals("c" + i, container.getId());
+ String[] ap = container.getAccessPermissions();
+ assertEquals(i, ap.length);
+ for (j=0; j<ap.length; j++)
+ {
+ assertEquals("*:/platform/administrators" + j, ap[j]);
+ }
}
}
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingGadgetWindow.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingGadgetWindow.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingGadgetWindow.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -19,11 +19,22 @@
package org.exoplatform.portal.stax;
import junit.framework.TestCase;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.config.stax.GadgetWindowStAXParer;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
/**
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/20/11
*/
-public class TestParsingGadgetWindow extends TestCase
+public class TestParsingGadgetWindow extends AbstractStaxTestCase
{
+ public void testGadget() throws Exception
+ {
+ GadgetWindowStAXParer parser = new GadgetWindowStAXParer(createNavigator("/stax/gadget-application.xml"));
+ Application<Gadget> gadget = parser.parseXML();
+ assertNotNull(gadget);
+ assertEquals("Calendar", ((TransientApplicationState<Gadget>) gadget.getState()).getContentId());
+ }
}
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPage.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -18,51 +18,36 @@
*/
package org.exoplatform.portal.stax;
-import junit.framework.TestCase;
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.ModelObject;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.stax.PageStAXParser;
-import org.exoplatform.portal.config.stax.StAXElement;
-import org.staxnav.Naming;
-import org.staxnav.StaxNavigator;
-import org.staxnav.StaxNavigatorImpl;
-import java.io.InputStream;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.Preference;
/**
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/11/11
*/
-public class TestParsingPage extends TestCase
+public class TestParsingPage extends AbstractStaxTestCase
{
- private StaxNavigator<StAXElement> pageMetadata;
-
- protected void setUp() throws Exception
- {
- InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("./stax/test-page.xml");
- XMLInputFactory factory = XMLInputFactory.newInstance();
-
- XMLStreamReader streamReader = factory.createXMLStreamReader(in);
-
- pageMetadata = new StaxNavigatorImpl<StAXElement>(new Naming.Enumerated.Simple<StAXElement>(StAXElement.class, StAXElement.NO_SUCH_ELEMENT), streamReader);
- }
-
public void testConvertXML() throws Exception
{
- PageStAXParser pageStAXParser = new PageStAXParser(pageMetadata);
+ PageStAXParser pageStAXParser = new PageStAXParser(createNavigator("/stax/test-page.xml"));
Page page = pageStAXParser.parseXML();
assertNotNull(page);
assertEquals("homepage", page.getName());
assertEquals("Home Page", page.getTitle());
-
- Application application = (Application)page.getChildren().get(0);
-
- assertEquals(ApplicationType.PORTLET, application.getType());
- assertEquals("Home Page portlet", application.getTitle());
+ assertEquals("Everyone", Utils.join(";", page.getAccessPermissions()));
+ assertEquals("*:/platform/administrators", page.getEditPermission());
+ assertNotNull(page.getChildren());
+ assertEquals(1, page.getChildren().size());
}
}
Modified: portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/test/java/org/exoplatform/portal/stax/TestParsingPortletWindow.java 2011-05-22 23:14:08 UTC (rev 6525)
@@ -18,36 +18,111 @@
*/
package org.exoplatform.portal.stax;
-import junit.framework.TestCase;
-import org.exoplatform.portal.config.stax.StAXElement;
-import org.staxnav.Naming;
-import org.staxnav.StaxNavigator;
-import org.staxnav.StaxNavigatorImpl;
-import java.io.InputStream;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
+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.TransientApplicationState;
+import org.exoplatform.portal.config.stax.PortletWindowStAXParser;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.Preference;
+import java.util.Arrays;
+import java.util.List;
+
/**
* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
* @date 5/20/11
*/
-public class TestParsingPortletWindow extends TestCase
+public class TestParsingPortletWindow extends AbstractStaxTestCase
{
- private StaxNavigator<StAXElement> elementNavigator;
+ public void testPortletApplication1()
+ {
+ PortletWindowStAXParser parser = new PortletWindowStAXParser(createNavigator("/stax/portlet-application1.xml"));
+ Application<Portlet> application = parser.parseXML();
- protected void setUp() throws Exception
+ assertNotNull(application);
+ assertEquals(ApplicationType.PORTLET, application.getType());
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/HomePagePortlet", tas.getContentId());
+
+ assertNull(application.getTheme());
+ assertEquals("Home Page portlet", application.getTitle());
+ assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
+ assertFalse(application.getShowInfoBar());
+ assertFalse(application.getShowApplicationState());
+ assertFalse(application.getShowApplicationMode());
+ assertNull(application.getDescription());
+ assertNull(application.getIcon());
+ assertNull(application.getWidth());
+ assertNull(application.getHeight());
+ }
+
+ public void testPortletApplication2()
{
- InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("./stax/portlet-application.xml");
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ PortletWindowStAXParser parser = new PortletWindowStAXParser(createNavigator("/stax/portlet-application2.xml"));
+ Application<Portlet> application = parser.parseXML();
- XMLStreamReader streamReader = inputFactory.createXMLStreamReader(in);
- elementNavigator = new StaxNavigatorImpl<StAXElement>(new Naming.Enumerated.Simple(StAXElement.class, StAXElement.NO_SUCH_ELEMENT), streamReader);
+ assertNotNull(application);
+ assertEquals(ApplicationType.PORTLET, application.getType());
+ assertTrue(application.getType() == ApplicationType.PORTLET);
+ ApplicationState<Portlet> state = application.getState();
+ assertNotNull(state);
+ assertTrue(state instanceof TransientApplicationState);
+ TransientApplicationState<Portlet> tas = (TransientApplicationState<Portlet>) state;
+ assertEquals("web/HomePagePortlet", tas.getContentId());
+
+ assertEquals("Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme", application.getTheme());
+ assertEquals("Home Page portlet", application.getTitle());
+ assertEquals("Everyone", Utils.join(";", application.getAccessPermissions()));
+ assertTrue(application.getShowInfoBar());
+ assertTrue(application.getShowApplicationState());
+ assertTrue(application.getShowApplicationMode());
+ assertEquals("Home Page", application.getDescription());
+ assertEquals("PortletIcon", application.getIcon());
+ assertEquals("300px", application.getWidth());
+ assertEquals("200px", application.getHeight());
}
- public void testPortletApplication()
+ public void testPreferences()
{
+ PortletWindowStAXParser parser = new PortletWindowStAXParser(createNavigator("/stax/portlet-preferences.xml"));
+ Application<Portlet> application = parser.parseXML();
+ TransientApplicationState<Portlet> state = (TransientApplicationState<Portlet>) application.getState();
+ Portlet portlet = state.getContentState();
+ int count = 0;
+ for (Preference preference : portlet)
+ {
+ count++;
+ }
+ assertEquals(4, count);
+ assertPreference(portlet, "single-value", "value1");
+ assertPreference(portlet, "multi-value", "multi-value1", "multi-value2", "multi-value3");
+ assertPreference(portlet, "empty-value", null);
+ assertPreference(portlet, "no-value", null);
+ }
+ private void assertPreference(Portlet portlet, String name, String...values)
+ {
+ assertNotNull(portlet.getPreference(name));
+ if (values == null)
+ {
+ assertNull(portlet.getValue(name));
+ }
+ else if (values.length == 1)
+ {
+ assertEquals(values[0], portlet.getValue(name));
+ }
+ else if (values.length > 0)
+ {
+ List<String> list = Arrays.asList(values);
+ assertEquals(list, portlet.getValues(name));
+ }
}
}
Modified: portal/branches/stax-integration/component/portal/src/test/resources/stax/container.xml
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/container.xml 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/container.xml 2011-05-22 23:14:08 UTC (rev 6525)
@@ -19,25 +19,25 @@
02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<container>
-<container template='system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl'>
- <access-permissions>Everyone</access-permissions>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
- <access-permissions>Everyone</access-permissions>
- </container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
- <access-permissions>Everyone</access-permissions>
- </container>
-</container>
+<container id="root">
+ <container id="c0" template='system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ <container id="c0-1" template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container id="c0-2" template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ </container>
-<container template="system:/groovy/portal/webui/container/UIContainer1.gtmpl">
- <access-permissions>Everyone</access-permissions>
+ <container id="c1" template="system:/groovy/portal/webui/container/UIContainer1.gtmpl">
+ <access-permissions>*:/platform/administrators0</access-permissions>
+ </container>
+ <container id="c2" template="system:/groovy/portal/webui/container/UIContainer2.gtmpl">
+ <access-permissions>*:/platform/administrators0;*:/platform/administrators1</access-permissions>
+ </container>
+ <container id="c3" template="system:/groovy/portal/webui/container/UIContainer3.gtmpl">
+ <access-permissions>*:/platform/administrators0;*:/platform/administrators1;*:/platform/administrators2</access-permissions>
+ </container>
</container>
-<container template="system:/groovy/portal/webui/container/UIContainer2.gtmpl">
- <access-permissions>Everyone</access-permissions>
-</container>
-<container template="system:/groovy/portal/webui/container/UIContainer3.gtmpl">
- <access-permissions>Everyone</access-permissions>
-</container>
-</container>
Added: portal/branches/stax-integration/component/portal/src/test/resources/stax/gadget-application.xml
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/gadget-application.xml (rev 0)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/gadget-application.xml 2011-05-22 23:14:08 UTC (rev 6525)
@@ -0,0 +1,32 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<gadget-application>
+ <gadget>
+ <gadget-ref>Calendar</gadget-ref>
+ </gadget>
+ <title>Calendar Title</title>
+ <access-permissions>*:/platform/administrators;*:/organization/management/executive-board</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>false</show-application-state>
+ <show-application-mode>false</show-application-mode>
+</gadget-application>
\ No newline at end of file
Deleted: portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application.xml
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application.xml 2011-05-22 20:38:54 UTC (rev 6524)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application.xml 2011-05-22 23:14:08 UTC (rev 6525)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- 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.
-
--->
-
-<portlet-application>
- <portlet>
- <application-ref>web</application-ref>
- <portlet-ref>HomePagePortlet</portlet-ref>
- <preferences>
- <preference>
- <name>template</name>
- <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
- <read-only>false</read-only>
- </preference>
- </preferences>
- </portlet>
- <title>Home Page portlet</title>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>false</show-info-bar>
- <show-application-state>false</show-application-state>
- <show-application-mode>false</show-application-mode>
-</portlet-application>
-
-
Copied: portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application1.xml (from rev 6521, portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application.xml)
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application1.xml (rev 0)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application1.xml 2011-05-22 23:14:08 UTC (rev 6525)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+
+<portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>HomePagePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
+ </portlet>
+ <title>Home Page portlet</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>false</show-info-bar>
+ <show-application-state>false</show-application-state>
+ <show-application-mode>false</show-application-mode>
+</portlet-application>
+
+
Added: portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application2.xml
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application2.xml (rev 0)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-application2.xml 2011-05-22 23:14:08 UTC (rev 6525)
@@ -0,0 +1,45 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file 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.
+ -->
+
+<portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>HomePagePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>template</name>
+ <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
+ </portlet>
+ <theme>Vista:VistaTheme::Mac:MacTheme::Default:DefaultTheme</theme>
+ <title>Home Page portlet</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>true</show-application-mode>
+ <description>Home Page</description>
+ <icon>PortletIcon</icon>
+ <width>300px</width>
+ <height>200px</height>
+</portlet-application>
\ No newline at end of file
Added: portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-preferences.xml
===================================================================
--- portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-preferences.xml (rev 0)
+++ portal/branches/stax-integration/component/portal/src/test/resources/stax/portlet-preferences.xml 2011-05-22 23:14:08 UTC (rev 6525)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+
+<portlet-application>
+ <portlet>
+ <application-ref>web</application-ref>
+ <portlet-ref>HomePagePortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>single-value</name>
+ <value>value1</value>
+ </preference>
+ <preference>
+ <name>multi-value</name>
+ <value>multi-value1</value>
+ <value>multi-value2</value>
+ <value>multi-value3</value>
+ </preference>
+ <preference>
+ <name>empty-value</name>
+ <value></value>
+ </preference>
+ <preference>
+ <name>no-value</name>
+ </preference>
+ </preferences>
+ </portlet>
+ <theme>Mac:MacTheme::Default:DefaultTheme::Vista:VistaTheme</theme>
+ <title>Home Page portlet</title>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ <show-application-state>true</show-application-state>
+ <show-application-mode>true</show-application-mode>
+</portlet-application>
+
+
13 years, 7 months
gatein SVN: r6524 - in components/mop/branches/1.0.x: api and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2011-05-22 16:38:54 -0400 (Sun, 22 May 2011)
New Revision: 6524
Modified:
components/mop/branches/1.0.x/api/pom.xml
components/mop/branches/1.0.x/core/pom.xml
components/mop/branches/1.0.x/pom.xml
components/mop/branches/1.0.x/spi/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: components/mop/branches/1.0.x/api/pom.xml
===================================================================
--- components/mop/branches/1.0.x/api/pom.xml 2011-05-22 20:38:43 UTC (rev 6523)
+++ components/mop/branches/1.0.x/api/pom.xml 2011-05-22 20:38:54 UTC (rev 6524)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA</version>
+ <version>1.0.8-GA-SNAPSHOT</version>
</parent>
<!-- ****************** -->
Modified: components/mop/branches/1.0.x/core/pom.xml
===================================================================
--- components/mop/branches/1.0.x/core/pom.xml 2011-05-22 20:38:43 UTC (rev 6523)
+++ components/mop/branches/1.0.x/core/pom.xml 2011-05-22 20:38:54 UTC (rev 6524)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA</version>
+ <version>1.0.8-GA-SNAPSHOT</version>
</parent>
<!-- ****************** -->
Modified: components/mop/branches/1.0.x/pom.xml
===================================================================
--- components/mop/branches/1.0.x/pom.xml 2011-05-22 20:38:43 UTC (rev 6523)
+++ components/mop/branches/1.0.x/pom.xml 2011-05-22 20:38:54 UTC (rev 6524)
@@ -34,16 +34,16 @@
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA</version>
+ <version>1.0.8-GA-SNAPSHOT</version>
<packaging>pom</packaging>
<name>GateIn - MOP</name>
<description>Model Object for Portal</description>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/tags/1.0.7-GA</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/tags/1.0.7-GA</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/mop/tags/1.0.7-GA</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/branches/1.0.x/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/branches/1.0.x/</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/mop/branches/1.0.x/</url>
</scm>
<dependencyManagement>
Modified: components/mop/branches/1.0.x/spi/pom.xml
===================================================================
--- components/mop/branches/1.0.x/spi/pom.xml 2011-05-22 20:38:43 UTC (rev 6523)
+++ components/mop/branches/1.0.x/spi/pom.xml 2011-05-22 20:38:54 UTC (rev 6524)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA</version>
+ <version>1.0.8-GA-SNAPSHOT</version>
</parent>
<!-- ****************** -->
13 years, 7 months
gatein SVN: r6523 - components/mop/tags.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2011-05-22 16:38:43 -0400 (Sun, 22 May 2011)
New Revision: 6523
Added:
components/mop/tags/1.0.7-GA/
Log:
[maven-scm] copy for tag 1.0.7-GA
13 years, 7 months
gatein SVN: r6522 - in components/mop/branches/1.0.x: api and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2011-05-22 16:38:20 -0400 (Sun, 22 May 2011)
New Revision: 6522
Modified:
components/mop/branches/1.0.x/api/pom.xml
components/mop/branches/1.0.x/core/pom.xml
components/mop/branches/1.0.x/pom.xml
components/mop/branches/1.0.x/spi/pom.xml
Log:
[maven-release-plugin] prepare release 1.0.7-GA
Modified: components/mop/branches/1.0.x/api/pom.xml
===================================================================
--- components/mop/branches/1.0.x/api/pom.xml 2011-05-21 23:18:00 UTC (rev 6521)
+++ components/mop/branches/1.0.x/api/pom.xml 2011-05-22 20:38:20 UTC (rev 6522)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA-SNAPSHOT</version>
+ <version>1.0.7-GA</version>
</parent>
<!-- ****************** -->
Modified: components/mop/branches/1.0.x/core/pom.xml
===================================================================
--- components/mop/branches/1.0.x/core/pom.xml 2011-05-21 23:18:00 UTC (rev 6521)
+++ components/mop/branches/1.0.x/core/pom.xml 2011-05-22 20:38:20 UTC (rev 6522)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA-SNAPSHOT</version>
+ <version>1.0.7-GA</version>
</parent>
<!-- ****************** -->
Modified: components/mop/branches/1.0.x/pom.xml
===================================================================
--- components/mop/branches/1.0.x/pom.xml 2011-05-21 23:18:00 UTC (rev 6521)
+++ components/mop/branches/1.0.x/pom.xml 2011-05-22 20:38:20 UTC (rev 6522)
@@ -34,16 +34,16 @@
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA-SNAPSHOT</version>
+ <version>1.0.7-GA</version>
<packaging>pom</packaging>
<name>GateIn - MOP</name>
<description>Model Object for Portal</description>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/branches/1.0.x/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/branches/1.0.x/</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/mop/branches/1.0.x/</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/mop/tags/1.0.7-GA</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/mop/tags/1.0.7-GA</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/mop/tags/1.0.7-GA</url>
</scm>
<dependencyManagement>
Modified: components/mop/branches/1.0.x/spi/pom.xml
===================================================================
--- components/mop/branches/1.0.x/spi/pom.xml 2011-05-21 23:18:00 UTC (rev 6521)
+++ components/mop/branches/1.0.x/spi/pom.xml 2011-05-22 20:38:20 UTC (rev 6522)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-parent</artifactId>
- <version>1.0.7-GA-SNAPSHOT</version>
+ <version>1.0.7-GA</version>
</parent>
<!-- ****************** -->
13 years, 7 months
gatein SVN: r6521 - in components/mop/branches/1.0.x/core/src: test/java/org/gatein/mop/core/api/workspace and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2011-05-21 19:18:00 -0400 (Sat, 21 May 2011)
New Revision: 6521
Modified:
components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java
Log:
GTNMOP-39 : Preserve navigation index when renaming
Modified: components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
===================================================================
--- components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2011-05-21 23:07:50 UTC (rev 6520)
+++ components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2011-05-21 23:18:00 UTC (rev 6521)
@@ -88,10 +88,15 @@
public void setName(String name)
{
- // todo: change to setNodeName when it is fixed
- NavigationContainer parent = getParentContainer();
- Map<String, NavigationImpl> map = parent.getNavigationMap();
- map.put(name, this);
+ // Capture the current index
+ int index = getIndex();
+
+ // Rename (will change the index to the last / JCR move)
+ setNodeName(name);
+
+ // Set index back to original value
+ List<NavigationImpl> siblings = getParentContainer().getNavigationList();
+ siblings.add(index, this);
}
public int getIndex()
Modified: components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java
===================================================================
--- components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java 2011-05-21 23:07:50 UTC (rev 6520)
+++ components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java 2011-05-21 23:18:00 UTC (rev 6521)
@@ -72,8 +72,10 @@
Site portal = model.getWorkspace().addSite(ObjectType.PORTAL_SITE, "portal_for_navigation");
Navigation root = portal.getRootNavigation();
Navigation n1 = root.addChild("1");
+ Navigation n2 = root.addChild("2");
assertEquals("1", n1.getName());
- n1.setName("2");
- assertEquals("2", n1.getName());
+ n1.setName("3");
+ assertEquals("3", n1.getName());
+ assertEquals(0, n1.getIndex());
}
}
13 years, 7 months
gatein SVN: r6520 - in components/mop/branches/1.0.x: core/src/main/java/org/gatein/mop/core/api/workspace and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2011-05-21 19:07:50 -0400 (Sat, 21 May 2011)
New Revision: 6520
Modified:
components/mop/branches/1.0.x/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java
components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java
components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java
Log:
GTNMOP-38 : Navigation index method to ease client
Modified: components/mop/branches/1.0.x/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java
===================================================================
--- components/mop/branches/1.0.x/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java 2011-05-20 17:28:52 UTC (rev 6519)
+++ components/mop/branches/1.0.x/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java 2011-05-21 23:07:50 UTC (rev 6520)
@@ -49,6 +49,13 @@
void setName(String name);
/**
+ * Returns the index of this navigation.
+ *
+ * @return the navigation index
+ */
+ int getIndex();
+
+ /**
* Extends the object type to navigation.
*
* @return the object type
@@ -95,6 +102,19 @@
Navigation addChild(String name) throws NullPointerException, IllegalArgumentException;
/**
+ * Adds a child navigation that will be added to the specified position among the ordered children list. When
+ * the the index is not specified, the child is appended at the last position.
+ *
+ * @param index the child index
+ * @param name the child name
+ * @return the child navigation
+ * @throws NullPointerException when a null name is provided
+ * @throws IndexOutOfBoundsException if the index is out of bounds
+ * @throws IllegalArgumentException when an illegal name is provided
+ */
+ Navigation addChild(Integer index, String name) throws NullPointerException, IndexOutOfBoundsException, IllegalArgumentException;
+
+ /**
* Destroys this navigation.
*/
void destroy();
Modified: components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java
===================================================================
--- components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java 2011-05-20 17:28:52 UTC (rev 6519)
+++ components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationContainer.java 2011-05-21 23:07:50 UTC (rev 6520)
@@ -51,11 +51,19 @@
@Create
public abstract NavigationImpl createNavigation();
- public NavigationImpl addNavigation(String name)
+ public NavigationImpl addNavigation(Integer index, String name)
{
NavigationImpl page = createNavigation();
page.setNodeName(name);
- getNavigationList().add(page);
+ List<NavigationImpl> list = getNavigationList();
+ if (index != null)
+ {
+ list.add(index, page);
+ }
+ else
+ {
+ list.add(page);
+ }
return page;
}
}
\ No newline at end of file
Modified: components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
===================================================================
--- components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2011-05-20 17:28:52 UTC (rev 6519)
+++ components/mop/branches/1.0.x/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2011-05-21 23:07:50 UTC (rev 6520)
@@ -94,6 +94,19 @@
map.put(name, this);
}
+ public int getIndex()
+ {
+ NavigationImpl parent = getParent();
+ if (parent == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return parent.getChildren().indexOf(this);
+ }
+ }
+
public ObjectType<? extends Navigation> getObjectType()
{
return ObjectType.NAVIGATION;
@@ -131,12 +144,17 @@
return childrenContainer.getNavigationMap().get(name);
}
- public NavigationImpl addChild(String name)
+ public NavigationImpl addChild(Integer index, String name) throws NullPointerException, IndexOutOfBoundsException, IllegalArgumentException
{
NavigationContainer childrenContainer = getChildrenContainer();
- return childrenContainer.addNavigation(name);
+ return childrenContainer.addNavigation(index, name);
}
+ public NavigationImpl addChild(String name)
+ {
+ return addChild(null, name);
+ }
+
public <L extends Link> L linkTo(ObjectType<L> linkType)
{
setLink(null);
Modified: components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java
===================================================================
--- components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java 2011-05-20 17:28:52 UTC (rev 6519)
+++ components/mop/branches/1.0.x/core/src/test/java/org/gatein/mop/core/api/workspace/NavigationTestCase.java 2011-05-21 23:07:50 UTC (rev 6520)
@@ -32,14 +32,18 @@
*/
public class NavigationTestCase extends AbstractPOMTestCase
{
- public void testNavigationOrder()
+ public void testOrder()
{
ModelImpl model = pomService.getModel();
Site portal = model.getWorkspace().addSite(ObjectType.PORTAL_SITE, "portal_for_navigation");
Navigation root = portal.getRootNavigation();
+ assertEquals(0, root.getIndex());
Navigation n1 = root.addChild("1");
+ assertEquals(0, n1.getIndex());
Navigation n2 = root.addChild("2");
+ assertEquals(1, n2.getIndex());
Navigation n3 = root.addChild("3");
+ assertEquals(2, n3.getIndex());
List<? extends Navigation> ns = root.getChildren();
assertEquals(3, ns.size());
assertSame(n1, ns.get(0));
@@ -47,6 +51,21 @@
assertSame(n3, ns.get(2));
}
+ public void testIndexAdd()
+ {
+ ModelImpl model = pomService.getModel();
+ Site portal = model.getWorkspace().addSite(ObjectType.PORTAL_SITE, "portal_for_navigation");
+ Navigation root = portal.getRootNavigation();
+ Navigation n1 = root.addChild("1");
+ Navigation n3 = root.addChild("3");
+ Navigation n2 = root.addChild(1, "2");
+ List<? extends Navigation> ns = root.getChildren();
+ assertEquals(3, ns.size());
+ assertSame(n1, ns.get(0));
+ assertSame(n2, ns.get(1));
+ assertSame(n3, ns.get(2));
+ }
+
public void testSetName()
{
ModelImpl model = pomService.getModel();
13 years, 7 months