📄 abstractflowbuilder.java
字号:
*/
protected EndState addEndState(String endStateId, ViewDescriptorCreator creater, Map properties) throws IllegalArgumentException {
return new EndState(getFlow(), endStateId, creater, properties);
}
/**
* Adds an end state with the specified id. The created end state will be
* a marker end state with no associated view.
* @param endStateId the end state id
* @return the end state
* @throws IllegalArgumentException the state id is not unique
*/
protected EndState addEndState(String endStateId) throws IllegalArgumentException {
return new EndState(getFlow(), endStateId);
}
/**
* Creates a transition stating:
* <tt>On the occurence of an event that matches the criteria defined by
* ${criteria}, transition to state ${stateId}.
* </tt>
* @param criteria the transition criteria
* @param stateId the target state Id
* @return the transition (event matching criteria->stateId)
*/
protected Transition on(TransitionCriteria criteria, String stateId) {
return new Transition(criteria, stateId);
}
/**
* Creates a transition stating:
* <tt>On the occurence of an event that matches the criteria defined by
* ${criteria}, transition to state ${stateId}.
* </tt>
* @param criteria the transition criteria
* @param stateId the state Id
* @param properties additional properties about the transition
* @return the transition (event matching criteria->stateId)
*/
protected Transition on(TransitionCriteria criteria, String stateId, Map properties) {
return new Transition(criteria, stateId, properties);
}
/**
* Creates a transition stating:
* <tt>On the occurence of an event that matches the criteria defined by
* ${criteria}, transition to state ${stateId} if the ${executionCriteria}
* holds true.
* </tt>
* @param criteria the transition criteria
* @param stateId the state Id
* @param executionCriteria criteria that decide whether or not the transition
* can complete execution
* @return the transition (event matching criteria->stateId)
*/
protected Transition on(TransitionCriteria criteria, String stateId, TransitionCriteria executionCriteria) {
Transition t = on(criteria, stateId);
t.setExecutionCriteria(executionCriteria);
return t;
}
/**
* Creates a transition stating:
* <tt>On the occurence of an event that matches the criteria defined by
* ${criteria}, transition to state ${stateId} if the ${executionCriteria}
* holds true.
* </tt>
* @param criteria the transition criteria
* @param stateId the state Id
* @param properties additional properties about the transition
* @return the transition (event matching criteria->stateId)
*/
protected Transition on(TransitionCriteria criteria, String stateId, TransitionCriteria executionCriteria, Map properties) {
Transition t = on(criteria, stateId, properties);
t.setExecutionCriteria(executionCriteria);
return t;
}
/**
* Creates a transition stating:
* <tt>On the occurence of event ${eventId}, transition to state
* ${stateId}.
* </tt>
* @param eventId the event id
* @param stateId the state Id
* @return the transition (eventId->stateId)
*/
protected Transition on(String eventId, String stateId) {
TransitionCriteria criteria = (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute(eventId);
return on(criteria, stateId);
}
/**
* Creates a transition stating:
* <tt>On the occurence of event ${eventId}, transition to state
* ${stateId}.
* </tt>
* @param eventId the event id
* @param stateId the target state Id
* @param properties additional properties about the transition
* @return the transition (eventId->stateId)
*/
protected Transition on(String eventId, String stateId, Map properties) {
TransitionCriteria criteria = (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute(eventId);
return on(criteria, stateId, properties);
}
/**
* Creates a transition stating:
* <tt>On the occurence of the specified event, transition to state ${stateId} if and only
* the ${executionCriteria} is met.
* </tt>
* @param eventId the event id
* @param stateId the target state Id
* @param executionCriteria the executionCriteria
* @return the transition (eventId+executionCriteria->stateId)
*/
protected Transition on(String eventId, String stateId, TransitionCriteria executionCriteria) {
TransitionCriteria criteria = (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute(eventId);
return on(criteria, stateId, executionCriteria);
}
/**
* Creates a transition stating:
* <tt>On the occurence of the specified event, transition to state ${stateId} if and only
* the ${executionCriteria} is met.
* </tt>
* @param eventId the event id
* @param stateId the target state Id
* @param executionCriteria the executionCriteria
* @param properties additional properties about the transition
* @return the transition (eventId+executionCriteria->stateId)
*/
protected Transition on(String eventId, String stateId, TransitionCriteria executionCriteria, Map properties) {
TransitionCriteria criteria = (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute(eventId);
return on(criteria, stateId, executionCriteria, properties);
}
/**
* Produces a <code>TransitionCriteria</code> that will execute the specified action when the
* Transition is executed but before the transition's target state is entered.
* @param action the action to execute after a transition is matched but before
* it transitions to its target state
* @return the transition execution criteria
*/
protected TransitionCriteria beforeExecute(Action action) {
return new ActionTransitionCriteria(action);
}
/**
* Produces a <code>TransitionCriteria</code> that will execute the specified action when the
* Transition is executed but before the transition's target state is entered.
* @param action annotated action to execute after a transition is matched but
* before it transitions to its target state
* @return the transition execution criteria
*/
protected TransitionCriteria beforeExecute(AnnotatedAction action) {
return new ActionTransitionCriteria(action);
}
/**
* Creates a transition stating:
* <tt>On the occurence of any event (*), transition to state ${stateId}.
* </tt>
* @param stateId the target state id
* @return the transition (*->stateId)
*/
protected Transition onAnyEvent(String stateId) {
return new Transition(TransitionCriteriaFactory.alwaysTrue(), stateId);
}
/**
* Creates the <code>success</code> event id. "Success" indicates that an
* action completed successfuly.
* @return the event id
*/
protected String success() {
return "success";
}
/**
* Creates the <code>error</code> event id. "Error" indicates that an
* action completed with an error status.
* @return the event id
*/
protected String error() {
return "error";
}
/**
* Creates the <code>submit</code> event id. "Submit" indicates the user
* submitted a request (form) for processing.
* @return the event id
*/
protected String submit() {
return "submit";
}
/**
* Creates the <code>back</code> event id. "Back" indicates the user wants
* to go to the previous step in the flow.
* @return the event id
*/
protected String back() {
return "back";
}
/**
* Creates the <code>cancel</code> event id. "Cancel" indicates the flow
* was aborted because the user changed their mind.
* @return the event id
*/
protected String cancel() {
return "cancel";
}
/**
* Creates the <code>finish</code> event id. "Finish" indicates the flow
* has finished processing.
* @return the event id
*/
protected String finish() {
return "finish";
}
/**
* Creates the <code>select</code> event id. "Select" indicates an object
* was selected for processing or display.
* @return the event id
*/
protected String select() {
return "select";
}
/**
* Creates the <code>edit</code> event id. "Edit" indicates an object was
* selected for creation or updating.
* @return the event id
*/
protected String edit() {
return "edit";
}
/**
* Creates the <code>add</code> event id. "Add" indicates a child
* object is being added to a parent collection.
* @return the event id
*/
protected String add() {
return "add";
}
/**
* Creates the <code>delete</code> event id. "Delete" indicates a object
* is being removed.
* @return the event id
*/
protected String delete() {
return "delete";
}
/**
* Join given prefix and suffix into a single string separated by a
* delimiter.
* @param prefix the prefix
* @param suffix the suffix
* @return the qualified string
*/
protected String join(String prefix, String suffix) {
return prefix + getQualifierDelimiter() + suffix;
}
/**
* Returns the delimiter used to seperate identifier parts. E.g. flow id and
* state id ("customer.Detail.view"). Defaults to a dot (".").
*/
protected String getQualifierDelimiter() {
return ".";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -