class AmbariLdapDataPopulator {

  public LdapBatchDto synchronizeAllLdapUsers(LdapBatchDto batchInfo) throws AmbariException {
    LOG.trace("Synchronize All LDAP users...");
    Set<LdapUserDto> externalLdapUserInfo = getExternalLdapUserInfo();
    Map<String, User> internalUsersMap = getInternalUsers();

    for (LdapUserDto userDto : externalLdapUserInfo) {
      String userName = userDto.getUserName();
      if (internalUsersMap.containsKey(userName)) {
        final User user = internalUsersMap.get(userName);
        if (user != null && !user.isLdapUser()) {
          if (LdapUsernameCollisionHandlingBehavior.SKIP == getConfiguration().syncCollisionHandlingBehavior()) {
            LOG.info("User '{}' skipped because it is local user", userName);
            batchInfo.getUsersSkipped().add(userDto);
          } else {
            batchInfo.getUsersToBecomeLdap().add(userDto);
            LOG.trace("Convert user '{}' to LDAP user.", userName);
          }
        }
        internalUsersMap.remove(userName);
      } else {
        batchInfo.getUsersToBeCreated().add(userDto);
      }
    }
    for (Entry<String, User> internalUser : internalUsersMap.entrySet()) {
      if (internalUser.getValue().isLdapUser()) {
        LdapUserDto userDto = new LdapUserDto();
        userDto.setUserName(internalUser.getValue().getUserName());
        userDto.setDn(null);  // Setting to null since we do not know what the DN for this user was.
        batchInfo.getUsersToBeRemoved().add(userDto);
      }
    }

    return batchInfo;
  }

  @Inject public  AmbariLdapDataPopulator(Provider<AmbariLdapConfiguration> configurationProvider, Users users);

}