JBoss Portal SVN: r9138 - in branches/presentation: presentation/src/main/org/jboss/portal/presentation/impl/model and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-27 15:56:08 -0500 (Tue, 27 Nov 2007)
New Revision: 9138
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java
Log:
rename ObjectState to StructuralState
Modified: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -33,7 +33,7 @@
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
import org.jboss.portal.presentation.model.state.structural.StructuralStateManager;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
@@ -82,9 +82,9 @@
/**
*
*/
- public ObjectState load(String objectId) throws IllegalArgumentException
+ public StructuralState load(String objectId) throws IllegalArgumentException
{
- ObjectState objectState = null;
+ StructuralState structuralState = null;
// Get the PortalObject corresponding to this objectId from the PortalObjectContainer
PortalObject portalObject = this.portalObjectContainer.getObject(PortalObjectId.parse(objectId,
@@ -121,7 +121,7 @@
childrenIds.add(child.getId().toString());
}
- objectState = new ObjectState(
+ structuralState = new StructuralState(
type, //type
name,
properties, //properties
@@ -129,7 +129,7 @@
childrenIds // childrenIds
);
- return objectState;
+ return structuralState;
}
/**
@@ -157,7 +157,7 @@
return type;
}
- public ObjectState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
+ public StructuralState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
{
throw new StateChangeVetoException();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -25,7 +25,7 @@
import org.jboss.portal.presentation.model.UIContainer;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -34,7 +34,7 @@
public class UIContainerImpl extends UIObjectImpl implements UIContainer
{
- public UIContainerImpl(UIContextImpl context, String id, ObjectState state)
+ public UIContainerImpl(UIContextImpl context, String id, StructuralState state)
{
super(context, id, state);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -32,7 +32,7 @@
import org.jboss.portal.presentation.model.UIContainer;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.structural.StructuralStateManager;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -54,7 +54,7 @@
return loader.getRootId();
}
- private static ObjectState getRootState(StructuralStateManager loader)
+ private static StructuralState getRootState(StructuralStateManager loader)
{
return loader.load(loader.getRootId());
}
@@ -81,8 +81,8 @@
if (object == null)
{
//Fetch the state of the UIObject in question
- ObjectState objectState = this.structuralStateManager.load(id);
- object = getImplementation(id, objectState);
+ StructuralState structuralState = this.structuralStateManager.load(id);
+ object = getImplementation(id, structuralState);
objects.put(id, object);
}
return object;
@@ -96,7 +96,7 @@
/**
* @return
*/
- protected UIObject getImplementation(String id, ObjectState state) throws Exception
+ protected UIObject getImplementation(String id, StructuralState state) throws Exception
{
Class type = state.getType();
if(type == UIPortal.class)
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -24,7 +24,7 @@
import org.jboss.portal.presentation.model.StateScopeType;
import org.jboss.portal.presentation.model.UIObject;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import java.io.Serializable;
@@ -57,7 +57,7 @@
/**
* This is used to assist with data needed during lazy loading, other state related data etc
*/
- private ObjectState state;
+ private StructuralState state;
/**
*
@@ -69,7 +69,7 @@
*/
private final Map<String, Object> navigationalState;
- public UIObjectImpl(UIContextImpl context, String id, ObjectState state)
+ public UIObjectImpl(UIContextImpl context, String id, StructuralState state)
{
this.id = id;
this.state = state;
@@ -79,7 +79,7 @@
this.navigationalState = new HashMap<String, Object>();
}
- public UIObjectImpl(String id, ObjectState state)
+ public UIObjectImpl(String id, StructuralState state)
{
this.id = id;
this.state = state;
@@ -170,7 +170,7 @@
context.getModelLoader().update(id, changes);
Map<String, String> updatedProperties = new HashMap<String, String>(state.getProperties());
updateProperty(updatedProperties, propertyName, (String)propertyValue);
- state = new ObjectState(state.getType(), state.getName(), updatedProperties, state.getParentId(), state.getChildrenIds());
+ state = new StructuralState(state.getType(), state.getName(), updatedProperties, state.getParentId(), state.getChildrenIds());
}
else
{
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -26,7 +26,7 @@
import org.jboss.portal.presentation.model.UIContainer;
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -35,7 +35,7 @@
public class UIPageImpl extends UIObjectImpl implements UIPage
{
- public UIPageImpl(UIContextImpl context, String id, ObjectState state)
+ public UIPageImpl(UIContextImpl context, String id, StructuralState state)
{
super(context, id, state);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -25,7 +25,7 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIPage;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -34,7 +34,7 @@
public class UIPortalImpl extends UIObjectImpl implements UIPortal
{
- public UIPortalImpl(UIContextImpl context, String id, ObjectState state)
+ public UIPortalImpl(UIContextImpl context, String id, StructuralState state)
{
super(context, id, state);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -28,7 +28,7 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.content.WindowContent;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -37,7 +37,7 @@
public class UIWindowImpl extends UIObjectImpl implements UIWindow
{
- public UIWindowImpl(UIContextImpl context, String id, ObjectState state)
+ public UIWindowImpl(UIContextImpl context, String id, StructuralState state)
{
super(context, id, state);
}
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java (from rev 9129, branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/ObjectState.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * 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.presentation.model.state.structural;
+
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructuralState implements Serializable
+{
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final String parentId;
+
+ /** . */
+ private final List<String> childrenIds;
+
+ public StructuralState(Class<? extends UIObject> type, String name, Map<String, String> properties, String parentId, List<String> childrenIds)
+ {
+ this.type = type;
+ this.name = name;
+ this.properties = properties;
+ this.parentId = parentId;
+ this.childrenIds = childrenIds;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public String getParentId()
+ {
+ return parentId;
+ }
+
+ public List<String> getChildrenIds()
+ {
+ return childrenIds;
+ }
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -43,11 +43,11 @@
* @return the state of the object or null if such state does not exist
* @throws IllegalArgumentException if the object id argument is null
*/
- ObjectState load(String objectId) throws IllegalArgumentException;
+ StructuralState load(String objectId) throws IllegalArgumentException;
String getRootId();
- ObjectState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException;
+ StructuralState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException;
void destroy(String objectId) throws StateChangeVetoException;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.test.model;
import org.jboss.portal.presentation.model.state.structural.StructuralStateManager;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.UIObject;
@@ -54,7 +54,7 @@
return context;
}
- public ObjectState load(String objectId) throws IllegalArgumentException
+ public StructuralState load(String objectId) throws IllegalArgumentException
{
if (objectId == null)
{
@@ -143,14 +143,14 @@
return id;
}
- public ObjectState takeSnapshot()
+ public StructuralState takeSnapshot()
{
ArrayList<String> childrenIds = new ArrayList<String>();
for (MockObjectImpl child : children.values())
{
childrenIds.add(child.id);
}
- return new ObjectState(type.clazz, name, new HashMap<String, String>(propertyValues), parent != null ? parent.id : null, childrenIds);
+ return new StructuralState(type.clazz, name, new HashMap<String, String>(propertyValues), parent != null ? parent.id : null, childrenIds);
}
public String getPropertyValue(String propertyName)
@@ -212,7 +212,7 @@
}
}
- public ObjectState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
+ public StructuralState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
{
throw new StateChangeVetoException();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java 2007-11-27 20:52:01 UTC (rev 9137)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java 2007-11-27 20:56:08 UTC (rev 9138)
@@ -27,7 +27,7 @@
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
import java.util.Set;
@@ -78,5 +78,5 @@
*
* @return the state snapshot
*/
- ObjectState takeSnapshot();
+ StructuralState takeSnapshot();
}
16 years, 7 months
JBoss Portal SVN: r9137 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation: model and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-27 15:52:01 -0500 (Tue, 27 Nov 2007)
New Revision: 9137
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
Log:
implement property update of the model + test cases
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 20:17:12 UTC (rev 9136)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 20:52:01 UTC (rev 9137)
@@ -22,10 +22,10 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model;
-import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.presentation.model.StateScopeType;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import java.io.Serializable;
import java.util.HashMap;
@@ -57,7 +57,7 @@
/**
* This is used to assist with data needed during lazy loading, other state related data etc
*/
- private final ObjectState state;
+ private ObjectState state;
/**
*
@@ -152,22 +152,38 @@
return getProperty(scopeType, propertyName, Object.class);
}
- public <T> void setProperty(StateScopeType scopeType, String propertyName, T propertyValue)
+ public <T> void setProperty(StateScopeType scopeType, String propertyName, T propertyValue) throws StateChangeVetoException
{
- Map map;
switch (scopeType)
{
case CONTENT:
- map = transientState;
+ updateProperty(transientState, propertyName, propertyValue);
break;
case NAVIGATIONAL:
- map = navigationalState;
+ updateProperty(navigationalState, propertyName, propertyValue);
break;
case STRUCTURAL:
- throw new NotYetImplemented();
+ if (propertyValue instanceof String)
+ {
+ Map<String, String> changes = new HashMap<String, String>();
+ changes.put(propertyName, (String)propertyValue);
+ context.getModelLoader().update(id, changes);
+ Map<String, String> updatedProperties = new HashMap<String, String>(state.getProperties());
+ updateProperty(updatedProperties, propertyName, (String)propertyValue);
+ state = new ObjectState(state.getType(), state.getName(), updatedProperties, state.getParentId(), state.getChildrenIds());
+ }
+ else
+ {
+ throw new StateChangeVetoException("Structural property value must be string value");
+ }
+ break;
default:
throw new AssertionError();
}
+ }
+
+ private <T> void updateProperty(Map<String, T> map, String propertyName, T propertyValue)
+ {
if (propertyValue == null)
{
map.remove(propertyName);
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java 2007-11-27 20:17:12 UTC (rev 9136)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java 2007-11-27 20:52:01 UTC (rev 9137)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+
import java.util.List;
/**
@@ -53,7 +55,7 @@
<T> T getProperty(StateScopeType scopeType, String propertyName, Class<T> propertyType);
/**
- * Equivalent to call <code>getProperty(StateScopeType,String,Class)</code> with the <code>Object.class</code>
+ * Equivalent to call <code>getPropertyValue(StateScopeType,String,Class)</code> with the <code>Object.class</code>
* literal.
*
* @param scopeType
@@ -62,7 +64,7 @@
*/
Object getProperty(StateScopeType scopeType, String propertyName);
- <T> void setProperty(StateScopeType scopeType, String propertyName, T propertyValue);
+ <T> void setProperty(StateScopeType scopeType, String propertyName, T propertyValue) throws StateChangeVetoException;
/**
* Create a child with a specified type.
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java 2007-11-27 20:17:12 UTC (rev 9136)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java 2007-11-27 20:52:01 UTC (rev 9137)
@@ -26,7 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class StateChangeVetoException extends Exception
+public class StateChangeVetoException extends RuntimeException
{
public StateChangeVetoException()
{
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 20:17:12 UTC (rev 9136)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 20:52:01 UTC (rev 9137)
@@ -31,6 +31,7 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -81,9 +82,12 @@
private final String id = "" + generator++;
/** . */
- private final Map<String, String> properties;
+ private final Map<String, String> propertyValues;
/** . */
+ private final Map<String, Boolean> propertyMutables;
+
+ /** . */
private final Map<String, MockObjectImpl> children;
/** . */
@@ -95,7 +99,8 @@
this.name = "";
this.type = MockObject.Type.CONTEXT;
this.children = new LinkedHashMap<String, MockObjectImpl>();
- this.properties = new HashMap<String, String>();
+ this.propertyValues = new HashMap<String, String>();
+ this.propertyMutables = new HashMap<String, Boolean>();
//
universe.put(id, this);
@@ -112,7 +117,8 @@
this.name = name;
this.type = type;
this.children = new LinkedHashMap<String, MockObjectImpl>();
- this.properties = new HashMap<String, String>();
+ this.propertyValues = new HashMap<String, String>();
+ this.propertyMutables = new HashMap<String, Boolean>();
//
this.parent = parent;
@@ -144,12 +150,12 @@
{
childrenIds.add(child.id);
}
- return new ObjectState(type.clazz, name, new HashMap<String, String>(properties), parent != null ? parent.id : null, childrenIds);
+ return new ObjectState(type.clazz, name, new HashMap<String, String>(propertyValues), parent != null ? parent.id : null, childrenIds);
}
- public String getProperty(String name)
+ public String getPropertyValue(String propertyName)
{
- return properties.get(name);
+ return propertyValues.get(propertyName);
}
public MockObject addChild(String name, MockObject.Type type)
@@ -163,21 +169,47 @@
return new MockObjectImpl(this, name, type);
}
- public void setProperty(String name, String value)
+ public Set<String> getPropertyNames()
{
- if (name == null)
+ return propertyValues.keySet();
+ }
+
+ public void setPropertyMutable(String propertyName, Boolean propertyMutable)
+ {
+ if (propertyName == null)
{
throw new IllegalArgumentException();
}
- if (value != null)
+ if (propertyMutable != null)
{
- properties.put(name, value);
+ propertyMutables.put(name, propertyMutable);
}
else
{
- properties.remove(name);
+ propertyMutables.remove(name);
}
}
+
+ public Boolean isPropertyMutable(String propertyName)
+ {
+ return propertyMutables.get(propertyName);
+ }
+
+ public void setPropertyValue(String propertyName, String propertyValue)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyValue != null)
+ {
+ propertyValues.put(propertyName, propertyValue);
+ }
+ else
+ {
+ propertyValues.remove(propertyName);
+ }
+ }
}
public ObjectState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
@@ -195,8 +227,42 @@
throw new StateChangeVetoException();
}
- public void update(String objectId, Map<String, String> properties) throws StateChangeVetoException
+ public void update(String objectId, Map<String, String> changes) throws StateChangeVetoException
{
- throw new StateChangeVetoException();
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (changes == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ MockObjectImpl object = universe.get(objectId);
+ if (object == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ for (Map.Entry<String, String> entry : changes.entrySet())
+ {
+ String propertyName = entry.getKey();
+ Boolean mutable = object.propertyMutables.get(propertyName);
+ if (Boolean.FALSE.equals(mutable))
+ {
+ throw new StateChangeVetoException("Cannot modify non mutable property");
+ }
+ String propertyValue = entry.getValue();
+ if (propertyValue != null)
+ {
+ object.propertyValues.put(propertyName, propertyValue);
+ }
+ else
+ {
+ object.propertyValues.remove(propertyName);
+ }
+ }
}
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java 2007-11-27 20:17:12 UTC (rev 9136)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java 2007-11-27 20:52:01 UTC (rev 9137)
@@ -29,6 +29,8 @@
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import java.util.Set;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -59,10 +61,16 @@
String getId();
- String getProperty(String name);
+ String getPropertyValue(String propertyName);
- void setProperty(String name, String value);
+ void setPropertyMutable(String propertyName, Boolean propertyMutable);
+ Boolean isPropertyMutable(String propertyName);
+
+ void setPropertyValue(String propertyName, String propertyValue);
+
+ Set<String> getPropertyNames();
+
MockObject addChild(String name, Type type);
/**
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-11-27 20:17:12 UTC (rev 9136)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-11-27 20:52:01 UTC (rev 9137)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.test.model;
+import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.jboss.portal.presentation.impl.model.UIContextImpl;
@@ -30,6 +31,7 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import java.util.Collections;
import java.util.List;
@@ -186,54 +188,202 @@
assertEquals(mockDefaultPortal.getId(), defaultPortal.getId());
}
- public void testProperty()
+ private static class PropertyAssert
{
+ /** . */
+ private final UIObject object;
+
+ private PropertyAssert(UIObject object)
+ {
+ this.object = object;
+ }
+
+ private static final class Blah
+ {
+ }
+
+ void assertStructuralEquals(String propertyName, String propertyValue)
+ {
+ assertEquals(StateScopeType.STRUCTURAL, propertyName, propertyValue, String.class);
+ }
+
+ <T> void assertNavigationalEquals(String propertyName, T propertyValue, Class<T> propertyClass)
+ {
+ assertEquals(StateScopeType.NAVIGATIONAL, propertyName, propertyValue, propertyClass);
+ }
+
+ <T> void assertContentEquals(String propertyName, T propertyValue, Class<T> propertyClass)
+ {
+ assertEquals(StateScopeType.CONTENT, propertyName, propertyValue, propertyClass);
+ }
+
+ <T> void assertEquals(StateScopeType scopeType, String propertyName, T propertyValue, Class<T> propertyClass)
+ {
+ Assert.assertEquals(propertyValue, object.getProperty(scopeType, propertyName, propertyClass));
+ Assert.assertEquals(propertyValue, object.getProperty(scopeType, propertyName, Object.class));
+ Assert.assertEquals(propertyValue, object.getProperty(scopeType, propertyName));
+ Assert.assertEquals(null, object.getProperty(scopeType, propertyName, Blah.class)); }
+ }
+
+ public void testExistingMutableStructuralProperty()
+ {
MockObject mockFoo = model.getContext().addChild("foo", MockObject.Type.PORTAL);
- mockFoo.setProperty("foo_name", "foo_value");
+ mockFoo.setPropertyValue("foo", "foo_value");
+ mockFoo.setPropertyMutable("foo", true);
UIContext context = new UIContextImpl(model);
- //
+ // Check initial state
UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", String.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Object.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Float.class));
- assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Object.class));
- assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Float.class));
- assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Object.class));
- assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Float.class));
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", "foo_value");
- //
- foo.setProperty(StateScopeType.NAVIGATIONAL, "foo_name", 0);
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", String.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Object.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Float.class));
- assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Object.class));
- assertEquals(new Integer(0), foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Integer.class));
- assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Float.class));
- assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Object.class));
- assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Float.class));
+ // Update structural property
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", "foo_new_value");
+ fooAssert.assertStructuralEquals("foo", "foo_new_value");
- //
- foo.setProperty(StateScopeType.CONTENT, "foo_name", true);
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", String.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Object.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Float.class));
- assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Object.class));
- assertEquals(new Integer(0), foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Integer.class));
- assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Float.class));
- assertEquals(true, foo.getProperty(StateScopeType.CONTENT, "foo_name", Object.class));
- assertEquals(true, foo.getProperty(StateScopeType.CONTENT, "foo_name"));
- assertEquals(Boolean.TRUE, foo.getProperty(StateScopeType.CONTENT, "foo_name", Boolean.class));
- assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Float.class));
+ // Try a non string type
+ try
+ {
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_new_value");
+ }
- //
+ public void testExistingNonMutableStructuralProperty()
+ {
+ MockObject mockFoo = model.getContext().addChild("foo", MockObject.Type.PORTAL);
+ mockFoo.setPropertyValue("foo", "foo_value");
+ mockFoo.setPropertyMutable("foo", false);
+ UIContext context = new UIContextImpl(model);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", "foo_value");
+
+ // Try an update
+ try
+ {
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", "foo_new_value");
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_value");
+
+ // Try a non string type
+ try
+ {
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_value");
}
+
+ public void testNonExistingMutableStructuralProperty()
+ {
+ MockObject mockFoo = model.getContext().addChild("foo", MockObject.Type.PORTAL);
+ mockFoo.setPropertyMutable("foo", true);
+ UIContext context = new UIContextImpl(model);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", null);
+
+ // Update structural property
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", "foo_new_value");
+ fooAssert.assertStructuralEquals("foo", "foo_new_value");
+
+ // Try a non string type
+ try
+ {
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_new_value");
+ }
+
+ public void testNonExistingNonMutableStructuralProperty()
+ {
+ MockObject mockFoo = model.getContext().addChild("foo", MockObject.Type.PORTAL);
+ mockFoo.setPropertyMutable("foo", false);
+ UIContext context = new UIContextImpl(model);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", null);
+
+ // Try an update
+ try
+ {
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", "foo_new_value");
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", null);
+
+ // Try a non string type
+ try
+ {
+ foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", null);
+ }
+
+ public void testContentProperty()
+ {
+ MockObject mockFoo = model.getContext().addChild("foo", MockObject.Type.PORTAL);
+ UIContext context = new UIContextImpl(model);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertContentEquals("foo", null, String.class);
+
+ // Update content state
+ foo.setProperty(StateScopeType.CONTENT, "foo", "foo_new_value");
+ fooAssert.assertContentEquals("foo", "foo_new_value", String.class);
+
+ // Update content state
+ foo.setProperty(StateScopeType.CONTENT, "foo", 2);
+ fooAssert.assertContentEquals("foo", 2, Integer.class);
+ }
+
+ public void testNavigationalProperty()
+ {
+ MockObject mockFoo = model.getContext().addChild("foo", MockObject.Type.PORTAL);
+ UIContext context = new UIContextImpl(model);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertNavigationalEquals("foo", null, String.class);
+
+ // Update navigational state
+ foo.setProperty(StateScopeType.NAVIGATIONAL, "foo", "foo_new_value");
+ fooAssert.assertNavigationalEquals("foo", "foo_new_value", String.class);
+
+ // Update navigational state
+ foo.setProperty(StateScopeType.NAVIGATIONAL, "foo", 2);
+ fooAssert.assertNavigationalEquals("foo", 2, Integer.class);
+ }
}
16 years, 7 months
JBoss Portal SVN: r9136 - in branches/JBoss_Portal_Branch_2_6: cms/src/main/org/jboss/portal/cms/impl/interceptors and 11 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-27 15:17:12 -0500 (Tue, 27 Nov 2007)
New Revision: 9136
Modified:
branches/JBoss_Portal_Branch_2_6/cms/build.xml
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProvider.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
branches/JBoss_Portal_Branch_2_6/core/build.xml
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml
Log:
[JBPORTAL-1733],[JBPORTAL-1740],[JBPORTAL-1646] - made 'cms root user' and 'security console accessibility' configurable from end user standpoint
Modified: branches/JBoss_Portal_Branch_2_6/cms/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/build.xml 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/build.xml 2007-11-27 20:17:12 UTC (rev 9136)
@@ -392,7 +392,7 @@
</target>
<target name="tests" depends="init">
<execute-tests>
- <x-sysproperty>
+ <x-sysproperty>
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
@@ -404,13 +404,11 @@
<jvmarg value="-Djava.net.preferIPv4Stack=true"/>
</x-sysproperty>
<x-test>
- <!-- general cms setup related tests -->
<test todir="${test.reports}" name="org.jboss.portal.test.cms.JackrabbitTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryBootStrap"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRegEx"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryUtil"/>
- <!-- cms file command tests -->
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileUpdate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileArchiveUpload"/>
@@ -422,19 +420,16 @@
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileDelete"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestSearch"/>
- <!-- cms folder command tests -->
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCopy"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCreate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderDelete"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderGet"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderUpdate"/>
-
- <!-- cms fine grained security related tests -->
+
<test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestReadAccess"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestWriteAccess"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.security.TestManageAccess"/>
-
- <!-- cms workflow related tests -->
+
<test todir="${test.reports}" name="org.jboss.portal.test.cms.workflow.TestApprovedPublish"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.workflow.TestDeniedPublish"/>
</x-test>
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -455,14 +455,15 @@
try
{
role = this.roleModule.findRoleByName(name);
+ tx.commit();
}
catch (Exception e)
{
+ tx.rollback();
role = null;
}
finally
{
- tx.rollback();
session.close();
}
@@ -489,10 +490,14 @@
{
bootRequired = true;
}
+ tx.commit();
}
+ catch(Exception e)
+ {
+ tx.rollback();
+ }
finally
{
- tx.rollback();
Tools.closeSession(session);
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -40,6 +40,7 @@
import org.jboss.portal.cms.model.Folder;
import org.jboss.portal.cms.util.RepositoryUtil;
import org.jboss.portal.cms.workflow.ApprovePublish;
+import org.jboss.portal.cms.security.AuthorizationManager;
import org.jboss.portal.common.invocation.InterceptorStackFactory;
import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.InvocationException;
@@ -48,11 +49,7 @@
import org.jboss.portal.common.net.URLNavigator;
import org.jboss.portal.common.net.URLVisitor;
import org.jboss.portal.common.xml.XMLTools;
-import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.IdentityServiceController;
import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserModule;
import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.util.StopWatch;
@@ -97,11 +94,9 @@
private InterceptorStackFactory stackFactory;
private Element config;
+
+ private AuthorizationManager authorizationManager;
- private String identitySessionFactory = null;
-
- private IdentityServiceController identityServiceController;
-
private ApprovePublish approvePublishWorkflow;
private String jndiName;
@@ -220,34 +215,25 @@
{
this.approvePublishWorkflow = approvePublishWorkflow;
}
-
- public UserModule getUserModule()
+
+ /**
+ *
+ * @return
+ */
+ public AuthorizationManager getAuthorizationManager()
{
- if (identityServiceController != null)
- {
- try
- {
- return (UserModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
- }
- catch (IdentityException ignore)
- {
- }
- }
-
- //
- return null;
+ return authorizationManager;
}
- public IdentityServiceController getIdentityServiceController()
+ /**
+ *
+ * @param authorizationManager
+ */
+ public void setAuthorizationManager(AuthorizationManager authorizationManager)
{
- return identityServiceController;
+ this.authorizationManager = authorizationManager;
}
- public void setIdentityServiceController(IdentityServiceController identityServiceController)
- {
- this.identityServiceController = identityServiceController;
- }
-
/** @return */
public String getJNDIName()
{
@@ -260,19 +246,7 @@
this.jndiName = jndiName;
}
- /** @return */
- public String getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
- /** @param identitySessionFactory */
- public void setIdentitySessionFactory(String identitySessionFactory)
- {
- this.identitySessionFactory = identitySessionFactory;
- }
-
-
/** CMS Start */
public void startService() throws Exception
{
@@ -377,20 +351,16 @@
// Get the content
URL root = Thread.currentThread().getContextClassLoader().getResource(defaultContentLocation);
- //make the user executing these to create the default content, an 'Admin' user
- //without this, the fine grained security won't allow the creation
- UserModule userModule = getUserModule();
- if (userModule != null)
+ //make the user executing these to create the default content, an cms root user
+ //without this, the fine grained security won't allow the creation
+ //Get the cms root user to create this content
+ if(this.authorizationManager != null)
{
- org.hibernate.Session session = org.jboss.portal.cms.hibernate.state.Tools.getOpenSession();
- org.hibernate.Transaction tx = session.beginTransaction();
- User user = userModule.findUserByUserName("admin");
+ User user = this.authorizationManager.getProvider().getRoot();
if (user != null)
{
JCRCMS.getUserInfo().set(user);
- }
- tx.rollback();
- org.jboss.portal.cms.hibernate.state.Tools.closeSession(session);
+ }
}
// Iterate over the content
@@ -677,5 +647,5 @@
public InterceptorStackFactory getStackFactory()
{
return stackFactory;
- }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -314,12 +314,13 @@
{
boolean hasAccess = false;
- //to prevent any administration issues, if the user is the 'admin'
+ //to prevent any administration issues, if the user is the 'cmsRootUser'
//treat him like a super user with access to everything in the cms
- if (user != null && user.getUserName() != null && user.getUserName().equals("admin"))
+ User root = this.authorizationManager.getProvider().getRoot();
+ if (user != null && user.getUserName() != null && user.getUserName().equals(root.getUserName()))
{
return true;
- }
+ }
//get the permissions available for the user in question
Collection userPermissions = this.getPermissions(user);
@@ -461,12 +462,13 @@
{
boolean toolAccess = false;
- //to prevent any administration issues, if the user is the 'admin'
+ //to prevent any administration issues, if the user is the 'cmsRoot'
//treat him like a super user with access to everything in the cms
- if (user != null && user.getUserName() != null && user.getUserName().equals("admin"))
+ User root = this.authorizationManager.getProvider().getRoot();
+ if (user != null && user.getUserName() != null && user.getUserName().equals(root.getUserName()))
{
return true;
- }
+ }
//get the permissions available for the user in question
Collection userPermissions = this.getPermissions(user);
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProvider.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProvider.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProvider.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -23,6 +23,7 @@
package org.jboss.portal.cms.security;
import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.User;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
@@ -56,4 +57,16 @@
/** @return */
public MembershipModule getMembershipModule();
+
+ /**
+ *
+ * @return
+ */
+ public User getRoot();
+
+ /**
+ *
+ * @return
+ */
+ public String getDefaultAdminRole();
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -29,6 +29,9 @@
import org.jboss.portal.identity.AnonymousRole;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.IdentityConfiguration;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.User;
@@ -58,6 +61,8 @@
private MembershipModule membershipModule = null;
private UserModule userModule = null;
+
+ private String cmsRootUserName = null;
/**
*
@@ -105,7 +110,25 @@
{
return this.getClass().getName();
}
+
+ /**
+ *
+ * @return
+ */
+ public String getCmsRootUserName()
+ {
+ return cmsRootUserName;
+ }
+ /**
+ *
+ * @param cmsRootUserName
+ */
+ public void setCmsRootUserName(String cmsRootUserName)
+ {
+ this.cmsRootUserName = cmsRootUserName;
+ }
+
// ------DomainConfigurator
// impl------------------------------------------------------------------
/**
@@ -184,7 +207,52 @@
return permissions;
}
-
+
+ /**
+ *
+ */
+ public User getRoot()
+ {
+ Session session = Tools.getOpenSession();
+ Transaction tx = session.beginTransaction();
+ try
+ {
+ User cmsRoot = this.userModule.findUserByUserName(this.cmsRootUserName);
+ tx.commit();
+ return cmsRoot;
+ }
+ catch(Exception e)
+ {
+ tx.rollback();
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ Tools.closeSession(session);
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getDefaultAdminRole()
+ {
+ try
+ {
+ String defaultAdminRole = null;
+
+ IdentityConfiguration configuration = (IdentityConfiguration)this.identityServiceController.getIdentityContext().
+ getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION);
+ defaultAdminRole = configuration.getValue("defaultAdminRole");
+
+ return defaultAdminRole;
+ }
+ catch(IdentityException ie)
+ {
+ throw new RuntimeException(ie);
+ }
+ }
// ---------URIFactory
// impl-----------------------------------------------------------------------------------------
/**
@@ -385,6 +453,8 @@
}
}
}
+
+ tx.commit();
return permissions;
}
@@ -395,7 +465,6 @@
}
finally
{
- tx.commit();
Tools.closeSession(session);
}
}
@@ -421,6 +490,8 @@
roleQuery.setString(0, roleId);
roleQuery.setCacheable(true);
permissions.addAll(roleQuery.list());
+
+ tx.commit();
}
catch (Exception e)
{
@@ -429,7 +500,6 @@
}
finally
{
- tx.commit();
Tools.closeSession(session);
}
@@ -458,6 +528,8 @@
criteriaQuery.setString(1, criteria.getValue());
criteriaQuery.setCacheable(true);
permissions.addAll(criteriaQuery.list());
+
+ tx.commit();
}
catch (Exception e)
{
@@ -466,7 +538,6 @@
}
finally
{
- tx.commit();
Tools.closeSession(session);
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/IdentityDataLoader.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -105,7 +105,6 @@
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
- boolean success = false;
try
{
if (userModule.getUserCount() == 0)
@@ -155,22 +154,15 @@
session.save(user);
session.save(sysAdmin);
- success = true;
+ tx.commit();
}
}
- finally
+ catch(Exception e)
{
- if (tx != null)
- {
- if (success)
- {
- tx.commit();
- }
- else
- {
- tx.rollback();
- }
- }
+ tx.rollback();
+ }
+ finally
+ {
if (session != null)
{
session.close();
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/security/SecureCommandTestCase.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -28,7 +28,9 @@
import org.jboss.portal.cms.impl.jcr.JCRCMS;
import org.jboss.portal.cms.security.AuthorizationProviderImpl;
import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.UserModule;
import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
import org.jboss.portal.test.cms.commands.AbstractCommandTestCase;
import org.jboss.portal.test.cms.commands.CMSInterceptorStackFactory;
@@ -39,6 +41,11 @@
public abstract class SecureCommandTestCase extends AbstractCommandTestCase
{
/**
+ *
+ */
+ protected UserModule userModule = null;
+
+ /**
*
*/
public SecureCommandTestCase()
@@ -69,7 +76,7 @@
//Register the IdentityService with the JCR service
IdentityServiceController identityService = ((AuthorizationProviderImpl)aclInterceptor.getAuthorizationManager().getProvider()).
getIdentityServiceController();
- this.service.setIdentityServiceController(identityService);
+ this.userModule = (UserModule)identityService.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
}
/**
@@ -78,6 +85,7 @@
public void tearDown() throws Exception
{
super.tearDown();
+ this.userModule = null;
}
@@ -94,7 +102,7 @@
SessionFactory sessionFactory = (SessionFactory)new InitialContext().lookup("java:/SessionFactory");
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
- JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
+ JCRCMS.getUserInfo().set(this.userModule.findUserByUserName(username));
tx.commit();
session.close();
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/AbstractWorkflowTestCase.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -25,12 +25,14 @@
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.jboss.portal.cms.impl.interceptors.ApprovalWorkflowInterceptor;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
import org.jboss.portal.cms.workflow.ApprovePublish;
import org.jboss.portal.cms.workflow.ApprovePublishImpl;
import org.jboss.portal.common.invocation.Interceptor;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityServiceController;
import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.User;
import org.jboss.portal.identity.db.HibernateRoleImpl;
import org.jboss.portal.identity.db.HibernateUserImpl;
import org.jboss.portal.server.impl.invocation.JBossInterceptorStack;
@@ -43,6 +45,11 @@
public abstract class AbstractWorkflowTestCase extends AbstractCommandTestCase
{
/**
+ *
+ */
+ protected UserModule userModule = null;
+
+ /**
*
*/
public AbstractWorkflowTestCase()
@@ -76,7 +83,8 @@
this.service.setStackFactory(stackFactory);
this.service.setApprovePublishWorkflow(approvePublish);
- this.service.setIdentityServiceController(identityService);
+
+ this.userModule = (UserModule)identityService.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
}
/**
@@ -85,6 +93,7 @@
public void tearDown() throws Exception
{
super.tearDown();
+ this.userModule = null;
}
@@ -114,7 +123,6 @@
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
- boolean success = false;
try
{
if (userModule.getUserCount() == 0)
@@ -151,26 +159,26 @@
session.save(admin);
session.save(user);
- success = true;
+ tx.commit();
}
}
+ catch(Exception e)
+ {
+ tx.rollback();
+ }
finally
- {
- if (tx != null)
- {
- if (success)
- {
- tx.commit();
- }
- else
- {
- tx.rollback();
- }
- }
+ {
if (session != null)
{
session.close();
}
}
}
+
+ /** @param username */
+ protected void runAs(String username) throws Exception
+ {
+ User user = this.userModule.findUserByUserName(username);
+ JCRCMS.getUserInfo().set(user);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestApprovedPublish.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -172,11 +172,5 @@
{
assertTrue(queueItems.isEmpty());
}
- }
-
- /** @param username */
- private void runAs(String username) throws Exception
- {
- JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
- }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/workflow/TestDeniedPublish.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -189,11 +189,5 @@
{
assertTrue(queueItems.isEmpty());
}
- }
-
- /** @param username */
- private void runAs(String username) throws Exception
- {
- JCRCMS.getUserInfo().set(this.service.getUserModule().findUserByUserName(username));
- }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-11-27 20:17:12 UTC (rev 9136)
@@ -83,6 +83,7 @@
<!-- setup for cms security testing -->
<bean name="AuthorizationProvider" class="org.jboss.portal.cms.security.AuthorizationProviderImpl">
<property name="identityServiceController"><inject bean="IdentityServiceController"/></property>
+ <property name="cmsRootUserName">admin</property>
</bean>
<bean name="AuthorizationManager" class="org.jboss.portal.cms.security.AuthorizationManagerImpl">
Modified: branches/JBoss_Portal_Branch_2_6/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-11-27 20:17:12 UTC (rev 9136)
@@ -762,4 +762,14 @@
<fileset dir="${build.lib}/jboss-portal-ha-exploded.sar"/>
</copy>
</target>
+
+ <target name="deploy-ha-explode-dev" description="Deploy high availability." depends="output-ha,explode-ha">
+ <require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
+ <copy todir="${jboss.home}/server/${portal-ha.deploy.dir}/jboss-portal-ha.sar" overwrite="true">
+ <fileset dir="${build.lib}/jboss-portal-ha-exploded.sar"/>
+ </copy>
+ <copy todir="${jboss.home}/server/ports-02/deploy/jboss-portal-ha.sar" overwrite="true">
+ <fileset dir="${build.lib}/jboss-portal-ha-exploded.sar"/>
+ </copy>
+ </target>
</project>
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -41,6 +41,8 @@
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
+import javax.transaction.UserTransaction;
+import javax.transaction.Transaction;
import java.io.Serializable;
import java.security.Principal;
import java.util.Date;
@@ -239,7 +241,7 @@
}
try
- {
+ {
// Continue the invocation
invocation.invokeNext();
}
@@ -302,45 +304,79 @@
}
protected void finalizeUser() throws Exception
- {
- //
- if (log.isTraceEnabled())
+ {
+ /**
+ * Note: Due to a possible bug in JBoss Cache Transaction propagation within a cluster,
+ * We need to spawn a separate thread with its own new transaction to perform the finalizeUser
+ * logic.
+ *
+ * Without that, it results in data deadlocks in the cluster.
+ */
+ Thread thread = new Thread(new FinalizeRunner());
+ thread.start();
+ thread.join();
+ }
+
+ /**
+ *
+ * @author soshah
+ *
+ */
+ private class FinalizeRunner implements Runnable
+ {
+ public void run()
{
- log.trace("Finalizing user " + userId);
- }
-
- //
- // Here we use JNDI to locate the module as this finalizer could have been
- // migrated in the session of another node of the cluster
- UserModule userModule = null;
- UserProfileModule userProfileModule = null;
-
- try
- {
- userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
- userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
- }
- catch (NameNotFoundException ignore)
- {
- // Name is not bound anymore, it could happen during a shutdown, we don't do anything
- }
-
- // Get user and set last visit date to now if we can
- if (userModule != null && userProfileModule != null)
- {
+ UserTransaction tx = null;
try
{
- User user = userModule.findUserById(userId);
- //user.setLastVisitDate(new Date());
- userProfileModule.setProperty(user, User.INFO_USER_LAST_LOGIN_DATE, new Date().toString());
-
+ //
+ if (log.isTraceEnabled())
+ {
+ log.trace("Finalizing user " + userId);
+ }
+
+ //
+ // Here we use JNDI to locate the module as this finalizer could have been
+ // migrated in the session of another node of the cluster
+ UserModule userModule = null;
+ UserProfileModule userProfileModule = null;
+ InitialContext ctx = new InitialContext();
+ tx = (UserTransaction)ctx.lookup("UserTransaction");
+ tx.begin();
+ try
+ {
+ userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
+ userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
+ }
+ catch (NameNotFoundException ignore)
+ {
+ // Name is not bound anymore, it could happen during a shutdown, we don't do anything
+ }
+
+ // Get user and set last visit date to now if we can
+ if (userModule != null && userProfileModule != null)
+ {
+ try
+ {
+ User user = userModule.findUserById(userId);
+ //user.setLastVisitDate(new Date());
+ userProfileModule.setProperty(user, User.INFO_USER_LAST_LOGIN_DATE, new Date().toString());
+
+ }
+ catch (NoSuchUserException e)
+ {
+ // User is not found
+ log.warn("Trying to finalize non existing user " + userId);
+ }
+ }
+ tx.commit();
}
- catch (NoSuchUserException e)
+ catch(Exception e)
{
- // User is not found
- log.warn("Trying to finalize non existing user " + userId);
- }
+ try{tx.rollback();}catch(Exception rbe){}
+ throw new RuntimeException(e);
+ }
}
}
- }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml 2007-11-27 20:17:12 UTC (rev 9136)
@@ -320,6 +320,11 @@
<name>membershipAttributeIsDN</name>
<value>true</value>
</option>
+ <!-- NOTE: defaultAdminRole is a required option -->
+ <option>
+ <name>defaultAdminRole</name>
+ <value>Admin</value>
+ </option>
</option-group>
<option-group>
<group-name>userCreateAttibutes</group-name>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-11-27 20:17:12 UTC (rev 9136)
@@ -1460,6 +1460,11 @@
}
}
+ /**
+ *
+ * @param portletRequest
+ * @return
+ */
private boolean isSecurityConsoleAccessible(PortletRequest portletRequest)
{
try
@@ -1470,12 +1475,13 @@
{
User user = this.userModule.findUserByUserName(portletRequest.getUserPrincipal().getName());
Set roles = this.membershipModule.getRoles(user);
+ String defaultAdminRole = this.authorizationManager.getProvider().getDefaultAdminRole();
if (roles != null)
{
for (Iterator itr = roles.iterator(); itr.hasNext();)
{
Role role = (Role)itr.next();
- if (role.getName().equalsIgnoreCase("admin"))
+ if (role.getName().equalsIgnoreCase(defaultAdminRole))
{
isAccessible = true;
break;
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-11-27 18:41:46 UTC (rev 9135)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-11-27 20:17:12 UTC (rev 9136)
@@ -61,7 +61,7 @@
<depends>portal:service=JAASLoginModule</depends>
<depends>portal:service=Hibernate,type=CMS</depends>
<depends>cms.pm.cache:service=TreeCache</depends>
- <depends optional-attribute-name="IdentityServiceController" proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>
+ <depends optional-attribute-name="AuthorizationManager" proxy-type="attribute">portal:service=AuthorizationManager,type=cms</depends>
<!-- Add this to activate publish/approval workflow integration -->
<!--
@@ -74,7 +74,6 @@
<attribute name="DefaultLocale">en</attribute>
<attribute name="RepositoryName">PortalRepository</attribute>
<attribute name="HomeDir">${jboss.server.data.dir}${/}portal${/}cms${/}conf</attribute>
- <attribute name="IdentitySessionFactory">java:/portal/IdentitySessionFactory</attribute>
<attribute name="Config">
<Repository>
<!--
@@ -466,6 +465,12 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ <!--
+ NOTE: cmsRootUserName denotes a single Portal user that has access to everything in the CMS. Denote this user
+ carefully and should be synonymous to the 'root' user in a Unix system. By default: this value is the built-in
+ 'admin' user account. This can be changed to any other user account registered in your Portal
+ -->
+ <attribute name="CmsRootUserName">admin</attribute>
<depends optional-attribute-name="IdentityServiceController" proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>
</mbean>
16 years, 7 months
JBoss Portal SVN: r9135 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-11-27 13:41:46 -0500 (Tue, 27 Nov 2007)
New Revision: 9135
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
Log:
- JBPORTAL-1566: improved handling of WSDL status. Perfect handling would require database update which is deffered for 2.8.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2007-11-27 17:48:07 UTC (rev 9134)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2007-11-27 18:41:46 UTC (rev 9135)
@@ -75,6 +75,7 @@
/** Whether we're using information from a WSDL or not. */
private boolean usingWSDL = true;
+ private boolean isModifiedWSDL;
// todo: public for tests
public EndpointConfigurationInfo()
@@ -106,9 +107,14 @@
public boolean usesWSDL()
{
- return usingWSDL;
+ return (isWSDLNotNullAndSet() && !isModifiedWSDL) || usingWSDL;
}
+ public void setUsesWSDL(boolean useWSDL)
+ {
+ usingWSDL = useWSDL;
+ }
+
public String getWsdlDefinitionURL()
{
if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
@@ -199,25 +205,46 @@
// WSDL url is optional so can be null (and in particular, it is when loaded from Hibernate most of the time)
// do not attempt to set the URL if the service factory hasn't been created yet to avoid issues when
// ConsumerRegistry starts (in particular, raising an exception if the WSDL is not available)
- if (wsdlDefinitionURL != null && !UNSET.equals(wsdlDefinitionURL) && serviceFactory != null)
+ if (isWSDLNotNullAndSet())
{
usingWSDL = true;
- if (!(serviceFactory instanceof RemoteSOAPInvokerServiceFactory))
+ if (serviceFactory != null)
{
- serviceFactory = new RemoteSOAPInvokerServiceFactory();
+ if (!(serviceFactory instanceof RemoteSOAPInvokerServiceFactory))
+ {
+ serviceFactory = new RemoteSOAPInvokerServiceFactory();
+ }
+ internalSetWsdlURL();
}
- internalSetWsdlURL();
}
+ else
+ {
+ usingWSDL = false;
+ }
}
+ private boolean isWSDLNotNullAndSet()
+ {
+ return persistentWsdlDefinitionURL != null && !UNSET.equals(persistentWsdlDefinitionURL);
+ }
+
private String modifyIfNeeded(String oldValue, String newValue, int whichURL)
{
if ((oldValue != null && !oldValue.equals(newValue)) || (oldValue == null && newValue != null))
{
+ if (usesWSDL())
+ {
+ if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
+ {
+ isModifiedWSDL = true;
+ }
+
+ usingWSDL = false;
+ }
+
oldValue = newValue;
clean.clear(whichURL);
- usingWSDL = false;
}
return oldValue;
@@ -227,7 +254,7 @@
{
if (serviceFactory == null)
{
- if (usesWSDL() && !UNSET.equals(persistentWsdlDefinitionURL))
+ if (usesWSDL())
{
serviceFactory = new RemoteSOAPInvokerServiceFactory();
internalSetWsdlURL();
@@ -288,6 +315,7 @@
persistentServiceDescriptionURL = serviceFactory.getServiceDescriptionURL();
clean.set(0, 4); // if setting the WSDL URL worked, consider everything clean
+ isModifiedWSDL = false;
}
catch (Exception e)
{
16 years, 7 months
JBoss Portal SVN: r9134 - branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-27 12:48:07 -0500 (Tue, 27 Nov 2007)
New Revision: 9134
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PageImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
Log:
Copy to dashboard bug
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2007-11-27 17:00:45 UTC (rev 9133)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2007-11-27 17:48:07 UTC (rev 9134)
@@ -104,6 +104,7 @@
ContextImpl clone = new ContextImpl();
clone.setDeclaredPropertyMap(new HashMap(getDeclaredPropertyMap()));
clone.setListener(getListener());
+ clone.setDisplayName(getDisplayName());
return clone;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PageImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PageImpl.java 2007-11-27 17:00:45 UTC (rev 9133)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PageImpl.java 2007-11-27 17:48:07 UTC (rev 9134)
@@ -103,6 +103,7 @@
PageImpl clone = new PageImpl();
clone.setDeclaredPropertyMap(new HashMap(getDeclaredPropertyMap()));
clone.setListener(getListener());
+ clone.setDisplayName(getDisplayName());
return clone;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalImpl.java 2007-11-27 17:00:45 UTC (rev 9133)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalImpl.java 2007-11-27 17:48:07 UTC (rev 9134)
@@ -127,6 +127,7 @@
clone.setModes(new HashSet(getModes()));
clone.setDeclaredPropertyMap(new HashMap(getDeclaredPropertyMap()));
clone.setListener(getListener());
+ clone.setDisplayName(getDisplayName());
return clone;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-11-27 17:00:45 UTC (rev 9133)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-11-27 17:48:07 UTC (rev 9134)
@@ -170,7 +170,14 @@
public LocalizedString getDisplayName()
{
- return new LocalizedString(displayNames, Locale.ENGLISH);
+ if (displayNames != null)
+ {
+ return new LocalizedString(displayNames, Locale.ENGLISH);
+ }
+ else
+ {
+ return null;
+ }
}
public PortalObject copy(PortalObject parent, String name, boolean deep) throws DuplicatePortalObjectException, IllegalArgumentException
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-11-27 17:00:45 UTC (rev 9133)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-11-27 17:48:07 UTC (rev 9134)
@@ -154,6 +154,7 @@
clone.setURI(uri);
clone.setDeclaredPropertyMap(new HashMap(getDeclaredPropertyMap()));
clone.setListener(getListener());
+ clone.setDisplayName(getDisplayName());
return clone;
}
16 years, 7 months
JBoss Portal SVN: r9133 - in branches/presentation: presentation/src/main/org/jboss/portal/presentation/model/state/structural and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-27 12:00:45 -0500 (Tue, 27 Nov 2007)
New Revision: 9133
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
Log:
works better with an object id specified :-)
Modified: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 16:59:31 UTC (rev 9132)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 17:00:45 UTC (rev 9133)
@@ -172,7 +172,7 @@
throw new StateChangeVetoException();
}
- public void update(Map<String, String> properties) throws StateChangeVetoException
+ public void update(String objectId, Map<String, String> properties) throws StateChangeVetoException
{
throw new StateChangeVetoException();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 16:59:31 UTC (rev 9132)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 17:00:45 UTC (rev 9133)
@@ -53,6 +53,6 @@
void move(String objectId, String parentId) throws StateChangeVetoException;
- void update(Map<String, String> properties) throws StateChangeVetoException;
+ void update(String objectId, Map<String, String> properties) throws StateChangeVetoException;
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 16:59:31 UTC (rev 9132)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 17:00:45 UTC (rev 9133)
@@ -195,7 +195,7 @@
throw new StateChangeVetoException();
}
- public void update(Map<String, String> properties) throws StateChangeVetoException
+ public void update(String objectId, Map<String, String> properties) throws StateChangeVetoException
{
throw new StateChangeVetoException();
}
16 years, 7 months
JBoss Portal SVN: r9132 - in branches/presentation: presentation/src/main/org/jboss/portal/presentation/client/controller and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-27 11:59:31 -0500 (Tue, 27 Nov 2007)
New Revision: 9132
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
Log:
- forgot to add state update in StructuralStateManager
Modified: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 16:55:35 UTC (rev 9131)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 16:59:31 UTC (rev 9132)
@@ -82,7 +82,7 @@
/**
*
*/
- public ObjectState loadState(String objectId) throws IllegalArgumentException
+ public ObjectState load(String objectId) throws IllegalArgumentException
{
ObjectState objectState = null;
@@ -157,7 +157,7 @@
return type;
}
- public ObjectState createState(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
+ public ObjectState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
{
throw new StateChangeVetoException();
}
@@ -172,6 +172,11 @@
throw new StateChangeVetoException();
}
+ public void update(Map<String, String> properties) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
+
/**
*
*
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java 2007-11-27 16:55:35 UTC (rev 9131)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java 2007-11-27 16:59:31 UTC (rev 9132)
@@ -307,7 +307,7 @@
String token = st.nextToken();
buffer.append(token);
String id = buffer.toString();
- ObjectState objectState = this.presentationServer.getStructuralStateManager().loadState(id);
+ ObjectState objectState = this.presentationServer.getStructuralStateManager().load(id);
if(objectState != null && objectState.getType() == UIPortal.class)
{
targetPortal = (UIPortal)requestContext.getUIContext().getObject(id);
@@ -336,7 +336,7 @@
String token = st.nextToken();
buffer.append(token);
String id = buffer.toString();
- ObjectState objectState = this.presentationServer.getStructuralStateManager().loadState(id);
+ ObjectState objectState = this.presentationServer.getStructuralStateManager().load(id);
if(objectState != null)
{
if(objectState.getType() == UIPage.class)
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-11-27 16:55:35 UTC (rev 9131)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-11-27 16:59:31 UTC (rev 9132)
@@ -56,7 +56,7 @@
private static ObjectState getRootState(StructuralStateManager loader)
{
- return loader.loadState(loader.getRootId());
+ return loader.load(loader.getRootId());
}
public UIContextImpl(StructuralStateManager structuralStateManager)
@@ -81,7 +81,7 @@
if (object == null)
{
//Fetch the state of the UIObject in question
- ObjectState objectState = this.structuralStateManager.loadState(id);
+ ObjectState objectState = this.structuralStateManager.load(id);
object = getImplementation(id, objectState);
objects.put(id, object);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 16:55:35 UTC (rev 9131)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 16:59:31 UTC (rev 9132)
@@ -270,7 +270,7 @@
// ((UIObjectImpl)child).id = this.generateChildId(name);
//
// //State
-// ((UIObjectImpl)child).state = this.getUIContext().getStructuralStateManager().loadState(((UIObjectImpl)child).id);
+// ((UIObjectImpl)child).state = this.getUIContext().getStructuralStateManager().load(((UIObjectImpl)child).id);
//
// this.children.add(child);
//
@@ -312,7 +312,7 @@
// //Parent..load using parentId from state being used
// if(loadParent && state.getParentId() != null && state.getParentId().trim().length()>0)
// {
-// ObjectState parentState = uiContext.getStructuralStateManager().loadState(state.getParentId());
+// ObjectState parentState = uiContext.getStructuralStateManager().load(state.getParentId());
// this.parent = uiContext.getObject(state.getParentId(), parentState.getType());
// }
//
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 16:55:35 UTC (rev 9131)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 16:59:31 UTC (rev 9132)
@@ -43,14 +43,16 @@
* @return the state of the object or null if such state does not exist
* @throws IllegalArgumentException if the object id argument is null
*/
- ObjectState loadState(String objectId) throws IllegalArgumentException;
+ ObjectState load(String objectId) throws IllegalArgumentException;
String getRootId();
- ObjectState createState(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException;
+ ObjectState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException;
void destroy(String objectId) throws StateChangeVetoException;
void move(String objectId, String parentId) throws StateChangeVetoException;
+ void update(Map<String, String> properties) throws StateChangeVetoException;
+
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 16:55:35 UTC (rev 9131)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 16:59:31 UTC (rev 9132)
@@ -53,7 +53,7 @@
return context;
}
- public ObjectState loadState(String objectId) throws IllegalArgumentException
+ public ObjectState load(String objectId) throws IllegalArgumentException
{
if (objectId == null)
{
@@ -180,7 +180,7 @@
}
}
- public ObjectState createState(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
+ public ObjectState create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
{
throw new StateChangeVetoException();
}
@@ -194,4 +194,9 @@
{
throw new StateChangeVetoException();
}
+
+ public void update(Map<String, String> properties) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
}
16 years, 7 months
JBoss Portal SVN: r9131 - in branches/presentation: presentation/src/main/org/jboss/portal/presentation/model/state and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-27 11:55:35 -0500 (Tue, 27 Nov 2007)
New Revision: 9131
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java
Removed:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
Log:
- added StateChangeVetoException for signaling a non possible state change
- added state modifying operations on StructuralStateManager although those for now throw StateChangeVetoException at the moment
Deleted: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-27 16:55:27 UTC (rev 9130)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-27 16:55:35 UTC (rev 9131)
@@ -1,179 +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.presentation.model;
-
-import java.util.StringTokenizer;
-import java.util.Map;
-import java.util.List;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-import org.jboss.portal.presentation.model.UIObject;
-import org.jboss.portal.presentation.model.UIPortal;
-import org.jboss.portal.presentation.model.UIPage;
-import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.ModelLoader;
-import org.jboss.portal.presentation.model.state.ObjectState;
-
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.PortalContainer;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.PortalObjectPath;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Portal;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class ModelLoaderImpl implements ModelLoader
-{
- /**
- *
- */
- private PortalObjectContainer portalObjectContainer = null;
-
- /**
- *
- * @return
- */
- public PortalObjectContainer getPortalObjectContainer()
- {
- return portalObjectContainer;
- }
-
- /**
- *
- * @param portalObjectContainer
- */
- public void setPortalObjectContainer(
- PortalObjectContainer portalObjectContainer)
- {
- this.portalObjectContainer = portalObjectContainer;
- }
-
-
- public String getRootId()
- {
- return portalObjectContainer.getContext().getId().toString();
- }
-
- /**
- *
- */
- public ObjectState loadState(String objectId) throws IllegalArgumentException
- {
- ObjectState objectState = null;
-
- // Get the PortalObject corresponding to this objectId from the PortalObjectContainer
- PortalObject portalObject = this.portalObjectContainer.getObject(PortalObjectId.parse(objectId,
- PortalObjectPath.CANONICAL_FORMAT));
-
- if(portalObject == null)
- {
- // Object by this id was not found in the Portal
- return null;
- }
-
- // Type
- Class<? extends UIObject> type = this.getType(portalObject);
-
- // Name
- String name = portalObject.getName();
-
- // Properties
- Map<String, String> properties = portalObject.getDeclaredProperties();
-
- // Parent Id
- String parentId = null;
- if(portalObject.getParent() != null)
- {
- parentId = portalObject.getParent().getId().toString();
- }
-
- //Children Ids
- List<String> childrenIds = new ArrayList<String>();
- Collection children = portalObject.getChildren();
- for(Iterator itr=children.iterator(); itr.hasNext();)
- {
- PortalObject child = (PortalObject)itr.next();
- childrenIds.add(child.getId().toString());
- }
-
- objectState = new ObjectState(
- type, //type
- name,
- properties, //properties
- parentId,
- childrenIds // childrenIds
- );
-
- return objectState;
- }
-
- /**
- *
- * @param portalObject
- * @return
- */
- private Class<? extends UIObject> getType(PortalObject portalObject)
- {
- Class<? extends UIObject> type = null;
-
- if(portalObject instanceof Portal)
- {
- type = UIPortal.class;
- }
- else if(portalObject instanceof Page)
- {
- type = UIPage.class;
- }
- else if(portalObject instanceof Window)
- {
- type = UIWindow.class;
- }
-
- return type;
- }
-
- /**
- *
- *
- */
- public void start()
- {
-
- }
-
- /**
- *
- *
- */
- public void stop()
- {
-
- }
-}
Modified: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 16:55:27 UTC (rev 9130)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-27 16:55:35 UTC (rev 9131)
@@ -22,26 +22,26 @@
******************************************************************************/
package org.jboss.portal.core.presentation.model;
-import java.util.Map;
-import java.util.List;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.ArrayList;
-
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIPortal;
-import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.state.structural.ObjectState;
import org.jboss.portal.presentation.model.state.structural.StructuralStateManager;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.PortalObjectPath;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Portal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -156,7 +156,22 @@
return type;
}
-
+
+ public ObjectState createState(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
+
+ public void destroy(String objectId) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
+
+ public void move(String objectId, String parentId) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
+
/**
*
*
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeVetoException.java 2007-11-27 16:55:35 UTC (rev 9131)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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.presentation.model.state;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StateChangeVetoException extends Exception
+{
+ public StateChangeVetoException()
+ {
+ }
+
+ public StateChangeVetoException(String s)
+ {
+ super(s);
+ }
+
+ public StateChangeVetoException(String s, Throwable throwable)
+ {
+ super(s, throwable);
+ }
+
+ public StateChangeVetoException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 16:55:27 UTC (rev 9130)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 16:55:35 UTC (rev 9131)
@@ -22,6 +22,11 @@
******************************************************************************/
package org.jboss.portal.presentation.model.state.structural;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+
+import java.util.Map;
+
/**
* The structural state manager.
*
@@ -42,4 +47,10 @@
String getRootId();
+ ObjectState createState(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException;
+
+ void destroy(String objectId) throws StateChangeVetoException;
+
+ void move(String objectId, String parentId) throws StateChangeVetoException;
+
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 16:55:27 UTC (rev 9130)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-11-27 16:55:35 UTC (rev 9131)
@@ -24,6 +24,8 @@
import org.jboss.portal.presentation.model.state.structural.StructuralStateManager;
import org.jboss.portal.presentation.model.state.structural.ObjectState;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.UIObject;
import java.util.ArrayList;
import java.util.HashMap;
@@ -177,4 +179,19 @@
}
}
}
+
+ public ObjectState createState(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
+
+ public void destroy(String objectId) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
+
+ public void move(String objectId, String parentId) throws StateChangeVetoException
+ {
+ throw new StateChangeVetoException();
+ }
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-11-27 16:55:27 UTC (rev 9130)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-11-27 16:55:35 UTC (rev 9131)
@@ -25,10 +25,6 @@
import junit.framework.TestCase;
import org.apache.log4j.Logger;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
import org.jboss.portal.presentation.model.*;
import org.jboss.portal.presentation.impl.model.UIContextImpl;
@@ -46,7 +42,7 @@
*/
protected void setUp() throws Exception
{
- this.uiContext = new UIContextImpl(new MockModelLoaderImpl());
+ this.uiContext = new UIContextImpl(new MockModel());
}
/**
16 years, 7 months
JBoss Portal SVN: r9130 - branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-11-27 11:55:27 -0500 (Tue, 27 Nov 2007)
New Revision: 9130
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
Log:
fixing NPE when deleting a page on the dashboard
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-11-27 16:37:49 UTC (rev 9129)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-11-27 16:55:27 UTC (rev 9130)
@@ -112,7 +112,7 @@
private void refresh()
{
- // Create page manager if it doees not exit
+ // Create page manager if it does not exit
if (pageManager == null)
{
pageManager = new PageManagerBean(layoutService, new PortletDefinitionInvoker(instanceContainer));
@@ -129,7 +129,7 @@
return;
}
- // Page for editting
+ // Page for editing
if (selectedPageName != null)
{
pageManager.page = userPortal.getPage(selectedPageName);
@@ -147,7 +147,7 @@
defaultPageName = PortalObject.DEFAULT_OBJECT_NAME;
}
selectePageIsDefault = selectedPageName.equals(defaultPageName);
-
+
//
Collection pages = userPortal.getChildren(PortalObject.PAGE_MASK);
pageItems = new SelectItem[pages.size()];
@@ -198,7 +198,14 @@
try
{
userPortal.destroyChild(selectedPageName);
- selectedPageName = null;
+
+ // Fallback to default page
+ String defaultPageName = pageManager.page.getProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
+ if (defaultPageName == null)
+ {
+ defaultPageName = PortalObject.DEFAULT_OBJECT_NAME;
+ }
+ selectedPageName = defaultPageName;
}
catch (NoSuchPortalObjectException e)
{
16 years, 7 months
JBoss Portal SVN: r9129 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation: model and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-27 11:37:49 -0500 (Tue, 27 Nov 2007)
New Revision: 9129
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateScopeType.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/content/WindowContent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
Log:
better categorization of the different type of state scopes
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 16:28:30 UTC (rev 9128)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-27 16:37:49 UTC (rev 9129)
@@ -132,13 +132,13 @@
Map map;
switch (scopeType)
{
- case TRANSIENT:
+ case CONTENT:
map = transientState;
break;
case NAVIGATIONAL:
map = navigationalState;
break;
- case PERSISTENT:
+ case STRUCTURAL:
map = state.getProperties();
break;
default:
@@ -157,13 +157,13 @@
Map map;
switch (scopeType)
{
- case TRANSIENT:
+ case CONTENT:
map = transientState;
break;
case NAVIGATIONAL:
map = navigationalState;
break;
- case PERSISTENT:
+ case STRUCTURAL:
throw new NotYetImplemented();
default:
throw new AssertionError();
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-27 16:28:30 UTC (rev 9128)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-27 16:37:49 UTC (rev 9129)
@@ -44,12 +44,12 @@
public WindowContent getContent()
{
- return getProperty(StateScopeType.TRANSIENT, "content", WindowContent.class);
+ return getProperty(StateScopeType.CONTENT, "content", WindowContent.class);
}
public void setContent(WindowContent windowContent)
{
- setProperty(StateScopeType.TRANSIENT, "content", windowContent);
+ setProperty(StateScopeType.CONTENT, "content", windowContent);
}
/**
@@ -74,7 +74,7 @@
public void setMode(Mode mode)
{
setProperty(StateScopeType.NAVIGATIONAL, "mode", mode);
- setProperty(StateScopeType.TRANSIENT, "content", null);
+ setProperty(StateScopeType.CONTENT, "content", null);
}
/**
@@ -83,7 +83,7 @@
public void setWindowState(WindowState windowState)
{
setProperty(StateScopeType.NAVIGATIONAL, "windowstate", windowState);
- setProperty(StateScopeType.TRANSIENT, "content", null);
+ setProperty(StateScopeType.CONTENT, "content", null);
}
public Object getContentState()
@@ -94,7 +94,7 @@
public void setContentState(Object contentState)
{
setProperty(StateScopeType.NAVIGATIONAL, "content", contentState);
- setProperty(StateScopeType.TRANSIENT, "content", null);
+ setProperty(StateScopeType.CONTENT, "content", null);
}
/**
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateScopeType.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateScopeType.java 2007-11-27 16:28:30 UTC (rev 9128)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateScopeType.java 2007-11-27 16:37:49 UTC (rev 9129)
@@ -29,17 +29,20 @@
public enum StateScopeType
{
/**
- * The transient scope type.
+ * The content scope type. The content scope defines state which can be stored in the model for convenience but can
+ * always be computed again.
*/
- TRANSIENT,
+ CONTENT,
/**
- * The navigational scope type.
+ * The navigational scope type. The navigational scope describe the a kind of change done at runtime by the user when it
+ * interacts with the model (i.e not all interactions with the model are automatically navigational state changes).
*/
NAVIGATIONAL,
/**
- * The persistent scope type.
+ * The structural scope type. The structural scope describe the structure of the model, i.e it defines an enduring
+ * state managed by the presentation server.
*/
- PERSISTENT
+ STRUCTURAL
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/content/WindowContent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/content/WindowContent.java 2007-11-27 16:28:30 UTC (rev 9128)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/content/WindowContent.java 2007-11-27 16:37:49 UTC (rev 9129)
@@ -23,6 +23,8 @@
package org.jboss.portal.presentation.model.state.content;
/**
+ * The content of a window.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 16:28:30 UTC (rev 9128)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-27 16:37:49 UTC (rev 9129)
@@ -22,9 +22,9 @@
******************************************************************************/
package org.jboss.portal.presentation.model.state.structural;
-import org.jboss.portal.presentation.model.state.structural.ObjectState;
-
/**
+ * The structural state manager.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-11-27 16:28:30 UTC (rev 9128)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-11-27 16:37:49 UTC (rev 9129)
@@ -194,45 +194,45 @@
//
UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name", String.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name", Object.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.PERSISTENT, "foo_name", Float.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", String.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Object.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name"));
+ assertEquals(null, foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Float.class));
assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Object.class));
assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name"));
assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Float.class));
- assertEquals(null, foo.getProperty(StateScopeType.TRANSIENT, "foo_name", Object.class));
- assertEquals(null, foo.getProperty(StateScopeType.TRANSIENT, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.TRANSIENT, "foo_name", Float.class));
+ assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Object.class));
+ assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name"));
+ assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Float.class));
//
foo.setProperty(StateScopeType.NAVIGATIONAL, "foo_name", 0);
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name", String.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name", Object.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.PERSISTENT, "foo_name", Float.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", String.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Object.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name"));
+ assertEquals(null, foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Float.class));
assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Object.class));
assertEquals(new Integer(0), foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Integer.class));
assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name"));
assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Float.class));
- assertEquals(null, foo.getProperty(StateScopeType.TRANSIENT, "foo_name", Object.class));
- assertEquals(null, foo.getProperty(StateScopeType.TRANSIENT, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.TRANSIENT, "foo_name", Float.class));
+ assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Object.class));
+ assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name"));
+ assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Float.class));
//
- foo.setProperty(StateScopeType.TRANSIENT, "foo_name", true);
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name", String.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name", Object.class));
- assertEquals("foo_value", foo.getProperty(StateScopeType.PERSISTENT, "foo_name"));
- assertEquals(null, foo.getProperty(StateScopeType.PERSISTENT, "foo_name", Float.class));
+ foo.setProperty(StateScopeType.CONTENT, "foo_name", true);
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", String.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Object.class));
+ assertEquals("foo_value", foo.getProperty(StateScopeType.STRUCTURAL, "foo_name"));
+ assertEquals(null, foo.getProperty(StateScopeType.STRUCTURAL, "foo_name", Float.class));
assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Object.class));
assertEquals(new Integer(0), foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Integer.class));
assertEquals(0, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name"));
assertEquals(null, foo.getProperty(StateScopeType.NAVIGATIONAL, "foo_name", Float.class));
- assertEquals(true, foo.getProperty(StateScopeType.TRANSIENT, "foo_name", Object.class));
- assertEquals(true, foo.getProperty(StateScopeType.TRANSIENT, "foo_name"));
- assertEquals(Boolean.TRUE, foo.getProperty(StateScopeType.TRANSIENT, "foo_name", Boolean.class));
- assertEquals(null, foo.getProperty(StateScopeType.TRANSIENT, "foo_name", Float.class));
+ assertEquals(true, foo.getProperty(StateScopeType.CONTENT, "foo_name", Object.class));
+ assertEquals(true, foo.getProperty(StateScopeType.CONTENT, "foo_name"));
+ assertEquals(Boolean.TRUE, foo.getProperty(StateScopeType.CONTENT, "foo_name", Boolean.class));
+ assertEquals(null, foo.getProperty(StateScopeType.CONTENT, "foo_name", Float.class));
//
}
16 years, 7 months