Better support for annotating actions in Java flow builders.
This commit is contained in:
@@ -20,6 +20,8 @@ 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.
|
||||
* AnnotatedAction now has a convenience putAttribute(String, Object) method.
|
||||
* Added annotate(Action) method to AbstractFlowBuilder.
|
||||
|
||||
Package org.springframework.webflow.executor
|
||||
* JSF integration code now manages flow execution locks properly in exceptional situations and when the
|
||||
|
||||
@@ -134,6 +134,18 @@ public class AnnotatedAction extends AnnotatedObject implements Action {
|
||||
public void setMethod(String method) {
|
||||
getAttributeMap().put(METHOD_ATTRIBUTE, method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an attribute on this annotated object.
|
||||
* @param attributeName the name of the attribute to set
|
||||
* @param attributeValue the value of the attribute
|
||||
* @return this object, to support call chaining
|
||||
* @since 1.0.4
|
||||
*/
|
||||
public AnnotatedAction putAttribute(String attributeName, Object attributeValue) {
|
||||
getAttributeMap().put(attributeName, attributeValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Event execute(RequestContext context) throws Exception {
|
||||
AttributeMap originalAttributes = getAttributeMap();
|
||||
|
||||
@@ -638,6 +638,22 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder {
|
||||
protected ActionResultExposer result(String resultName, ScopeType resultScope) {
|
||||
return new ActionResultExposer(resultName, resultScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap given action in an {@link AnnotatedAction}} to be able
|
||||
* to annotate it with attributes.
|
||||
* @param action the action to annotate
|
||||
* @return the wrapped action
|
||||
* @since 1.0.4
|
||||
*/
|
||||
protected AnnotatedAction annotate(Action action) {
|
||||
if (action instanceof AnnotatedAction) {
|
||||
return (AnnotatedAction)action;
|
||||
}
|
||||
else {
|
||||
return new AnnotatedAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an annotated action decorator that instructs the specified method
|
||||
|
||||
Reference in New Issue
Block a user