aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
index ec4535a27d..ab01b99957 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
@@ -2369,6 +2369,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
private <T extends PropertyDefinition> void validateToscaGetFunction(T property, Component parentComponent) {
final ToscaGetFunctionDataDefinition toscaGetFunction = property.getToscaGetFunction();
+ validateGetToscaFunctionAttributes(toscaGetFunction);
validateGetPropertySource(toscaGetFunction.getFunctionType(), toscaGetFunction.getPropertySource());
if (toscaGetFunction.getFunctionType() == ToscaGetFunctionType.GET_INPUT) {
validateGetFunction(property, parentComponent.getInputs(), parentComponent.getModel());
@@ -2471,6 +2472,31 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
}
}
+ private void validateGetToscaFunctionAttributes(final ToscaGetFunctionDataDefinition toscaGetFunction) {
+ if (toscaGetFunction.getFunctionType() == null) {
+ throw ToscaGetFunctionExceptionSupplier.targetFunctionTypeNotFound().get();
+ }
+ if (toscaGetFunction.getPropertySource() == null) {
+ throw ToscaGetFunctionExceptionSupplier.targetPropertySourceNotFound(toscaGetFunction.getFunctionType()).get();
+ }
+ if (CollectionUtils.isEmpty(toscaGetFunction.getPropertyPathFromSource())) {
+ throw ToscaGetFunctionExceptionSupplier
+ .targetSourcePathNotFound(toscaGetFunction.getFunctionType()).get();
+ }
+ if (StringUtils.isEmpty(toscaGetFunction.getSourceName()) || StringUtils.isBlank(toscaGetFunction.getSourceName())) {
+ throw ToscaGetFunctionExceptionSupplier.sourceNameNotFound(toscaGetFunction.getPropertySource()).get();
+ }
+ if (StringUtils.isEmpty(toscaGetFunction.getSourceUniqueId()) || StringUtils.isBlank(toscaGetFunction.getSourceUniqueId())) {
+ throw ToscaGetFunctionExceptionSupplier.sourceIdNotFound(toscaGetFunction.getPropertySource()).get();
+ }
+ if (StringUtils.isEmpty(toscaGetFunction.getPropertyName()) || StringUtils.isBlank(toscaGetFunction.getPropertyName())) {
+ throw ToscaGetFunctionExceptionSupplier.propertyNameNotFound(toscaGetFunction.getPropertySource()).get();
+ }
+ if (StringUtils.isEmpty(toscaGetFunction.getPropertyUniqueId()) || StringUtils.isBlank(toscaGetFunction.getPropertyUniqueId())) {
+ throw ToscaGetFunctionExceptionSupplier.propertyIdNotFound(toscaGetFunction.getPropertySource()).get();
+ }
+ }
+
private ResponseFormat updateInputOnContainerComponent(ComponentInstanceInput input, String newValue, Component containerComponent,
ComponentInstance foundResourceInstance) {
StorageOperationStatus status;