public Model createCopy() { EndStateModel copy = new EndStateModel(getId()); super.fillCopy(copy); copy.setView(view); copy.setCommit(commit); copy.setOutputs(outputs); return copy; }
private EndStateModel parseEndState(Element element) { EndStateModel state = new EndStateModel(element.getAttribute("id")); state.setParent(element.getAttribute("parent")); state.setView(element.getAttribute("view")); state.setCommit(element.getAttribute("commit")); state.setOutputs(parseOutputs(element)); state.setAttributes(parseAttributes(element)); state.setSecured(parseSecured(element)); state.setOnEntryActions(parseOnEntryActions(element)); state.setExceptionHandlers(parseExceptionHandlers(element)); return state; }
private static void createDuoSuccessEndState(final List<AbstractStateModel> states) { states.add(new EndStateModel(CasWebflowConstants.TRANSITION_ID_SUCCESS)); states.add(new EndStateModel(CasWebflowConstants.TRANSITION_ID_DENY)); states.add(new EndStateModel(CasWebflowConstants.TRANSITION_ID_UNAVAILABLE)); }
public FlowModel getFlowModel() throws FlowModelBuilderException { FlowModel flow = new FlowModel(); flow.setStates(new LinkedList<>(Collections.singletonList(new EndStateModel("end")))); return flow; }
public void testNotMergeable() { EndStateModel child = new EndStateModel("child"); EndStateModel parent = new EndStateModel("parent"); assertFalse(child.isMergeableWith(parent)); }
public Model createCopy() { EndStateModel copy = new EndStateModel(getId()); super.fillCopy(copy); copy.setView(view); copy.setCommit(commit); copy.setOutputs(outputs); return copy; }
private EndStateModel parseEndState(Element element) { EndStateModel state = new EndStateModel(element.getAttribute("id")); state.setParent(element.getAttribute("parent")); state.setView(element.getAttribute("view")); state.setCommit(element.getAttribute("commit")); state.setOutputs(parseOutputs(element)); state.setAttributes(parseAttributes(element)); state.setSecured(parseSecured(element)); state.setOnEntryActions(parseOnEntryActions(element)); state.setExceptionHandlers(parseExceptionHandlers(element)); return state; }
private EndStateModel parseEndState(Element element) { EndStateModel state = new EndStateModel(element.getAttribute("id")); state.setParent(element.getAttribute("parent")); state.setView(element.getAttribute("view")); state.setCommit(element.getAttribute("commit")); state.setOutputs(parseOutputs(element)); state.setAttributes(parseAttributes(element)); state.setSecured(parseSecured(element)); state.setOnEntryActions(parseOnEntryActions(element)); state.setExceptionHandlers(parseExceptionHandlers(element)); return state; }
public void testNotMergeableWithNull() { EndStateModel child = new EndStateModel("child"); assertFalse(child.isMergeableWith(null)); }
public void testMerge() { EndStateModel child = new EndStateModel("child"); EndStateModel parent = new EndStateModel("child"); parent.setCommit("true"); parent.setView("view"); LinkedList<OutputModel> outputs = new LinkedList<>(); outputs.add(new OutputModel("foo", "bar")); parent.setOutputs(outputs); child.merge(parent); assertEquals("true", child.getCommit()); assertEquals("bar", child.getOutputs().get(0).getValue()); } }
public void testBuildFlowWithStartStateAttribute() { model.setStartStateId("end"); model.setStates(asList(new EndStateModel("foo"), new EndStateModel("end"))); Flow flow = getFlow(model); assertEquals("flow", flow.getId()); assertEquals("end", flow.getStartState().getId()); }
public void testBuildFlowWithDefaultStartState() { model.setStates(asList(new EndStateModel("end"))); Flow flow = getFlow(model); assertEquals("flow", flow.getId()); assertEquals("end", flow.getStartState().getId()); }
public void testFlowSecured() { model.setSecured(new SecuredModel("ROLE_USER")); model.setStates(asList(new EndStateModel("end"))); Flow flow = getFlow(model); SecurityRule rule = (SecurityRule) flow.getAttributes().get(SecurityRule.SECURITY_ATTRIBUTE_NAME); assertNotNull(rule); assertEquals(SecurityRule.COMPARISON_ANY, rule.getComparisonType()); assertEquals(1, rule.getAttributes().size()); assertTrue(rule.getAttributes().contains("ROLE_USER")); }
public void testBuildFlowWithEndState() { model.setStates(asList(new EndStateModel("end"))); Flow flow = getFlow(model); assertEquals("flow", flow.getId()); assertEquals("end", flow.getStartState().getId()); }
public void testFlowSecuredState() { EndStateModel end = new EndStateModel("end"); end.setSecured(new SecuredModel("ROLE_USER")); model.setStates(asList(end)); Flow flow = getFlow(model); SecurityRule rule = (SecurityRule) flow.getState("end").getAttributes() .get(SecurityRule.SECURITY_ATTRIBUTE_NAME); assertNotNull(rule); assertEquals(SecurityRule.COMPARISON_ANY, rule.getComparisonType()); assertEquals(1, rule.getAttributes().size()); assertTrue(rule.getAttributes().contains("ROLE_USER")); }
public void testFlowVariable() { model.setVars(asList(new VarModel("flow-foo", "org.springframework.webflow.TestBean"))); model.setStates(asList(new EndStateModel("end"))); Flow flow = getFlow(model); assertEquals("flow-foo", flow.getVariable("flow-foo").getName()); }
public void testMergeStates() { FlowModel child = new FlowModel(); child.setStates(asList(new ViewStateModel("view"), new EndStateModel("end"))); FlowModel parent = new FlowModel(); ViewStateModel view = new ViewStateModel("view"); view.setView("jsp"); parent.setStates(asList(view, new DecisionStateModel("decider"), new ActionStateModel("action"))); child.merge(parent); assertEquals(4, child.getStates().size()); assertEquals("jsp", ((ViewStateModel) child.getStates().get(0)).getView()); }
public void testPersistenceContextFlow() { model.setPersistenceContext(new PersistenceContextModel()); model.setStates(asList(new EndStateModel("end"))); Flow flow = getFlow(model); assertNotNull(flow.getAttributes().get("persistenceContext")); assertTrue((Boolean) flow.getAttributes().get("persistenceContext")); }
public void testFlowSecuredTransition() { model.setStates(asList(new EndStateModel("end"))); TransitionModel transition = new TransitionModel(); transition.setTo("end"); transition.setSecured(new SecuredModel("ROLE_USER")); model.setGlobalTransitions(asList(transition)); Flow flow = getFlow(model); SecurityRule rule = (SecurityRule) flow.getGlobalTransitionSet().toArray()[0].getAttributes().get( SecurityRule.SECURITY_ATTRIBUTE_NAME); assertNotNull(rule); assertEquals(SecurityRule.COMPARISON_ANY, rule.getComparisonType()); assertEquals(1, rule.getAttributes().size()); assertTrue(rule.getAttributes().contains("ROLE_USER")); }
public void testCustomFlowAttribute() { AttributeModel attribute1 = new AttributeModel("foo", "bar"); AttributeModel attribute2 = new AttributeModel("number", "1"); attribute2.setType("integer"); model.setAttributes(asList(attribute1, attribute2)); model.setStates(asList(new EndStateModel("end"))); Flow flow = getFlow(model); assertEquals("bar", flow.getAttributes().get("foo")); assertEquals(1, flow.getAttributes().get("number")); }