use of alien4cloud.topology.task.TaskLevel in project alien4cloud by alien4cloud.
the class OrchestratorPropertiesValidationService method validate.
public PropertiesTask validate(OrchestratorDeploymentProperties orchestratorDeploymentProperties) {
if (orchestratorDeploymentProperties == null || StringUtils.isBlank(orchestratorDeploymentProperties.getOrchestratorId())) {
return null;
}
Map<String, PropertyDefinition> deploymentProperties = orchestratorDeploymentService.getDeploymentPropertyDefinitions(orchestratorDeploymentProperties.getOrchestratorId());
if (MapUtils.isEmpty(deploymentProperties)) {
return null;
}
Map<String, String> properties = orchestratorDeploymentProperties.getProviderDeploymentProperties();
if (properties == null) {
properties = Maps.newHashMap();
}
PropertiesTask task = null;
List<String> required = Lists.newArrayList();
for (Entry<String, PropertyDefinition> entry : deploymentProperties.entrySet()) {
if (entry.getValue().isRequired()) {
String value = properties.get(entry.getKey());
if (StringUtils.isBlank(value)) {
required.add(entry.getKey());
}
}
}
if (CollectionUtils.isNotEmpty(required)) {
task = new PropertiesTask(Maps.<TaskLevel, List<String>>newHashMap());
task.setCode(TaskCode.ORCHESTRATOR_PROPERTY);
task.getProperties().put(TaskLevel.REQUIRED, required);
}
return task;
}
Aggregations