[seam-commits] Seam SVN: r7779 - trunk/src/main/org/jboss/seam/navigation.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Mar 31 18:24:49 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-03-31 18:24:49 -0400 (Mon, 31 Mar 2008)
New Revision: 7779
Added:
trunk/src/main/org/jboss/seam/navigation/NaturalConversationIdParameter.java
Removed:
trunk/src/main/org/jboss/seam/navigation/ELConversationIdParameter.java
Modified:
trunk/src/main/org/jboss/seam/navigation/Pages.java
Log:
Rename ELConversationIdParameter to NaturalConversationIdParameter (less confusing)
Deleted: trunk/src/main/org/jboss/seam/navigation/ELConversationIdParameter.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/ELConversationIdParameter.java 2008-03-31 22:24:14 UTC (rev 7778)
+++ trunk/src/main/org/jboss/seam/navigation/ELConversationIdParameter.java 2008-03-31 22:24:49 UTC (rev 7779)
@@ -1,85 +0,0 @@
-package org.jboss.seam.navigation;
-
-import java.util.Map;
-
-import org.jboss.seam.core.ConversationPropagation;
-import org.jboss.seam.core.Expressions;
-import org.jboss.seam.core.Expressions.ValueExpression;
-import org.jboss.seam.util.Id;
-
-/**
- * A conversation parameter strategy for "natural" conversation ids.
- * Natural conversation ids are defined using <conversation/> in
- * pages.xml.
- *
- * @author Shane Bryzak
- */
-public class ELConversationIdParameter implements ConversationIdParameter
-{
- private String name;
- private String parameterName;
- private ValueExpression vb;
-
- public ELConversationIdParameter(String name, String paramName, String expression)
- {
- this.name = name;
- this.parameterName = paramName;
-
- this.vb = expression != null ?
- Expressions.instance().createValueExpression(expression) : null;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getParameterName()
- {
- return parameterName;
- }
-
- public String getInitialConversationId(Map parameters)
- {
- String id = getRequestConversationId(parameters);
- return id==null ? Id.nextId() : id; //TODO: should we try using the expression?
- }
-
- public String getRequestConversationId(Map parameters)
- {
- String value = ConversationPropagation.getRequestParameterValue(parameters, parameterName);
- if (value==null)
- {
- return null;
- }
- else
- {
- return name + ':' + value;
- }
- }
-
- public String getConversationId()
- {
- return name + ':' + getParameterValue();
- }
-
- public String getParameterValue()
- {
- Object value = vb.getValue();
- if (value==null)
- {
- throw new IllegalStateException("conversation id evaluated to null: " + name);
- }
- else
- {
- //TODO: use a JSF converter!
- return vb.getValue().toString();
- }
- }
-
- public String getParameterValue(String value)
- {
- return value.startsWith(name + ":") ? value.substring(name.length() + 1) : value;
- }
-
-}
Copied: trunk/src/main/org/jboss/seam/navigation/NaturalConversationIdParameter.java (from rev 7776, trunk/src/main/org/jboss/seam/navigation/ELConversationIdParameter.java)
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/NaturalConversationIdParameter.java (rev 0)
+++ trunk/src/main/org/jboss/seam/navigation/NaturalConversationIdParameter.java 2008-03-31 22:24:49 UTC (rev 7779)
@@ -0,0 +1,85 @@
+package org.jboss.seam.navigation;
+
+import java.util.Map;
+
+import org.jboss.seam.core.ConversationPropagation;
+import org.jboss.seam.core.Expressions;
+import org.jboss.seam.core.Expressions.ValueExpression;
+import org.jboss.seam.util.Id;
+
+/**
+ * A conversation parameter strategy for "natural" conversation ids.
+ * Natural conversation ids are defined using <conversation/> in
+ * pages.xml.
+ *
+ * @author Shane Bryzak
+ */
+public class NaturalConversationIdParameter implements ConversationIdParameter
+{
+ private String name;
+ private String parameterName;
+ private ValueExpression vb;
+
+ public NaturalConversationIdParameter(String name, String paramName, String expression)
+ {
+ this.name = name;
+ this.parameterName = paramName;
+
+ this.vb = expression != null ?
+ Expressions.instance().createValueExpression(expression) : null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getParameterName()
+ {
+ return parameterName;
+ }
+
+ public String getInitialConversationId(Map parameters)
+ {
+ String id = getRequestConversationId(parameters);
+ return id==null ? Id.nextId() : id; //TODO: should we try using the expression?
+ }
+
+ public String getRequestConversationId(Map parameters)
+ {
+ String value = ConversationPropagation.getRequestParameterValue(parameters, parameterName);
+ if (value==null)
+ {
+ return null;
+ }
+ else
+ {
+ return name + ':' + value;
+ }
+ }
+
+ public String getConversationId()
+ {
+ return name + ':' + getParameterValue();
+ }
+
+ public String getParameterValue()
+ {
+ Object value = vb.getValue();
+ if (value==null)
+ {
+ throw new IllegalStateException("conversation id evaluated to null: " + name);
+ }
+ else
+ {
+ //TODO: use a JSF converter!
+ return vb.getValue().toString();
+ }
+ }
+
+ public String getParameterValue(String value)
+ {
+ return value.startsWith(name + ":") ? value.substring(name.length() + 1) : value;
+ }
+
+}
Property changes on: trunk/src/main/org/jboss/seam/navigation/NaturalConversationIdParameter.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/src/main/org/jboss/seam/navigation/Pages.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Pages.java 2008-03-31 22:24:14 UTC (rev 7778)
+++ trunk/src/main/org/jboss/seam/navigation/Pages.java 2008-03-31 22:24:49 UTC (rev 7779)
@@ -972,7 +972,7 @@
throw new IllegalStateException("<conversation/> declaration already exists for [" + name + "]");
}
- ELConversationIdParameter param = new ELConversationIdParameter(name,
+ NaturalConversationIdParameter param = new NaturalConversationIdParameter(name,
element.attributeValue("parameter-name"),
element.attributeValue("parameter-value"));
More information about the seam-commits
mailing list