You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2007/10/04 19:59:44 UTC
svn commit: r581978 -
/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/
Author: apetrelli
Date: Thu Oct 4 10:59:41 2007
New Revision: 581978
URL: http://svn.apache.org/viewvc?rev=581978&view=rev
Log:
TILES-209
Modified "equals" method of param/header/attribute maps for portlets.
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletApplicationScopeMap.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletInitParamMap.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamMap.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamValuesMap.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletRequestScopeMap.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletSessionScopeMap.java
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletApplicationScopeMap.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletApplicationScopeMap.java?rev=581978&r1=581977&r2=581978&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletApplicationScopeMap.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletApplicationScopeMap.java Thu Oct 4 10:59:41 2007
@@ -108,8 +108,21 @@
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
public boolean equals(Object o) {
- return (context.equals(o));
+ PortletContext otherContext = ((PortletApplicationScopeMap) o).context;
+ boolean retValue = true;
+ synchronized (context) {
+ for (Enumeration<String> attribs = context.getAttributeNames(); attribs
+ .hasMoreElements()
+ && retValue;) {
+ String parameterName = attribs.nextElement();
+ retValue = context.getAttribute(parameterName).equals(
+ otherContext.getAttribute(parameterName));
+ }
+ }
+
+ return retValue;
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletInitParamMap.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletInitParamMap.java?rev=581978&r1=581977&r2=581978&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletInitParamMap.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletInitParamMap.java Thu Oct 4 10:59:41 2007
@@ -99,8 +99,21 @@
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
public boolean equals(Object o) {
- return (context.equals(o));
+ PortletContext otherContext = ((PortletInitParamMap) o).context;
+ boolean retValue = true;
+ synchronized (context) {
+ for (Enumeration<String> attribs = context.getInitParameterNames(); attribs
+ .hasMoreElements()
+ && retValue;) {
+ String parameterName = attribs.nextElement();
+ retValue = context.getInitParameter(parameterName).equals(
+ otherContext.getInitParameter(parameterName));
+ }
+ }
+
+ return retValue;
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamMap.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamMap.java?rev=581978&r1=581977&r2=581978&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamMap.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamMap.java Thu Oct 4 10:59:41 2007
@@ -100,8 +100,21 @@
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
public boolean equals(Object o) {
- return (request.equals(o));
+ PortletRequest otherRequest = ((PortletParamMap) o).request;
+ boolean retValue = true;
+ synchronized (request) {
+ for (Enumeration<String> attribs = request.getParameterNames(); attribs
+ .hasMoreElements()
+ && retValue;) {
+ String parameterName = attribs.nextElement();
+ retValue = request.getParameter(parameterName).equals(
+ otherRequest.getParameter(parameterName));
+ }
+ }
+
+ return retValue;
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamValuesMap.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamValuesMap.java?rev=581978&r1=581977&r2=581978&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamValuesMap.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletParamValuesMap.java Thu Oct 4 10:59:41 2007
@@ -21,12 +21,19 @@
package org.apache.tiles.portlet.context;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import javax.portlet.PortletRequest;
import org.apache.tiles.context.MapEntry;
-import java.util.*;
-
/**
* <p>Private implementation of <code>Map</code> for portlet parameter
@@ -108,8 +115,21 @@
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
public boolean equals(Object o) {
- return (request.equals(o));
+ PortletRequest otherRequest = ((PortletParamValuesMap) o).request;
+ boolean retValue = true;
+ synchronized (request) {
+ for (Enumeration<String> attribs = request.getParameterNames(); attribs
+ .hasMoreElements()
+ && retValue;) {
+ String parameterName = attribs.nextElement();
+ retValue = request.getParameterValues(parameterName).equals(
+ otherRequest.getParameterValues(parameterName));
+ }
+ }
+
+ return retValue;
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletRequestScopeMap.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletRequestScopeMap.java?rev=581978&r1=581977&r2=581978&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletRequestScopeMap.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletRequestScopeMap.java Thu Oct 4 10:59:41 2007
@@ -108,8 +108,21 @@
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
public boolean equals(Object o) {
- return (request.equals(o));
+ PortletRequest otherRequest = ((PortletRequestScopeMap) o).request;
+ boolean retValue = true;
+ synchronized (request) {
+ for (Enumeration<String> attribs = request.getAttributeNames(); attribs
+ .hasMoreElements()
+ && retValue;) {
+ String attributeName = attribs.nextElement();
+ retValue = request.getAttribute(attributeName).equals(
+ otherRequest.getAttribute(attributeName));
+ }
+ }
+
+ return retValue;
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletSessionScopeMap.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletSessionScopeMap.java?rev=581978&r1=581977&r2=581978&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletSessionScopeMap.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletSessionScopeMap.java Thu Oct 4 10:59:41 2007
@@ -109,8 +109,21 @@
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
public boolean equals(Object o) {
- return (session.equals(o));
+ PortletSession otherSession = ((PortletSessionScopeMap) o).session;
+ boolean retValue = true;
+ synchronized (session) {
+ for (Enumeration<String> attribs = session.getAttributeNames(); attribs
+ .hasMoreElements()
+ && retValue;) {
+ String attributeName = attribs.nextElement();
+ retValue = session.getAttribute(attributeName).equals(
+ otherSession.getAttribute(attributeName));
+ }
+ }
+
+ return retValue;
}