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 merge(Model model) { EndStateModel state = (EndStateModel) model; setParent(null); setAttributes(merge(getAttributes(), state.getAttributes())); setSecured((SecuredModel) merge(getSecured(), state.getSecured())); setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false)); setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers())); setView(merge(getView(), state.getView())); setCommit(merge(getCommit(), state.getCommit())); setOutputs(merge(getOutputs(), state.getOutputs(), false)); }
public Model createCopy() { EndStateModel copy = new EndStateModel(getId()); super.fillCopy(copy); copy.setView(view); copy.setCommit(commit); copy.setOutputs(outputs); return copy; }
private void parseAndAddEndState(EndStateModel state, Flow flow) { MutableAttributeMap<Object> attributes = parseMetaAttributes(state.getAttributes()); if (StringUtils.hasText(state.getCommit())) { attributes.put("commit", fromStringTo(Boolean.class).execute(state.getCommit())); } parseAndPutSecured(state.getSecured(), attributes); Action finalResponseAction; ViewFactory viewFactory = parseViewFactory(state.getView(), state.getId(), true, null); if (viewFactory != null) { finalResponseAction = new ViewFactoryActionAdapter(viewFactory); } else { finalResponseAction = null; } getLocalContext().getFlowArtifactFactory().createEndState(state.getId(), flow, parseActions(state.getOnEntryActions()), finalResponseAction, parseFlowOutputMapper(state.getOutputs()), parseExceptionHandlers(state.getExceptionHandlers(), null), attributes); }
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()); } }
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 void testNotMergeable() { EndStateModel child = new EndStateModel("child"); EndStateModel parent = new EndStateModel("parent"); assertFalse(child.isMergeableWith(parent)); }
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")); }
model.setOutputs(asList(output1, output2, output3, output4)); EndStateModel end = new EndStateModel("end"); end.setOutputs(asList(new OutputModel("foo", "flowScope.foo"))); EndStateModel notReached = new EndStateModel("notReached"); notReached.setOutputs(asList(new OutputModel("notReached", "flowScope.foo")));
private void parseAndAddEndState(EndStateModel state, Flow flow) { MutableAttributeMap<Object> attributes = parseMetaAttributes(state.getAttributes()); if (StringUtils.hasText(state.getCommit())) { attributes.put("commit", fromStringTo(Boolean.class).execute(state.getCommit())); } parseAndPutSecured(state.getSecured(), attributes); Action finalResponseAction; ViewFactory viewFactory = parseViewFactory(state.getView(), state.getId(), true, null); if (viewFactory != null) { finalResponseAction = new ViewFactoryActionAdapter(viewFactory); } else { finalResponseAction = null; } getLocalContext().getFlowArtifactFactory().createEndState(state.getId(), flow, parseActions(state.getOnEntryActions()), finalResponseAction, parseFlowOutputMapper(state.getOutputs()), parseExceptionHandlers(state.getExceptionHandlers(), null), attributes); }
public Model createCopy() { EndStateModel copy = new EndStateModel(getId()); super.fillCopy(copy); copy.setView(view); copy.setCommit(commit); copy.setOutputs(outputs); return copy; }
public FlowModel getFlowModel() throws FlowModelBuilderException { FlowModel flow = new FlowModel(); flow.setStates(new LinkedList<>(Collections.singletonList(new EndStateModel("end")))); return flow; }
public void testNotMergeableWithNull() { EndStateModel child = new EndStateModel("child"); assertFalse(child.isMergeableWith(null)); }
public void merge(Model model) { EndStateModel state = (EndStateModel) model; setParent(null); setAttributes(merge(getAttributes(), state.getAttributes())); setSecured((SecuredModel) merge(getSecured(), state.getSecured())); setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false)); setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers())); setView(merge(getView(), state.getView())); setCommit(merge(getCommit(), state.getCommit())); setOutputs(merge(getOutputs(), state.getOutputs(), false)); }
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 void parseAndAddEndState(EndStateModel state, Flow flow) { MutableAttributeMap attributes = parseMetaAttributes(state.getAttributes()); if (StringUtils.hasText(state.getCommit())) { attributes.put("commit", fromStringTo(Boolean.class).execute(state.getCommit())); } parseAndPutSecured(state.getSecured(), attributes); Action finalResponseAction; ViewFactory viewFactory = parseViewFactory(state.getView(), state.getId(), true, null); if (viewFactory != null) { finalResponseAction = new ViewFactoryActionAdapter(viewFactory); } else { finalResponseAction = null; } getLocalContext().getFlowArtifactFactory().createEndState(state.getId(), flow, parseActions(state.getOnEntryActions()), finalResponseAction, parseFlowOutputMapper(state.getOutputs()), parseExceptionHandlers(state.getExceptionHandlers(), null), attributes); }
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 testMergeable() { EndStateModel child = new EndStateModel("child"); assertTrue(child.isMergeableWith(child)); }
public void merge(Model model) { EndStateModel state = (EndStateModel) model; setParent(null); setAttributes(merge(getAttributes(), state.getAttributes())); setSecured((SecuredModel) merge(getSecured(), state.getSecured())); setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false)); setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers())); setView(merge(getView(), state.getView())); setCommit(merge(getCommit(), state.getCommit())); setOutputs(merge(getOutputs(), state.getOutputs(), false)); }
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; }