Author: julien(a)jboss.com
Date: 2007-04-25 11:57:31 -0400 (Wed, 25 Apr 2007)
New Revision: 7048
Added:
trunk/core/src/main/org/jboss/portal/core/navstate/
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateChange.java
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateKey.java
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateObjectChange.java
Removed:
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateContext.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateKey.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java
Log:
renamed o.j.p.core.ns to o.j.p.core.navstate
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -45,9 +45,9 @@
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
-import org.jboss.portal.core.ns.NavigationalStateChange;
-import org.jboss.portal.core.ns.NavigationalStateObjectChange;
-import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.navstate.NavigationalStateChange;
+import org.jboss.portal.core.navstate.NavigationalStateObjectChange;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.core.theme.WindowRendition;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -23,7 +23,7 @@
package org.jboss.portal.core.impl.api;
import org.jboss.portal.api.navstate.NavigationalStateContext;
-import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.Mode;
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -40,7 +40,7 @@
import org.jboss.portal.core.controller.ResourceAccessDeniedException;
import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.core.theme.WindowRendition;
import org.jboss.portal.core.aspects.portlet.AjaxInterceptor;
import org.jboss.portal.server.config.ServerConfig;
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -36,7 +36,7 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.impl.model.content.InternalContentProvider;
-import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.core.theme.WindowRendition;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.StateString;
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -33,7 +33,7 @@
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.portlet.impl.PortletRequestDecoder;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.servlet.PathMapping;
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -33,7 +33,7 @@
import org.jboss.portal.core.model.portal.command.action.InvokeWindowCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
-import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.portlet.StateString;
/**
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -22,9 +22,9 @@
******************************************************************************/
package org.jboss.portal.core.model.portal.ns;
-import org.jboss.portal.core.ns.NavigationalStateContext;
-import org.jboss.portal.core.ns.NavigationalStateKey;
-import org.jboss.portal.core.ns.NavigationalStateObjectChange;
+import org.jboss.portal.core.navstate.NavigationalStateContext;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
+import org.jboss.portal.core.navstate.NavigationalStateObjectChange;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
Copied: trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateChange.java
(from rev 7046,
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateChange.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateChange.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.navstate;
+
+/**
+ * Base navigational state change.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class NavigationalStateChange
+{
+}
Copied: trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java
(from rev 7046,
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateContext.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.navstate;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface NavigationalStateContext extends AttributeResolver
+{
+}
Copied: trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateKey.java (from
rev 7046, trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateKey.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateKey.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateKey.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -0,0 +1,96 @@
+/******************************************************************************
+ * 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.navstate;
+
+import java.io.Serializable;
+import java.io.Externalizable;
+
+/**
+ * A key for navigational state.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public final class NavigationalStateKey implements Serializable
+{
+
+ /** The type. */
+ private final Class type;
+
+ /** The id. */
+ private final Object id;
+
+ /**
+ * Construct a new navigational state key.
+ *
+ * @param type the type of state
+ * @param id the id
+ * @throws IllegalArgumentException if any argument is null or the id argument does
not implement either Serializable or Externalizable
+ */
+ public NavigationalStateKey(Class type, Object id)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No type provided");
+ }
+ if (id == null)
+ {
+ throw new IllegalArgumentException("No id provided");
+ }
+ if (id instanceof Serializable == false && id instanceof Externalizable ==
false)
+ {
+ throw new IllegalArgumentException("Id should implement Serializable or
Externalizable");
+ }
+ this.type = type;
+ this.id = id;
+ }
+
+ public Class getType()
+ {
+ return type;
+ }
+
+ public Object getId()
+ {
+ return id;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof NavigationalStateKey)
+ {
+ NavigationalStateKey that = (NavigationalStateKey)obj;
+ return type.equals(that.type) && id.equals(that.id);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return type.hashCode() + id.hashCode();
+ }
+}
Copied:
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateObjectChange.java
(from rev 7046,
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateObjectChange.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/navstate/NavigationalStateObjectChange.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -0,0 +1,115 @@
+/******************************************************************************
+ * 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.navstate;
+
+/**
+ * The change of the navigational state of a single object. If both old and new values
are not null, it denotes
+ * an update. Whenever the old value is null, a creation occured and conversely if the
new value is null, a
+ * destruction occured.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NavigationalStateObjectChange extends NavigationalStateChange
+{
+
+ /** . */
+ public static final int UPDATE = 0;
+
+ /** . */
+ public static final int CREATE = 1;
+
+ /** . */
+ public static final int DESTROY = 2;
+
+ /** . */
+ private final Object oldValue;
+
+ /** . */
+ private final Object newValue;
+
+ /** . */
+ private NavigationalStateKey key;
+
+ private NavigationalStateObjectChange(NavigationalStateKey key, Object oldValue,
Object newValue)
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No key provided");
+ }
+ this.key = key;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+ public int getType()
+ {
+ return oldValue == null ? CREATE : (newValue == null ? DESTROY : UPDATE);
+ }
+
+ public NavigationalStateKey getKey()
+ {
+ return key;
+ }
+
+ public Object getOldValue()
+ {
+ return oldValue;
+ }
+
+ public Object getNewValue()
+ {
+ return newValue;
+ }
+
+ public static NavigationalStateObjectChange newUpdate(NavigationalStateKey key, Object
oldValue, Object newValue)
+ {
+ if (oldValue == null)
+ {
+ throw new IllegalArgumentException("No old value provided");
+ }
+ if (newValue == null)
+ {
+ throw new IllegalArgumentException("No new value provided");
+ }
+ return new NavigationalStateObjectChange(key, oldValue, newValue);
+ }
+
+ public static NavigationalStateObjectChange newCreate(NavigationalStateKey key, Object
newValue)
+ {
+ if (newValue == null)
+ {
+ throw new IllegalArgumentException("No new value provided");
+ }
+ return new NavigationalStateObjectChange(key, null, newValue);
+ }
+
+ public static NavigationalStateObjectChange newDestroy(NavigationalStateKey key,
Object oldValue)
+ {
+ if (oldValue == null)
+ {
+ throw new IllegalArgumentException("No old value provided");
+ }
+ return new NavigationalStateObjectChange(key, oldValue, null);
+ }
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java 2007-04-25
15:56:22 UTC (rev 7047)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -1,33 +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.ns;
-
-/**
- * Base navigational state change.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class NavigationalStateChange
-{
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateContext.java 2007-04-25
15:56:22 UTC (rev 7047)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateContext.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -1,33 +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.ns;
-
-import org.jboss.portal.common.invocation.AttributeResolver;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface NavigationalStateContext extends AttributeResolver
-{
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateKey.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateKey.java 2007-04-25
15:56:22 UTC (rev 7047)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateKey.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -1,96 +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.ns;
-
-import java.io.Serializable;
-import java.io.Externalizable;
-
-/**
- * A key for navigational state.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public final class NavigationalStateKey implements Serializable
-{
-
- /** The type. */
- private final Class type;
-
- /** The id. */
- private final Object id;
-
- /**
- * Construct a new navigational state key.
- *
- * @param type the type of state
- * @param id the id
- * @throws IllegalArgumentException if any argument is null or the id argument does
not implement either Serializable or Externalizable
- */
- public NavigationalStateKey(Class type, Object id)
- {
- if (type == null)
- {
- throw new IllegalArgumentException("No type provided");
- }
- if (id == null)
- {
- throw new IllegalArgumentException("No id provided");
- }
- if (id instanceof Serializable == false && id instanceof Externalizable ==
false)
- {
- throw new IllegalArgumentException("Id should implement Serializable or
Externalizable");
- }
- this.type = type;
- this.id = id;
- }
-
- public Class getType()
- {
- return type;
- }
-
- public Object getId()
- {
- return id;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof NavigationalStateKey)
- {
- NavigationalStateKey that = (NavigationalStateKey)obj;
- return type.equals(that.type) && id.equals(that.id);
- }
- return false;
- }
-
- public int hashCode()
- {
- return type.hashCode() + id.hashCode();
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java 2007-04-25
15:56:22 UTC (rev 7047)
+++
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java 2007-04-25
15:57:31 UTC (rev 7048)
@@ -1,115 +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.ns;
-
-/**
- * The change of the navigational state of a single object. If both old and new values
are not null, it denotes
- * an update. Whenever the old value is null, a creation occured and conversely if the
new value is null, a
- * destruction occured.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class NavigationalStateObjectChange extends NavigationalStateChange
-{
-
- /** . */
- public static final int UPDATE = 0;
-
- /** . */
- public static final int CREATE = 1;
-
- /** . */
- public static final int DESTROY = 2;
-
- /** . */
- private final Object oldValue;
-
- /** . */
- private final Object newValue;
-
- /** . */
- private NavigationalStateKey key;
-
- private NavigationalStateObjectChange(NavigationalStateKey key, Object oldValue,
Object newValue)
- {
- if (key == null)
- {
- throw new IllegalArgumentException("No key provided");
- }
- this.key = key;
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
-
- public int getType()
- {
- return oldValue == null ? CREATE : (newValue == null ? DESTROY : UPDATE);
- }
-
- public NavigationalStateKey getKey()
- {
- return key;
- }
-
- public Object getOldValue()
- {
- return oldValue;
- }
-
- public Object getNewValue()
- {
- return newValue;
- }
-
- public static NavigationalStateObjectChange newUpdate(NavigationalStateKey key, Object
oldValue, Object newValue)
- {
- if (oldValue == null)
- {
- throw new IllegalArgumentException("No old value provided");
- }
- if (newValue == null)
- {
- throw new IllegalArgumentException("No new value provided");
- }
- return new NavigationalStateObjectChange(key, oldValue, newValue);
- }
-
- public static NavigationalStateObjectChange newCreate(NavigationalStateKey key, Object
newValue)
- {
- if (newValue == null)
- {
- throw new IllegalArgumentException("No new value provided");
- }
- return new NavigationalStateObjectChange(key, null, newValue);
- }
-
- public static NavigationalStateObjectChange newDestroy(NavigationalStateKey key,
Object oldValue)
- {
- if (oldValue == null)
- {
- throw new IllegalArgumentException("No old value provided");
- }
- return new NavigationalStateObjectChange(key, oldValue, null);
- }
-}