예제 #1
0
파일: UserMap.java 프로젝트: netxph/gittf
  private List<String> getNotMappedUserEmails() {
    final List<String> userEmails = new ArrayList<String>();

    for (final GitUser gitUser : gitUsers) {
      if (!userMap.containsKey(gitUser)) {
        userEmails.add(gitUser.getEmail());
      }
    }

    return userEmails;
  }
예제 #2
0
파일: UserMap.java 프로젝트: netxph/gittf
  public void searchTfsUsers(final TaskProgressMonitor progressMonitor) {

    // We search TFS user identities in the following order:
    //
    // 0. By a Git user e-mail address as a TFS user name.
    // 1. By a Git user e-mail address as a TFS user e-mail.
    // 2. By a Git user name address as a TFS user name.

    for (int i = 0; i < 3; i++) {
      List<String> searchValues = null;
      IdentitySearchFactor searchFactor = null;

      switch (i) {
        case 0:
          searchValues = getNotMappedUserEmails();
          searchFactor = IdentitySearchFactor.GENERAL;
          break;
        case 1:
          searchValues = getNotMappedUserEmails();
          searchFactor = IdentitySearchFactor.MAIL_ADDRESS;
          break;
        case 2:
          searchValues = getNotMappedUserNames();
          searchFactor = IdentitySearchFactor.GENERAL;
          break;
      }

      if (searchValues.size() == 0) {
        complete = true;
      }

      final Map<String, List<TfsUser>> newMapping =
          findTfsUsers(progressMonitor, searchValues, searchFactor);

      if (newMapping.size() > 0) {
        for (final GitUser gitUser : getNotMappedUsers()) {
          final String key = i < 2 ? gitUser.getEmail() : gitUser.getName();

          if (newMapping.containsKey(key)) {
            final List<TfsUser> mappedUsers = newMapping.get(key);
            mapTfsUsers(gitUser, mappedUsers);
          }
        }
      }
    }
  }