Added name(String, Action) method to AbstractFlowBuilder for convenient creation of named actions.

This commit is contained in:
Erwin Vervaet
2007-05-14 13:23:25 +00:00
parent 98f9f7d803
commit cb401461f1
2 changed files with 32 additions and 7 deletions

View File

@@ -19,6 +19,7 @@ Package org.springframework.webflow.conversation
Package org.springframework.webflow.engine
* Added invoke(String, Action) method to AbstractFlowBuilder.
* Added initBuilder() hook method to AbstractFlowBuilder.
* Added name(String, Action) method to AbstractFlowBuilder for convenient creation of named actions.
Package org.springframework.webflow.executor
* JSF integration code now manages flow execution locks properly in exceptional situations and when the

View File

@@ -22,7 +22,6 @@ import org.springframework.binding.mapping.Mapping;
import org.springframework.binding.mapping.MappingBuilder;
import org.springframework.binding.method.MethodSignature;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
import org.springframework.webflow.action.AbstractBeanInvokingAction;
import org.springframework.webflow.action.ActionResultExposer;
import org.springframework.webflow.action.BeanInvokingActionFactory;
@@ -653,12 +652,17 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder {
* used by the multi action to instruct it with what method to invoke
* @since 1.0.4
*/
protected AnnotatedAction invoke(String methodName, Action multiAction) throws FlowArtifactLookupException {
Assert.isInstanceOf(MultiAction.class, multiAction,
"The action passed into invoke() should be a MultiAction");
AnnotatedAction action = new AnnotatedAction(multiAction);
action.setMethod(methodName);
return action;
protected AnnotatedAction invoke(String methodName, Action multiAction) {
AnnotatedAction annotatedAction;
if (multiAction instanceof AnnotatedAction) {
// already wrapped in an AnnotatedAction
annotatedAction = (AnnotatedAction)multiAction;
}
else {
annotatedAction = new AnnotatedAction(multiAction);
}
annotatedAction.setMethod(methodName);
return annotatedAction;
}
/**
@@ -676,6 +680,26 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder {
protected AnnotatedAction invoke(String methodName, MultiAction multiAction) throws FlowArtifactLookupException {
return invoke(methodName, (Action)multiAction);
}
/**
* Creates an annotated action decorator that makes the given action
* an named action.
* @param name the action name
* @param action the action to name
* @return the annotated named action
*/
protected AnnotatedAction name(String name, Action action) {
AnnotatedAction annotatedAction;
if (action instanceof AnnotatedAction) {
// already wrapped in an AnnotatedAction
annotatedAction = (AnnotatedAction)action;
}
else {
annotatedAction = new AnnotatedAction(action);
}
annotatedAction.setName(name);
return annotatedAction;
}
/**
* Request that the attribute mapper with the specified name be used to map