aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-03-04 14:53:33 +0200
committerMichael Lando <ml636r@att.com>2018-03-07 13:19:05 +0000
commita5445100050e49e83f73424198d73cd72d672a4d (patch)
treecacf4df817df31be23e4e790d1dda857bdae061e /catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
parent51157f92c21976cba4914c378aaa3cba49826931 (diff)
Sync Integ to Master
Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java51
1 files changed, 5 insertions, 46 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
index 6b083596c7..318840d60a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java
@@ -1,15 +1,7 @@
package org.openecomp.sdc.be.components.merge.property;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import javax.annotation.Resource;
-
-import org.openecomp.sdc.be.components.impl.ImportUtils;
+import com.google.gson.Gson;
+import fj.data.Either;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -22,9 +14,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-import com.google.gson.Gson;
-
-import fj.data.Either;
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
@Component
public class PropertyDataValueMergeBusinessLogic {
@@ -88,39 +80,6 @@ public class PropertyDataValueMergeBusinessLogic {
return propertyConvertor.convertToToscaObject(propertyType, propValue, innerType, dataTypes);
}
-
- @SuppressWarnings("unchecked")
- private Object removeUnwantedGetInputValues(Object val, List<String> getInputNamesToMerge) {
- if (val instanceof Map) {
- return removeUnwantedGetInputValues((Map<String, Object>) val, getInputNamesToMerge);
- }
- if (val instanceof List) {
- return removeUnwantedGetInputValues((List<Object>)val, getInputNamesToMerge);
- }
- return val;
- }
-
- private List<Object> removeUnwantedGetInputValues(List<Object> listVal, List<String> getInputNamesToMerge) {
- return listVal.stream().map(val -> removeUnwantedGetInputValues(val, getInputNamesToMerge)).collect(Collectors.toList());
- }
-
- private Map<String, Object> removeUnwantedGetInputValues(Map<String, Object> val, List<String> getInputNamesToMerge) {
- return val.entrySet().stream().filter(entry -> !isGetInputEntry(entry) || isGetInputToMerge(getInputNamesToMerge, entry))
- .collect(Collectors.toMap(Map.Entry::getKey, entry -> removeUnwantedGetInputValues(entry.getValue(), getInputNamesToMerge)));
- }
-
- private boolean isGetInputToMerge(List<String> getInputNamesToMerge, Map.Entry<String, Object> entry) {
- return getInputNamesToMerge.contains(retrieveGetInputInputName(entry.getValue()));
- }
-
- private String retrieveGetInputInputName(Object getInputValue) {
- return getInputValue instanceof List ? (String)((List) getInputValue).get(0) : (String)getInputValue;
- }
-
- private boolean isGetInputEntry(Map.Entry<String, Object> oldValEntry) {
- return oldValEntry.getKey().equals(ImportUtils.ToscaTagNamesEnum.GET_INPUT.getElementName());
- }
-
private boolean isEmptyValue(Object val) {
return val == null ||
val instanceof Map && ((Map) val).isEmpty() ||