summaryrefslogtreecommitdiffstats
path: root/common-be/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src/main/java/org')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java1
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java25
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java80
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java81
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java53
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java1
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java3
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java33
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java10
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java1
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java86
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java1
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java50
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java6
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java5
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java4
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java67
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java10
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java6
21 files changed, 370 insertions, 157 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java
index 9675cd37fb..8dac7ea4c4 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java
@@ -23,7 +23,6 @@ package org.openecomp.sdc.be.datatypes.components;
import java.io.Serializable;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java
index 4a42436583..7a85a763f6 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java
@@ -22,8 +22,6 @@ package org.openecomp.sdc.be.datatypes.components;
import java.io.Serializable;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-
public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
/**
@@ -40,6 +38,8 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
private String namingPolicy = EMPTY_STR;
+ private String environmentContext;
+
public ServiceMetadataDataDefinition() {
super();
serviceType = "";
@@ -92,11 +92,20 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
this.namingPolicy = namingPolicy;
}
+ public String getEnvironmentContext() { return environmentContext; }
+
+ public void setEnvironmentContext(String environmentContext) { this.environmentContext = environmentContext; }
+
@Override
public String toString() {
- return "ServiceMetadataDataDefinition [ distributionStatus=" + distributionStatus
- + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole + ", ecompGeneratedNaming="
- + ecompGeneratedNaming + ", namingPolicy=" + namingPolicy + ", parent=" + super.toString() + "]";
+ return "ServiceMetadataDataDefinition{" +
+ "distributionStatus='" + distributionStatus + '\'' +
+ ", serviceType='" + serviceType + '\'' +
+ ", serviceRole='" + serviceRole + '\'' +
+ ", ecompGeneratedNaming=" + ecompGeneratedNaming +
+ ", namingPolicy='" + namingPolicy + '\'' +
+ ", environmentContext='" + environmentContext + '\'' +
+ '}';
}
@Override
@@ -108,6 +117,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode());
result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode());
+ result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode());
return result;
}
@@ -151,6 +161,11 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
return false;
} else if (!serviceRole.equals(other.serviceRole))
return false;
+ if (environmentContext == null){
+ if (other.environmentContext != null)
+ return false;
+ } else if (!environmentContext.equals(other.environmentContext))
+ return false;
return super.equals(obj);
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java
index fd04f47b29..5baed964c7 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java
@@ -27,50 +27,72 @@ import java.util.List;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import com.google.common.collect.Lists;
-
+/**
+ * Represents the capability of the component or component instance
+ */
public class CapabilityDataDefinition extends ToscaDataDefinition implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7544984873506188920L;
- public final static String MIN_OCCURRENCES = "1"; // occurrences
- public final static String MAX_OCCURRENCES = "UNBOUNDED";
+ public static final String MIN_OCCURRENCES = "1";
+ public static final String MAX_OCCURRENCES = "UNBOUNDED";
-
+ /**
+ * The default constructor initializing limits of the occurrences
+ */
public CapabilityDataDefinition() {
super();
this.setMinOccurrences( MIN_OCCURRENCES );
this.setMaxOccurrences( MAX_OCCURRENCES);
this.setLeftOccurrences( MAX_OCCURRENCES);
}
-
- public CapabilityDataDefinition(CapabilityDataDefinition a) {
+ /**
+ * Deep copy constructor
+ * @param other
+ */
+ public CapabilityDataDefinition(CapabilityDataDefinition other) {
super();
- this.setUniqueId(a.getUniqueId());
- this.setType(a.getType());
- this.setDescription ( a.getDescription());
- this.setName( a.getName());
- this.setParentName( a.getParentName());
- this.setValidSourceTypes( a.getValidSourceTypes());
- this.setCapabilitySources( a.getCapabilitySources());
- this.setOwnerId( a.getOwnerId());
- this.setOwnerName( a.getOwnerName());
- this.setMinOccurrences( a.getMinOccurrences());
- this.setMaxOccurrences( a.getMaxOccurrences());
- this.setLeftOccurrences(a.getLeftOccurrences());
- this.setPath(a.getPath());
- this.setSource(a.getSource());
+ this.setUniqueId(other.getUniqueId());
+ this.setType(other.getType());
+ this.setDescription ( other.getDescription());
+ this.setName( other.getName());
+ this.setParentName( other.getParentName());
+
+ if(other.getValidSourceTypes() == null)
+ this.setValidSourceTypes(Lists.newArrayList());
+ else
+ this.setValidSourceTypes(Lists.newArrayList(other.getValidSourceTypes()));
+
+ if(other.getCapabilitySources() == null)
+ this.setCapabilitySources(Lists.newArrayList());
+ else
+ this.setCapabilitySources(Lists.newArrayList(other.getCapabilitySources()));
+
+ this.setOwnerId( other.getOwnerId());
+ this.setOwnerName( other.getOwnerName());
+ this.setMinOccurrences( other.getMinOccurrences());
+ this.setMaxOccurrences( other.getMaxOccurrences());
+ this.setLeftOccurrences(other.getLeftOccurrences());
+
+ if(other.getPath() == null)
+ this.setPath(Lists.newArrayList());
+ else
+ this.setPath(Lists.newArrayList(other.getPath()));
+
+ this.setSource(other.getSource());
}
-
-
+ @Override
public String getOwnerId() {
return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID);
}
-
+
+ @Override
public void setOwnerId(String ownerId) {
setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId);
}
@@ -146,6 +168,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser
setToscaPresentationValue(JsonPresentationFields.TYPE, type);
}
+ @SuppressWarnings("unchecked")
public List<String> getValidSourceTypes() {
return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE);
}
@@ -154,6 +177,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser
setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes);
}
+ @SuppressWarnings("unchecked")
public List<String> getCapabilitySources() {
return (List<String>) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES);
}
@@ -165,6 +189,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser
public void setPath(List<String> path){
setToscaPresentationValue(JsonPresentationFields.PATH, path);
}
+ @SuppressWarnings("unchecked")
public List<String> getPath() {
return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH);
}
@@ -174,12 +199,19 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser
public String getSource() {
return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE);
}
+
+ /**
+ * Adds the element to the path avoiding duplication
+ * @param elementInPath
+ */
public void addToPath(String elementInPath){
List<String> path = getPath();
if ( path == null ){
path = new ArrayList<>();
}
- path.add(elementInPath);
+ if(!path.contains(elementInPath)){
+ path.add(elementInPath);
+ }
setPath(path);
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java
index 2fc84bd8f2..be21a70bbc 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.util.ValidationUtils;
public class ComponentInstanceDataDefinition extends ToscaDataDefinition implements Serializable {
@@ -33,16 +32,15 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
/**
*
*/
-
- private static final long serialVersionUID = 7215033872921497743L;
+ private static final long serialVersionUID = 7215033872921497743L;
-
public ComponentInstanceDataDefinition() {
super();
setPropertyValueCounter(1);
setAttributeValueCounter(1);
setInputValueCounter(1);
+ setIsProxy(false);
}
public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) {
@@ -59,12 +57,17 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
setNormalizedName(dataDefinition.getNormalizedName());
setOriginType(dataDefinition.getOriginType());
setCustomizationUUID(dataDefinition.getCustomizationUUID());
- setComponentName( dataDefinition.getComponentName());
+ setComponentName(dataDefinition.getComponentName());
setComponentVersion(dataDefinition.getComponentVersion());
setToscaComponentName(dataDefinition.getToscaComponentName());
- setInvariantName( dataDefinition.getInvariantName());
+ setInvariantName(dataDefinition.getInvariantName());
+ setSourceModelInvariant(dataDefinition.getSourceModelInvariant());
+ setSourceModelName(dataDefinition.getSourceModelName());
+ setSourceModelUuid(dataDefinition.getSourceModelUuid());
+ setSourceModelUid(dataDefinition.getSourceModelUid());
+ setIsProxy(dataDefinition.getIsProxy());
}
-
+
public String getIcon() {
return (String) getToscaPresentationValue(JsonPresentationFields.CI_ICON);
}
@@ -72,6 +75,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
public void setIcon(String icon) {
setToscaPresentationValue(JsonPresentationFields.CI_ICON, icon);
}
+
public String getUniqueId() {
return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID);
}
@@ -133,12 +137,12 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
}
public void setName(String name) {
- if(this.getInvariantName() == null){
+ if (this.getInvariantName() == null) {
this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name));
}
setToscaPresentationValue(JsonPresentationFields.NAME, name);
}
-
+
public String getInvariantName() {
return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME);
}
@@ -165,7 +169,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
public OriginTypeEnum getOriginType() {
OriginTypeEnum originType = null;
- String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE);
+ String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE);
if (origType != null && !origType.isEmpty()) {
originType = OriginTypeEnum.findByValue(origType);
@@ -174,7 +178,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
}
public void setOriginType(OriginTypeEnum originType) {
- if(originType != null)
+ if (originType != null)
setToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE, originType.getValue());
}
@@ -226,11 +230,60 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion);
}
+ public void setSourceModelUuid(String targetModelUuid) {
+ setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid);
+ }
+ public void setSourceModelUid(String targetModelUid) {
+ setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid);
+ }
+
+ public void setSourceModelName(String targetModelName) {
+ setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName);
+ }
+
+ public void setSourceModelInvariant(String targetModelInvariant) {
+ setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant);
+ }
+
+ public String getSourceModelUuid() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID);
+ }
+ public String getSourceModelUid() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID);
+ }
+
+ public String getSourceModelName() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME);
+ }
+
+ public String getSourceModelInvariant() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT);
+ }
+
+ public void setIsProxy(Boolean isProxy) {
+ if (isProxy == null) {
+ setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, false);
+ } else {
+ setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, isProxy);
+ }
+ }
+
+ public Boolean getIsProxy() {
+ Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY);
+ return ( isProxy != null ) ? isProxy : false;
+ }
+
@Override
public String toString() {
- return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid() + ", creationTime=" + getCreationTime() + ", modificationTime="
- + getModificationTime() + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter=" + getAttributeValueCounter() + ", inputValueCounter="
- + getInputValueCounter() + ", originType=" + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" + getToscaComponentName() + "]";
+ return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name="
+ + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid()
+ + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime()
+ + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY()
+ + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter="
+ + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType="
+ + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName="
+ + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName="
+ + getToscaComponentName() + "]";
}
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java
index 57e1c2154f..0ea3e64f28 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java
@@ -21,8 +21,6 @@
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonValue;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java
index 6d11c51596..e9969d73de 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java
@@ -21,18 +21,16 @@
package org.openecomp.sdc.be.datatypes.elements;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
-import java.util.function.Predicate;
+import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
import org.codehaus.jackson.annotate.JsonCreator;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-
public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition {
protected List<T> listToscaDataDefinition;
@@ -76,22 +74,49 @@ public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaData
listToscaDataDefinition.forEach(e -> e.setOwnerIdIfEmpty(ownerId));
}
}
-
+
@Override
- public <S extends ToscaDataDefinition> S mergeFunction(S other, boolean allowDefaultValueOverride){
+ public <S extends ToscaDataDefinition> S mergeFunction(S other, boolean allowDefaultValueOverride) {
Map<String, T> mapByName = listToMapByName(listToscaDataDefinition);
- List<T> otherList = ((ListDataDefinition)other).getListToscaDataDefinition();
- for(T item : otherList){
- mapByName.merge((String)item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride));
+ List<T> otherList = ((ListDataDefinition) other).getListToscaDataDefinition();
+ for (T item : otherList) {
+ mapByName.merge((String) item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride));
}
- ((ListDataDefinition)other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList());
- return other;
+ ((ListDataDefinition) other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList());
+ return other;
+ }
+
+ @Override
+ public boolean findUidMatch(String uid) {
+ return listToscaDataDefinition.stream().anyMatch(p -> p.findUidMatch(uid));
}
@Override
- public boolean findUidMatch(String uid){
- return listToscaDataDefinition.stream()
- .anyMatch(p -> p.findUidMatch(uid));
+ public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) {
+ List<T> collect1 = (List<T>) listToscaDataDefinition.stream().filter(e -> ownerIdList.contains(e.getOwnerId())).collect(Collectors.toList());
+ ListDataDefinition listDef = new ListDataDefinition(collect1);
+
+ listToscaDataDefinition.removeIf(e -> ownerIdList.contains(e.getOwnerId()));
+ return (T) listDef;
}
+ @Override
+ public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) {
+
+ List<T> list = ((ListDataDefinition)other).getListToscaDataDefinition();
+ list.forEach(e -> {
+ String nameFromPrev = (String)e.getToscaPresentationValue(JsonPresentationFields.NAME);
+ if ( nameFromPrev != null ){
+ Optional<T> findAny = (Optional<T>) listToscaDataDefinition.stream().filter(o->nameFromPrev.equals(e.getToscaPresentationValue(JsonPresentationFields.NAME))).findAny();
+ if ( findAny.isPresent() ){
+ e.mergeFunction(findAny.get(), allowDefaultValueOverride);
+ }
+ }
+ });
+ return other;
+ }
+ @Override
+ public boolean isEmpty(){
+ return listToscaDataDefinition == null || listToscaDataDefinition.isEmpty();
+ }
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java
index d0a1465096..f6c0c491f5 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java
@@ -21,7 +21,6 @@
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
-import java.util.Map;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonValue;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java
index b601fb0988..dee3a8a1f3 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java
@@ -21,12 +21,9 @@
package org.openecomp.sdc.be.datatypes.elements;
import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonValue;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
public class ListRequirementDataDefinition extends ListDataDefinition<RequirementDataDefinition> {
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java
index 741aa39230..597e640165 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java
@@ -22,6 +22,8 @@ package org.openecomp.sdc.be.datatypes.elements;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonValue;
@@ -79,7 +81,7 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa
public String findKeyByItemUidMatch(String uid){
- if(null == mapToscaDataDefinition)
+ if(null == mapToscaDataDefinition || uid == null)
return null;
Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e ->
e.getValue().findUidMatch(uid))
@@ -88,5 +90,32 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa
return null;
return entry.getKey();
}
-
+ @Override
+ public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) {
+ Map<String, T > collect = (Map<String, T >)mapToscaDataDefinition.entrySet().stream().filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue)));
+
+ MapDataDefinition collectMap = new MapDataDefinition<>(collect);
+
+ mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId()));
+
+ return (T) collectMap;
+ }
+
+ @Override
+ public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) {
+
+ Map<String, T > map = ((MapDataDefinition)other).getMapToscaDataDefinition();
+
+ map.entrySet().forEach(e ->{
+ String key = e.getKey();
+ if ( mapToscaDataDefinition.containsKey(key) ){
+ e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride);
+ }
+ });
+ return other;
+ }
+ @Override
+ public boolean isEmpty(){
+ return mapToscaDataDefinition == null || mapToscaDataDefinition.isEmpty();
+ }
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java
index a2a59ad778..87a7c60d92 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.be.datatypes.elements;
+import java.util.HashMap;
import java.util.Map;
import org.codehaus.jackson.annotate.JsonCreator;
@@ -38,6 +39,15 @@ public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataD
public MapPropertiesDataDefinition(Map<String, PropertyDataDefinition > mapToscaDataDefinition) {
super(mapToscaDataDefinition);
}
+
+ /**
+ * Copy Constructor
+ */
+ public MapPropertiesDataDefinition(MapPropertiesDataDefinition toBeDeepCopiedMapPropertiesDataDefinition){
+ this.parentName = toBeDeepCopiedMapPropertiesDataDefinition.parentName;
+ this.toscaPresentation = toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation);
+ this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition);
+ }
public MapPropertiesDataDefinition() {
super();
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java
index 11ad219df3..3f044c1d46 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java
index 0b8456bd5c..c338597f40 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java
@@ -21,17 +21,12 @@
package org.openecomp.sdc.be.datatypes.elements;
import java.io.Serializable;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import fj.data.Either;
-
-
public class PropertyDataDefinition extends ToscaDataDefinition implements Serializable {
/**
@@ -63,20 +58,19 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
private String label;
protected Boolean hidden = Boolean.FALSE;
private Boolean immutable = Boolean.FALSE;
-
+
private String inputPath;
- private String status;
- private String inputId;
- private String instanceUniqueId;
- private String propertyId;
+ private String status;
+ private String inputId;
+ private String instanceUniqueId;
+ private String propertyId;
/**
* The resource id which this property belongs to
*/
private String parentUniqueId;
-
private List<GetInputValueDataDefinition> getInputValues;
-
+
public PropertyDataDefinition() {
super();
}
@@ -200,6 +194,13 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
this.schema = entrySchema;
}
+ public String getSchemaType() {
+ if (schema != null && schema.getProperty() != null) {
+ return schema.getProperty().getType();
+ }
+ return null;
+ }
+
public String getLabel() {
return label;
}
@@ -223,8 +224,7 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
public void setImmutable(Boolean immutable) {
this.immutable = immutable;
}
-
-
+
public String getParentUniqueId() {
return getOwnerId();
}
@@ -233,7 +233,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
setOwnerId(parentUniqueId);
}
-
public List<GetInputValueDataDefinition> getGetInputValues() {
return getInputValues;
}
@@ -241,15 +240,15 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
public void setGetInputValues(List<GetInputValueDataDefinition> getInputValues) {
this.getInputValues = getInputValues;
}
-
+
public String getStatus() {
return status;
- }
+ }
public void setStatus(String status) {
this.status = status;
}
-
+
public String getInputId() {
return inputId;
}
@@ -274,7 +273,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
this.propertyId = propertyId;
}
-
@Override
public String toString() {
return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required + ", definition=" + definition + ", defaultValue=" + defaultValue + ", description=" + description + ", schema=" + schema + ", password="
@@ -299,6 +297,27 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
return result;
}
+ public boolean typeEquals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ PropertyDataDefinition other = (PropertyDataDefinition) obj;
+ if (this.getType() == null)
+ return other.getType() == null;
+ if (!this.type.equals(other.type)) {
+ return false;
+ }
+ String thisSchemaType = this.getSchemaType();
+ String otherSchemaType = other.getSchemaType();
+ if (thisSchemaType == null) {
+ return otherSchemaType == null;
+ }
+ return thisSchemaType.equals(otherSchemaType);
+ }
+
@Override
public boolean equals(Object obj) {
if (this == obj)
@@ -377,28 +396,31 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
}
}
- private <T extends ToscaDataDefinition> boolean compareSchemaType(T other){
- return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType().equals(((PropertyDataDefinition)other).getSchema().getProperty().getType());
+ private <T extends ToscaDataDefinition> boolean compareSchemaType(T other) {
+ return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType().equals(((PropertyDataDefinition) other).getSchema().getProperty().getType());
}
-
-
+
@Override
- public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride){
- if(this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)){
+ public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) {
+ if (this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)) {
other.setOwnerId(getOwnerId());
- if(allowDefaultValueOverride)
- other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue());
+ if (allowDefaultValueOverride) {
+ if (getDefaultValue() != null && !getDefaultValue().isEmpty()) {
+ other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue());
+ }
+ }
return other;
}
return null;
}
-
- public void convertPropertyDataToInstancePropertyData(){
- if(null != value)
+
+ public void convertPropertyDataToInstancePropertyData() {
+ if (null != value)
defaultValue = value;
}
-
-
+ public boolean isGetInputProperty() {
+ return this.getGetInputValues() != null && !this.getGetInputValues().isEmpty();
+ }
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java
index c5297e273a..639c6dd118 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.be.datatypes.elements;
import java.io.Serializable;
import java.util.List;
+
import org.codehaus.jackson.annotate.JsonIgnore;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java
index 4a6f770ebc..75f4b857c5 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java
@@ -27,23 +27,32 @@ import java.util.List;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import com.google.common.collect.Lists;
+/**
+ * Represents the requirement of the component or component instance
+ */
public class RequirementDataDefinition extends ToscaDataDefinition implements Serializable {
/**
*
*/
- public final static String MIN_OCCURRENCES = "1";
- public final static String MAX_OCCURRENCES = "UNBOUNDED";
- public final static String MAX_DEFAULT_OCCURRENCES = "1";
+ public static final String MIN_OCCURRENCES = "1";
+ public static final String MAX_OCCURRENCES = "UNBOUNDED";
+ public static final String MAX_DEFAULT_OCCURRENCES = "1";
private static final long serialVersionUID = -8840549489409274532L;
-
+ /**
+ * The default constructor initializing limits of the occurrences
+ */
public RequirementDataDefinition() {
super();
this.setMinOccurrences( MIN_OCCURRENCES );
this.setMaxOccurrences( MAX_OCCURRENCES);
this.setLeftOccurrences( MAX_OCCURRENCES);
}
-
+ /**
+ * Deep copy constructor
+ * @param other
+ */
public RequirementDataDefinition(RequirementDataDefinition other) {
this.setUniqueId(other.getUniqueId());
this.setName(other.getName());
@@ -56,9 +65,11 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
this.setMinOccurrences(other.getMinOccurrences());
this.setMaxOccurrences(other.getMaxOccurrences());
this.setLeftOccurrences(other.getLeftOccurrences());
- this.setPath(other.getPath());
+ if(other.getPath() == null)
+ this.setPath(Lists.newArrayList());
+ else
+ this.setPath(Lists.newArrayList(other.getPath()));
this.setSource(other.getSource());
-
}
/**
@@ -122,19 +133,15 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
setToscaPresentationValue(JsonPresentationFields.RELATIONSHIP, relationship);
}
- // public RequirementImplDef getRequirementImpl() {
- // return requirementImpl;
- // }
- //
- // public void setRequirementImpl(RequirementImplDef requirementImpl) {
- // this.requirementImpl = requirementImpl;
- // }
-
- // specifies the resource instance holding this requirement
+ /**
+ * specifies the resource instance holding this requirement
+ */
+ @Override
public String getOwnerId() {
return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID);
}
-
+
+ @Override
public void setOwnerId(String ownerId) {
setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId);
}
@@ -175,6 +182,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
setToscaPresentationValue(JsonPresentationFields.PATH, path);
}
+ @SuppressWarnings({ "unchecked" })
public List<String> getPath() {
return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH);
}
@@ -187,12 +195,18 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE);
}
+ /**
+ * Adds the element to the path avoiding duplication
+ * @param elementInPath
+ */
public void addToPath(String elementInPath) {
List<String> path = getPath();
if (path == null) {
path = new ArrayList<>();
}
- path.add(elementInPath);
+ if(!path.contains(elementInPath)){
+ path.add(elementInPath);
+ }
setPath(path);
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
index bc24efa411..8d8e518049 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
@@ -21,11 +21,9 @@
package org.openecomp.sdc.be.datatypes.elements;
import java.io.Serializable;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
/**
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
index 8634ac871a..f88c84644c 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
@@ -42,6 +42,7 @@ public enum JsonPresentationFields {
IS_DELETED ("isDeleted", GraphPropertyEnum.IS_DELETED),
ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", null),
NAMING_POLICY ("namingPolicy", null),
+ ENVIRONMENT_CONTEXT ("environmentContext", null),
TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME),
DESCRIPTION ("description", null),
TYPE ("type", null),
@@ -174,6 +175,11 @@ public enum JsonPresentationFields {
CI_TOSCA_COMPONENT_NAME ("toscaComponentName", null),
CI_INVARIANT_NAME ("invariantName", null),
CI_ICON ("icon", null),
+ CI_SOURCE_MODEL_UUID ("sourceModelUuid", null),
+ CI_SOURCE_MODEL_UID ("sourceModelUid", null),
+ CI_SOURCE_MODEL_INVARIANT ("sourceModelInvariant", null),
+ CI_SOURCE_MODEL_NAME ("sourceModelName", null),
+ CI_IS_PROXY ("isProxy", null),
;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java
index 36756e9225..714e3c6c0a 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java
@@ -27,9 +27,12 @@ public enum OriginTypeEnum {
VFC("VFC", "VFC (Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE),
CP("CP", "CP (Connection Point)", "resource instance", ComponentTypeEnum.RESOURCE),
VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE),
+ Configuration("Configuration", "Configuration ()", "resource instance", ComponentTypeEnum.RESOURCE),
VFCMT("VFCMT", "VFCMT (VFC Monitoring Template)", "resource instance", ComponentTypeEnum.RESOURCE),
CVFC("CVFC", "CVFC (Complex Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE),
- PNF("PNF", "PNF (Physical Network Function)", "resource instance", ComponentTypeEnum.RESOURCE);
+ PNF("PNF", "PNF (Physical Network Function)", "resource instance", ComponentTypeEnum.RESOURCE),
+ ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE)
+ ;
private String value;
private String displayValue;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java
index 182657e125..a4efafbf75 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java
@@ -33,7 +33,9 @@ public enum ResourceTypeEnum {
PNF("PNF"/* (Physical Network Function)" */),
CVFC("CVFC"/*Complex Virtual Function Component*/),
VL( "VL (Virtual Link)"),
- VFCMT("VFCMT (VFC Monitoring Template)"),
+ VFCMT("VFCMT (VFC Monitoring Template)"),
+ Configuration("Configuration ()"),
+ ServiceProxy("ServiceProxy ()"),
ABSTRACT("Abstract (Generic VFC/VF/PNF/Service Type)");
private String value;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java
index b8d164e4aa..31ca6bb1cd 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java
@@ -28,25 +28,24 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.codehaus.jackson.annotate.JsonCreator;
-import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonValue;
-import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import fj.data.Either;
public abstract class ToscaDataDefinition {
-
+
protected Map<String, Object> toscaPresentation;
-
- public ToscaDataDefinition(){
+ public ToscaDataDefinition() {
toscaPresentation = new HashMap<String, Object>();
}
+
@JsonCreator
- public ToscaDataDefinition(Map<String, Object> art){
+ public ToscaDataDefinition(Map<String, Object> art) {
toscaPresentation = art;
}
+
@JsonValue
public Object getToscaPresentationValue(JsonPresentationFields name) {
if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) {
@@ -54,56 +53,57 @@ public abstract class ToscaDataDefinition {
}
return null;
}
-
+
public void setToscaPresentationValue(JsonPresentationFields name, Object value) {
- if (toscaPresentation == null && value !=null) {
- toscaPresentation = new HashMap<String, Object>();
+ if (toscaPresentation == null && value != null) {
+ toscaPresentation = new HashMap<String, Object>();
}
toscaPresentation.put(name.getPresentation(), value);
-
+
}
- public void setOwnerIdIfEmpty(String ownerId){
- if ( getOwnerId() == null ){
+
+ public void setOwnerIdIfEmpty(String ownerId) {
+ if (getOwnerId() == null) {
setOwnerId(ownerId);
}
}
- public void setOwnerId(String ownerId){
+
+ public void setOwnerId(String ownerId) {
setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId);
}
- public String getOwnerId(){
+ public String getOwnerId() {
return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID);
}
-
-
- //default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2)
- public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride){
+
+ // default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2)
+ public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) {
other.setOwnerId(getOwnerId());
return other;
}
-
- public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2){
+
+ public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2) {
return mergeDataMaps(map1, map2, false);
}
-
- //return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden)
- public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2, boolean allowDefaultValueOverride){
- for(Entry<String, T> entry : map2.entrySet()){
+
+ // return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden)
+ public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2, boolean allowDefaultValueOverride) {
+ for (Entry<String, T> entry : map2.entrySet()) {
map1.merge(entry.getKey(), entry.getValue(), (item1, item2) -> item1.mergeFunction(item2, allowDefaultValueOverride));
- //validate merge success
- if(!map1.containsKey(entry.getKey()))
- return Either.right(entry.getKey());
+ // validate merge success
+ if (!map1.containsKey(entry.getKey()))
+ return Either.right(entry.getKey());
}
return Either.left(map1);
}
-
+
public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> dataList) {
- return null == dataList? new HashMap<>() : dataList.stream()
- .collect(Collectors.toMap(p -> (String)p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p));
+ return null == dataList ? new HashMap<>() : dataList.stream().collect(Collectors.toMap(p -> (String) p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p));
}
- public boolean findUidMatch(String uid){
+ public boolean findUidMatch(String uid) {
return uid.equals(getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID));
+
}
public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) {
return (T) this;
@@ -111,6 +111,11 @@ public abstract class ToscaDataDefinition {
public static <T extends ToscaDataDefinition> T removeAndCollectByOwnerId(T complexStructure, Set<String> ownerIdList) {
return complexStructure.removeByOwnerId(ownerIdList);
}
+
+ public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) {
+ return other;
+ }
+
public boolean isEmpty(){
return false;
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java
index 76d2cc5a6d..2243434ce7 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java
@@ -20,10 +20,16 @@
package org.openecomp.sdc.be.workers;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.*;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
* Created by michael on 6/24/2016.
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java
index 9fb81d0e12..e8957fc9ef 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java
@@ -20,13 +20,13 @@
package org.openecomp.sdc.be.workers;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
/**
* Created by michael on 6/24/2016.
*/