- validateGetPropertySource(toscaGetFunction.getFunctionType(), toscaGetFunction.getPropertySource());
- if (toscaGetFunction.getFunctionType() == ToscaGetFunctionType.GET_INPUT) {
- validateGetFunction(property, parentComponent.getInputs(), parentComponent.getModel());
- return;
- }
- if (toscaGetFunction.getFunctionType() == ToscaGetFunctionType.GET_PROPERTY) {
- if (toscaGetFunction.getPropertySource() == PropertySource.SELF) {
- validateGetFunction(property, parentComponent.getProperties(), parentComponent.getModel());
- } else if (toscaGetFunction.getPropertySource() == PropertySource.INSTANCE) {
- final ComponentInstance componentInstance =
- parentComponent.getComponentInstanceById(toscaGetFunction.getSourceUniqueId())
+ final ToscaGetFunctionType functionType = toscaGetFunction.getFunctionType();
+ validateGetPropertySource(functionType, toscaGetFunction.getPropertySource());
+ final String model = parentComponent.getModel();
+ switch (functionType) {
+ case GET_INPUT:
+ validateGetFunction(property, parentComponent.getInputs(), model);
+ break;
+ case GET_PROPERTY:
+ if (toscaGetFunction.getPropertySource() == PropertySource.SELF) {
+ validateGetFunction(property, parentComponent.getProperties(), model);
+ } else if (toscaGetFunction.getPropertySource() == PropertySource.INSTANCE) {
+ final ComponentInstance componentInstance =
+ parentComponent.getComponentInstanceById(toscaGetFunction.getSourceUniqueId())
+ .orElseThrow(ToscaGetFunctionExceptionSupplier.instanceNotFound(toscaGetFunction.getSourceName()));
+ validateGetFunction(property, componentInstance.getProperties(), model);
+ }
+ break;
+ case GET_ATTRIBUTE:
+ if (toscaGetFunction.getPropertySource() == PropertySource.SELF) {
+ validateGetFunction(property, combine(parentComponent.getProperties(), parentComponent.getAttributes()), model);
+ } else if (toscaGetFunction.getPropertySource() == PropertySource.INSTANCE) {
+ final ComponentInstance componentInstance = parentComponent.getComponentInstanceById(toscaGetFunction.getSourceUniqueId())