protected void collectUsages()

in usage-statistics-impl/src/jetbrains/buildServer/usageStatistics/impl/providers/OAuthConnectionsUsageStatisticsProvider.java [33:50]


  protected void collectUsages(@NotNull final UsagesCollectorCallback callback) {
    final Map<String, String> connectionTypes = myConnectionsManager.getOAuthProviders().stream()
                                                                    .collect(Collectors.toMap(
                                                                      connectionType -> connectionType.getType(),
                                                                      connectionType -> connectionType.getDisplayName()
                                                                    ));
    for(SProject project: myProjectManager.getActiveProjects()) {
      for (SProjectFeatureDescriptor feature: project.getOwnFeaturesOfType(OAuthConstants.FEATURE_TYPE)) {
        String connectionType = feature.getParameters().get(OAuthConstants.OAUTH_TYPE_PARAM);
        if (connectionType != null) {
          String displayName = connectionTypes.get(connectionType);
          if (displayName != null) {
            callback.addUsage(connectionType, displayName);
          }
        }
      }
    }
  }