use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class JiraServerDistributionConfigurationValidator method validate.
@Override
public Set<AlertFieldStatus> validate(JobFieldModel jobFieldModel) {
HashSet<AlertFieldStatus> validationResults = new HashSet<>();
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromJobFieldModel(jobFieldModel);
commonChannelDistributionValidator.validate(configurationFieldValidator);
configurationFieldValidator.validateRequiredFieldsAreNotBlank(JiraServerDescriptor.KEY_JIRA_PROJECT_NAME, JiraServerDescriptor.KEY_ISSUE_TYPE);
configurationFieldValidator.validateRequiredRelatedSet(JiraServerDescriptor.KEY_OPEN_WORKFLOW_TRANSITION, JiraServerDescriptor.LABEL_OPEN_WORKFLOW_TRANSITION, JiraServerDescriptor.KEY_RESOLVE_WORKFLOW_TRANSITION);
// Validate custom field mappings
jobFieldModel.getFieldModels().stream().filter(fieldModel -> jiraServerChannelKey.getUniversalKey().equals(fieldModel.getDescriptorName())).findFirst().flatMap(fieldModel -> fieldModel.getFieldValueModel(JiraServerDescriptor.KEY_FIELD_MAPPING)).flatMap(fieldValueModel -> jiraFieldMappingValidator.validateFieldMappings(JiraServerDescriptor.KEY_FIELD_MAPPING, fieldValueModel)).ifPresent(validationResults::add);
validationResults.addAll(configurationFieldValidator.getValidationResults());
return validationResults;
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class AzureBoardsDistributionConfigurationValidator method validate.
@Override
public Set<AlertFieldStatus> validate(JobFieldModel jobFieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromJobFieldModel(jobFieldModel);
commonChannelDistributionValidator.validate(configurationFieldValidator);
configurationFieldValidator.validateRequiredFieldsAreNotBlank(AzureBoardsDescriptor.KEY_AZURE_PROJECT, AzureBoardsDescriptor.KEY_WORK_ITEM_TYPE);
configurationFieldValidator.validateRequiredRelatedSet(AzureBoardsDescriptor.KEY_WORK_ITEM_REOPEN_STATE, AzureBoardsDescriptor.LABEL_WORK_ITEM_REOPEN_STATE, AzureBoardsDescriptor.KEY_WORK_ITEM_COMPLETED_STATE);
return configurationFieldValidator.getValidationResults();
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class AzureBoardsGlobalConfigurationFieldModelValidator method validate.
@Override
public Set<AlertFieldStatus> validate(FieldModel fieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromFieldModel(fieldModel);
configurationFieldValidator.validateRequiredFieldIsNotBlank(AzureBoardsDescriptor.KEY_ORGANIZATION_NAME);
configurationFieldValidator.validateRequiredFieldIsNotBlank(AzureBoardsDescriptor.KEY_CLIENT_ID);
configurationFieldValidator.validateRequiredFieldIsNotBlank(AzureBoardsDescriptor.KEY_CLIENT_SECRET);
if (oAuthRequestValidator.hasRequests()) {
configurationFieldValidator.addValidationResults(AlertFieldStatus.error(AzureBoardsDescriptor.KEY_OAUTH, "Authentication in progress cannot perform current action."));
}
return configurationFieldValidator.getValidationResults();
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class BlackDuckGlobalConfigurationFieldModelValidator method validate.
@Override
public Set<AlertFieldStatus> validate(FieldModel fieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromFieldModel(fieldModel);
configurationFieldValidator.validateRequiredFieldsAreNotBlank(List.of(ProviderDescriptor.KEY_PROVIDER_CONFIG_NAME, BlackDuckDescriptor.KEY_BLACKDUCK_URL, BlackDuckDescriptor.KEY_BLACKDUCK_API_KEY, BlackDuckDescriptor.KEY_BLACKDUCK_TIMEOUT));
configurationFieldValidator.validateIsAURL(BlackDuckDescriptor.KEY_BLACKDUCK_URL);
validateAPIToken(configurationFieldValidator);
validateDuplicateNames(fieldModel).ifPresent(configurationFieldValidator::addValidationResults);
validateTimeout(configurationFieldValidator);
return configurationFieldValidator.getValidationResults();
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class JiraServerGlobalConfigurationFieldModelValidator method validate.
@Override
public Set<AlertFieldStatus> validate(FieldModel fieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromFieldModel(fieldModel);
configurationFieldValidator.validateRequiredFieldIsNotBlank(JiraServerDescriptor.KEY_SERVER_URL);
configurationFieldValidator.validateIsAURL(JiraServerDescriptor.KEY_SERVER_URL);
configurationFieldValidator.validateRequiredFieldIsNotBlank(JiraServerDescriptor.KEY_SERVER_USERNAME);
configurationFieldValidator.validateRequiredFieldIsNotBlank(JiraServerDescriptor.KEY_SERVER_PASSWORD);
return configurationFieldValidator.getValidationResults();
}
Aggregations