use of org.alien4cloud.tosca.variable.ScopeVariableExpressionDTO in project alien4cloud by alien4cloud.
the class VariableExpressionService method getInEnvironmentScope.
public List<ScopeVariableExpressionDTO> getInEnvironmentScope(String varName, String applicationId, String topologyVersion, String envId) {
Application application = applicationService.getOrFail(applicationId);
if (StringUtils.isBlank(envId)) {
return Arrays.stream(applicationEnvironmentService.getAuthorizedByApplicationId(applicationId)).map(env -> getVariableDef(varName, Csar.createId(env.getApplicationId(), topologyVersion), env)).collect(Collectors.toList());
} else {
ApplicationEnvironment env = applicationEnvironmentService.getOrFail(envId);
AuthorizationUtil.checkAuthorizationForEnvironment(application, env);
return Lists.newArrayList(getVariableDef(varName, Csar.createId(env.getApplicationId(), topologyVersion), env));
}
}
use of org.alien4cloud.tosca.variable.ScopeVariableExpressionDTO in project alien4cloud by alien4cloud.
the class VariableExpressionService method getScopeVariableExpressionDTO.
private ScopeVariableExpressionDTO getScopeVariableExpressionDTO(String varName, String scopeId, String scopeName, Map<String, Object> variables) {
ScopeVariableExpressionDTO dto = new ScopeVariableExpressionDTO();
dto.setScopeId(scopeId);
dto.setScopeName(scopeName);
dto.setVariable(new Variable(varName, YamlParserUtil.dump(variables.get(varName))));
return dto;
}
Aggregations