Package org.springframework.binding.mapping

Examples of org.springframework.binding.mapping.Mapper


  hotel.setId(1L);
  hotel.setName("Jameson Inn");
  getFlowScope().put("hotel", hotel);

  Flow mockBookingFlow = new Flow("booking");
  mockBookingFlow.setInputMapper(new Mapper() {
      public MappingResults map(Object source, Object target) {
    assertEquals(new Long(1), ((AttributeMap) source).get("hotelId"));
    return null;
      }
  });
View Full Code Here


      }

      public void mapSubflowOutput(AttributeMap flowOutput, RequestContext context) {
      }
    });
    subflow.setInputMapper(new Mapper() {
      public MappingResults map(Object source, Object target) {
        MutableAttributeMap map = (MutableAttributeMap) source;
        assertEquals("bar", map.get("foo"));
        return new DefaultMappingResults(source, target, Collections.EMPTY_LIST);
      }
View Full Code Here

    new State(parentFlow, "whatev") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
      }
    };
    new EndState(subflow, "end");
    subflow.setOutputMapper(new Mapper() {
      public MappingResults map(Object source, Object target) {
        MutableAttributeMap map = (MutableAttributeMap) target;
        map.put("foo", "bar");
        return new DefaultMappingResults(source, target, Collections.EMPTY_LIST);
      }
View Full Code Here

    if (StringUtils.hasText(state.getSubflowAttributeMapper())) {
      String beanId = state.getSubflowAttributeMapper();
      return (SubflowAttributeMapper) getLocalContext().getApplicationContext().getBean(beanId,
          SubflowAttributeMapper.class);
    } else {
      Mapper inputMapper = parseSubflowInputMapper(state.getInputs());
      Mapper outputMapper = parseSubflowOutputMapper(state.getOutputs());
      return new GenericSubflowAttributeMapper(inputMapper, outputMapper);
    }
  }
View Full Code Here

    assertCurrentStateEquals("displayResults");
  }

  protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) {
    Flow mockDetailFlow = new Flow("detail-flow");
    mockDetailFlow.setInputMapper(new Mapper() {
      public MappingResults map(Object source, Object target) {
        assertEquals("id of value 1 not provided as input by calling search flow", new Long(1),
            ((AttributeMap) source).get("id"));
        return null;
      }
View Full Code Here

      }

      public void mapSubflowOutput(AttributeMap<?> flowOutput, RequestContext context) {
      }
    });
    subflow.setInputMapper(new Mapper() {
      @SuppressWarnings("unchecked")
      public MappingResults map(Object source, Object target) {
        MutableAttributeMap<Object> map = (MutableAttributeMap<Object>) source;
        assertEquals("bar", map.get("foo"));
        return new DefaultMappingResults(source, target, Collections.<MappingResult> emptyList());
View Full Code Here

    new State(parentFlow, "whatev") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
      }
    };
    new EndState(subflow, "end");
    subflow.setOutputMapper(new Mapper() {
      @SuppressWarnings("unchecked")
      public MappingResults map(Object source, Object target) {
        MutableAttributeMap<Object> map = (MutableAttributeMap<Object>) target;
        map.put("foo", "bar");
        return new DefaultMappingResults(source, target, Collections.<MappingResult> emptyList());
View Full Code Here

    assertCurrentStateEquals("displayResults");
  }

  protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) {
    Flow mockDetailFlow = new Flow("detail-flow");
    mockDetailFlow.setInputMapper(new Mapper() {
      @SuppressWarnings("unchecked")
      public MappingResults map(Object source, Object target) {
        assertEquals("id of value 1 not provided as input by calling search flow", new Long(1),
            ((AttributeMap<Object>) source).get("id"));
        return null;
View Full Code Here

  private SubflowAttributeMapper parseSubflowAttributeMapper(SubflowStateModel state) {
    if (StringUtils.hasText(state.getSubflowAttributeMapper())) {
      String beanId = state.getSubflowAttributeMapper();
      return getLocalContext().getApplicationContext().getBean(beanId, SubflowAttributeMapper.class);
    } else {
      Mapper inputMapper = parseSubflowInputMapper(state.getInputs());
      Mapper outputMapper = parseSubflowOutputMapper(state.getOutputs());
      return new GenericSubflowAttributeMapper(inputMapper, outputMapper);
    }
  }
View Full Code Here

    resumeFlow(context);
  }

  private Flow createMockBookingSubflow() {
      Flow mockBookingFlow = new Flow("secured/placeOrders");
      mockBookingFlow.setInputMapper(new Mapper() {
          public MappingResults map(Object source, Object target) {
              // assert that 1L was passed in as input
              return null;
          }
      });
View Full Code Here

TOP

Related Classes of org.springframework.binding.mapping.Mapper

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.