[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Peter Muir
peter at bleepbleep.org.uk
Fri Nov 23 18:00:05 EST 2007
User: pmuir
Date: 07/11/23 18:00:05
Modified: src/main/org/jboss/seam/core ConversationPropagation.java
Log:
One more for JBSEAM-2124
Revision Changes Path
1.8 +24 -14 jboss-seam/src/main/org/jboss/seam/core/ConversationPropagation.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConversationPropagation.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ConversationPropagation.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- ConversationPropagation.java 10 Sep 2007 08:53:00 -0000 1.7
+++ ConversationPropagation.java 23 Nov 2007 23:00:05 -0000 1.8
@@ -19,6 +19,8 @@
* from a request.
*
* @author Gavin King
+ * @author Pete Muir
+ * @author Shane Bryzak
*
*/
@Name("org.jboss.seam.core.conversationPropagation")
@@ -29,6 +31,10 @@
{
private static final LogProvider log = Logging.getLogProvider(ConversationPropagation.class);
+ public static final String CONVERSATION_NAME_PARAMETER = "conversationName";
+ public static final String CONVERSATION_PROPAGATION_PARAMETER = "conversationPropagation";
+
+ private String conversationName;
private String conversationId;
private String parentConversationId;
private boolean validateLongRunningConversation;
@@ -45,6 +51,7 @@
*/
public void restoreConversationId(Map parameters)
{
+ getConversationNameFromRequestParameters(parameters);
restoreNaturalConversationId(parameters);
restoreSyntheticConversationId(parameters);
restorePageContextConversationId();
@@ -86,6 +93,11 @@
}
}
+ private void getConversationNameFromRequestParameters(Map parameters)
+ {
+ conversationName = getRequestParameterValue(parameters, CONVERSATION_NAME_PARAMETER);
+ }
+
private void restoreNaturalConversationId(Map parameters)
{
//First, try to get the conversation id from the request parameter defined for the page
@@ -96,6 +108,7 @@
conversationId = page.getConversationIdParameter().getRequestConversationId(parameters);
//TODO: how about the parent conversation id?
}
+ // TODO handle conversationName
}
private void restoreSyntheticConversationId(Map parameters)
@@ -114,21 +127,12 @@
private void getPropagationFromRequestParameter(Map parameters)
{
- Object type = parameters.get("conversationPropagation");
- String value = null;
+ String value = getRequestParameterValue(parameters, CONVERSATION_PROPAGATION_PARAMETER);
- if (type == null)
+ if (value == null)
{
return;
}
- else if (type instanceof String)
- {
- value = (String) type;
- }
- else
- {
- value = ((String[]) type)[0];
- }
if (value.startsWith("begin"))
{
@@ -166,10 +170,11 @@
}
/**
- * Retrieve the conversation id from the request parameters.
+ * Retrieve a parameter value from the request
*
* @param parameters the request parameters
- * @return the conversation id
+ * @param parameterName the name of the parameter to retrieve
+ * @return the parameter value or null if not in the map
*/
public static String getRequestParameterValue(Map parameters, String parameterName)
{
@@ -191,7 +196,7 @@
String[] values = (String[]) object;
if (values.length!=1)
{
- throw new IllegalArgumentException("expected exactly one value for conversationId request parameter");
+ throw new IllegalArgumentException("expected exactly one value for " + parameterName + " request parameter");
}
return values[0];
}
@@ -264,4 +269,9 @@
{
return pageflow;
}
+
+ public String getConversationName()
+ {
+ return this.conversationName;
+ }
}
More information about the jboss-cvs-commits
mailing list