Author: julien(a)jboss.com
Date: 2006-11-30 17:53:29 -0500 (Thu, 30 Nov 2006)
New Revision: 5746
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java
Removed:
trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java
Modified:
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/core/src/resources/portal-core-sar/portal-aop.xml
Log:
minor improvements to portal objects :
- more complete javadoc
- introducer PortalContainer interface which is a container for portal objects
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/build.xml 2006-11-30 22:53:29 UTC (rev 5746)
@@ -246,10 +246,10 @@
<include
name="org/jboss/portal/core/aspects/server/TransactionInterceptor.class"/>
<include
name="org/jboss/portal/core/aspects/server/UserInterceptor$UserFinalizer.class"/>
<include
name="org/jboss/portal/core/aspects/portlet/TransactionInterceptor.class"/>
- <include
name="org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.class"/>
<include
name="org/jboss/portal/core/deployment/jboss/ObjectDeployment.class"/>
<include
name="org/jboss/portal/core/deployment/jboss/PortletAppDeployment.class"/>
<include
name="org/jboss/portal/core/impl/model/instance/PersistentInstanceContainer.class"/>
+ <include
name="org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.class"/>
<include
name="org/jboss/portal/core/impl/portlet/state/ProducerPortletInvoker.class"/>
<include
name="org/jboss/portal/core/hibernate/SessionFactoryBinder.class"/>
</aopc>
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -31,7 +31,7 @@
import org.jboss.portal.core.controller.command.SignOutCommand;
import org.jboss.portal.core.model.portal.command.ViewDashboardCommand;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -381,7 +381,7 @@
private static float getOrder(Object o)
{
- if (o instanceof Context)
+ if (o instanceof PortalContainer)
{
return 0;
}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -28,7 +28,6 @@
import org.jboss.portal.theme.PageRendition;
import org.jboss.portal.core.controller.command.response.SignOutResponse;
import org.jboss.portal.core.controller.command.response.StreamContentResponse;
-import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.Portal;
@@ -48,6 +47,8 @@
public class ClassicResponseHandler extends AbstractResponseHandler
{
+ private String defaultPortalPath = "default";
+
public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd,
Object response) throws IOException, ServletException, ServerException
{
ServerInvocation invocation = ctx.getServerInvocation();
@@ -70,7 +71,7 @@
if (location == null)
{
PortalObjectContainer portalObjectContainer =
ctx.getController().getPortalObjectContainer();
- Portal portal = portalObjectContainer.getContext().getDefaultPortal();
+ Portal portal = (Portal)portalObjectContainer.getObject(defaultPortalPath);
RenderPageCommand renderCmd = new RenderPageCommand(portal.getId());
boolean secure = invocation.getServerContext().getURLContext().getSecure();
URLContext urlContext = URLContext.newInstance(secure, false);
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -67,8 +67,8 @@
this.requestContext = new
AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(),
controllerContext.getServerInvocation().getServerContext().getClientResponse());
this.securityContext = new
AbstractSecurityContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
this.userContext = new
ControllerUserContext(controllerContext.getServerInvocation());
- this.portalContext = new
org.jboss.portal.core.model.portal.PortalContextImpl(portal);
- this.windowContext = new
org.jboss.portal.core.model.portal.WindowContextImpl(window);
+ this.portalContext = new
org.jboss.portal.core.model.portal.portlet.PortalContextImpl(portal);
+ this.windowContext = new
org.jboss.portal.core.model.portal.portlet.WindowContextImpl(window);
}
public PortletContextFactory(ControllerContext controllerContext)
Modified:
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -24,7 +24,6 @@
import org.jboss.deployment.DeploymentException;
import org.jboss.portal.common.transaction.TransactionManagerProvider;
-import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.server.deployment.PortalWebApp;
import org.jboss.portal.server.deployment.jboss.AbstractDeploymentFactory;
@@ -80,24 +79,4 @@
{
this.portalObjectContainer = portalObjectContainer;
}
-
- public void registerFactory()
- {
- createContextIfNotExist();
-
- //
- super.registerFactory();
- }
-
- public void createContextIfNotExist()
- {
- // Create context if not exist
- Context ctx = portalObjectContainer.getContext();
-
- //
- if (ctx == null)
- {
- portalObjectContainer.createContext();
- }
- }
}
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.impl.model.portal;
-import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
@@ -66,9 +65,9 @@
}
}
- public Context getContext()
+ public PortalObject getRootObject()
{
- return (Context)getObject("");
+ return getObject("");
}
public String getType()
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.impl.model.portal;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -31,7 +31,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class ContextImpl extends PortalObjectImpl implements Context
+public class ContextImpl extends PortalObjectImpl implements PortalContainer
{
public ContextImpl()
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -45,9 +45,6 @@
public class PersistentPortalObjectContainer extends AbstractPortalObjectContainer
{
- /** The query for lookup. */
- private static final String LOOKUP_QUERY = "from ObjectNode where
path=:path";
-
/** The query for lookup when the path is null. */
private static final String LOOKUP_QUERY_FOR_NULL_PATH = "from ObjectNode where
path=:path or path is null";
@@ -78,6 +75,9 @@
/** . */
protected boolean cacheNaturalId;
+ /** . */
+ protected String rootName;
+
public PersistentPortalObjectContainer()
{
ctx = new ContainerContext()
@@ -116,6 +116,16 @@
cache = new ConcurrentReaderHashMap();
}
+ public String getRootName()
+ {
+ return rootName;
+ }
+
+ public void setRootName(String rootName)
+ {
+ this.rootName = rootName;
+ }
+
public void flushNaturalIdCache()
{
cache.clear();
@@ -173,6 +183,9 @@
//
contextualizer.attach(sessionFactory);
+ // todo : move to use the ha singleton stuff
+ createRootIfNotExist();
+
// Add ourself as the authorization domain
if (authorizationDomainRegistry != null)
{
@@ -197,28 +210,13 @@
sessionFactory = null;
}
- /** @see PortalObjectContainer#getAuthorizationDomain() */
public AuthorizationDomain getAuthorizationDomain()
{
return this;
}
- public boolean createContext()
+ public boolean createRootIfNotExist() throws Exception
{
- try
- {
- return createContextIfNotExist();
- }
- catch (Exception e)
- {
- log.error("Was not able to create root context", e);
- return false;
- }
- }
-
- /** todo : use AOP for tx demarcation. */
- public boolean createContextIfNotExist() throws Exception
- {
log.debug("Detecting the existence of the portal object root context");
Session session = sessionFactory.getCurrentSession();
@@ -248,10 +246,6 @@
}
}
- //*******************************************************************
- // AuthorizationDomain interface methods
- //*******************************************************************
-
protected ObjectNode getObjectNode(String uri)
{
return getObjectNode(sessionFactory.getCurrentSession(), uri);
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -112,11 +112,6 @@
return objectNode.getPath();
}
- public PortalObjectContainer getContainer()
- {
- return objectNode.getContext().getContainer();
- }
-
public String getName()
{
return objectNode.getName();
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -30,7 +30,6 @@
* @version $Revision$
*/
public class TransientPortalObjectContainer extends AbstractPortalObjectContainer
-// implements AuthorizationDomain, DomainConfigurator, PermissionRepository,
PermissionFactory
{
/** . */
@@ -65,7 +64,7 @@
};
}
- public boolean createContext()
+ public boolean createRootObject()
{
if (root != null)
{
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java 2006-11-30
07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -25,7 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.XML;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.portlet.impl.jsr168.metadata.ModesMetaData;
@@ -79,13 +79,13 @@
public PortalObject create(PortalObject parent, BuildContext buildContext) throws
Exception
{
- if (!(parent instanceof Context))
+ if (!(parent instanceof PortalContainer))
{
throw new IllegalArgumentException("Not a context");
}
//
- Portal portal = ((Context)parent).createPortal(getName());
+ Portal portal = ((PortalContainer)parent).createPortal(getName());
//
configure(portal, buildContext);
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 2006-11-30
07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -1,49 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal;
-
-/**
- * Contains nodes of type portal.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface Context extends PortalObject
-{
- /** Return an existing portal. */
- Portal getPortal(String name);
-
- /**
- * Create a new portal.
- *
- * @throws DuplicatePortalObjectException
- * @throws IllegalArgumentException
- */
- Portal createPortal(String name) throws DuplicatePortalObjectException,
IllegalArgumentException;
-
- /**
- * Get the default portal of the context based on some criteria. For instance a shared
context get the portal with
- * the "default" name, for a private portal it gets the only portal owned by
the user.
- */
- Portal getDefaultPortal();
-}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -36,6 +36,9 @@
*/
public class DefaultPortalCommandFactory extends AbstractCommandFactory
{
+
+ private String defaultPortalPath = "default";
+
private CommandFactory nextFactory;
private PortalObjectContainer container;
@@ -65,12 +68,7 @@
ControllerCommand cmd = nextFactory.doMapping(invocation, portalContextPath,
portalRequestPath);
if (cmd == null)
{
- Context ctx = container.getContext();
- if (ctx == null)
- {
- throw new IllegalStateException("Default context does not exist");
- }
- Portal portal = ctx.getDefaultPortal();
+ Portal portal = (Portal)container.getObject(defaultPortalPath);
if (portal == null)
{
throw new IllegalStateException("Default portal does not exist");
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java 2006-11-30 07:43:40
UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java 2006-11-30 22:53:29
UTC (rev 5746)
@@ -23,22 +23,37 @@
package org.jboss.portal.core.model.portal;
/**
+ * A page contains window and is also a page container which can contain nested pages.
+ *
* @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
* @version $Revision$
*/
public interface Page extends PageContainer
{
- /** Return the portal containing this page. */
+ /**
+ * Return the portal containing this page.
+ *
+ * @return the portal for this page
+ */
Portal getPortal();
- /** Get an existing windows. */
- Window getWindow(String name);
+ /**
+ * Return a page window or null if the portal object does not exist or
+ * does not have the appropriate type.
+ *
+ * @param name the window name
+ * @return the specified page window
+ * @throws IllegalArgumentException if the name is null
+ */
+ Window getWindow(String name) throws IllegalArgumentException;
/**
* Create a new window.
*
- * @throws DuplicatePortalObjectException
- * @throws IllegalArgumentException
+ * @param name window name
+ * @return the created window
+ * @throws DuplicatePortalObjectException if a portal object with the specified name
already exist
+ * @throws IllegalArgumentException if the name is null
*/
Window createWindow(String name) throws DuplicatePortalObjectException,
IllegalArgumentException;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java 2006-11-30
07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -23,14 +23,28 @@
package org.jboss.portal.core.model.portal;
/**
+ * An interface which defines a page container.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public interface PageContainer extends PortalObject
{
- /** Return an existing page. */
- Page getPage(String name);
+ /**
+ * Return an existing page or null if the child does not exist or does not have the
right type.
+ *
+ * @return the specified page
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ Page getPage(String name) throws IllegalArgumentException;
- /** Create a new page. */
- Page createPage(String name) throws DuplicatePortalObjectException;
+ /**
+ * Create a new page in the scope of this container.
+ *
+ * @param name the name of the child page to create
+ * @return the create page
+ * @throws DuplicatePortalObjectException if an object with the specified name already
exist
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ Page createPage(String name) throws DuplicatePortalObjectException,
IllegalArgumentException;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java 2006-11-30 07:43:40
UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java 2006-11-30 22:53:29
UTC (rev 5746)
@@ -25,28 +25,31 @@
import java.util.Set;
/**
+ * Defines a logical portal.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public interface Portal extends PageContainer
{
- /** Return the window state provider of this portal. */
+ /**
+ * Return the window states supported by this portal.
+ *
+ * @return the supported window states by this portal
+ */
Set getSupportedWindowStates();
- /** Return the mode provider of this portal. */
+ /**
+ * Return the modes supported of this portal.
+ *
+ * @return the supported modes by this portal
+ */
Set getSupportedModes();
- /** Return an existing page. */
- Page getPage(String name);
-
/**
- * Create a new page.
+ * Return the default page of this portal.
*
- * @throws DuplicatePortalObjectException
- * @throws IllegalArgumentException
+ * @return the default page
*/
- Page createPage(String name) throws DuplicatePortalObjectException,
IllegalArgumentException;
-
- /** Return the default page. */
Page getDefaultPage();
}
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java (from
rev 5730, trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 2006-11-28
05:41:09 UTC (rev 5730)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal;
+
+/**
+ * Contains nodes of type portal.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface PortalContainer extends PortalObject
+{
+ /**
+ * Return an existing portal or null if such a child does not exist or does not have
+ * the right type.
+ *
+ * @param name the portal name
+ * @return the specified portal
+ * @throws IllegalArgumentException if the specified name is null
+ */
+ Portal getPortal(String name) throws IllegalArgumentException;
+
+ /**
+ * Create a new portal.
+ *
+ * @param name the portal name
+ * @return the newly created portal
+ * @throws DuplicatePortalObjectException if a child with the specified name already
exists
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ Portal createPortal(String name) throws DuplicatePortalObjectException,
IllegalArgumentException;
+
+ /**
+ * Returns the default portal.
+ *
+ * @return the default portal of that container
+ */
+ Portal getDefaultPortal();
+}
Property changes on:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal;
-
-import org.jboss.portal.portlet.spi.PortalContext;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalContextImpl implements PortalContext
-{
-
- /** . */
- protected Portal portal;
-
- public PortalContextImpl(Portal portal)
- {
- if (portal == null)
- {
- throw new IllegalStateException();
- }
- this.portal = portal;
- }
-
- public Set getWindowStates()
- {
- return portal.getSupportedWindowStates();
- }
-
- public Set getModes()
- {
- return portal.getSupportedModes();
- }
-
- public Map getProperties()
- {
- // This should be filtered somehow
- return portal.getDeclaredProperties();
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-11-30
07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -40,39 +40,51 @@
/** The default portal name. */
String DEFAULT_OBJECT_NAME = "default";
+ /** . */
int TYPE_CONTEXT = 0;
+
+ /** . */
int TYPE_PORTAL = 1;
+
+ /** . */
int TYPE_PAGE = 2;
+
+ /** . */
int TYPE_WINDOW = 3;
- /** Return the id in the scope of its container. */
+ /**
+ * Return the object id unique in the scope of its container.
+ *
+ * @return the object id
+ */
String getId();
- /** Return the container of this object. */
- PortalObjectContainer getContainer();
-
/**
- * A numerical type that discriminates the object.
+ * Returns the type of the object which is a value that discriminates the object
type.
*
* @return the object type.
*/
int getType();
/**
- * Return the name.
+ * Return the object name unique in the scope of its parent.
*
- * @return the name
+ * @return the object name
*/
String getName();
/**
- * Return the listener id.
+ * Returns the listener id or null if there is none.
*
* @return the listener
*/
String getListener();
- /** Set a listener id. */
+ /**
+ * Set a listener id.
+ *
+ * @param listener the listener id
+ */
void setListener(String listener);
/**
@@ -99,24 +111,48 @@
/**
* Destroy an existing child.
*
- * @param name
+ * @param name the child name
* @throws NoSuchPortalObjectException if the child does not exist
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException if the name argument is null
*/
void destroyChild(String name) throws NoSuchPortalObjectException,
IllegalArgumentException;
- /** Return a property of that object. */
- String getProperty(String name);
+ /**
+ * Return a property of that object.
+ *
+ * @return the property value
+ * @throws IllegalArgumentException if the name is null
+ */
+ String getProperty(String name) throws IllegalArgumentException;
- /** Returns a read only map that contains the object properties. */
+ /**
+ * Returns a read only map that contains the object properties.
+ *
+ * @return a map of the object properties
+ */
Map getProperties();
- /** Return a map that contains the object declared properties. */
- Map getDeclaredProperties();
+ /**
+ * Return a property declared on that object.
+ *
+ * @return the property value
+ * @throws IllegalArgumentException if the name is null
+ */
+ String getDeclaredProperty(String name) throws IllegalArgumentException;
- /** Return a property declared on that object. */
- String getDeclaredProperty(String name);
+ /**
+ * Update a property declared on that object.
+ *
+ * @param name the property name
+ * @param value the property value
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ void setDeclaredProperty(String name, String value) throws IllegalArgumentException;
- /** Update a property declared on that object. */
- void setDeclaredProperty(String name, String value);
+ /**
+ * Return a map that contains the object declared properties.
+ *
+ * @return a map of the properties declared by the object
+ */
+ Map getDeclaredProperties();
}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -61,7 +61,7 @@
{
public Object getRoot()
{
- return container.getContext();
+ return container.getRootObject();
}
public Object getChild(Object parent, String name)
@@ -93,7 +93,7 @@
Object target = null;
if (portalRequestPath.length() == 0)
{
- target = container.getContext();
+ target = container.getRootObject();
}
else
{
@@ -150,9 +150,9 @@
}
else
{
- if (target instanceof Context)
+ if (target instanceof PortalContainer)
{
- Context ctx = (Context)target;
+ PortalContainer ctx = (PortalContainer)target;
target = ctx.getDefaultPortal();
}
if (target instanceof Portal)
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -33,13 +33,6 @@
public interface PortalObjectContainer
{
/**
- * Create the root context
- *
- * @return true if the context was created
- */
- boolean createContext();
-
- /**
* Return a container object.
*
* @return the specified portal object
@@ -48,11 +41,11 @@
PortalObject getObject(String id) throws IllegalArgumentException;
/**
- * Return the root context of this container.
+ * Return the root object of this container.
*
- * @return the root context
+ * @return the root object
*/
- Context getContext();
+ PortalObject getRootObject();
/**
* Get the authorization domain.
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2006-11-30 07:43:40
UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2006-11-30 22:53:29
UTC (rev 5746)
@@ -23,16 +23,25 @@
package org.jboss.portal.core.model.portal;
/**
- * Represents a window, i.e the state of the ternary relationship a page has with
instances.
+ * Represents a window, i.e the state of the ternary relationship a page has with portlet
instances.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public interface Window extends PortalObject
{
- /** Return the instance ref. */
+ /**
+ * Return the instance reference.
+ *
+ * @return the instance reference
+ *
+ */
String getInstanceRef();
- /** Update the instance ref. */
+ /**
+ * Update the instance ref.
+ *
+ * @param instanceRef the instance ref
+ */
void setInstanceRef(String instanceRef);
}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -1,49 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal;
-
-import org.jboss.portal.portlet.spi.WindowContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class WindowContextImpl implements WindowContext
-{
-
- private final Window window;
-
- public WindowContextImpl(Window window)
- {
- if (window == null)
- {
- throw new IllegalArgumentException();
- }
- this.window = window;
- }
-
- public String getId()
- {
- return window.getId();
- }
-}
Copied:
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java
(from rev 5730,
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java 2006-11-28
05:41:09 UTC (rev 5730)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.portlet;
+
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.core.model.portal.Portal;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalContextImpl implements PortalContext
+{
+
+ /** . */
+ protected Portal portal;
+
+ public PortalContextImpl(Portal portal)
+ {
+ if (portal == null)
+ {
+ throw new IllegalStateException();
+ }
+ this.portal = portal;
+ }
+
+ public Set getWindowStates()
+ {
+ return portal.getSupportedWindowStates();
+ }
+
+ public Set getModes()
+ {
+ return portal.getSupportedModes();
+ }
+
+ public Map getProperties()
+ {
+ // This should be filtered somehow
+ return portal.getDeclaredProperties();
+ }
+}
Property changes on:
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied:
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java
(from rev 5730,
trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java 2006-11-28
05:41:09 UTC (rev 5730)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.portlet;
+
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.core.model.portal.Window;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class WindowContextImpl implements WindowContext
+{
+
+ private final Window window;
+
+ public WindowContextImpl(Window window)
+ {
+ if (window == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getId();
+ }
+}
Property changes on:
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -57,6 +57,11 @@
*/
public class Configurator extends JBossPortlet
{
+
+ private static final int MOVE_UP = 0;
+
+ private static final int MOVE_DOWN = 1;
+
private Logger log = Logger.getLogger(Configurator.class);
private InstanceContainer instanceContainer;
@@ -65,9 +70,6 @@
private LayoutService layoutService;
- private static final int MOVE_UP = 0;
- private static final int MOVE_DOWN = 1;
-
public void init()
throws PortletException
{
@@ -107,32 +109,53 @@
if (req.getParameter("editPageSelect") != null)
{
String editPageSelect = req.getParameter("editPageSelect");
- page =
portalObjectContainer.getContext().getPortal("dashboard").getPage(editPageSelect);
+ page =
(Page)portalObjectContainer.getObject("dashboard").getChild(editPageSelect);
}
else
{
- page =
portalObjectContainer.getContext().getPortal("dashboard").getPage(req.getUser().getUserName());
+ page =
(Page)portalObjectContainer.getObject("dashboard").getChild(req.getUser().getUserName());
}
List available_instances = (List)instanceContainer.getInstances();
+ List left_instances = new ArrayList();
+ List center_instances = new ArrayList();
+ List right_instances = new ArrayList();
- resp.setContentType("text/html");
try
{
Map windowMap = getWindows(page);
-
List regions = new ArrayList(windowMap.keySet());
Collections.sort(regions);
- req.setAttribute("windowMap", windowMap);
- req.setAttribute("regions", regions);
+ for (Iterator i = regions.iterator(); i.hasNext();)
+ {
+ String region = (String)i.next();
+
+ TreeSet windows = (TreeSet)windowMap.get(region);
+ for (Iterator j = windows.iterator(); j.hasNext();)
+ {
+ Window window = (Window)j.next();
+ if (region.equals("left"))
+ {
+ left_instances.add(window);
+ //System.out.println(window.getInstanceRef() + ":" +
window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER));
+ }
+ else if (region.equals("center"))
+ {
+ center_instances.add(window);
+ }
+ else if (region.equals("right"))
+ {
+ right_instances.add(window);
+ }
+ }
+ }
}
catch (Exception e)
{
e.printStackTrace();
}
- // page select box
List pages = new ArrayList();
for (Iterator j = page.getPortal().getChildren().iterator(); j.hasNext();)
{
@@ -143,10 +166,13 @@
}
}
+ resp.setContentType("text/html");
req.setAttribute("available_instances", available_instances);
+ req.setAttribute("left_instances", left_instances);
+ req.setAttribute("center_instances", center_instances);
+ req.setAttribute("right_instances", right_instances);
req.setAttribute("pages", pages);
req.setAttribute("currentPage", page.getName());
-
PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/dashboard/editpage.jsp");
rd.include(req, resp);
}
@@ -164,7 +190,7 @@
String toRegion = actionRequest.getParameter("toRegion");
String[] copyInstance =
actionRequest.getParameterValues("available_instances");
- Page page =
portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
+ Page page =
(Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
try
{
for (int i = 0; i < copyInstance.length; i++)
@@ -191,26 +217,20 @@
{
String fromRegion = actionRequest.getParameter("fromRegion");
String[] removeWindows = null;
-
- Page page =
portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
- try
+ if ("left".equals(fromRegion))
{
- Map windowMap = getWindows(page);
- List regions = new ArrayList(windowMap.keySet());
- for (int i = 0; i < regions.size(); i++)
- {
- String region = (String)regions.get(i);
- if (region.equalsIgnoreCase(fromRegion))
- {
- removeWindows = actionRequest.getParameterValues(region +
"_instances");
- }
- }
+ removeWindows =
actionRequest.getParameterValues("left_instances");
}
- catch (Exception e)
+ else if ("center".equals(fromRegion))
{
- // todo
+ removeWindows =
actionRequest.getParameterValues("center_instances");
}
+ else if ("right".equals(fromRegion))
+ {
+ removeWindows =
actionRequest.getParameterValues("right_instances");
+ }
+ Page page =
(Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
try
{
for (int i = 0; i < removeWindows.length; i++)
@@ -228,51 +248,40 @@
{
String sortRegion = actionRequest.getParameter("sortRegion");
String[] moveWindows = null;
+ if ("left".equals(sortRegion))
+ {
+ moveWindows = actionRequest.getParameterValues("left_instances");
+ }
+ else if ("center".equals(sortRegion))
+ {
+ moveWindows =
actionRequest.getParameterValues("center_instances");
+ }
+ else if ("right".equals(sortRegion))
+ {
+ moveWindows = actionRequest.getParameterValues("right_instances");
+ }
- Page page =
portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
- try
+ Page page =
(Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
+ for (int i = 0; i < moveWindows.length; i++)
{
- Map windowMap = getWindows(page);
- List regions = new ArrayList(windowMap.keySet());
- for (int i = 0; i < regions.size(); i++)
+ Window window = page.getWindow(moveWindows[i]);
+ if ("up".equals(op))
{
- String region = (String)regions.get(i);
- if (region.equalsIgnoreCase(sortRegion))
- {
- moveWindows = actionRequest.getParameterValues(region +
"_instances");
- }
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER,
Integer.toString(getOrder(window) - 1));
}
-
- SortedSet windows = (SortedSet)windowMap.get(sortRegion);
-
- for (int i = 0; i < moveWindows.length; i++)
+ else if ("down".equals(op))
{
- Window window = page.getWindow(moveWindows[i]);
- if ("up".equals(op))
- {
- int order = getMoveUpOrder(window, windows);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER,
Integer.toString(order));
- }
- else if ("down".equals(op))
- {
- int order = getMoveDownOrder(window, windows);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER,
Integer.toString(order));
- }
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER,
Integer.toString(getOrder(window) + 1));
}
}
- catch (Exception e)
- {
- // todo
- }
-
actionResponse.setRenderParameter("editPageSelect", editPage);
}
else if ("newpage".equals(op))
{
String pageName = actionRequest.getParameter("pagename");
- Page page =
portalObjectContainer.getContext().getPortal("dashboard").getPage(actionRequest.getUser().getUserName());
- PageContainer pageContainer = (PageContainer)page.getPortal();
+ Page page =
(Page)portalObjectContainer.getObject("dashboard").getChild(actionRequest.getUser().getUserName());
+ PageContainer pageContainer = page.getPortal();
try
{
@@ -357,50 +366,4 @@
return Integer.MAX_VALUE;
}
}
-
- private static int getMoveUpOrder(Window window, SortedSet set)
- {
- Window previous = null;
- for (Iterator i = set.iterator(); i.hasNext();)
- {
- Window current = (Window)i.next();
-
- if (current.getName().equalsIgnoreCase(window.getName()))
- {
- if (previous == null)
- {
- return getOrder(current);
- }
- else
- {
- return (getOrder(previous) - 1);
- }
- }
- previous = current;
- }
- return 0;
- }
-
- private int getMoveDownOrder(Window window, SortedSet set)
- {
- for (Iterator i = set.iterator(); i.hasNext();)
- {
- Window current = (Window)i.next();
-
- if (current.getName().equalsIgnoreCase(window.getName()))
- {
- Window next = (Window)i.next();
-
- if (next == null)
- {
- return getOrder(current);
- }
- else
- {
- return (getOrder(next) + 1);
- }
- }
- }
- return 0;
- }
}
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -23,7 +23,7 @@
package org.jboss.portal.core.portlet.management;
import org.apache.myfaces.custom.tree2.TreeNode;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -155,7 +155,7 @@
private static int getOrder(Object o)
{
- if (o instanceof Context)
+ if (o instanceof PortalContainer)
{
return 0;
}
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -35,7 +35,6 @@
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
@@ -413,8 +412,8 @@
public TreeNode getTreeData()
{
- Context context = portalObjectContainer.getContext();
- return new LazyPortalObjectTreeNode(context);
+ PortalObject root = portalObjectContainer.getRootObject();
+ return new LazyPortalObjectTreeNode(root);
}
public SelectItem[] getInstanceItems()
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -24,7 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -135,8 +135,8 @@
{
try
{
- Context context = (Context)pomgr.getSelectedObject();
- Portal portal = context.createPortal(portalName);
+ PortalContainer portalContainer = (PortalContainer)pomgr.getSelectedObject();
+ Portal portal = portalContainer.createPortal(portalName);
DomainConfigurator configurator = pomgr.getDomainConfigurator();
// Initial portal permissions
Modified:
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-11-30
07:43:40 UTC (rev 5745)
+++
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-11-30
22:53:29 UTC (rev 5746)
@@ -24,7 +24,7 @@
import junit.framework.TestSuite;
import org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -37,8 +37,6 @@
import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.common.test.junit.POJOJUnitTest;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.net.URL;
/**
@@ -109,7 +107,6 @@
//
hibernate.openSession();
- container.createContext();
assertTrue(hibernate.commitTransaction());
//
@@ -128,12 +125,11 @@
//
hibernate.openSession();
- container.createContext();
assertTrue(hibernate.commitTransaction());
//
hibernate.openSession();
- Context ctx = container.getContext();
+ PortalContainer ctx = (PortalContainer)container.getRootObject();
Portal portal = ctx.createPortal("default");
String portalId = portal.getId();
assertNotNull(portalId);
@@ -190,7 +186,7 @@
//
hibernate.openSession();
- ctx = container.getContext();
+ ctx = (PortalContainer)container.getRootObject();
assertNotNull(ctx);
portal = ctx.getPortal("default");
assertNotNull(portal);
@@ -205,7 +201,7 @@
//
hibernate.openSession();
- ctx = container.getContext();
+ ctx = (PortalContainer)container.getRootObject();
assertNotNull(ctx);
ctx.destroyChild("default");
portal = ctx.getPortal("default");
@@ -214,7 +210,7 @@
//
hibernate.openSession();
- ctx = container.getContext();
+ ctx = (PortalContainer)container.getRootObject();
portal = ctx.getPortal("default");
assertNull(portal);
assertTrue(hibernate.commitTransaction());
@@ -229,12 +225,11 @@
//
hibernate.openSession();
- container.createContext();
assertTrue(hibernate.commitTransaction());
//
hibernate.openSession();
- Context ctx = container.getContext();
+ PortalContainer ctx = (PortalContainer)container.getRootObject();
Portal portal = ctx.createPortal("default");
assertNotNull(portal);
Modified: trunk/core/src/resources/portal-core-sar/portal-aop.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/portal-aop.xml 2006-11-30 07:43:40 UTC (rev
5745)
+++ trunk/core/src/resources/portal-core-sar/portal-aop.xml 2006-11-30 22:53:29 UTC (rev
5746)
@@ -43,7 +43,6 @@
</method>
<method name="invokeSupports">
<trans-attribute>supports</trans-attribute>
- <!--<application-exceptions>,</application-exceptions>-->
</method>
<method name="invokeRequired">
<trans-attribute>Required</trans-attribute>
@@ -81,8 +80,8 @@
</metadata>
<metadata
tag="transaction"
-
class="org.jboss.portal.core.deployment.jboss.ObjectDeploymentFactory">
- <method name="createContextIfNotExist">
+
class="org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer">
+ <method name="createRootIfNotExist">
<trans-attribute>Required</trans-attribute>
</method>
</metadata>