use of com.blackducksoftware.integration.validator.FieldEnum in project hub-alert by blackducksoftware.
the class GlobalHubConfigActions method validateHubConfiguration.
public void validateHubConfiguration(final HubServerConfigBuilder hubServerConfigBuilder) throws AlertFieldException {
final AbstractValidator validator = hubServerConfigBuilder.createValidator();
final ValidationResults results = validator.assertValid();
if (!results.getResultMap().isEmpty()) {
final Map<String, String> fieldErrors = new HashMap<>();
for (final Entry<FieldEnum, Set<ValidationResult>> result : results.getResultMap().entrySet()) {
final Set<ValidationResult> validationResult = result.getValue();
final List<String> errors = new ArrayList<>();
for (final ValidationResult currentValidationResult : validationResult) {
errors.add(currentValidationResult.getMessage());
}
fieldErrors.put(result.getKey().getKey(), StringUtils.join(errors, " , "));
}
throw new AlertFieldException("There were issues with the configuration.", fieldErrors);
}
}
use of com.blackducksoftware.integration.validator.FieldEnum in project hub-alert by blackducksoftware.
the class LoginActions method validateHubConfiguration.
public void validateHubConfiguration(final HubServerConfigBuilder hubServerConfigBuilder) throws AlertFieldException {
final AbstractValidator validator = hubServerConfigBuilder.createValidator();
final ValidationResults results = validator.assertValid();
if (!results.getResultMap().isEmpty()) {
final Map<String, String> fieldErrors = new HashMap<>();
for (final Entry<FieldEnum, Set<ValidationResult>> result : results.getResultMap().entrySet()) {
final Set<ValidationResult> validationResult = result.getValue();
final List<String> errors = new ArrayList<>();
for (final ValidationResult currentValidationResult : validationResult) {
errors.add(currentValidationResult.getMessage());
}
final String key = result.getKey().getKey();
final String errorMessage = StringUtils.join(errors, " , ");
fieldErrors.put(key, errorMessage);
}
throw new AlertFieldException("There were issues with the configuration.", fieldErrors);
}
}
Aggregations