aboutsummaryrefslogtreecommitdiffstats
path: root/common-be/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src/main/java/org/openecomp')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java19
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java21
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java38
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java8
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java12
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java16
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java6
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java3
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java4
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java12
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java4
11 files changed, 119 insertions, 24 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
index 24d801262c..5fecac429a 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
@@ -28,6 +28,8 @@ import java.util.Map;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition implements Serializable {
@@ -35,7 +37,8 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
*
*/
private static final long serialVersionUID = -9114770126086263552L;
-
+ private static final Logger log = LoggerFactory.getLogger(ComponentMetadataDataDefinition.class.getName());
+
private String uniqueId;
private String name; // archiveName
@@ -156,13 +159,13 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.lastUpdateDate = other.getLastUpdateDate();
this.description = other.getDescription();
this.state = other.getState();
- this.tags = new ArrayList<String>(other.getTags());
+ this.tags = new ArrayList<>(other.getTags());
this.icon = other.getIcon();
this.contactId = other.getContactId();
this.UUID = other.getUUID();
this.normalizedName = other.getNormalizedName();
this.systemName = other.getSystemName();
- this.allVersions = new HashMap<String, String>(other.getAllVersions());
+ this.allVersions = new HashMap<>(other.getAllVersions());
this.isDeleted = other.isDeleted();
this.projectCode = other.getProjectCode();
this.csarUUID = other.getCsarUUID();
@@ -177,6 +180,8 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
}
public void setUniqueId(String uniqueId) {
+ if ( this.uniqueId != null && !this.uniqueId.equals( uniqueId ) )
+ log.warn("uniqueId changed more then once -> OLD : {} , NEW: {} ", this.uniqueId ,uniqueId );
this.uniqueId = uniqueId;
}
@@ -264,8 +269,10 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
return UUID;
}
- public void setUUID(String uUID) {
- UUID = uUID;
+ public void setUUID(String UUID) {
+ if ( this.UUID != null && !this.UUID.equals( UUID ) )
+ log.warn("UUID changed more then once -> OLD : {} , NEW: {} ", this.UUID, UUID );
+ this.UUID = UUID;
}
public String getNormalizedName() {
@@ -297,6 +304,8 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
}
public void setInvariantUUID(String invariantUUID) {
+ if ( this.invariantUUID != null && !this.invariantUUID.equals( invariantUUID ) )
+ log.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID ,invariantUUID );
this.invariantUUID = invariantUUID;
}
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 7b112ce129..9675cd37fb 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
@@ -34,6 +34,7 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
private String vendorName;
private String vendorRelease;
+ private String resourceVendorModelNumber;
private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC
// is
// default
@@ -44,12 +45,14 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
public ResourceMetadataDataDefinition() {
super();
+ resourceVendorModelNumber = "";
}
public ResourceMetadataDataDefinition(ResourceMetadataDataDefinition other) {
super(other);
this.vendorName = other.getVendorName();
this.vendorRelease = other.getVendorRelease();
+ this.resourceVendorModelNumber = other.getResourceVendorModelNumber();
this.isAbstract = other.isHighestVersion();
this.resourceType = other.getResourceType();
this.toscaResourceName = other.getToscaResourceName();
@@ -70,6 +73,15 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
public void setVendorRelease(String vendorRelease) {
this.vendorRelease = vendorRelease;
}
+
+ public String getResourceVendorModelNumber() {
+ return resourceVendorModelNumber;
+ }
+
+ public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
+ this.resourceVendorModelNumber = resourceVendorModelNumber;
+ }
+
public ResourceTypeEnum getResourceType() {
return resourceType;
@@ -114,7 +126,8 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
@Override
public String toString() {
return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease
- + ", resourceType=" + resourceType + ", isAbstract=" + isAbstract + super.toString() + "]";
+ + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType +
+ ", isAbstract=" + isAbstract + super.toString() + "]";
}
@Override
@@ -127,6 +140,7 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode());
result = prime * result + ((vendorRelease == null) ? 0 : vendorRelease.hashCode());
+ result = prime * result + ((resourceVendorModelNumber == null)? 0 : resourceVendorModelNumber.hashCode());
return result;
}
@@ -170,6 +184,11 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit
return false;
} else if (!vendorRelease.equals(other.vendorRelease))
return false;
+ if (resourceVendorModelNumber == null) {
+ if (other.resourceVendorModelNumber != null)
+ return false;
+ } else if (!resourceVendorModelNumber.equals(other.resourceVendorModelNumber))
+ return false;
return super.equals(obj);
}
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 4f3486e457..4a42436583 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
@@ -33,6 +33,8 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
public static final String EMPTY_STR = "";
private String distributionStatus;
+ private String serviceType;
+ private String serviceRole;
private Boolean ecompGeneratedNaming = true;
@@ -40,10 +42,14 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
public ServiceMetadataDataDefinition() {
super();
+ serviceType = "";
+ serviceRole = "";
}
public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) {
super(other);
+ serviceType = other.getServiceType();
+ serviceRole = other.getServiceRole();
}
public String getDistributionStatus() {
@@ -53,6 +59,22 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
public void setDistributionStatus(String distributionStatus) {
this.distributionStatus = distributionStatus;
}
+
+ public String getServiceType(){
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType){
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole(){
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole){
+ this.serviceRole = serviceRole;
+ }
public Boolean isEcompGeneratedNaming() {
return ecompGeneratedNaming;
@@ -73,8 +95,8 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
@Override
public String toString() {
return "ServiceMetadataDataDefinition [ distributionStatus=" + distributionStatus
- + ", ecompGeneratedNaming=" + ecompGeneratedNaming + ", namingPolicy=" + namingPolicy
- + ", parent=" + super.toString() + "]";
+ + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole + ", ecompGeneratedNaming="
+ + ecompGeneratedNaming + ", namingPolicy=" + namingPolicy + ", parent=" + super.toString() + "]";
}
@Override
@@ -84,6 +106,8 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode());
result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode());
result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode());
+ result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
+ result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode());
return result;
}
@@ -117,6 +141,16 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
return false;
} else if (!namingPolicy.equals(other.namingPolicy))
return false;
+ if (serviceType == null){
+ if (other.serviceType != null)
+ return false;
+ } else if (!serviceType.equals(other.serviceType))
+ return false;
+ if (serviceRole == null){
+ if (other.serviceRole != null)
+ return false;
+ } else if (!serviceRole.equals(other.serviceRole))
+ return false;
return super.equals(obj);
}
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 424b15059e..6d11c51596 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
@@ -25,6 +25,7 @@ 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.stream.Collectors;
import org.codehaus.jackson.annotate.JsonCreator;
@@ -86,6 +87,11 @@ public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaData
((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));
+ }
}
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 537d9502cd..741aa39230 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
@@ -76,5 +76,17 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa
mapToscaDataDefinition.entrySet().forEach(e -> e.getValue().setOwnerIdIfEmpty(ownerId));
}
}
+
+
+ public String findKeyByItemUidMatch(String uid){
+ if(null == mapToscaDataDefinition)
+ return null;
+ Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e ->
+ e.getValue().findUidMatch(uid))
+ .findAny().orElse(null);
+ if(null == entry)
+ return null;
+ return entry.getKey();
+ }
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java
index de9127d08c..0017567031 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java
@@ -44,12 +44,12 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition implemen
this.setModificationTime(cdt.getModificationTime());
this.setCapabilityOwnerId(cdt.getCapabilityOwnerId());
this.setRequirementOwnerId(cdt.getRequirementOwnerId());
- this.setCapabiltyId(cdt.getCapabiltyId());
+ this.setCapabilityId(cdt.getCapabilityId());
this.setRequirementId(cdt.getRequirementId());
this.setFromId(cdt.getFromId());
this.setToId(cdt.getToId());
this.setRequirement(cdt.getRequirement());
- this.setCapability(cdt.getCapabilty());
+ this.setCapability(cdt.getCapability());
}
@@ -60,11 +60,11 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition implemen
public String getRequirement() {
return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT);
}
- public void setCapability(String capabilty) {
- setToscaPresentationValue(JsonPresentationFields.CAPAPILITY, capabilty);
+ public void setCapability(String capability) {
+ setToscaPresentationValue(JsonPresentationFields.CAPAPILITY, capability);
}
- public String getCapabilty() {
+ public String getCapability() {
return (String) getToscaPresentationValue(JsonPresentationFields.CAPAPILITY);
}
public void setToId(Object toId) {
@@ -87,15 +87,15 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition implemen
setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID, requirementId);
}
- public void setCapabiltyId(Object capabiltyId) {
- setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabiltyId);
+ public void setCapabilityId(Object capabilityId) {
+ setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabilityId);
}
public String getRequirementId() {
return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID);
}
- public String getCapabiltyId() {
+ public String getCapabilityId() {
return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID);
}
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 59b14b3060..b32f65f9d3 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
@@ -191,7 +191,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
public int hashCode() {
final int prime = 31;
int result = 1;
- String name = getUniqueId();
+ String name = getName();
String uniqueId = getUniqueId();
String capability = getCapability();
String node = getNode();
@@ -230,7 +230,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
return false;
RequirementDataDefinition other = (RequirementDataDefinition) obj;
- String name = getUniqueId();
+ String name = getName();
String uniqueId = getUniqueId();
String capability = getCapability();
String node = getNode();
@@ -308,7 +308,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
@Override
public String toString() {
- String name = getUniqueId();
+ String name = getName();
String uniqueId = getUniqueId();
String capability = getCapability();
String node = getNode();
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 9dfc3b602a..d5592995e6 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
@@ -48,6 +48,9 @@ public enum JsonPresentationFields {
DERIVED_FROM ("derivedFrom", null),
VENDOR_NAME ("vendorName", null),
VENDOR_RELEASE ("vendorRelease", null),
+ RESOURCE_VENDOR_MODEL_NUMBER ("reourceVendorModelNumber",null),
+ SERVICE_TYPE ("serviceType", null),
+ SERVICE_ROLE ("serviceRole", null),
CONFORMANCE_LEVEL ("conformanceLevel", null),
ICON ("icon", null),
TAGS ("tags", 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 0d837762e2..36756e9225 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,7 +27,9 @@ 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),
- VFCMT("VFCMT", "VFCMT (VFC Monitoring Template)", "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);
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 d3652c238f..182657e125 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
@@ -27,8 +27,14 @@ package org.openecomp.sdc.be.datatypes.enums;
*/
public enum ResourceTypeEnum {
- VFC("VFC (Virtual Function Component)"), VF("VF"/* (Virtual Function)" */), CP("CP (Connection Point)"),
- VL( "VL (Virtual Link)"), VFCMT("VFCMT (VFC Monitoring Template)"), ABSTRACT("Abstract (Generic VFC/VF/Service Type)");
+ VFC("VFC (Virtual Function Component)"),
+ VF("VF"/* (Virtual Function)" */),
+ CP("CP (Connection Point)"),
+ PNF("PNF"/* (Physical Network Function)" */),
+ CVFC("CVFC"/*Complex Virtual Function Component*/),
+ VL( "VL (Virtual Link)"),
+ VFCMT("VFCMT (VFC Monitoring Template)"),
+ ABSTRACT("Abstract (Generic VFC/VF/PNF/Service Type)");
private String value;
@@ -85,7 +91,7 @@ public enum ResourceTypeEnum {
return false;
}
/**
- * Checks if enum exist with given type ignare case
+ * Checks if enum exist with given type ignore case
* @param type
* @return
*/
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 eba27fb48b..df73adaa4a 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
@@ -100,4 +100,8 @@ public abstract class ToscaDataDefinition {
return null == dataList? new HashMap<>() : dataList.stream()
.collect(Collectors.toMap(p -> (String)p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p));
}
+
+ public boolean findUidMatch(String uid){
+ return uid.equals(getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID));
+ }
}