本文整理了Java中org.springframework.webflow.engine.Flow.containsState()
方法的一些代码示例,展示了Flow.containsState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flow.containsState()
方法的具体详情如下:
包路径:org.springframework.webflow.engine.Flow
类名称:Flow
方法名:containsState
[英]Is a state with the provided id present in this flow?
[中]此流中是否存在具有所提供id的状态?
代码示例来源:origin: org.springframework.webflow/spring-webflow
/**
* Add given state definition to this flow definition. Marked protected, as this method is to be called by the
* (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
* @param state the state to add
* @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
* the same id as the one provided or if given state already belongs to another flow
*/
protected void add(State state) throws IllegalArgumentException {
if (this != state.getFlow() && state.getFlow() != null) {
throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
+ "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
}
if (this.states.contains(state) || this.containsState(state.getId())) {
throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
+ state.getId() + "' -- state ids must be locally unique to the flow definition; "
+ "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
}
boolean firstAdd = states.isEmpty();
states.add(state);
if (firstAdd) {
setStartState(state);
}
}
代码示例来源:origin: org.apereo.cas/cas-server-core-webflow-api
/**
* Contains flow state?
*
* @param flow the flow
* @param stateId the state id
* @return true if flow contains the state.
*/
public boolean containsFlowState(final Flow flow, final String stateId) {
if (flow == null) {
LOGGER.error("Flow is not configured correctly and cannot be null.");
return false;
}
return flow.containsState(stateId);
}
代码示例来源:origin: spring-projects/spring-webflow
/**
* Add given state definition to this flow definition. Marked protected, as this method is to be called by the
* (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
* @param state the state to add
* @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
* the same id as the one provided or if given state already belongs to another flow
*/
protected void add(State state) throws IllegalArgumentException {
if (this != state.getFlow() && state.getFlow() != null) {
throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
+ "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
}
if (this.states.contains(state) || this.containsState(state.getId())) {
throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
+ state.getId() + "' -- state ids must be locally unique to the flow definition; "
+ "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
}
boolean firstAdd = states.isEmpty();
states.add(state);
if (firstAdd) {
setStartState(state);
}
}
代码示例来源:origin: org.springframework.webflow/org.springframework.webflow
/**
* Add given state definition to this flow definition. Marked protected, as this method is to be called by the
* (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
* @param state the state to add
* @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
* the same id as the one provided or if given state already belongs to another flow
*/
protected void add(State state) throws IllegalArgumentException {
if (this != state.getFlow() && state.getFlow() != null) {
throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
+ "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
}
if (this.states.contains(state) || this.containsState(state.getId())) {
throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
+ state.getId() + "' -- state ids must be locally unique to the flow definition; "
+ "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
}
boolean firstAdd = states.isEmpty();
states.add(state);
if (firstAdd) {
setStartState(state);
}
}
代码示例来源:origin: org.springframework/spring-webflow
/**
* Add given state definition to this flow definition. Marked protected, as this method is to be called by the
* (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
* @param state the state to add
* @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
* the same id as the one provided or if given state already belongs to another flow
*/
protected void add(State state) throws IllegalArgumentException {
if (this != state.getFlow() && state.getFlow() != null) {
throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
+ "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
}
if (this.states.contains(state) || this.containsState(state.getId())) {
throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
+ state.getId() + "' -- state ids must be locally unique to the flow definition; "
+ "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
}
boolean firstAdd = states.isEmpty();
states.add(state);
if (firstAdd) {
setStartState(state);
}
}
代码示例来源:origin: org.apereo.cas/cas-server-core-webflow-mfa-api
if (mfaFlow.containsState(CasWebflowConstants.STATE_ID_MFA_PRE_AUTH)) {
createTransitionForState(availableAction, CasWebflowConstants.TRANSITION_ID_YES, CasWebflowConstants.STATE_ID_MFA_PRE_AUTH);
} else {
代码示例来源:origin: spring-projects/spring-webflow
public void testAddStates() {
Flow flow = new Flow("myFlow");
new EndState(flow, "myState1");
new EndState(flow, "myState2");
assertEquals("Wrong start state:", "myState1", flow.getStartState().getId());
assertEquals("State count wrong:", 2, flow.getStateCount());
assertTrue(flow.containsState("myState1"));
assertTrue(flow.containsState("myState2"));
State state = flow.getStateInstance("myState1");
assertEquals("Wrong flow:", flow.getId(), state.getFlow().getId());
assertEquals("Wrong state:", "myState1", flow.getState("myState1").getId());
assertEquals("Wrong state:", "myState2", flow.getState("myState2").getId());
}
内容来源于网络,如有侵权,请联系作者删除!