private void parseAndAddViewState(ViewStateModel state, Flow flow) { ViewFactory viewFactory = parseViewFactory(state.getView(), state.getId(), false, state.getBinder()); Boolean redirect = null; if (StringUtils.hasText(state.getRedirect())) { redirect = (Boolean) fromStringTo(Boolean.class).execute(state.getRedirect()); } boolean popup = false; if (StringUtils.hasText(state.getPopup())) { popup = ((Boolean) fromStringTo(Boolean.class).execute(state.getPopup())); } MutableAttributeMap<Object> attributes = parseMetaAttributes(state.getAttributes()); if (state.getModel() != null) { attributes.put( "model", getLocalContext().getExpressionParser().parseExpression(state.getModel(), new FluentParserContext().evaluate(RequestContext.class))); } if (state.getValidationHints() != null) { attributes.put("validationHints", getLocalContext().getExpressionParser().parseExpression(state.getValidationHints(), new FluentParserContext().evaluate(RequestContext.class))); } parseAndPutSecured(state.getSecured(), attributes); getLocalContext().getFlowArtifactFactory().createViewState(state.getId(), flow, parseViewVariables(state.getVars()), parseActions(state.getOnEntryActions()), viewFactory, redirect, popup, parseActions(state.getOnRenderActions()), parseTransitions(state.getTransitions()), parseExceptionHandlers(state.getExceptionHandlers(), state.getTransitions()), parseActions(state.getOnExitActions()), attributes); }
public void merge(Model model) { ViewStateModel state = (ViewStateModel) 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())); setTransitions(merge(getTransitions(), state.getTransitions())); setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false)); setView(merge(getView(), state.getView())); setRedirect(merge(getRedirect(), state.getRedirect())); setPopup(merge(getPopup(), state.getPopup())); setModel(merge(getModel(), state.getModel())); setValidationHints(mergeValidationHints(getValidationHints(), state.getValidationHints())); setVars(merge(getVars(), state.getVars(), false)); setBinder((BinderModel) merge(getBinder(), state.getBinder())); setOnRenderActions(merge(getOnRenderActions(), state.getOnRenderActions(), false)); }
public void testParsedFlowValidationHints() { ClassPathResource res = new ClassPathResource("flow-validation-hints.xml", getClass()); XmlFlowModelBuilder builder = new XmlFlowModelBuilder(res); DefaultFlowModelHolder holder = new DefaultFlowModelHolder(builder); FlowModel model = holder.getFlowModel(); ViewStateModel state = (ViewStateModel) model.getStateById("state1"); assertEquals("foo,bar", state.getValidationHints()); TransitionModel transition = state.getTransitions().get(0); assertEquals("baz", transition.getValidationHints()); state = (ViewStateModel) model.getStateById("state2"); assertNull(state.getValidationHints()); } }
private void parseAndAddViewState(ViewStateModel state, Flow flow) { ViewFactory viewFactory = parseViewFactory(state.getView(), state.getId(), false, state.getBinder()); Boolean redirect = null; if (StringUtils.hasText(state.getRedirect())) { redirect = (Boolean) fromStringTo(Boolean.class).execute(state.getRedirect()); } boolean popup = false; if (StringUtils.hasText(state.getPopup())) { popup = ((Boolean) fromStringTo(Boolean.class).execute(state.getPopup())).booleanValue(); } MutableAttributeMap attributes = parseMetaAttributes(state.getAttributes()); if (state.getModel() != null) { attributes.put("model", getLocalContext().getExpressionParser().parseExpression(state.getModel(), new FluentParserContext().evaluate(RequestContext.class))); } parseAndPutSecured(state.getSecured(), attributes); getLocalContext().getFlowArtifactFactory().createViewState(state.getId(), flow, parseViewVariables(state.getVars()), parseActions(state.getOnEntryActions()), viewFactory, redirect, popup, parseActions(state.getOnRenderActions()), parseTransitions(state.getTransitions()), parseExceptionHandlers(state.getExceptionHandlers(), state.getTransitions()), parseActions(state.getOnExitActions()), attributes); }
private void parseAndAddViewState(ViewStateModel state, Flow flow) { ViewFactory viewFactory = parseViewFactory(state.getView(), state.getId(), false, state.getBinder()); Boolean redirect = null; if (StringUtils.hasText(state.getRedirect())) { redirect = (Boolean) fromStringTo(Boolean.class).execute(state.getRedirect()); } boolean popup = false; if (StringUtils.hasText(state.getPopup())) { popup = ((Boolean) fromStringTo(Boolean.class).execute(state.getPopup())); } MutableAttributeMap<Object> attributes = parseMetaAttributes(state.getAttributes()); if (state.getModel() != null) { attributes.put( "model", getLocalContext().getExpressionParser().parseExpression(state.getModel(), new FluentParserContext().evaluate(RequestContext.class))); } if (state.getValidationHints() != null) { attributes.put("validationHints", getLocalContext().getExpressionParser().parseExpression(state.getValidationHints(), new FluentParserContext().evaluate(RequestContext.class))); } parseAndPutSecured(state.getSecured(), attributes); getLocalContext().getFlowArtifactFactory().createViewState(state.getId(), flow, parseViewVariables(state.getVars()), parseActions(state.getOnEntryActions()), viewFactory, redirect, popup, parseActions(state.getOnRenderActions()), parseTransitions(state.getTransitions()), parseExceptionHandlers(state.getExceptionHandlers(), state.getTransitions()), parseActions(state.getOnExitActions()), attributes); }
assertEquals("bar", child.getAttributes().get(0).getValue()); assertEquals("foo", child.getBinder().getBindings().get(0).getProperty()); assertEquals("bar", child.getTransitions().get(0).getTo()); assertEquals("foo.bar", ((EvaluateModel) child.getOnEntryActions().get(0)).getExpression()); assertEquals("foo.bar", ((EvaluateModel) child.getOnExitActions().get(0)).getExpression());
public void merge(Model model) { ViewStateModel state = (ViewStateModel) 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())); setTransitions(merge(getTransitions(), state.getTransitions())); setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false)); setView(merge(getView(), state.getView())); setRedirect(merge(getRedirect(), state.getRedirect())); setPopup(merge(getPopup(), state.getPopup())); setModel(merge(getModel(), state.getModel())); setVars(merge(getVars(), state.getVars(), false)); setBinder((BinderModel) merge(getBinder(), state.getBinder())); setOnRenderActions(merge(getOnRenderActions(), state.getOnRenderActions(), false)); }
public void merge(Model model) { ViewStateModel state = (ViewStateModel) 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())); setTransitions(merge(getTransitions(), state.getTransitions())); setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false)); setView(merge(getView(), state.getView())); setRedirect(merge(getRedirect(), state.getRedirect())); setPopup(merge(getPopup(), state.getPopup())); setModel(merge(getModel(), state.getModel())); setValidationHints(mergeValidationHints(getValidationHints(), state.getValidationHints())); setVars(merge(getVars(), state.getVars(), false)); setBinder((BinderModel) merge(getBinder(), state.getBinder())); setOnRenderActions(merge(getOnRenderActions(), state.getOnRenderActions(), false)); }