📄 abstractflowbuilder.java
字号:
* @return the action
*/
protected Action action(Class actionImplementationClass) {
return getFlowServiceLocator().createAction(actionImplementationClass, AutowireMode.DEFAULT);
}
/**
* Request that the action with the specified implementation be instantiated
* and executed when the action state being built is entered. Creates the
* action instance.
* @param actionImplementationClass the action implementation to instantiate
* @param autowireMode the instance autowiring strategy
* @return the action
*/
protected Action action(Class actionImplementationClass, AutowireMode autowireMode) {
return getFlowServiceLocator().createAction(actionImplementationClass, autowireMode);
}
/**
* Request that the actions with the specified implementation be executed
* when the action state being built is entered. Looks the action up by
* implementation class and returns it.
* @param actionImplementationClass the action implementation -- there must be
* only one action implementation of this type defined in the registry
* @return the action
* @throws ServiceLookupException the action could not be resolved
*/
protected Action actionRef(Class actionImplementationClass) throws ServiceLookupException {
return getFlowServiceLocator().getAction(actionImplementationClass);
}
/**
* Creates an annotated action suitable for adding to exactly one action
* state, wrapping the specified target action, with no properties configured
* initially.
* @param action the action
* @return the annotated action
*/
protected AnnotatedAction annotate(Action action) {
return new AnnotatedAction(action);
}
/**
* Creates an annotated action suitable for adding to exactly one action
* state, wrapping the specified target action and annotating it with the
* specified properties.
* @param action the action
* @param properties the action state properties
* @return the annotated action
*/
protected AnnotatedAction annotate(Action action, Map properties) {
return new AnnotatedAction(action, properties);
}
/**
* Creates an named action suitable for adding to exactly one
* action state.
* @param name the action name
* @param action the action
* @return the annotated action
*/
protected AnnotatedAction name(Action action, String name) {
Map properties = new HashMap(1);
properties.put(AnnotatedAction.NAME_PROPERTY, name);
AnnotatedAction stateAction = new AnnotatedAction(action, properties);
return stateAction;
}
/**
* Creates an annotated action with a single property that indicates which
* method should be invoked on the target action when the state is entered.
* @param methodName the method name, with the signature
* <code>Event ${methodName}(RequestContext context)</code>
* @return the annotated action
*/
protected AnnotatedAction method(String methodName, Action action) {
Map properties = new HashMap(1);
properties.put(MultiAction.DefaultActionExecuteMethodNameResolver.METHOD_PROPERTY, methodName);
AnnotatedAction stateAction = new AnnotatedAction(action, properties);
return stateAction;
}
/**
* Adds a subflow state to the flow built by this builder with the specified id.
* @param id the state id, must be unique among all states of the flow built
* by this builder
* @param subFlow the flow to be used as a subflow
* @param transition the single supported transition out of the state
* @throws IllegalArgumentException the state id is not unique
*/
protected void addSubflowState(String id, Flow subFlow, Transition transition) {
new SubflowState(getFlow(), id, subFlow, transition);
}
/**
* Adds a subflow state to the flow built by this builder with the specified id.
* @param id the state id, must be unique among all states of the flow built
* by this builder
* @param subFlow the flow to be used as a subflow
* @param transitions the eligible set of state transitions
* @throws IllegalArgumentException the state id is not unique
*/
protected void addSubflowState(String id, Flow subFlow, Transition[] transitions) {
new SubflowState(getFlow(), id, subFlow, transitions);
}
/**
* Adds a subflow state to the flow built by this builder with the specified id.
* @param id the state id, must be unique among all states of the flow built
* by this builder
* @param subFlow the flow to be used as a subflow
* @param transitions the eligible set of state transitions
* @param properties additional properties describing the state
* @throws IllegalArgumentException the state id is not unique
*/
protected void addSubflowState(String id, Flow subFlow, Transition[] transitions, Map properties) {
new SubflowState(getFlow(), id, subFlow, transitions, properties);
}
/**
* Adds a subflow state to the flow built by this builder with the specified id.
* @param id the state id, must be unique among all states of the flow built
* by this builder
* @param subFlow the flow to be used as a subflow
* @param attributeMapper the attribute mapper to map attributes between the
* flow built by this builder and the subflow
* @param transition the single supported transition out of the state
* @throws IllegalArgumentException the state id is not unique
*/
protected void addSubflowState(String id, Flow subFlow, FlowAttributeMapper attributeMapper, Transition transition) {
new SubflowState(getFlow(), id, subFlow, transition);
}
/**
* Adds a subflow state to the flow built by this builder with the specified id.
* @param id the state id
* @param subFlow the flow definition to be used as the subflow
* @param attributeMapper the attribute mapper to map attributes between the
* flow built by this builder and the subflow
* @param transitions the eligible set of state transitions
* @throws IllegalArgumentException the state id is not unique
*/
protected void addSubflowState(String id, Flow subFlow, FlowAttributeMapper attributeMapper,
Transition[] transitions) {
new SubflowState(getFlow(), id, subFlow, attributeMapper, transitions);
}
/**
* Adds a subflow state to the flow built by this builder with the specified id.
* @param id the state id
* @param subFlow the flow definition to be used as the subflow
* @param attributeMapper the attribute mapper to map attributes between the
* flow built by this builder and the subflow
* @param transitions the eligible set of state transitions
* @param properties additional properties describing the state
* @throws IllegalArgumentException the state id is not unique
*/
protected void addSubflowState(String id, Flow subFlow, FlowAttributeMapper attributeMapper,
Transition[] transitions, Map properties) {
new SubflowState(getFlow(), id, subFlow, attributeMapper, transitions, properties);
}
/**
* Request that the attribute mapper with the specified name be used
* to map attributes between a parent flow and a spawning subflow when the
* subflow state being constructed is entered.
* @param attributeMapperId the id of the attribute mapper that will
* map attributes between the flow built by this builder and the
* subflow
* @return the attribute mapper
* @throws ServiceLookupException no FlowAttributeMapper
* implementation was exported with the specified id
*/
protected FlowAttributeMapper attributeMapper(String attributeMapperId) throws ServiceLookupException {
if (!StringUtils.hasText(attributeMapperId)) {
return null;
}
return getFlowServiceLocator().getFlowAttributeMapper(attributeMapperId);
}
/**
* Request that the mapper of the specified implementation be used to map
* attributes between a parent flow and a spawning subflow when the subflow
* state being built is entered.
* @param flowAttributeMapperImplementationClass the attribute mapper
* implementation, there must be only one instance in the registry
* @return the attribute mapper
* @throws ServiceLookupException no FlowAttributeMapper
* implementation was exported with the specified implementation, or
* more than one existed
*/
protected FlowAttributeMapper attributeMapperRef(Class flowAttributeMapperImplementationClass)
throws ServiceLookupException {
return getFlowServiceLocator().getFlowAttributeMapper(flowAttributeMapperImplementationClass);
}
/**
* Request that the flow attribute mapper with the specified implementation
* be instantiated, to be used to map attributs when a subflow is spawned in
* a subflow state. Creates the mapper instance.
* @param attributeMapperImplementationClass the attribute mapper
* implementation to instantiate
* @return the attribute mapper
*/
protected FlowAttributeMapper attributeMapper(Class attributeMapperImplementationClass) {
return getFlowServiceLocator().createFlowAttributeMapper(attributeMapperImplementationClass,
AutowireMode.DEFAULT);
}
/**
* Request that the flow attribute mapper with the specified implementation
* be instantiated, to be used to map attributs when a subflow is spawned in
* a subflow state. Creates the mapper instance.
* @param attributeMapperImplementationClass the action implementation to
* instantiate
* @param autowireMode the instance autowiring strategy
* @return the attribute mapper
*/
protected FlowAttributeMapper attributeMapper(Class attributeMapperImplementationClass, AutowireMode autowireMode) {
return getFlowServiceLocator().createFlowAttributeMapper(attributeMapperImplementationClass, autowireMode);
}
/**
* Request that the <code>Flow</code> with the specified flowId be spawned
* as a subflow when the subflow state being built is entered. Simply
* resolves the subflow definition by id and returns it; throwing a
* fail-fast exception if it does not exist.
* @param flowId the flow definition id
* @return the flow to be used as a subflow, this should be passed to a
* addSubflowState call
* @throws ServiceLookupException when the flow cannot be resolved
*/
protected Flow flow(String flowId) throws ServiceLookupException {
return getFlowServiceLocator().getFlow(flowId);
}
/**
* Adds an end state with the specified id that will display the specified
* view when entered as part of a terminating flow execution.
* @param endStateId the end state id
* @param viewName the view name
* @return the end state
* @throws IllegalArgumentException the state id is not unique
*/
protected EndState addEndState(String endStateId, String viewName) throws IllegalArgumentException {
return new EndState(getFlow(), endStateId, view(viewName));
}
/**
* Adds an end state with the specified id that will display the specified
* view when entered as part of a terminating flow execution.
* @param endStateId the end state id
* @param viewName the view name
* @param properties additional properties describing the state
* @return the end state
* @throws IllegalArgumentException the state id is not unique
*/
protected EndState addEndState(String endStateId, String viewName, Map properties) throws IllegalArgumentException {
return new EndState(getFlow(), endStateId, view(viewName), properties);
}
/**
* Adds an end state with the specified id that will message the specified
* view descriptor creater to produce a view to display when entered as part of a
* root flow termination.
* @param endStateId the end state id
* @param creater the view descriptor creater
* @return the end state
* @throws IllegalArgumentException the state id is not unique
*/
protected EndState addEndState(String endStateId, ViewDescriptorCreator creater) throws IllegalArgumentException {
return new EndState(getFlow(), endStateId, creater);
}
/**
* Adds an end state with the specified id that will message the specified
* view descriptor creater to produce a view to display when entered as part of a
* root flow termination.
* @param endStateId the end state id
* @param creater the view descriptor creater
* @param properties additional properties describing the state
* @return the end state
* @throws IllegalArgumentException the state id is not unique
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -