Getting the data

As a good practice, we'll define an interface for interacting with the other system. We'll introduce a LegacyBankService interface for this purpose. It will make it easier to change the way we communicate with the legacy system, and also the tests will be easier to write.

package droolsbook.transform.service;

import java.util.List;
import java.util.Map;

public interface LegacyBankService {

  /**
   * @return all customers
   */
  List<Map<String, Object>> findAllCustomers();

  /**
   * @return addresses for specified customer id
   */
  List<Map<String, Object>> findAddressByCustomerId(
      Long customerId);

  /**
   * @return accounts for specified customer id
   */
  List<Map<String, Object>> findAccountByCustomerId(
      Long customerId);

}

Code listing 1: Interface ...

Get Drools JBoss Rules 5.X Developer's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.