aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorsiddharth0905 <siddharth.singh4@amdocs.com>2019-04-11 15:38:15 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-04-11 11:26:52 +0000
commit55e8600f2f70f051f7bd897cd4926e258980ba07 (patch)
tree3a53e9a5cc31bb5c291293f08e06e515c2903bed /catalog-be/src/main/java
parentc78fe38ca9a3684d8ccd94c6b3101a1dee474b5b (diff)
Apply Valid Value Constraints validation
Service consumption scenario fix Change-Id: I5ad7beb18b0490385d24ce30b750ca5c2ebb28a8 Issue-ID: SDC-2224 Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
index 364b007ce3..83d6730534 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
@@ -669,19 +669,30 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
private Either<Boolean, ResponseFormat> validateOperationInputConstraint(
OperationInputDefinition operationInputDefinition, String value, String type) {
- ComponentInstanceProperty propertyDefinition = new ComponentInstanceProperty();
- propertyDefinition.setType(operationInputDefinition.getParentPropertyType());
-
- InputDefinition inputDefinition = new InputDefinition();
- inputDefinition.setDefaultValue(value);
- inputDefinition.setInputPath(operationInputDefinition.getSubPropertyInputPath());
- inputDefinition.setType(type);
- if (Objects.nonNull(operationInputDefinition.getParentPropertyType())) {
+
+ if (Objects.nonNull(operationInputDefinition.getParentPropertyType())
+ && !operationInputDefinition.getParentPropertyType().equals(operationInputDefinition.getType())) {
+ InputDefinition inputDefinition = new InputDefinition();
+ inputDefinition.setDefaultValue(value);
+ inputDefinition.setInputPath(operationInputDefinition.getSubPropertyInputPath());
+ inputDefinition.setName(operationInputDefinition.getName());
+ inputDefinition.setType(type);
+
+ ComponentInstanceProperty propertyDefinition = new ComponentInstanceProperty();
+ propertyDefinition.setType(operationInputDefinition.getParentPropertyType());
inputDefinition.setProperties(Collections.singletonList(propertyDefinition));
- }
- return PropertyValueConstraintValidationUtil.getInstance()
- .validatePropertyConstraints(Collections.singletonList(inputDefinition), applicationDataTypeCache);
+ return PropertyValueConstraintValidationUtil.getInstance()
+ .validatePropertyConstraints(Collections.singletonList(inputDefinition), applicationDataTypeCache);
+ } else {
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setType(operationInputDefinition.getType());
+ propertyDefinition.setValue(value);
+ propertyDefinition.setName(operationInputDefinition.getName());
+
+ return PropertyValueConstraintValidationUtil.getInstance()
+ .validatePropertyConstraints(Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ }
}
private void addStaticValueToInputOperation(String value, Operation operation,