use of com.epam.pipeline.exception.ConfigurationReadingException in project cloud-pipeline by epam.
the class PipelineVersionManager method loadConfigurationEntry.
public ConfigurationEntry loadConfigurationEntry(Long id, String version, String configName) throws GitClientException {
List<ConfigurationEntry> configurations = loadConfigurationsFromScript(id, version);
if (CollectionUtils.isEmpty(configurations)) {
throw new ConfigurationReadingException(CONFIG_FILE_NAME);
}
if (StringUtils.hasText(configName)) {
return configurations.stream().filter(conf -> conf.getName() != null && conf.getName().equals(configName)).findFirst().orElseThrow(() -> new IllegalArgumentException(messageHelper.getMessage(MessageConstants.ERROR_CONFIG_NOT_FOUND, configName)));
}
ConfigurationEntry defaultConfig = getDefaultConfig(configurations);
return defaultConfig == null ? configurations.get(0) : defaultConfig;
}
Aggregations