[jboss-svn-commits] JBoss Portal SVN: r5385 - in trunk/core/src/main/org/jboss/portal/core: aspects/controller controller controller/command model/portal
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 9 20:23:31 EDT 2006
Author: julien at jboss.com
Date: 2006-10-09 20:23:20 -0400 (Mon, 09 Oct 2006)
New Revision: 5385
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java
trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
Log:
in PortalObjectCommand added a targetId and target object retrieved upon creation
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -48,7 +48,7 @@
{
WindowCommand wc = (WindowCommand)cmd;
InvocationContext invocationCtx = cmd.getContext();
- String scopeKey = "cached_markup." + wc.getWindowRef();
+ String scopeKey = "cached_markup." + wc.getTargetId();
//
if (cmd instanceof RenderWindowCommand)
Modified: trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -285,7 +285,7 @@
WindowState windowState = renderResult.getWindowState();
Mode mode = renderResult.getMode();
InvokeWindowRenderCommand iwrc = new InvokeWindowRenderCommand(
- iwac.getWindowRef(),
+ iwac.getTargetId(),
mode,
windowState,
portletNavState);
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -63,7 +63,7 @@
private PortletInvocation invocation;
public InvokeWindowActionCommand(
- String windowRef,
+ String windowId,
Mode mode,
WindowState windowState,
StateString navigationalState,
@@ -71,7 +71,7 @@
Parameters formParameters)
throws IllegalArgumentException
{
- super(windowRef, mode, windowState);
+ super(windowId, mode, windowState);
this.navigationalState = navigationalState;
this.interactionState = interactionState;
this.formParameters = formParameters;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -37,9 +37,9 @@
/** . */
protected final WindowState windowState;
- public InvokeWindowCommand(String windowRef, Mode mode, WindowState windowState) throws IllegalArgumentException
+ public InvokeWindowCommand(String windowId, Mode mode, WindowState windowState) throws IllegalArgumentException
{
- super(windowRef);
+ super(windowId);
this.mode = mode;
this.windowState = windowState;
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -60,12 +60,12 @@
}
public InvokeWindowRenderCommand(
- String windowRef,
+ String windowId,
Mode mode,
WindowState windowState)
throws IllegalArgumentException
{
- super(windowRef, mode, windowState);
+ super(windowId, mode, windowState);
this.navigationalState = null;
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -85,7 +85,7 @@
{
WindowContext windowCtx = (WindowContext)i.next();
String windowRegion = windowCtx.getRegionName();
- if (windowRef.equals(windowCtx.getId()))
+ if (targetId.equals(windowCtx.getId()))
{
windowCtx.setRegionName(toRegion);
windowCtx.setOrder(toPos);
@@ -104,7 +104,7 @@
{
PortalAuthorizationManagerFactory pamf = getControllerContext().getController().getPortalAuthorizationManagerFactory();
PortalAuthorizationManager pam = pamf.getManager();
- PortalObjectPermission perm = new PortalObjectPermission(windowRef, PortalObjectPermission.DASHBOARD_MASK);
+ PortalObjectPermission perm = new PortalObjectPermission(targetId, PortalObjectPermission.DASHBOARD_MASK);
//
if (pam.checkPermission(perm))
@@ -123,7 +123,7 @@
try
{
int pos = Integer.parseInt(posAsString);
- if (windowRef.equals(windowId))
+ if (targetId.equals(windowId))
{
window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, toRegion);
window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(toPos));
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -35,34 +35,17 @@
{
/** . */
- protected final String pageRef;
+ protected Page page;
/** . */
protected Portal portal;
- /** . */
- protected Page page;
-
- public PageCommand(String pageRef)
+ public PageCommand(String pageId)
{
- if (pageRef == null)
- {
- throw new IllegalArgumentException();
- }
- this.pageRef = pageRef;
+ super(pageId);
}
/**
- * Get the identifier of the requeste page
- *
- * @return the identifier of the requeste page
- */
- public String getPageRef()
- {
- return pageRef;
- }
-
- /**
* Get the requeste page
*
* @return the requested page
@@ -72,11 +55,6 @@
return page;
}
- public PortalObject getTarget()
- {
- return page;
- }
-
/**
* Initialize the command
*
@@ -84,18 +62,18 @@
*/
public void create() throws ControllerException
{
- // Get page
- page = (Page)context.getController().getPortalObjectContainer().getObject(pageRef);
- if (page == null)
- {
- throw new ResourceNotFoundException(pageRef);
- }
+ super.create();
+
+ //
+ page = (Page)getTarget();
// Get nearest portal ancestor
portal = page.getPortal();
+
+ //
if (portal == null)
{
- throw new ResourceNotFoundException("Portal for " + pageRef);
+ throw new ResourceNotFoundException(targetId);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -23,9 +23,12 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerSecurityException;
import org.jboss.portal.core.controller.ResourceAccessDeniedException;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.security.PortalSecurityException;
@@ -36,6 +39,36 @@
public abstract class PortalObjectCommand extends ControllerCommand
{
+ protected final String targetId;
+
+ protected PortalObject target;
+
+ protected PortalObjectCommand(String targetId)
+ {
+ if (targetId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.targetId = targetId;
+ }
+
+
+ public final String getTargetId()
+ {
+ return targetId;
+ }
+
+ public void create() throws ControllerException
+ {
+ // Get portal object
+ target = context.getController().getPortalObjectContainer().getObject(targetId);
+
+ if (target == null)
+ {
+ throw new ResourceNotFoundException(targetId);
+ }
+ }
+
/**
* Enforce the security on this command using the provided portal authorization manager.
*
@@ -58,5 +91,8 @@
*
* @return the target portal object
*/
- public abstract PortalObject getTarget();
+ public final PortalObject getTarget()
+ {
+ return target;
+ }
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -128,9 +128,9 @@
/** . */
private PageRendition result;
- public RenderPageCommand(String pageRef)
+ public RenderPageCommand(String pageId)
{
- super(pageRef);
+ super(pageId);
}
/**
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -82,7 +82,7 @@
StateString ns = (StateString)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef());
//
- WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, windowRef + "_window");
+ WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, targetId + "_window");
if (windowNavState == null)
{
windowNavState = new WindowNavigationalState();
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -42,9 +42,6 @@
public abstract class WindowCommand extends PortalObjectCommand
{
- /** The window ref. */
- protected String windowRef;
-
/** The portal. */
protected Portal portal;
@@ -57,30 +54,16 @@
/** The instance. */
protected Instance instance;
- public WindowCommand(String windowRef) throws IllegalArgumentException
+ public WindowCommand(String windowId) throws IllegalArgumentException
{
- if (windowRef == null)
- {
- throw new IllegalArgumentException();
- }
- this.windowRef = windowRef;
+ super(windowId);
}
- public PortalObject getTarget()
- {
- return window;
- }
-
public Instance getInstance()
{
return instance;
}
- public String getWindowRef()
- {
- return windowRef;
- }
-
public Portal getPortal()
{
return portal;
@@ -98,25 +81,23 @@
public void create() throws ControllerException
{
+ super.create();
+
// Retrieve the window
- window = (Window)context.getController().getPortalObjectContainer().getObject(windowRef);
- if (window == null)
- {
- throw new ResourceNotFoundException(windowRef);
- }
+ window = (Window)getTarget();
// First retrieve the target
page = (Page)window.getParent();
if (page == null)
{
- throw new ResourceNotFoundException(windowRef);
+ throw new ResourceNotFoundException(targetId);
}
// Get hardcoded portal for now
portal = page.getPortal();
if (portal == null)
{
- throw new ResourceNotFoundException(windowRef);
+ throw new ResourceNotFoundException(targetId);
}
// Get instance
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-10-10 00:01:51 UTC (rev 5384)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-10-10 00:23:20 UTC (rev 5385)
@@ -85,7 +85,7 @@
if (cmd instanceof RenderPageCommand)
{
RenderPageCommand rpCmd = (RenderPageCommand)cmd;
- String pageRef = rpCmd.getPageRef();
+ String pageRef = rpCmd.getTargetId();
return getBaseURL(pageRef);
}
else if (cmd instanceof InvokeWindowCommand)
@@ -93,7 +93,7 @@
InvokeWindowCommand iwaCmd = (InvokeWindowCommand)cmd;
// The base URL
- AbstractServerURL serverURL = getBaseURL(iwaCmd.getWindowRef());
+ AbstractServerURL serverURL = getBaseURL(iwaCmd.getTargetId());
// The meta param
int meta = 0;
More information about the jboss-svn-commits
mailing list