summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java/org
diff options
context:
space:
mode:
authortalio <tali.orenbach@amdocs.com>2019-04-14 15:37:20 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-04-14 16:07:26 +0000
commitfe4afd47955705bb377583649cb53e2cf4508493 (patch)
tree335f4555155fbeb1085e7ab554ad8406a3ad68be /catalog-model/src/main/java/org
parentb08309847c24bd3c060839a335a20cb3f750ed30 (diff)
Declare properties as policies
Change-Id: I54dc7b444e08117097c314cf5f51bd356ac5287d Issue-ID: SDC-2240 Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'catalog-model/src/main/java/org')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java82
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java56
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java208
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java11
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java3
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverter.java9
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java24
10 files changed, 223 insertions, 184 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
index e33ded2fb4..65ad149a89 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
@@ -39,28 +39,18 @@ import java.util.stream.Collectors;
import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.utils.MapUtil;
-import org.openecomp.sdc.be.datatypes.elements.*;
+import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType;
+import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-import static java.util.Collections.emptyList;
-import static java.util.Collections.emptyMap;
-import static java.util.stream.Collectors.toMap;
-import static org.apache.commons.collections.CollectionUtils.isEmpty;
-import static org.apache.commons.collections.MapUtils.isEmpty;
-
public abstract class Component implements PropertiesOwner {
private ComponentMetadataDefinition componentMetadataDefinition;
@@ -83,9 +73,11 @@ public abstract class Component implements PropertiesOwner {
private String derivedFromGenericVersion;
private String toscaType;
protected List<AdditionalInformationDefinition> additionalInformation;
+ private Map<String, CINodeFilterDataDefinition> nodeFilterComponents;
+ private Map<String, List<UploadNodeFilterInfo>> nodeFilters;
+ private Map<String, List<UploadNodeFilterInfo>> serviceFilters;
protected List<PropertyDefinition> properties;
private Map<String, InterfaceDefinition> interfaces;
- private Map<String, CINodeFilterDataDefinition> nodeFilterComponents;
public Map<String, InterfaceDefinition> getInterfaces() {
return interfaces;
@@ -567,6 +559,42 @@ public abstract class Component implements PropertiesOwner {
this.policies = policies;
}
+ public void addPolicy(PolicyDefinition policyDefinition) {
+ if(MapUtils.isEmpty(this.policies)) {
+ this.policies = new HashMap<>();
+ }
+
+ this.policies.put(policyDefinition.getUniqueId(), policyDefinition);
+ }
+
+ public Map<String, CINodeFilterDataDefinition> getNodeFilterComponents() {
+ return nodeFilterComponents;
+ }
+
+ public void setNodeFilterComponents(Map<String, CINodeFilterDataDefinition> nodeFilter) {
+ this.nodeFilterComponents = nodeFilter;
+ }
+
+
+
+ public Map<String, List<UploadNodeFilterInfo>> getNodeFilters() {
+ return nodeFilters;
+ }
+
+ public void setNodeFilters(
+ Map<String, List<UploadNodeFilterInfo>> nodeFilters) {
+ this.nodeFilters = nodeFilters;
+ }
+
+ public Map<String, List<UploadNodeFilterInfo>> getServiceFilters() {
+ return serviceFilters;
+ }
+
+ public void setServiceFilters(
+ Map<String, List<UploadNodeFilterInfo>> serviceFilters) {
+ this.serviceFilters = serviceFilters;
+ }
+
public List<PropertyDefinition> getProperties() {
return properties;
}
@@ -575,6 +603,14 @@ public abstract class Component implements PropertiesOwner {
this.properties = properties;
}
+ public void addProperty(PropertyDefinition propertyDefinition) {
+ if(org.apache.commons.collections.CollectionUtils.isEmpty(this.properties)) {
+ this.properties = new ArrayList<>();
+ }
+
+ this.properties.add(propertyDefinition);;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
@@ -582,11 +618,7 @@ public abstract class Component implements PropertiesOwner {
result = prime * result + ((artifacts == null) ? 0 : artifacts.hashCode());
result = prime * result + ((categories == null) ? 0 : categories.hashCode());
result = prime * result + ((componentMetadataDefinition == null) ? 0 : componentMetadataDefinition.hashCode());
-// result = prime * result + ((creatorUserId == null) ? 0 : creatorUserId.hashCode());
-// result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode());
result = prime * result + ((deploymentArtifacts == null) ? 0 : deploymentArtifacts.hashCode());
-// result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode());
-// result = prime * result + ((lastUpdaterFullName == null) ? 0 : lastUpdaterFullName.hashCode());
result = prime * result + ((capabilities == null) ? 0 : capabilities.hashCode());
result = prime * result + ((requirements == null) ? 0 : requirements.hashCode());
result = prime * result + ((componentInstances == null) ? 0 : componentInstances.hashCode());
@@ -604,14 +636,6 @@ public abstract class Component implements PropertiesOwner {
return result;
}
- public Map<String, CINodeFilterDataDefinition> getNodeFilterComponents() {
- return nodeFilterComponents;
- }
-
- public void setNodeFilterComponents(Map<String, CINodeFilterDataDefinition> nodeFilterComponents) {
- this.nodeFilterComponents = nodeFilterComponents;
- }
-
@Override
public boolean equals(Object obj) {
if (this == obj) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java
index 9d0877d8f9..a7903b3f30 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.be.model;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
@@ -27,6 +29,8 @@ import java.util.Map;
import static org.apache.commons.collections.MapUtils.isNotEmpty;
+@Getter
+@Setter
public class ComponentInstInputsMap {
private Map<String, List<ComponentInstancePropInput>> componentInstanceInputsMap;
@@ -34,6 +38,8 @@ public class ComponentInstInputsMap {
private Map<String, List<ComponentInstancePropInput>> serviceProperties;
private Map<String, List<ComponentInstancePropInput>> policyProperties;
private Map<String, List<ComponentInstancePropInput>> groupProperties;
+ private Map<String, List<ComponentInstancePropInput>> componentPropertiesToPolicies;
+ private Map<String, List<ComponentInstancePropInput>> componentInstancePropertiesToPolicies;
public Pair<String, List<ComponentInstancePropInput>> resolvePropertiesToDeclare() {
if (isNotEmpty(componentInstanceInputsMap)) {
@@ -51,6 +57,12 @@ public class ComponentInstInputsMap {
if (isNotEmpty(groupProperties)) {
return singleMapEntry(groupProperties);
}
+ if(isNotEmpty(componentPropertiesToPolicies)) {
+ return singleMapEntry(componentPropertiesToPolicies);
+ }
+ if (isNotEmpty(componentInstancePropertiesToPolicies)) {
+ return singleMapEntry(componentInstancePropertiesToPolicies);
+ }
throw new IllegalStateException("there are no properties selected for declaration");
}
@@ -58,48 +70,4 @@ public class ComponentInstInputsMap {
Map.Entry<String, List<ComponentInstancePropInput>> singleEntry = propertiesMap.entrySet().iterator().next();
return Pair.of(singleEntry.getKey(), singleEntry.getValue());
}
-
- public Map<String, List<ComponentInstancePropInput>> getComponentInstanceInputsMap() {
- return componentInstanceInputsMap;
- }
-
- public void setComponentInstanceInputsMap(Map<String, List<ComponentInstancePropInput>> componentInstanceInputsMap) {
- this.componentInstanceInputsMap = componentInstanceInputsMap;
- }
-
- public Map<String, List<ComponentInstancePropInput>> getComponentInstanceProperties() {
- return componentInstanceProperties;
- }
-
- public void setComponentInstancePropInput(Map<String, List<ComponentInstancePropInput>> componentInstanceProperties) {
- this.componentInstanceProperties = componentInstanceProperties;
- }
-
- public Map<String, List<ComponentInstancePropInput>> getPolicyProperties() {
- return policyProperties;
- }
-
- public void setPolicyProperties(Map<String, List<ComponentInstancePropInput>> policyProperties) {
- this.policyProperties = policyProperties;
- }
-
- public Map<String, List<ComponentInstancePropInput>> getServiceProperties() {
- return serviceProperties;
- }
-
- public void setServiceProperties(
- Map<String, List<ComponentInstancePropInput>> serviceProperties) {
- this.serviceProperties = serviceProperties;
- }
-
- public Map<String, List<ComponentInstancePropInput>> getGroupProperties() {
- return groupProperties;
- }
-
- public void setGroupProperties(Map<String, List<ComponentInstancePropInput>> groupProperties) {
- this.groupProperties = groupProperties;
- }
-
-
-
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java
index 35b4a865a1..05d9a572a3 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java
@@ -20,12 +20,11 @@
package org.openecomp.sdc.be.model;
+import java.util.List;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import java.util.List;
-
public class ComponentParametersView {
private boolean ignoreUsers = false;
@@ -40,6 +39,7 @@ public class ComponentParametersView {
private boolean ignoreAdditionalInformation = false;
private boolean ignoreArtifacts = false;
private boolean ignoreInterfaces = false;
+ private boolean ignoreInterfaceInstances = false;
private boolean ignoreComponentInstancesInterfaces = false;
private boolean ignoreDerivedFrom = false;
private boolean ignoreAttributesFrom = false;
@@ -49,6 +49,7 @@ public class ComponentParametersView {
private boolean ignoreCapabiltyProperties = true;
private boolean ignoreServicePath = true;
private boolean ignorePolicies = false;
+ private boolean ignoreNodeFilterRequirements = false;
private boolean ignoreNodeFilter = false;
public ComponentParametersView() {
@@ -146,6 +147,7 @@ public class ComponentParametersView {
this.setIgnorePolicies(false);
break;
case NODE_FILTER:
+ this.setIgnoreNodeFilterRequirements(false);
this.setIgnoreNodeFilter(false);
break;
case COMPONENT_INSTANCES_INTERFACES:
@@ -165,96 +167,120 @@ public class ComponentParametersView {
public Component filter(Component component, ComponentTypeEnum componentType) {
- if (ignoreUsers) {
- component.setCreatorUserId(null);
- component.setCreatorFullName(null);
- component.setLastUpdaterUserId(null);
- component.setLastUpdaterFullName(null);
- }
- if (ignoreGroups) {
- component.setGroups(null);
- }
- if (ignoreComponentInstances) {
- component.setComponentInstances(null);
- component.setComponentInstancesRelations(null);
- }
- if (ignoreComponentInstancesProperties) {
- component.setComponentInstancesProperties(null);
- }
- if (ignoreProperties && componentType == ComponentTypeEnum.RESOURCE) {
- ((Resource) component).setProperties(null);
- }
- if (ignoreCapabilities) {
- component.setCapabilities(null);
- }
- if (ignoreRequirements) {
- component.setRequirements(null);
- }
- if (ignoreCategories) {
- component.setCategories(null);
- }
- if (ignoreAllVersions) {
- component.setAllVersions(null);
- }
- if (ignoreAdditionalInformation && componentType == ComponentTypeEnum.RESOURCE) {
- ((Resource) component).setAdditionalInformation(null);
- }
- if (ignoreArtifacts) {
- component.setArtifacts(null);
- component.setSpecificComponetTypeArtifacts(null);
- component.setDeploymentArtifacts(null);
- component.setToscaArtifacts(null);
- }
- if (ignoreInterfaces && componentType == ComponentTypeEnum.RESOURCE) {
- ((Resource) component).setInterfaces(null);
- }
- if (ignoreDerivedFrom && componentType == ComponentTypeEnum.RESOURCE) {
- ((Resource) component).setDerivedFrom(null);
- }
- if (ignoreAttributesFrom && componentType == ComponentTypeEnum.RESOURCE) {
- ((Resource) component).setAttributes(null);
- }
- if (ignoreComponentInstancesAttributesFrom) {
- component.setComponentInstancesAttributes(null);
- }
- if (ignoreInputs) {
- component.setInputs(null);
- }
- if (ignoreComponentInstancesInputs) {
- component.setComponentInstancesInputs(null);
- }
- if (ignoreServicePath && componentType == ComponentTypeEnum.SERVICE) {
- ((Service) component).setForwardingPaths(null);
- }
- if (ignoreNodeFilter){
- component.setNodeFilterComponents(null);
- }
- return component;
- }
-
- public void disableAll() {
- ignoreUsers = true;
- ignoreGroups = true;
- ignorePolicies = true;
- ignoreComponentInstances = true;
- ignoreComponentInstancesProperties = true;
- ignoreProperties = true;
- ignoreCapabilities = true;
- ignoreRequirements = true;
- ignoreCategories = true;
- ignoreAllVersions = true;
- ignoreAdditionalInformation = true;
- ignoreArtifacts = true;
- ignoreInterfaces = true;
- ignoreDerivedFrom = true;
- ignoreAttributesFrom = true;
- ignoreInputs = true;
- ignoreComponentInstancesAttributesFrom = true;
- ignoreComponentInstancesInputs = true;
- ignoreCapabiltyProperties = true;
- ignoreServicePath = true;
+ if (ignoreUsers) {
+ component.setCreatorUserId(null);
+ component.setCreatorFullName(null);
+ component.setLastUpdaterUserId(null);
+ component.setLastUpdaterFullName(null);
+ }
+
+ if (ignoreGroups) {
+ component.setGroups(null);
+ }
+
+ if (ignoreComponentInstances) {
+ component.setComponentInstances(null);
+ component.setComponentInstancesRelations(null);
+ }
+
+ if (ignoreComponentInstancesProperties) {
+ component.setComponentInstancesProperties(null);
+ }
+
+ if (ignoreProperties && componentType == ComponentTypeEnum.RESOURCE) {
+ ((Resource) component).setProperties(null);
+ }
+
+ if (ignoreCapabilities) {
+ component.setCapabilities(null);
+ }
+
+ if (ignoreRequirements) {
+ component.setRequirements(null);
+ }
+
+ if (ignoreCategories) {
+ component.setCategories(null);
+ }
+
+ if (ignoreAllVersions) {
+ component.setAllVersions(null);
+ }
+ if (ignoreAdditionalInformation && componentType == ComponentTypeEnum.RESOURCE) {
+ ((Resource) component).setAdditionalInformation(null);
+ }
+
+ if (ignoreArtifacts) {
+ component.setArtifacts(null);
+ component.setSpecificComponetTypeArtifacts(null);
+ component.setDeploymentArtifacts(null);
+ component.setToscaArtifacts(null);
+ }
+ if (ignoreNodeFilterRequirements){
+ component.setNodeFilterComponents(null);
+ }
+ if (ignoreInterfaces && ignoreInterfaceInstances &&
+ componentType == ComponentTypeEnum.RESOURCE) {
+ component.setInterfaces(null);
+ }
+ if (ignoreDerivedFrom && componentType == ComponentTypeEnum.RESOURCE) {
+ ((Resource) component).setDerivedFrom(null);
+ }
+ if (ignoreAttributesFrom && componentType == ComponentTypeEnum.RESOURCE) {
+ ((Resource) component).setAttributes(null);
+ }
+ if (ignoreComponentInstancesAttributesFrom) {
+ component.setComponentInstancesAttributes(null);
+ }
+ if (ignoreInputs) {
+ component.setInputs(null);
+ }
+ if (ignoreComponentInstancesInputs) {
+ component.setComponentInstancesInputs(null);
+ }
+ if (ignoreServicePath && componentType == ComponentTypeEnum.SERVICE) {
+ ((Service) component).setForwardingPaths(null);
+ }
+ if (ignoreNodeFilter){
+ component.setNodeFilterComponents(null);
+ }
+ return component;
+
+ }
+
+ public boolean isIgnoreNodeFilterRequirements() {
+ return ignoreNodeFilterRequirements;
+ }
+
+ public void setIgnoreNodeFilterRequirements(boolean ignoreNodeFilter) {
+ this.ignoreNodeFilterRequirements = ignoreNodeFilter;
+ }
+
+ public void disableAll() {
+ ignoreUsers = true;
+ ignoreGroups = true;
+ ignorePolicies = true;
+ ignoreComponentInstances = true;
+ ignoreComponentInstancesProperties = true;
+ ignoreProperties = true;
+ ignoreCapabilities = true;
+ ignoreRequirements = true;
+ ignoreCategories = true;
+ ignoreAllVersions = true;
+ ignoreAdditionalInformation = true;
+ ignoreArtifacts = true;
+ ignoreInterfaces = true;
+ ignoreInterfaceInstances = true;
+ ignoreDerivedFrom = true;
+ ignoreAttributesFrom = true;
+ ignoreInputs = true;
+ ignoreComponentInstancesAttributesFrom = true;
+ ignoreComponentInstancesInputs = true;
+ ignoreCapabiltyProperties = true;
+ ignoreServicePath = true;
+ ignoreNodeFilterRequirements = true;
ignoreNodeFilter = true;
- }
+ }
public boolean isIgnoreGroups() {
return ignoreGroups;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java
index 17e422bc5b..e69bf3f16b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java
@@ -1,12 +1,11 @@
package org.openecomp.sdc.be.model;
-import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner;
-import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
-
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
+import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
/**
* public class representing the component policy
*/
@@ -19,6 +18,10 @@ public class PolicyDefinition extends PolicyDataDefinition implements Properties
super();
}
+ public PolicyDefinition(PropertyDataDefinition propertyDataDefinition) {
+ super(propertyDataDefinition);
+ }
+
/**
* public constructor from superclass
* @param policy
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java
index 1f55fecc86..6e52976a42 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java
@@ -7,7 +7,8 @@ public enum ToscaFunctions {
GET_INPUT("get_input"),
GET_PROPERTY("get_property"),
- GET_OPERATION_OUTPUT("get_operation_output");
+ GET_OPERATION_OUTPUT("get_operation_output"),
+ GET_POLICY("get_policy");
private String functionName;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java
index 6384146df9..04b6874f93 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.be.model.tosca;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
@@ -27,8 +29,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil;
import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintValueDoNotMatchPropertyTypeException;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java
index 0bbc0f755f..188ad1b5c7 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java
@@ -20,14 +20,14 @@
package org.openecomp.sdc.be.model.tosca.constraints;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
import org.openecomp.sdc.be.model.tosca.ToscaType;
import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintValueDoNotMatchPropertyTypeException;
import org.slf4j.Logger;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverter.java
index f3b842e0cf..7f11330bdf 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverter.java
@@ -5,14 +5,13 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonReader;
-import org.openecomp.sdc.be.model.DataTypeDefinition;
-import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.common.util.JsonUtils;
-
import java.io.StringReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.common.util.JsonUtils;
public class DataTypePropertyConverter {
@@ -52,7 +51,7 @@ public class DataTypePropertyConverter {
}
private void mergeDefaultValuesRec(JsonObject defaultValue, JsonObject value) {
- if (ToscaConverterUtils.isGetInputValue(value)) {
+ if (ToscaConverterUtils.isGetInputValue(value) || ToscaConverterUtils.isGetPolicyValue(value)) {
return;
}
for (Map.Entry<String, JsonElement> defVal : defaultValue.entrySet()) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java
index 941535a09d..5848abfc49 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaConverterUtils.java
@@ -5,8 +5,14 @@ import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
public class ToscaConverterUtils {
+ private ToscaConverterUtils() {}
+
public static boolean isGetInputValue(JsonObject value) {
return value.get(ToscaFunctions.GET_INPUT.getFunctionName()) != null;
}
+ public static boolean isGetPolicyValue(JsonObject value) {
+ return value.get(ToscaFunctions.GET_POLICY.getFunctionName()) != null;
+ }
+
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java
index 04636d87e0..f0b3ca25b9 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java
@@ -20,18 +20,27 @@
package org.openecomp.sdc.be.model.tosca.converters;
-import com.google.gson.*;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonParser;
+import com.google.gson.JsonSyntaxException;
import com.google.gson.stream.JsonReader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.common.log.wrappers.Logger;
-import java.io.StringReader;
-import java.util.*;
-import java.util.Map.Entry;
-
public class ToscaMapValueConverter extends ToscaValueBaseConverter implements ToscaValueConverter {
private static ToscaMapValueConverter mapConverter = new ToscaMapValueConverter();
@@ -230,7 +239,7 @@ public class ToscaMapValueConverter extends ToscaValueBaseConverter implements T
convValue = handleComplexJsonValue(elementValue);
}
}
- if(preserveEmptyValue || !isEmptyObjectValue(convValue)){
+ if(preserveEmptyValue || !isEmptyObjectValue(convValue) || isGetPolicyValue(propName)){
toscaObjectPresentation.put(propName, convValue);
}
}
@@ -238,4 +247,7 @@ public class ToscaMapValueConverter extends ToscaValueBaseConverter implements T
return convertedValue;
}
+ private boolean isGetPolicyValue(String key) {
+ return key.equals(ToscaFunctions.GET_POLICY.getFunctionName());
+ }
}