diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2022-06-28 08:50:53 +0100 |
---|---|---|
committer | Andr� Schmid <andre.schmid@est.tech> | 2022-07-11 16:15:10 +0000 |
commit | 4508aef64655154553aa01f5f6f5cc51317f7266 (patch) | |
tree | 0f8cfd04e8536818c6891969f1799a04cf1e0068 | |
parent | a99abdf5317f4f0f7435af71278701b3b43282a2 (diff) |
Support tosca functions for group instances in composition view
Issue-ID: SDC-4078
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: Id65ae1c0cac8cb61cece69e2c88a588027c675fd
2 files changed, 11 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java index 4a1e787588..7c01a35a32 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java @@ -19,6 +19,7 @@ * Modifications copyright (c) 2019 Nokia * ================================================================================ */ + package org.openecomp.sdc.be.components.impl; import static org.openecomp.sdc.be.components.impl.BaseBusinessLogic.enumHasValueFilter; @@ -139,6 +140,9 @@ public class GroupBusinessLogicNew { if (!isOnlyGroupPropertyValueChanged(gp, originalProperties.get(updatedPropertyName))) { throw new ByActionStatusComponentException(ActionStatus.INVALID_PROPERTY, updatedPropertyName); } + if (gp.hasGetFunction()) { + gp.setValue(gp.getToscaGetFunction().generatePropertyValue()); + } if (StringUtils.isEmpty(gp.getValue())) { gp.setValue(originalProperties.get(updatedPropertyName).getDefaultValue()); } @@ -225,7 +229,7 @@ public class GroupBusinessLogicNew { } else { value = parentValues.get(propertyKey); } - return Integer.valueOf(value); + return Integer.parseInt(value); } private boolean isOnlyGroupPropertyValueChanged(GroupProperty groupProperty1, GroupProperty groupProperty2) { @@ -233,10 +237,14 @@ public class GroupBusinessLogicNew { groupProperty1Duplicate.setValue(null); groupProperty1Duplicate.setSchema(null); groupProperty1Duplicate.setParentUniqueId(null); + groupProperty1Duplicate.setToscaGetFunction(null); + groupProperty1Duplicate.setToscaGetFunctionType(null); GroupProperty groupProperty2Duplicate = new GroupProperty(groupProperty2); groupProperty2Duplicate.setValue(null); groupProperty2Duplicate.setSchema(null); groupProperty2Duplicate.setParentUniqueId(null); + groupProperty2Duplicate.setToscaGetFunction(null); + groupProperty2Duplicate.setToscaGetFunctionType(null); return StringUtils.equals(groupProperty1Duplicate.getValueUniqueUid(), groupProperty2Duplicate.getValueUniqueUid()) && groupProperty1Duplicate .equals(groupProperty2Duplicate); } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java index 8fe4cffac3..d20d2afea0 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java @@ -313,6 +313,8 @@ public class GroupsOperation extends BaseOperation { Optional<PropertyDataDefinition> currentProp = properties.stream().filter(p -> p.getName().equals(np.getName())).findAny(); if (currentProp.isPresent()) { currentProp.get().setValue(np.getValue()); + currentProp.get().setToscaGetFunction(np.getToscaGetFunction()); + currentProp.get().setToscaGetFunctionType(np.getToscaGetFunctionType()); } }); updateVersion(promoteMinorVersion, group); |