summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org/openecomp/sdc/be/components/property
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/property')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java10
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java9
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java69
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java77
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclarator.java7
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java7
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarationOrchestrator.java44
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarator.java17
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java7
10 files changed, 232 insertions, 20 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java
index faeca88d60..d7b366e0a8 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java
@@ -79,6 +79,16 @@ public class ComponentInstanceInputPropertyDeclarator extends DefaultPropertyDec
}
@Override
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition input) {
+ List<ComponentInstanceInput> componentInstanceInputsByInputId = componentInstanceBusinessLogic.getComponentInstanceInputsByInputId(component, input.getUniqueId());
+ if (isEmpty(componentInstanceInputsByInputId)) {
+ return StorageOperationStatus.OK;
+ }
+ componentInstanceInputsByInputId.forEach(cmptInstanceInput -> prepareValueBeforeDelete(input, cmptInstanceInput, cmptInstanceInput.getPath()));
+ return toscaOperationFacade.updateComponentInstanceInputs(component, componentInstanceInputsByInputId.get(0).getComponentInstanceId(), componentInstanceInputsByInputId);
+ }
+
+ @Override
InputDefinition createInputFromProperty(String componentId, ComponentInstance propertiesOwner, String inputName, ComponentInstancePropInput propInput, PropertyDataDefinition prop) {
InputDefinition inputFromProperty = super.createInputFromProperty(componentId, propertiesOwner, inputName, propInput, prop);
Component propertiesOwnerNodeType = getInstanceOriginType(propertiesOwner);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java
index c716e24440..973e5985f9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java
@@ -70,4 +70,13 @@ public class ComponentInstancePropertyDeclarator extends DefaultPropertyDeclarat
return toscaOperationFacade.updateComponentInstanceProperties(component, componentInstancePropertiesDeclaredAsInput.get(0).getComponentInstanceId(), componentInstancePropertiesDeclaredAsInput);
}
+ @Override
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition input) {
+ List<ComponentInstanceProperty> componentInstancePropertiesDeclaredAsInput = componentInstanceBusinessLogic.getComponentInstancePropertiesByInputId(component, input.getUniqueId());
+ if (CollectionUtils.isEmpty(componentInstancePropertiesDeclaredAsInput)) {
+ return StorageOperationStatus.OK;
+ }
+ componentInstancePropertiesDeclaredAsInput.forEach(cmptInstanceProperty -> prepareValueBeforeDelete(input, cmptInstanceProperty, cmptInstanceProperty.getPath()));
+ return toscaOperationFacade.updateComponentInstanceProperties(component, componentInstancePropertiesDeclaredAsInput.get(0).getComponentInstanceId(), componentInstancePropertiesDeclaredAsInput);
+ }
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java
index d382499172..ae76dadbf0 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java
@@ -110,6 +110,40 @@ public class ComponentPropertyDeclarator extends DefaultPropertyDeclarator<Compo
return StorageOperationStatus.OK;
}
+ @Override
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component,
+ InputDefinition input) {
+ PropertyDefinition propertyDefinition = new PropertyDefinition(input);
+
+ if(propertyBL.isPropertyUsedByOperation(component, propertyDefinition)) {
+ return StorageOperationStatus.DECLARED_INPUT_USED_BY_OPERATION;
+ }
+
+ Optional<List <PropertyDefinition>> propertyToUpdateCandidate =
+ getDeclaredPropertiesByInputId(component, input.getUniqueId());
+
+ if(propertyToUpdateCandidate.isPresent()) {
+ List<PropertyDefinition> propertiesToUpdate = propertyToUpdateCandidate.get();
+ if (!propertiesToUpdate.isEmpty()) {
+ return unDeclareInputs(component, input, propertiesToUpdate);
+ }
+ }
+
+ return StorageOperationStatus.OK;
+ }
+
+ private StorageOperationStatus unDeclareInputs(Component component,
+ InputDefinition input,
+ List <PropertyDefinition> propertiesToUpdate) {
+ for (PropertyDefinition propertyToUpdate : propertiesToUpdate) {
+ StorageOperationStatus storageOperationStatus = unDeclareInput(component, input, propertyToUpdate);
+ if (StorageOperationStatus.OK != storageOperationStatus) {
+ return storageOperationStatus;
+ }
+ }
+ return StorageOperationStatus.OK;
+ }
+
private StorageOperationStatus unDeclareInput(Component component,
InputDefinition input,
PropertyDefinition propertyToUpdate) {
@@ -124,9 +158,34 @@ public class ComponentPropertyDeclarator extends DefaultPropertyDeclarator<Compo
return StorageOperationStatus.OK;
}
- private Optional<PropertyDefinition> getDeclaredPropertyByInputId(Component component,
+ private Optional<PropertyDefinition> getDeclaredPropertyByInputId(Component component, String inputId) {
+ List<PropertyDefinition> properties = component.getProperties();
+
+ if (CollectionUtils.isEmpty(properties)) {
+ return Optional.empty();
+ }
+
+ for (PropertyDefinition propertyDefinition : properties) {
+ List<GetInputValueDataDefinition> getInputValues = propertyDefinition.getGetInputValues();
+ if (CollectionUtils.isEmpty(getInputValues)) {
+ continue;
+ }
+
+ Optional<GetInputValueDataDefinition> getInputCandidate =
+ getInputValues.stream().filter(getInput -> getInput.getInputId().equals(inputId)).findAny();
+
+ if (getInputCandidate.isPresent()) {
+ return Optional.of(propertyDefinition);
+ }
+ }
+
+ return Optional.empty();
+ }
+
+ private Optional<List <PropertyDefinition>> getDeclaredPropertiesByInputId(Component component,
String inputId) {
List<PropertyDefinition> properties = component.getProperties();
+ List<PropertyDefinition> propertiesToUpdate = new ArrayList<>();
if(CollectionUtils.isEmpty(properties)) {
return Optional.empty();
@@ -139,14 +198,14 @@ public class ComponentPropertyDeclarator extends DefaultPropertyDeclarator<Compo
}
Optional<GetInputValueDataDefinition> getInputCandidate =
- getInputValues.stream().filter(getInput -> getInput.getInputId().equals(inputId))
- .findAny();
+ getInputValues.stream().filter(getInput -> getInput.getInputId().equals(inputId))
+ .findAny();
if(getInputCandidate.isPresent()) {
- return Optional.of(propertyDefinition);
+ propertiesToUpdate.add(propertyDefinition);
}
}
- return Optional.empty();
+ return Optional.of(propertiesToUpdate);
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
index 02b261b132..46c1c009bc 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java
@@ -11,12 +11,14 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.StringUtils;
import org.json.simple.JSONObject;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
@@ -45,6 +47,7 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
private final Gson gson = new Gson();
private ComponentsUtils componentsUtils;
private PropertyOperation propertyOperation;
+ private static final String GET_INPUT_INDEX = "INDEX";
public DefaultPropertyDeclarator(ComponentsUtils componentsUtils, PropertyOperation propertyOperation) {
this.componentsUtils = componentsUtils;
@@ -75,7 +78,17 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
return resolvePropertiesOwner(component, propertiesOwnerId)
.map(propertyOwner -> declarePropertiesAsPolicies(component, propertyOwner, propsToDeclare))
.orElse(Either.right(onPropertiesOwnerNotFound(component.getUniqueId(), propertiesOwnerId)));
+ }
+ @Override
+ public Either<InputDefinition, StorageOperationStatus> declarePropertiesAsListInput(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare, InputDefinition input) {
+ log.debug("#declarePropertiesAsListInput - declaring properties as inputs for component {} from properties owner {}", component.getUniqueId(), propertiesOwnerId);
+ Optional<PROPERTYOWNER> propertyOwner = resolvePropertiesOwner(component, propertiesOwnerId);
+ if (propertyOwner.isPresent()) {
+ return declarePropertiesAsListInput(component, propertyOwner.get(), propsToDeclare, input);
+ } else {
+ return Either.right(onPropertiesOwnerNotFound(component.getUniqueId(), propertiesOwnerId));
+ }
}
public StorageOperationStatus unDeclarePropertiesAsPolicies(Component component, PolicyDefinition policy) {
@@ -130,12 +143,12 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
}
private void changePropertyValueToGetPolicy(PropertyDataDefinition prop, PolicyDefinition policyDefinition) {
- JSONObject jobject = new JSONObject();
+ JSONObject jsonObject = new JSONObject();
String origValue = Objects.isNull(prop.getValue()) ? prop.getDefaultValue() : prop.getValue();
- jobject.put(GET_POLICY, null);
- prop.setValue(jobject.toJSONString());
- policyDefinition.setValue(jobject.toJSONString());
+ jsonObject.put(GET_POLICY, null);
+ prop.setValue(jsonObject.toJSONString());
+ policyDefinition.setValue(jsonObject.toJSONString());
if(CollectionUtils.isEmpty(prop.getGetPolicyValues())){
prop.setGetPolicyValues(new ArrayList<>());
@@ -155,6 +168,39 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
}
+ private Either<InputDefinition, StorageOperationStatus> declarePropertiesAsListInput(Component component, PROPERTYOWNER propertiesOwner, List<ComponentInstancePropInput> propsToDeclare, InputDefinition input) {
+ List<PROPERTYTYPE> declaredProperties = new ArrayList<>();
+ for (ComponentInstancePropInput propInput : propsToDeclare) {
+ if (StringUtils.isNotEmpty(propInput.getPropertiesName()) && propInput.getInput() != null) {
+ // sub-property in complex type is checked on UI. currently not supported.
+ log.debug("skip propInput (propertiesName={}) currently not supported.", propInput.getPropertiesName());
+ continue;
+ }
+ PROPERTYTYPE declaredProperty = createDeclaredProperty(propInput);
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put(GET_INPUT, Arrays.asList(input.getName(), GET_INPUT_INDEX, propInput.getName()));
+ declaredProperty.setValue(jsonObject.toJSONString());
+
+ GetInputValueDataDefinition getInputValueDataDefinition = new GetInputValueDataDefinition();
+ getInputValueDataDefinition.setInputId(input.getUniqueId());
+ getInputValueDataDefinition.setInputName(input.getName());
+ List<GetInputValueDataDefinition> getInputValues = declaredProperty.getGetInputValues();
+ if (getInputValues == null) {
+ getInputValues = new ArrayList<>();
+ declaredProperty.setGetInputValues(getInputValues);
+ }
+ getInputValues.add(getInputValueDataDefinition);
+
+ if (!declaredProperties.contains(declaredProperty)) {
+ // Add property to the list if not contain in declareProperties.
+ declaredProperties.add(declaredProperty);
+ }
+ }
+ return updatePropertiesValues(component, propertiesOwner.getUniqueId(), declaredProperties)
+ .left().map(x -> input);
+ }
+
private PropertiesDeclarationData createInputsAndOverridePropertiesValues(String componentId, PROPERTYOWNER propertiesOwner, List<ComponentInstancePropInput> propsToDeclare) {
List<PROPERTYTYPE> declaredProperties = new ArrayList<>();
List<InputDefinition> createdInputs = propsToDeclare.stream()
@@ -182,6 +228,7 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
generatedInputPrefix = null;
}
String generatedInputName = generateInputName(generatedInputPrefix, propInput);
+ log.debug("createInput: propOwner.uniqueId={}, propInput.parentUniqueId={}", propertiesOwner.getUniqueId(), propInput.getParentUniqueId());
return createInputFromProperty(componentId, propertiesOwner, generatedInputName, propInput, prop);
}
@@ -266,18 +313,18 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
}
private void changePropertyValueToGetInputValue(String inputName, String[] parsedPropNames, InputDefinition input, PropertyDataDefinition prop, boolean complexProperty) {
- JSONObject jobject = new JSONObject();
+ JSONObject jsonObject = new JSONObject();
String value = prop.getValue();
if(value == null || value.isEmpty()){
if(complexProperty){
- jobject = createJSONValueForProperty(parsedPropNames.length -1, parsedPropNames, jobject, inputName);
- prop.setValue(jobject.toJSONString());
+ jsonObject = createJSONValueForProperty(parsedPropNames.length -1, parsedPropNames, jsonObject, inputName);
+ prop.setValue(jsonObject.toJSONString());
}else{
- jobject.put(GET_INPUT, input.getName());
- prop.setValue(jobject.toJSONString());
+ jsonObject.put(GET_INPUT, input.getName());
+ prop.setValue(jsonObject.toJSONString());
}
@@ -286,8 +333,8 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
Object objValue = new Yaml().load(value);
if( objValue instanceof Map || objValue instanceof List){
if(!complexProperty){
- jobject.put(GET_INPUT, input.getName());
- prop.setValue(jobject.toJSONString());
+ jsonObject.put(GET_INPUT, input.getName());
+ prop.setValue(jsonObject.toJSONString());
}else{
@@ -300,14 +347,13 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
}
}else{
- jobject.put(GET_INPUT, input.getName());
- prop.setValue(jobject.toJSONString());
+ jsonObject.put(GET_INPUT, input.getName());
+ prop.setValue(jsonObject.toJSONString());
}
}
-
if(CollectionUtils.isEmpty(prop.getGetInputValues())){
prop.setGetInputValues(new ArrayList<>());
}
@@ -453,6 +499,9 @@ public abstract class DefaultPropertyDeclarator<PROPERTYOWNER extends Properties
} else if (value instanceof Map) {
Map<String, Object> subMap = (Map<String, Object>)value;
resetInputName(subMap, inputName);
+ } else if (value instanceof List && ((List) value).contains(inputName) && key.equals(GET_INPUT)) {
+ value = "";
+ lhm1.remove(key);
} else {
continue;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclarator.java
index 46ca85c585..f9ef479ab0 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclarator.java
@@ -89,6 +89,13 @@ public class GroupPropertyDeclarator extends DefaultPropertyDeclarator<GroupDefi
.orElse(StorageOperationStatus.OK);
}
+ @Override
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition inputForDelete) {
+ return getGroupPropertiesDeclaredAsInput(component, inputForDelete.getUniqueId())
+ .map(groupProperties -> unDeclareGroupProperties(component, inputForDelete, groupProperties))
+ .orElse(StorageOperationStatus.OK);
+ }
+
private StorageOperationStatus unDeclareGroupProperties(Component container, InputDefinition input, GroupProperties groupProperties) {
String groupId = groupProperties.getGroupId();
List<PropertyDataDefinition> propsDeclaredAsInput = groupProperties.getProperties();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java
index f7f4a75be1..17059104ff 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java
@@ -87,6 +87,13 @@ public class PolicyPropertyDeclarator extends DefaultPropertyDeclarator<PolicyDe
.orElse(StorageOperationStatus.OK);
}
+ @Override
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition inputForDelete) {
+ return getPolicyPropertiesDeclaredAsInput(component, inputForDelete.getUniqueId())
+ .map(policyProperties -> unDeclarePolicyProperties(component, inputForDelete, policyProperties))
+ .orElse(StorageOperationStatus.OK);
+ }
+
private StorageOperationStatus unDeclarePolicyProperties(Component container, InputDefinition input, PolicyProperties policyProperties) {
String policyId = policyProperties.getPolicyId();
List<PropertyDataDefinition> propsDeclaredAsInput = policyProperties.getProperties();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarationOrchestrator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarationOrchestrator.java
index 3a32559dda..a6c752d689 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarationOrchestrator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarationOrchestrator.java
@@ -58,6 +58,20 @@ public class PropertyDeclarationOrchestrator {
return propertyDeclarator.declarePropertiesAsPolicies(component, propsToDeclare.getLeft(), propsToDeclare.getRight());
}
+ /**
+ *
+ * @param component
+ * @param componentInstInputsMap
+ * @param input
+ * @return
+ */
+ public Either<InputDefinition, StorageOperationStatus> declarePropertiesToListInput(Component component, ComponentInstInputsMap componentInstInputsMap, InputDefinition input) {
+ PropertyDeclarator propertyDeclarator = getPropertyDeclarator(componentInstInputsMap);
+ Pair<String, List<ComponentInstancePropInput>> propsToDeclare = componentInstInputsMap.resolvePropertiesToDeclare();
+ log.debug("#declarePropertiesToInputs: componentId={}, propOwnerId={}", component.getUniqueId(), propsToDeclare.getLeft());
+ return propertyDeclarator.declarePropertiesAsListInput(component, propsToDeclare.getLeft(), propsToDeclare.getRight(), input);
+ }
+
public StorageOperationStatus unDeclarePropertiesAsInputs(Component component, InputDefinition inputToDelete) {
log.debug("#unDeclarePropertiesAsInputs - removing input declaration for input {} on component {}", inputToDelete.getName(), component.getUniqueId());
for (PropertyDeclarator propertyDeclarator : propertyDeclaratorsToInput) {
@@ -70,6 +84,36 @@ public class PropertyDeclarationOrchestrator {
return StorageOperationStatus.OK;
}
+ /**
+ * Un declare properties declared as list type input
+ *
+ * @param component
+ * @param inputToDelete
+ * @return
+ */
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition inputToDelete) {
+ log.debug("#unDeclarePropertiesAsListInputs - removing input declaration for input {} on component {}", inputToDelete.getName(), component.getUniqueId());
+ for (PropertyDeclarator propertyDeclarator : propertyDeclaratorsToInput) {
+ StorageOperationStatus storageOperationStatus = propertyDeclarator.unDeclarePropertiesAsListInputs(component, inputToDelete);
+ if (StorageOperationStatus.OK != storageOperationStatus) {
+ log.debug("#unDeclarePropertiesAsListInputs - failed to remove input declaration for input {} on component {}. reason {}", inputToDelete.getName(), component.getUniqueId(), storageOperationStatus);
+ return storageOperationStatus;
+ }
+ }
+ return StorageOperationStatus.OK;
+
+ }
+
+ /**
+ * Get properties owner id
+ *
+ * @param componentInstInputsMap
+ * @return
+ */
+ public String getPropOwnerId(ComponentInstInputsMap componentInstInputsMap) {
+ Pair<String, List<ComponentInstancePropInput>> propsToDeclare = componentInstInputsMap.resolvePropertiesToDeclare();
+ return propsToDeclare.getLeft();
+ }
public StorageOperationStatus unDeclarePropertiesAsPolicies(Component component, PolicyDefinition policyToDelete) {
log.debug("#unDeclarePropertiesAsInputs - removing policy declaration for input {} on component {}", policyToDelete
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarator.java
index c0f76288b2..b8b6c6eb62 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDeclarator.java
@@ -44,4 +44,21 @@ public interface PropertyDeclarator {
*/
StorageOperationStatus unDeclarePropertiesAsPolicies(Component component, PolicyDefinition policy);
+ /**
+ * Updates given list of properties to get values from the specified "list input" with get_input function.
+ * This function does NOT create "list input", it needs to be created separately.
+ * @param component the container
+ * @param propertiesOwnerId the id of the owner of the properties to declare (e.g ComponentInstance, Policy, Group etc)
+ * @param propsToDeclare the list of properties that are being declared as inputs
+ * @param input the input from which properties get values
+ * @return the input same as passed one at 4th argument
+ */
+ Either<InputDefinition, StorageOperationStatus> declarePropertiesAsListInput(Component component, String propertiesOwnerId, List<ComponentInstancePropInput> propsToDeclare, InputDefinition input);
+
+ /**
+ * Un declare properties declared as list type input
+ * @param component the container of the input to be deleted
+ * @param input the input to be deleted
+ */
+ StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition input);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java
index bbbdf6f105..2726f67342 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java
@@ -65,6 +65,11 @@ public class ComponentInstancePropertyToPolicyDeclarator extends
}
@Override
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition input) {
+ return StorageOperationStatus.OK;
+ }
+
+ @Override
public StorageOperationStatus unDeclarePropertiesAsPolicies(Component component, PolicyDefinition policy) {
Optional<ComponentInstanceProperty> propertyCandidate =
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java
index 1d73786938..6bd09c1622 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java
@@ -65,9 +65,14 @@ public class ComponentPropertyToPolicyDeclarator extends DefaultPropertyDeclarat
}
@Override
+ public StorageOperationStatus unDeclarePropertiesAsListInputs(Component component, InputDefinition input) {
+ // no need for implementation since we are in a policy scenario
+ return StorageOperationStatus.OK;
+ }
+
+ @Override
public void addPropertiesListToInput(PropertyDataDefinition declaredProp, InputDefinition input) {
// no need for implementation since we are in a policy scenario
- return;
}
@Override