use of jetbrains.buildServer.serverSide.parameters.types.PasswordsSearcher in project teamcity-rest by JetBrains.
the class Build method calculateAllParameters.
private static ParametersProvider calculateAllParameters(@NotNull final BuildPromotion buildPromotion, @NotNull PasswordsSearcher searcher) {
Set<String> passwords = searcher.collectPasswords(buildPromotion);
ParametersProvider provider = ((BuildPromotionEx) buildPromotion).getParametersProvider();
if (passwords.isEmpty()) {
return provider;
}
PasswordReplacer passwordReplacer = PasswordParametersFilterCore.createPasswordReplacer(passwords);
return new ParametersProvider() {
@Nullable
@Override
public String get(@NotNull final String key) {
return Util.resolveNull(provider.get(key), passwordReplacer::replacePasswords);
}
@Override
public int size() {
return provider.size();
}
@Override
public Map<String, String> getAll() {
return provider.getAll().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> passwordReplacer.replacePasswords(e.getValue())));
}
};
}
Aggregations