Package org.springframework.integration.samples.enricher.service

Examples of org.springframework.integration.samples.enricher.service.UserService


    context.registerShutdownHook();

    final Scanner scanner = new Scanner(System.in);

    final UserService service = context.getBean(UserService.class);

    LOGGER.info(LINE_SEPARATOR
          + EMPTY_LINE
          + "\n    Please press 'q + Enter' to quit the application.                     "
          + EMPTY_LINE
          + LINE_SEPARATOR
          + EMPTY_LINE
          + "\n    This example illustrates the usage of the Content Enricher.           "
          + EMPTY_LINE
          + "\n    Usage: Please enter 1 or 2 or 3 + Enter                               "
          + EMPTY_LINE
          + "\n    3 different message flows are triggered. For sample 1+2 a             "
          + "\n    user object containing only the username is passed in.                "
          + "\n    For sample 3 a Map with the 'username' key is passed in and enriched  "
          + "\n    with the user object using the 'user' key.                            "
          + EMPTY_LINE
          + "\n    1: In the Enricher, pass the full User object to the request channel. "
          + "\n    2: In the Enricher, pass only the username to the request channel.    "
          + "\n    3: In the Enricher, pass only the username to the request channel.    "
          + EMPTY_LINE
          + LINE_SEPARATOR);

    while (!scanner.hasNext("q")) {

      final String input = scanner.nextLine();

      User user = new User("foo", null, null);

      if ("1".equals(input)) {

        final User fullUser = service.findUser(user);
        printUserInformation(fullUser);

      } else if ("2".equals(input)) {

        final User fullUser = service.findUserByUsername(user);
        printUserInformation(fullUser);

      } else if ("3".equals(input)) {

        final Map<String, Object> userData = new HashMap<String, Object>();
        userData.put("username", "foo_map");

        final Map<String, Object> enrichedUserData = service.findUserWithUsernameInMap(userData);

        final User fullUser = (User) enrichedUserData.get("user");

        printUserInformation(fullUser);
View Full Code Here

TOP

Related Classes of org.springframework.integration.samples.enricher.service.UserService

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.