Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.AnnotatedAction


    SetModel setModel = new SetModel("flowScope.stringArray", "intArray");
    setModel.setType("java.lang.String[]");
    model.setOnStartActions(asList(AbstractActionModel.class, setModel));
    model.setStates(asList(AbstractStateModel.class, new ViewStateModel("view")));
    Flow flow = getFlow(model);
    AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0);
    MockRequestContext context = new MockRequestContext(flow);
    context.getFlowScope().put("intArray", new int[] { 1, 2 });
    action.execute(context);
    String[] expected = (String[]) context.getFlowScope().get("stringArray");
    assertEquals("1", expected[0]);
    assertEquals("2", expected[1]);
  }
View Full Code Here


    SetModel setModel = new SetModel("testBean.stringArray", "intArray");
    model.setOnStartActions(asList(AbstractActionModel.class, setModel));
    ViewStateModel state = new ViewStateModel("view");
    model.setStates(asList(AbstractStateModel.class, state));
    Flow flow = getFlow(model);
    AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0);
    MockRequestContext context = new MockRequestContext(flow);
    context.getFlowScope().put("testBean", new TestBean());
    context.getFlowScope().put("intArray", new int[] { 1, 2 });
    action.execute(context);
    TestBean expected = (TestBean) context.getFlowScope().get("testBean");
    assertEquals("1", expected.stringArray[0]);
    assertEquals("2", expected.stringArray[1]);
  }
View Full Code Here

    evaluateModel.setResult("flowScope.stringArray");
    evaluateModel.setResultType("java.lang.String[]");
    model.setOnStartActions(asList(AbstractActionModel.class, evaluateModel));
    model.setStates(asList(AbstractStateModel.class, new ViewStateModel("view")));
    Flow flow = getFlow(model);
    AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0);
    MockRequestContext context = new MockRequestContext(flow);
    context.getFlowScope().put("testBean", new TestBean());
    action.execute(context);
    String[] expected = (String[]) context.getFlowScope().get("stringArray");
    assertEquals("1", expected[0]);
    assertEquals("2", expected[1]);
  }
View Full Code Here

    evaluateModel.setResult("flowScope.stringArray");
    evaluateModel.setResultType("java.lang.String[]");
    model.setOnStartActions(asList(AbstractActionModel.class, evaluateModel));
    model.setStates(asList(AbstractStateModel.class, new ViewStateModel("view")));
    Flow flow = getFlow(model);
    AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0);
    MockRequestContext context = new MockRequestContext(flow);
    context.getFlowScope().put("testBean", new TestBean());
    action.execute(context);
    String[] expected = (String[]) context.getFlowScope().get("stringArray");
    assertEquals("1", expected[0]);
    assertEquals("2", expected[1]);
  }
View Full Code Here

    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("multiAction", new FormAction());
    context.getRootFlow().setApplicationContext(ac);
    Expression exp = parser.parseExpression("multiAction.setupForm",
        new FluentParserContext().evaluate(RequestContext.class));
    AnnotatedAction action = (AnnotatedAction) exp.getValue(context);
    assertSame(ac.getBean("multiAction"), action.getTargetAction());
    assertEquals("setupForm", action.getMethod());
  }
View Full Code Here

    Action action = get(index);
    if (action instanceof AnnotatedAction) {
      return (AnnotatedAction) action;
    } else {
      // wrap the action; no annotations will be available
      return new AnnotatedAction(action);
    }
  }
View Full Code Here

          action = parseSetAction((SetModel) actionModel);
        } else {
          action = null;
        }
        if (action != null) {
          AnnotatedAction annotatedAction = new AnnotatedAction(action);
          annotatedAction.getAttributes().putAll(parseMetaAttributes(actionModel.getAttributes()));
          actions.add(annotatedAction);
        }
      }
      return actions.toArray(new Action[actions.size()]);
    } else {
View Full Code Here

   * Resolves multi action methods.
   */
  private static class ActionPropertyAccessor implements PropertyAccessor {
    public Object getProperty(Map context, Object target, Object name) throws OgnlException {
      Action action = (Action) target;
      AnnotatedAction annotated = new AnnotatedAction(action);
      annotated.setMethod(name.toString());
      return annotated;
    }
View Full Code Here

  public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
    return true;
  }

  public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
    AnnotatedAction annotated = new AnnotatedAction((Action) target);
    annotated.setMethod(name);
    return new TypedValue(annotated);
  }
View Full Code Here

  public Object getValue(ELContext elContext, Object base, Object property) {
    if (base instanceof Action) {
      Action action = (Action) base;
      elContext.setPropertyResolved(true);
      AnnotatedAction annotated = new AnnotatedAction(action);
      annotated.setMethod(property.toString());
      return annotated;
    } else {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.execution.AnnotatedAction

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.