Package org.springframework.binding.expression.support

Examples of org.springframework.binding.expression.support.FluentParserContext


  }

  public void testSetConversationScope() {
    MockRequestContext context = new MockRequestContext();
    context.getConversationScope().put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class));
    exp.setValue(context, "baz");
    assertEquals("baz", exp.getValue(context));
  }
View Full Code Here


  public void testResolveSpringBean() {
    MockRequestContext context = new MockRequestContext();
    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("testBean", new TestBean());
    context.getRootFlow().setApplicationContext(ac);
    Expression exp = parser.parseExpression("testBean", new FluentParserContext().evaluate(RequestContext.class));
    assertSame(ac.getBean("testBean"), exp.getValue(context));
  }
View Full Code Here

  public void testResolveAction() {
    MockRequestContext context = new MockRequestContext();
    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("action", new TestAction());
    context.getRootFlow().setApplicationContext(ac);
    Expression exp = parser.parseExpression("action", new FluentParserContext().evaluate(RequestContext.class));
    assertSame(ac.getBean("action"), exp.getValue(context));
  }
View Full Code Here

    if (StringUtils.hasText(input.getValue())) {
      value = input.getValue();
    } else {
      value = "flowScope." + name;
    }
    Expression source = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class));
    Expression target = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class));
    DefaultMapping mapping = new DefaultMapping(source, target);
    parseAndSetMappingConversionExecutor(input, mapping);
    parseAndSetMappingRequired(input, mapping);
    return mapping;
  }
View Full Code Here

    if (StringUtils.hasText(input.getValue())) {
      value = input.getValue();
    } else {
      value = name;
    }
    Expression source = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class));
    Expression target = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class));
    DefaultMapping mapping = new DefaultMapping(source, target);
    parseAndSetMappingConversionExecutor(input, mapping);
    parseAndSetMappingRequired(input, mapping);
    return mapping;
  }
View Full Code Here

    if (StringUtils.hasText(output.getValue())) {
      value = output.getValue();
    } else {
      value = name;
    }
    Expression source = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class));
    Expression target = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class));
    DefaultMapping mapping = new DefaultMapping(source, target);
    parseAndSetMappingConversionExecutor(output, mapping);
    parseAndSetMappingRequired(output, mapping);
    return mapping;
  }
View Full Code Here

    if (StringUtils.hasText(output.getValue())) {
      value = output.getValue();
    } else {
      value = "flowScope." + name;
    }
    Expression source = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class));
    Expression target = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class));
    DefaultMapping mapping = new DefaultMapping(source, target);
    parseAndSetMappingConversionExecutor(output, mapping);
    parseAndSetMappingRequired(output, mapping);
    return mapping;
  }
View Full Code Here

      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()),
View Full Code Here

      if (endState) {
        return null;
      } else {
        view = getLocalContext().getViewFactoryCreator().getViewIdByConvention(stateId);
        Expression viewId = getLocalContext().getExpressionParser().parseExpression(view,
            new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class));
        return createViewFactory(viewId, binderModel);
      }
    } else if (view.startsWith("externalRedirect:")) {
      String encodedUrl = view.substring("externalRedirect:".length());
      Expression externalUrl = getLocalContext().getExpressionParser().parseExpression(encodedUrl,
          new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class));
      return new ActionExecutingViewFactory(new ExternalRedirectAction(externalUrl));
    } else if (view.startsWith("flowRedirect:")) {
      String flowRedirect = view.substring("flowRedirect:".length());
      Expression expression = getLocalContext().getExpressionParser().parseExpression(flowRedirect,
          new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class));
      return new ActionExecutingViewFactory(new FlowDefinitionRedirectAction(expression));
    } else {
      Expression viewId = getLocalContext().getExpressionParser().parseExpression(view,
          new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class));
      return createViewFactory(viewId, binderModel);
    }
  }
View Full Code Here

    }
  }

  private Transition parseThen(IfModel ifModel) {
    Expression test = getLocalContext().getExpressionParser().parseExpression(ifModel.getTest(),
        new FluentParserContext().evaluate(RequestContext.class).expectResult(Boolean.class));
    TransitionCriteria matchingCriteria = new DefaultTransitionCriteria(test);
    TargetStateResolver targetStateResolver = (TargetStateResolver) fromStringTo(TargetStateResolver.class)
        .execute(ifModel.getThen());
    return getLocalContext().getFlowArtifactFactory().createTransition(targetStateResolver, matchingCriteria, null,
        null);
View Full Code Here

TOP

Related Classes of org.springframework.binding.expression.support.FluentParserContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.