Author: julien(a)jboss.com
Date: 2007-11-27 19:41:54 -0500 (Tue, 27 Nov 2007)
New Revision: 9141
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/DuplicateStateException.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/NoSuchStateException.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateException.java
Removed:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/ObjectState.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
Log:
- added a bunch of state exceptions
- completed javadoc for structural state manager CRUD operations
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-28
00:40:25 UTC (rev 9140)
+++
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateManagerImpl.java 2007-11-28
00:41:54 UTC (rev 9141)
@@ -172,7 +172,7 @@
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();
}
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/DuplicateStateException.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/DuplicateStateException.java
(rev 0)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/DuplicateStateException.java 2007-11-28
00:41:54 UTC (rev 9141)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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 DuplicateStateException extends StateException
+{
+}
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/NoSuchStateException.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/NoSuchStateException.java
(rev 0)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/NoSuchStateException.java 2007-11-28
00:41:54 UTC (rev 9141)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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 NoSuchStateException extends StateException
+{
+}
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateException.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateException.java
(rev 0)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateException.java 2007-11-28
00:41:54 UTC (rev 9141)
@@ -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 StateException extends RuntimeException
+{
+ public StateException()
+ {
+ }
+
+ public StateException(String s)
+ {
+ super(s);
+ }
+
+ public StateException(String s, Throwable throwable)
+ {
+ super(s, throwable);
+ }
+
+ public StateException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
Deleted:
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/ObjectState.java 2007-11-28
00:40:25 UTC (rev 9140)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/ObjectState.java 2007-11-28
00:41:54 UTC (rev 9141)
@@ -1,86 +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.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 ObjectState 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 ObjectState(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-28
00:40:25 UTC (rev 9140)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateManager.java 2007-11-28
00:41:54 UTC (rev 9141)
@@ -24,6 +24,8 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.NoSuchStateException;
import java.util.Map;
@@ -45,14 +47,65 @@
*/
StructuralState load(String objectId) throws IllegalArgumentException;
+ /**
+ * Returns the id of the root object.
+ *
+ * @return the id of the root object.
+ */
String getRootId();
- StructuralState create(String parentId, Class<? extends UIObject> type, String
name, Map<String, String> properties) throws StateChangeVetoException;
+ /**
+ * Create an object.
+ *
+ * @param parentId the id of the parent object
+ * @param type the type of the child
+ * @param name the name of the child
+ * @param properties the initial properties of the child
+ * @return the structural state of the child
+ * @throws StateChangeVetoException if the creation is vetoed
+ * @throws StateException a generic state exception
+ * @throws NoSuchStateException if the parent id does not point a valid state
+ * @throws IllegalArgumentException if an argument is null or not valid
+ */
+ StructuralState create(String parentId, Class<? extends UIObject> type, String
name, Map<String, String> properties) throws StateChangeVetoException,
StateException, IllegalArgumentException;
- void destroy(String objectId) throws StateChangeVetoException;
+ /**
+ * Destroy a specified object.
+ *
+ * @param objectId the object id to destroy
+ * @throws StateChangeVetoException if the creation is vetoed
+ * @throws StateException a generic state exception
+ * @throws NoSuchStateException if the object id does not point a valid state
+ * @throws IllegalArgumentException if an argument is null or not valid
+ */
+ void destroy(String objectId) throws StateChangeVetoException, StateException,
IllegalArgumentException;
- void move(String objectId, String parentId) throws StateChangeVetoException;
+ /**
+ * Move an object to a new parent.
+ *
+ * @param objectId the object id to move
+ * @param parentId the id of the new parent
+ * @throws StateChangeVetoException if the creation is vetoed
+ * @throws StateException a generic state exception
+ * @throws NoSuchStateException if the object id does not point a valid state
+ * @throws IllegalArgumentException if an argument is null or not valid
+ */
+ void move(String objectId, String parentId) throws StateChangeVetoException,
StateException, IllegalArgumentException;
- void update(String objectId, Map<String, String> properties) throws
StateChangeVetoException;
+ /**
+ * Update the state of a specified object. The <code>Map</code> values are
interpreted as follow:
+ * <ul>
+ * <li>Each non null value will replace an existing value of create a new
one</li>
+ * <li>Each null value will destroy an existing value</li>
+ * </ul>
+ *
+ * @param objectId the id of the object to udpate
+ * @param changes the changes
+ * @throws StateChangeVetoException if the creation is vetoed
+ * @throws StateException a generic state exception
+ * @throws NoSuchStateException if the object id does not point a valid state
+ * @throws IllegalArgumentException if an argument is null or not valid
+ */
+ void update(String objectId, Map<String, String> changes) throws
StateChangeVetoException, StateException, IllegalArgumentException;
}