diff options
author | Michael Lando <ml636r@att.com> | 2018-07-29 16:13:45 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-07-29 16:20:34 +0300 |
commit | 5b593496b8f1b8e8be8d7d2dbcc223332e65a49b (patch) | |
tree | 2f9dfc45191e723da69cf74be7829784e9741b94 /common-be | |
parent | 9200382f2ce7b4bb729aa287d0878004b2d2b4f9 (diff) |
re base code
Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5
Issue-ID: SDC-1566
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'common-be')
92 files changed, 2245 insertions, 1848 deletions
diff --git a/common-be/pom.xml b/common-be/pom.xml index 880a1f0d83..8bae6805de 100644 --- a/common-be/pom.xml +++ b/common-be/pom.xml @@ -19,7 +19,14 @@ <version>${project.version}</version> <scope>provided</scope> </dependency> - + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${lang3.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java index 943c1191e5..641d0c143d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java @@ -20,17 +20,11 @@ package org.openecomp.sdc.be.datatypes.category; -import java.io.Serializable; -import java.util.List; - import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -public class CategoryDataDefinition extends ToscaDataDefinition implements Serializable { +import java.util.List; - /** - * - */ - private static final long serialVersionUID = 2882352060242714427L; +public class CategoryDataDefinition extends ToscaDataDefinition { private String name; private String normalizedName; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java index 1483a0aa1b..077862d3f6 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java @@ -20,15 +20,9 @@ package org.openecomp.sdc.be.datatypes.category; -import java.io.Serializable; - import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -public class GroupingDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ - private static final long serialVersionUID = 2641475929148843849L; +public class GroupingDataDefinition extends ToscaDataDefinition { private String name; private String normalizedName; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java index 21d3abaf4b..96579dafe1 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java @@ -20,16 +20,11 @@ package org.openecomp.sdc.be.datatypes.category; -import java.io.Serializable; -import java.util.List; - import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -public class SubCategoryDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ - private static final long serialVersionUID = 8279397988497086676L; +import java.util.List; + +public class SubCategoryDataDefinition extends ToscaDataDefinition { private String name; private String normalizedName; 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 a7f8152645..3f75583ef2 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 @@ -20,25 +20,15 @@ package org.openecomp.sdc.be.datatypes.components; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -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; +import org.openecomp.sdc.common.log.wrappers.Logger; -public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition implements Serializable { +import java.util.*; - /** - * - */ - private static final long serialVersionUID = -9114770126086263552L; - private static final Logger log = LoggerFactory.getLogger(ComponentMetadataDataDefinition.class.getName()); +public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition { + + private static final Logger log = Logger.getLogger(ComponentMetadataDataDefinition.class.getName()); private String uniqueId; @@ -95,6 +85,13 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio private String lastUpdaterFullName; + //Archive/Restore + private Boolean isArchived = false; + + private Long archiveTime; + + private Boolean isVspArchived = false; + public Boolean getIsHighestVersion() { return isHighestVersion; } @@ -147,6 +144,18 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio return isDeleted; } + public Boolean isArchived() { return isArchived; } + + public void setArchived(Boolean archived) { isArchived = archived; } + + public Long getArchiveTime() { return archiveTime; } + + public void setArchiveTime(Long archiveTime) { this.archiveTime = archiveTime; } + + public Boolean isVspArchived() { return isVspArchived; } + + public void setVspArchived(Boolean vspArchived) { isVspArchived = vspArchived; } + public ComponentMetadataDataDefinition() { } @@ -173,7 +182,9 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio this.csarVersion = other.csarVersion; this.importedToscaChecksum = other.getImportedToscaChecksum(); this.invariantUUID = other.getInvariantUUID(); - + this.isArchived = other.isArchived; + this.isVspArchived = other.isVspArchived; + this.archiveTime = other.getArchiveTime(); } public String getUniqueId() { 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 da432ca971..2b7ece292f 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 @@ -22,14 +22,7 @@ package org.openecomp.sdc.be.datatypes.components; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import java.io.Serializable; - -public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1142973528643758481L; +public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition { private String vendorName; private String vendorRelease; 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 7fbce574a9..8e80f927ae 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 @@ -20,19 +20,13 @@ package org.openecomp.sdc.be.datatypes.components; -import java.io.Serializable; - -public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -7661001892509435120L; +public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition { public static final String EMPTY_STR = ""; private String distributionStatus; private String serviceType; private String serviceRole; + private String instantiationType = EMPTY_STR; private Boolean ecompGeneratedNaming = true; @@ -72,6 +66,14 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti return serviceRole; } + public String getInstantiationType() { + return instantiationType; + } + + public void setInstantiationType(String instantiationType){ + this.instantiationType = instantiationType; + } + public void setServiceRole(String serviceRole){ this.serviceRole = serviceRole; } @@ -105,6 +107,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti ", ecompGeneratedNaming=" + ecompGeneratedNaming + ", namingPolicy='" + namingPolicy + '\'' + ", environmentContext='" + environmentContext + '\'' + + ", instantiationType='" + instantiationType + '\'' + '}'; } @@ -118,6 +121,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode()); result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode()); + result = prime * result + ((instantiationType == null) ? 0 : instantiationType.hashCode()); return result; } @@ -166,6 +170,11 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti return false; } else if (!environmentContext.equals(other.environmentContext)) return false; + if (instantiationType == null) { + if (other.instantiationType != null) + return false; + } else if (!instantiationType.equals(other.instantiationType)) + return false; return super.equals(obj); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java index ea47342ce3..76cb358962 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java @@ -22,15 +22,9 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.List; -public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -565365728516901670L; +public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition { private String uniqueId; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java index 94aea6d321..8dc95bc9d3 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java @@ -22,31 +22,22 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; +public class AdditionalInfoParameterInfo extends ToscaDataDefinition { -public class AdditionalInfoParameterInfo extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 2066876282722907709L; - - String uniqueId; - String key; - String value; + private String uniqueId; + private String key; + private String value; public AdditionalInfoParameterInfo() { super(); } public AdditionalInfoParameterInfo(String key, String value) { - super(); this.key = key; this.value = value; } public AdditionalInfoParameterInfo(String uniqueId, String key, String value) { - super(); this.uniqueId = uniqueId; this.key = key; this.value = value; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/Annotation.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/Annotation.java new file mode 100644 index 0000000000..e7020edcb7 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/Annotation.java @@ -0,0 +1,65 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class Annotation { + private String name; + private String type; + private String description; + private List<PropertyDataDefinition> properties; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List<PropertyDataDefinition> getProperties() { + return properties; + } + + public void setProperties(List<PropertyDataDefinition> properties) { + this.properties = properties; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public static void setAnnotationsName(Map<String, Annotation> annotations) { + annotations.forEach((name, annotation) -> annotation.setName(name)); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Annotation that = (Annotation) o; + return Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AnnotationTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AnnotationTypeDataDefinition.java new file mode 100644 index 0000000000..81dfc13011 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AnnotationTypeDataDefinition.java @@ -0,0 +1,96 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class AnnotationTypeDataDefinition extends ToscaDataDefinition { + + protected String uniqueId; + protected String type; + protected String description; + + protected Long creationTime; + protected Long modificationTime; + + protected String version; + protected boolean highestVersion; + + public AnnotationTypeDataDefinition() {} + + public AnnotationTypeDataDefinition(AnnotationTypeDataDefinition other) { + uniqueId = other.uniqueId; + type = other.type; + version = other.version; + description = other.description; + creationTime = other.creationTime; + modificationTime = other.modificationTime; + highestVersion = other.highestVersion; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + @Override + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + @Override + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public boolean isHighestVersion() { + return highestVersion; + } + + public void setHighestVersion(boolean highestVersion) { + this.highestVersion = highestVersion; + } + + @Override + public String toString() { + return getClass().getName() + ": [uniqueId=" + uniqueId + ", type=" + getType() + + ", version=" + version + ", highestVersion=" + highestVersion + + ", description=" + description + + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; + } + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java index b42ceab945..93519d29fe 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java @@ -24,23 +24,15 @@ import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; //import com.google.gson.reflect.TypeToken; -public class ArtifactDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ - private static final long serialVersionUID = -1691343090754083941L; - - +public class ArtifactDataDefinition extends ToscaDataDefinition { public ArtifactDataDefinition() { - super(); setArtifactVersion("0"); } @@ -52,7 +44,6 @@ public class ArtifactDataDefinition extends ToscaDataDefinition implements Seria public ArtifactDataDefinition(ArtifactDataDefinition a ) { - super(); this.setUniqueId(a.getUniqueId()); this.setArtifactType(a.getArtifactType()); this.setArtifactRef( a.getArtifactRef()); 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 9327499981..fdd1386e48 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,347 +24,450 @@ import com.google.common.collect.Lists; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * Represents the capability of the component or component instance */ -public class CapabilityDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 7544984873506188920L; - 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 class CapabilityDataDefinition extends ToscaDataDefinition { + + public static final String MIN_OCCURRENCES = "1"; + public static final String MAX_OCCURRENCES = "UNBOUNDED"; + + /** + * The default constructor initializing limits of the occurrences + */ + public CapabilityDataDefinition() { + this.setMinOccurrences(MIN_OCCURRENCES); + this.setMaxOccurrences(MAX_OCCURRENCES); + this.setLeftOccurrences(MAX_OCCURRENCES); + } + + /** + * Deep copy constructor + * + * @param other + */ + public CapabilityDataDefinition(CapabilityDataDefinition other) { + this.setUniqueId(other.getUniqueId()); + this.setType(other.getType()); + this.setDescription(other.getDescription()); + this.setName(other.getName()); + this.setParentName(other.getParentName()); + this.setPreviousName(other.getPreviousName()); + + 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.setOwnerType(other.getOwnerType()); + 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()); + this.setOwnerType(other.getOwnerType()); } - /** - * Deep copy constructor - * @param other - */ - public CapabilityDataDefinition(CapabilityDataDefinition other) { - super(); + + public CapabilityDataDefinition(CapabilityTypeDataDefinition other) { + super(); this.setUniqueId(other.getUniqueId()); - this.setType(other.getType()); - this.setDescription ( other.getDescription()); - this.setName( other.getName()); - this.setParentName( other.getParentName()); - + this.setType(other.getType()); + this.setDescription(other.getDescription()); + this.setOwnerId(other.getOwnerId()); 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()); - - } + this.setOwnerId(other.getOwnerId()); + } - @Override - public String getOwnerId() { - return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); - } - - @Override - public void setOwnerId(String ownerId) { - setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); - } + @Override + public String getOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); + } - public String getOwnerName() { - return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_NAME); - } + @Override + public void setOwnerId(String ownerId) { + setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); + } - public void setOwnerName(String ownerName) { - setToscaPresentationValue(JsonPresentationFields.OWNER_NAME, ownerName); - } + public String getOwnerName() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_NAME); + } - public String getMinOccurrences() { - return (String) getToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES); - } + public void setOwnerName(String ownerName) { + setToscaPresentationValue(JsonPresentationFields.OWNER_NAME, ownerName); + } - public void setMinOccurrences(String minOccurrences) { - setToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES, minOccurrences); + public OwnerType getOwnerType() { + return OwnerType.getByValue((String) getToscaPresentationValue(JsonPresentationFields.OWNER_TYPE)); } - public String getMaxOccurrences() { - return (String) getToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES); + public void setOwnerType(OwnerType ownerType) { + if(ownerType != null) + setToscaPresentationValue(JsonPresentationFields.OWNER_TYPE, ownerType.getValue()); } - public void setMaxOccurrences(String maxOccurrences) { - setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); - } - public String getLeftOccurrences() { - return (String) getToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES); - } + public String getMinOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES); + } - public void setLeftOccurrences(String leftOccurrences) { - setToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES, leftOccurrences); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } + public void setMinOccurrences(String minOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES, minOccurrences); + } - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } + public String getMaxOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES); + } - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } + public void setMaxOccurrences(String maxOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); + } - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } + public String getLeftOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES); + } - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } + public void setLeftOccurrences(String leftOccurrences) { + setToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES, leftOccurrences); + } - public void setName(String name) { - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - - public String getParentName() { - return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME); - } + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } - public void setParentName(String parentName) { - setToscaPresentationValue(JsonPresentationFields.PARENT_NAME, parentName); - } + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } - public String getType() { - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); - } + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } - public void setType(String type) { - setToscaPresentationValue(JsonPresentationFields.TYPE, type); - } + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } - @SuppressWarnings("unchecked") - public List<String> getValidSourceTypes() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE); - } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } - public void setValidSourceTypes(List<String> validSourceTypes) { - setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); - } + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } - @SuppressWarnings("unchecked") - public List<String> getCapabilitySources() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES); - } - - public void setCapabilitySources(List<String> capabilitySources) { - setToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES, capabilitySources); - } + public String getParentName() { + return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME); + } - public void setPath(List<String> path){ - setToscaPresentationValue(JsonPresentationFields.PATH, path); - } - @SuppressWarnings("unchecked") - public List<String> getPath() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); - } - public void setSource(String source){ - setToscaPresentationValue(JsonPresentationFields.SOURCE, source); - } - public String getSource() { - return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); + public void setParentName(String parentName) { + setToscaPresentationValue(JsonPresentationFields.PARENT_NAME, parentName); + } + + public String getPreviousName() { + return (String) getToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME); + } + + public void setPreviousName(String previousName) { + setToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME, previousName); + } + + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + @SuppressWarnings("unchecked") + public List<String> getValidSourceTypes() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE); + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); + } + + @SuppressWarnings("unchecked") + public List<String> getCapabilitySources() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES); + } + + public void setCapabilitySources(List<String> capabilitySources) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES, capabilitySources); + } + + public void setPath(List<String> path) { + setToscaPresentationValue(JsonPresentationFields.PATH, path); + } + + @SuppressWarnings("unchecked") + public List<String> getPath() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); + } + + public void setSource(String source) { + setToscaPresentationValue(JsonPresentationFields.SOURCE, source); + } + + 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<>(); + } + if (!path.contains(elementInPath)) { + path.add(elementInPath); + } + setPath(path); + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + + String uniqueId = this.getUniqueId(); + String description = this.getDescription(); + String name = this.getName(); + String type = this.getType(); + List<String> validSourceTypes = this.getValidSourceTypes(); + List<String> capabilitySources = this.getCapabilitySources(); + List<String> path = this.getPath(); + + String ownerId = this.getOwnerId(); + String ownerName = this.getOwnerName(); + String minOccurrences = this.getMinOccurrences(); + String maxOccurrences = this.getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + String source = getSource(); + + result = prime * result + ((capabilitySources == null) ? 0 : capabilitySources.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((maxOccurrences == null) ? 0 : maxOccurrences.hashCode()); + result = prime * result + ((minOccurrences == null) ? 0 : minOccurrences.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); + result = prime * result + ((ownerName == null) ? 0 : ownerName.hashCode()); + + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((validSourceTypes == null) ? 0 : validSourceTypes.hashCode()); + result = prime * result + ((leftOccurrences == null) ? 0 : leftOccurrences.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + result = prime * result + ((source == null) ? 0 : source.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + + String uniqueId = this.getUniqueId(); + String description = this.getDescription(); + String name = this.getName(); + String type = this.getType(); + List<String> validSourceTypes = this.getValidSourceTypes(); + List<String> capabilitySources = this.getCapabilitySources(); + String ownerId = this.getOwnerId(); + String ownerName = this.getOwnerName(); + String minOccurrences = this.getMinOccurrences(); + String maxOccurrences = this.getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + List<String> path = this.getPath(); + String source = getSource(); + + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + CapabilityDataDefinition other = (CapabilityDataDefinition) obj; + if (capabilitySources == null) { + if (other.getCapabilitySources() != null) { + return false; + } + } + else if (!capabilitySources.equals(other.getCapabilitySources())) { + return false; + } + if (description == null) { + if (other.getDescription() != null) { + return false; + } + } + else if (!description.equals(other.getDescription())) { + return false; + } + if (maxOccurrences == null) { + if (other.getMaxOccurrences() != null) { + return false; + } + } + else if (!maxOccurrences.equals(other.getMaxOccurrences())) { + return false; + } + if (minOccurrences == null) { + if (other.getMinOccurrences() != null) { + return false; + } + } + else if (!minOccurrences.equals(other.getMinOccurrences())) { + return false; + } + if (name == null) { + if (other.getName() != null) { + return false; + } + } + else if (!name.equals(other.getName())) { + return false; + } + if (ownerId == null) { + if (other.getOwnerId() != null) { + return false; + } + } + else if (!ownerId.equals(other.getOwnerId())) { + return false; + } + if (ownerName == null) { + if (other.getOwnerName() != null) { + return false; + } + } + else if (!ownerName.equals(other.getOwnerName())) { + return false; + } + if (type == null) { + if (other.getType() != null) { + return false; + } + } + else if (!type.equals(other.getType())) { + return false; + } + if (uniqueId == null) { + if (other.getUniqueId() != null) { + return false; + } + } + else if (!uniqueId.equals(other.getUniqueId())) { + return false; + } + if (validSourceTypes == null) { + if (other.getValidSourceTypes() != null) { + return false; + } + } + else if (!validSourceTypes.equals(other.getValidSourceTypes())) { + return false; + } + if (leftOccurrences == null) { + if (other.getLeftOccurrences() != null) { + return false; + } + } + else if (!leftOccurrences.equals(other.getLeftOccurrences())) { + return false; + } + if (path == null) { + if (other.getPath() != null) { + return false; + } + } + else if (!path.equals(other.getPath())) { + return false; + } + if (source == null) { + if (other.getSource() != null) { + return false; + } + } + else if (!source.equals(other.getSource())) { + return false; + } + return true; + } + + @Override + public String toString() { + String uniqueId = this.getUniqueId(); + String description = this.getDescription(); + String name = this.getName(); + String type = this.getType(); + List<String> validSourceTypes = this.getValidSourceTypes(); + List<String> capabilitySources = this.getCapabilitySources(); + List<String> path = this.getPath(); + String ownerId = this.getOwnerId(); + String ownerName = this.getOwnerName(); + String minOccurrences = this.getMinOccurrences(); + String maxOccurrences = this.getMaxOccurrences(); + String source = this.getSource(); + + + return "CapabilityDefinition [uniqueId=" + uniqueId + ", description=" + description + ", name=" + name + + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" + + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName + + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path + ", source=" + 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<>(); + + public enum OwnerType{ + GROUP("group"), + COMPONENT_INSTANCE("component instance"), + RESOURCE("resource"); + + private String value; + + private OwnerType(String value) { + this.value = value; } - if(!path.contains(elementInPath)){ - path.add(elementInPath); + + public String getValue() { + return value; } - setPath(path); - } - - - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - - String uniqueId = this.getUniqueId(); - String description = this.getDescription(); - String name = this.getName(); - String type = this.getType(); - List<String> validSourceTypes = this.getValidSourceTypes(); - List<String> capabilitySources = this.getCapabilitySources(); - List<String> path = this.getPath(); - - String ownerId = this.getOwnerId(); - String ownerName = this.getOwnerName(); - String minOccurrences = this.getMinOccurrences(); - String maxOccurrences = this.getMaxOccurrences(); - String leftOccurrences = getLeftOccurrences(); - String source = getSource(); - - result = prime * result + ((capabilitySources == null) ? 0 : capabilitySources.hashCode()); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((maxOccurrences == null) ? 0 : maxOccurrences.hashCode()); - result = prime * result + ((minOccurrences == null) ? 0 : minOccurrences.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); - result = prime * result + ((ownerName == null) ? 0 : ownerName.hashCode()); - - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((validSourceTypes == null) ? 0 : validSourceTypes.hashCode()); - result = prime * result + ((leftOccurrences == null) ? 0 : leftOccurrences.hashCode()); - result = prime * result + ((path == null) ? 0 : path.hashCode()); - result = prime * result + ((source == null) ? 0 : source.hashCode()); - return result; - } - @Override - public boolean equals(Object obj) { - - String uniqueId = this.getUniqueId(); - String description = this.getDescription(); - String name = this.getName(); - String type = this.getType(); - List<String> validSourceTypes = this.getValidSourceTypes(); - List<String> capabilitySources = this.getCapabilitySources(); - String ownerId = this.getOwnerId(); - String ownerName = this.getOwnerName(); - String minOccurrences = this.getMinOccurrences(); - String maxOccurrences = this.getMaxOccurrences(); - String leftOccurrences = getLeftOccurrences(); - List<String> path = this.getPath(); - String source = getSource(); - - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CapabilityDataDefinition other = (CapabilityDataDefinition) obj; - if (capabilitySources == null) { - if (other.getCapabilitySources() != null) - return false; - } else if (!capabilitySources.equals(other.getCapabilitySources())) - return false; - if (description == null) { - if (other.getDescription() != null) - return false; - } else if (!description.equals(other.getDescription())) - return false; - if (maxOccurrences == null) { - if (other.getMaxOccurrences() != null) - return false; - } else if (!maxOccurrences.equals(other.getMaxOccurrences())) - return false; - if (minOccurrences == null) { - if (other.getMinOccurrences() != null) - return false; - } else if (!minOccurrences.equals(other.getMinOccurrences())) - return false; - if (name == null) { - if (other.getName() != null) - return false; - } else if (!name.equals(other.getName())) - return false; - if (ownerId == null) { - if (other.getOwnerId() != null) - return false; - } else if (!ownerId.equals(other.getOwnerId())) - return false; - if (ownerName == null) { - if (other.getOwnerName() != null) - return false; - } else if (!ownerName.equals(other.getOwnerName())) - return false; - if (type == null) { - if (other.getType() != null) - return false; - } else if (!type.equals(other.getType())) - return false; - if (uniqueId == null) { - if (other.getUniqueId() != null) - return false; - } else if (!uniqueId.equals(other.getUniqueId())) - return false; - if (validSourceTypes == null) { - if (other.getValidSourceTypes() != null) - return false; - } else if (!validSourceTypes.equals(other.getValidSourceTypes())) - return false; - if (leftOccurrences == null) { - if (other.getLeftOccurrences() != null) - return false; - } else if (!leftOccurrences.equals(other.getLeftOccurrences())) - return false; - if (path == null) { - if (other.getPath() != null) - return false; - } else if (!path.equals(other.getPath())) - return false; - if (source == null) { - if (other.getSource() != null) - return false; - } else if (!source.equals(other.getSource())) - return false; - return true; - } + public static OwnerType getByValue(String value){ + for(OwnerType type : values()) + if(type.getValue().equals(value)) + return type; + return null; + } - @Override - public String toString() { - String uniqueId = this.getUniqueId(); - String description = this.getDescription(); - String name = this.getName(); - String type = this.getType(); - List<String> validSourceTypes = this.getValidSourceTypes(); - List<String> capabilitySources = this.getCapabilitySources(); - List<String> path = this.getPath(); - String ownerId = this.getOwnerId(); - String ownerName = this.getOwnerName(); - String minOccurrences = this.getMinOccurrences(); - String maxOccurrences = this.getMaxOccurrences(); - String source = this.getSource(); - - - return "CapabilityDefinition [uniqueId=" + uniqueId + ", description=" + description + ", name=" + name - + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" - + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName - + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path+ ", source=" + source + "]"; - } + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java index cecb4f1bf9..ac3e5d2fab 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java @@ -23,22 +23,11 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.List; -public class CapabilityTypeDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 3242123405337612089L; - - - - // private String derivedFrom; +public class CapabilityTypeDataDefinition extends ToscaDataDefinition { public CapabilityTypeDataDefinition(CapabilityTypeDataDefinition cdt) { - super(); this.setUniqueId(cdt.getUniqueId()); this.setDescription ( cdt.getDescription()); this.setType(cdt.getType()); @@ -46,7 +35,6 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition implements this.setVersion( cdt.getVersion()); this.setCreationTime (cdt.getCreationTime()); this.setModificationTime (cdt.getModificationTime()); - } public CapabilityTypeDataDefinition() { 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 384796b965..4a4a7a4b75 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,18 +25,9 @@ import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.common.util.ValidationUtils; -import java.io.Serializable; - -public class ComponentInstanceDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - - private static final long serialVersionUID = 7215033872921497743L; +public class ComponentInstanceDataDefinition extends ToscaDataDefinition { public ComponentInstanceDataDefinition() { - super(); setPropertyValueCounter(1); setAttributeValueCounter(1); setInputValueCounter(1); @@ -66,6 +57,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme setSourceModelUuid(dataDefinition.getSourceModelUuid()); setSourceModelUid(dataDefinition.getSourceModelUid()); setIsProxy(dataDefinition.getIsProxy()); + setOriginArchived(dataDefinition.isOriginArchived()); } public String getIcon() { @@ -273,6 +265,19 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme return ( isProxy != null ) ? isProxy : false; } + public void setOriginArchived(Boolean originArchived) { + if (originArchived == null) { + setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, false); + } else { + setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, originArchived); + } + } + + public Boolean isOriginArchived() { + Boolean originArchived = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED); + return ( originArchived != null ) ? originArchived : false; + } + @Override public String toString() { return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java index 923c47de58..358f8ef614 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java @@ -22,14 +22,7 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; - -public class DataTypeDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1751768352205892172L; +public class DataTypeDataDefinition extends ToscaDataDefinition { private String name; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java index bf63e20d38..aa36fc96b2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java @@ -1,18 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.DESCRIPTION; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_DESTINATION_PORT_NUMBER; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_ELEMENT_LIST; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_NAME; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_PROTOCOL; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.UNIQUE_ID; - import com.fasterxml.jackson.annotation.JsonCreator; -import java.io.Serializable; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -public class ForwardingPathDataDefinition extends ToscaDataDefinition implements Serializable { +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.*; + +public class ForwardingPathDataDefinition extends ToscaDataDefinition { @JsonCreator public ForwardingPathDataDefinition() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java index 3bbe9cae70..50e9c40ef9 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java @@ -5,10 +5,9 @@ import com.google.common.base.MoreObjects; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.Objects; -public class ForwardingPathElementDataDefinition extends ToscaDataDefinition implements Serializable { +public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { @JsonCreator public ForwardingPathElementDataDefinition() { super(); @@ -22,7 +21,6 @@ public class ForwardingPathElementDataDefinition extends ToscaDataDefinition imp setToCP(toCPName); setFromCPOriginId(fromCPOriginId); setToCPOriginId(toCPOriginId); - } public ForwardingPathElementDataDefinition(ForwardingPathElementDataDefinition pathElement) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java index 131d41a06a..5ce336c805 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java @@ -22,21 +22,17 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.Map; -public class GetInputValueDataDefinition extends ToscaDataDefinition implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 5466910697527037975L; +public class GetInputValueDataDefinition extends ToscaDataDefinition { + private String propName; private String inputName; private String inputId; private Integer indexValue; private GetInputValueDataDefinition getInputIndex; - boolean isList = false; + private boolean isList = false; public GetInputValueDataDefinition(){ super(); @@ -44,13 +40,9 @@ public class GetInputValueDataDefinition extends ToscaDataDefinition implements public GetInputValueDataDefinition(Map<String, Object> pr) { super(pr); - } public GetInputValueDataDefinition(GetInputValueDataDefinition p) { - - - super(); this.setPropName(p.getPropName()); this.setInputName( p.getInputName()); this.setInputId( p.getInputId()); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java index c46e21166c..1e03372b32 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,176 +20,210 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyMap; -public class GroupDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1565606165279109427L; - - private String typeUid; - - private Integer propertyValueCounter = 0; - - public GroupDataDefinition() { - super(); - - } - - public GroupDataDefinition(Map<String, Object> gr) { - super(gr); - propertyValueCounter = 0; - } - - public GroupDataDefinition(GroupDataDefinition other) { - this.setName(other.getName()); - this.setUniqueId(other.getUniqueId()); - this.setType(other.getType()); - this.setVersion(other.getVersion()); - this.setInvariantUUID(other.getInvariantUUID()); - this.setDescription(other.getDescription()); - this.propertyValueCounter = other.propertyValueCounter; - this.setGroupUUID(other.getGroupUUID()); - - if (other.getMembers() != null) { - this.setMembers(new HashMap<String, String>(other.getMembers())); - } - if (other.getArtifacts() != null) { - this.setArtifacts(new ArrayList<String>(other.getArtifacts())); - } - - if (other.getArtifactsUuid() != null) { - this.setArtifactsUuid( new ArrayList<String>(other.getArtifactsUuid())); - } - this.setTypeUid(other.typeUid); - this.setProperties(other.getProperties()); - } - - - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - - public void setName(String name) { - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public String getType() { - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); - } - - public void setType(String type) { - setToscaPresentationValue(JsonPresentationFields.TYPE, type); - } - - public String getVersion() { - return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); - } - - public void setVersion(String version) { - setToscaPresentationValue(JsonPresentationFields.VERSION, version); - } - - public String getInvariantUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); - } - - public void setInvariantUUID(String invariantUUID) { - setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); - } - - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } - - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } - - public Integer getPropertyValueCounter() { - return propertyValueCounter; - } - - public void setPropertyValueCounter(Integer propertyValueCounter) { - this.propertyValueCounter = propertyValueCounter; - } - - public String getGroupUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID); - } - - public void setGroupUUID(String groupUUID) { - setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, groupUUID); - } - - public Map<String, String> getMembers() { - return (Map<String, String>) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER); - } - - public void setMembers(Map<String, String> members) { - setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); - } - - public List<String> getArtifacts() { - return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS); - } - - public void setArtifacts(List<String> artifacts) { - setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS, artifacts); - } - - public List<String> getArtifactsUuid() { - return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID); - } - - public void setArtifactsUuid(List<String> artifactsUuid) { - setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID, artifactsUuid); - } - - public List<PropertyDataDefinition> getProperties() { - return (List<PropertyDataDefinition> ) getToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES); - } - - public void setProperties(List<PropertyDataDefinition> properties) { - setToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES, properties); - } - - public String getTypeUid() { - return typeUid; - } - - public void setTypeUid(String typeUid) { - this.typeUid = typeUid; - } - - @Override - public String toString() { - return "GroupDataDefinition [propertyValueCounter=" + propertyValueCounter + ", toscaPresentation=" + toscaPresentation + ", getName()=" + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()=" - + getVersion() + ", getInvariantUUID()=" + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()=" + getPropertyValueCounter() + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()=" - + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()=" + getArtifactsUuid() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" - + super.toString() + "]"; - } - - - public boolean containsInstanceAsMember(String instanceId) { - return getMembers() != null && getMembers().values().contains(instanceId); - } + +public class GroupDataDefinition extends ToscaDataDefinition { + + private String typeUid; + + private Integer propertyValueCounter = 0; + + public GroupDataDefinition() { + } + + public GroupDataDefinition(Map<String, Object> gr) { + super(gr); + propertyValueCounter = 0; + } + + public GroupDataDefinition(GroupDataDefinition other) { + this.setName(other.getName()); + this.setUniqueId(other.getUniqueId()); + this.setType(other.getType()); + this.setVersion(other.getVersion()); + this.setInvariantUUID(other.getInvariantUUID()); + this.setDescription(other.getDescription()); + this.propertyValueCounter = other.propertyValueCounter; + this.setGroupUUID(other.getGroupUUID()); + this.setInvariantName(other.getInvariantName()); + this.setCreatedFrom(other.getCreatedFrom()); + + if (other.getMembers() != null) { + this.setMembers(new HashMap<>(other.getMembers())); + } + if (other.getArtifacts() != null) { + this.setArtifacts(new ArrayList<>(other.getArtifacts())); + } + + if (other.getArtifactsUuid() != null) { + this.setArtifactsUuid(new ArrayList<>(other.getArtifactsUuid())); + } + if (other.getProperties() != null) { + this.setProperties(new ArrayList<>(other.getProperties())); + } + this.setTypeUid(other.typeUid); + } + + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getInvariantName() { + String invariantName = (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); + return invariantName == null ? getName() : invariantName; + } + + public void setInvariantName(String invariantName) { + setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName); + } + + public CreatedFrom getCreatedFrom() { + String createdFrom = (String) getToscaPresentationValue(JsonPresentationFields.CREATED_FROM); + return createdFrom == null ? CreatedFrom.CSAR : CreatedFrom.valueOf(createdFrom); + } + + public void setCreatedFrom(CreatedFrom createdFrom) { + setToscaPresentationValue(JsonPresentationFields.CREATED_FROM, createdFrom.name()); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setVersion(String version) { + setToscaPresentationValue(JsonPresentationFields.VERSION, version); + } + + public String getInvariantUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); + } + + public void setInvariantUUID(String invariantUUID) { + setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public Integer getPropertyValueCounter() { + return propertyValueCounter; + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + this.propertyValueCounter = propertyValueCounter; + } + + public String getGroupUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID); + } + + public void setGroupUUID(String groupUUID) { + setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, groupUUID); + } + + public Map<String, String> getMembers() { + return (Map<String, String>) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER); + } + //this is used by GroupCompositionMixin + public Map<String, String> resolveMembersList() { + Map<String, String> members = getMembers(); + if (members != null) { + return members; + } + return emptyMap(); + + } + + public void setMembers(Map<String, String> members) { + setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); + } + + public List<String> getArtifacts() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS); + } + + public void setArtifacts(List<String> artifacts) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS, artifacts); + } + + public List<String> getArtifactsUuid() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID); + } + + public void setArtifactsUuid(List<String> artifactsUuid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID, artifactsUuid); + } + + public List<PropertyDataDefinition> getProperties() { + return (List<PropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES); + } + + public void setProperties(List<PropertyDataDefinition> properties) { + setToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES, properties); + } + + public String getTypeUid() { + return typeUid; + } + + public void setTypeUid(String typeUid) { + this.typeUid = typeUid; + } + + public boolean isUserDefined() { + return CreatedFrom.UI.equals(getCreatedFrom()); + } + + public boolean isVspOriginated() { + return CreatedFrom.CSAR.equals(getCreatedFrom()); + } + + @Override + public String toString() { + return "GroupDataDefinition [propertyValueCounter=" + propertyValueCounter + ", toscaPresentation=" + toscaPresentation + ", getName()=" + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()=" + + getVersion() + ", getInvariantUUID()=" + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()=" + getPropertyValueCounter() + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()=" + + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()=" + getArtifactsUuid() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + + super.toString() + "]"; + } + + + public boolean containsInstanceAsMember(String instanceId) { + return getMembers() != null && getMembers().values().contains(instanceId); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java index 04cac38e47..69cca1e7be 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java @@ -23,15 +23,12 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; -public class GroupInstanceDataDefinition extends ToscaDataDefinition implements Serializable { - - private static final long serialVersionUID = -4231181556686542208L; - +public class GroupInstanceDataDefinition extends ToscaDataDefinition { + public GroupInstanceDataDefinition() { super(); } @@ -239,8 +236,4 @@ public class GroupInstanceDataDefinition extends ToscaDataDefinition implements public void setProperties(List<PropertyDataDefinition> properties) { setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_PROPERTIES, properties); } - - public static long getSerialversionuid() { - return serialVersionUID; - } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java index 18e594e0ce..a3bb8d4183 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java @@ -20,32 +20,18 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - -import java.io.Serializable; import java.util.List; import java.util.Map; -public class GroupTypeDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -7001817818907172496L; +public class GroupTypeDataDefinition extends ToscaTypeDataDefinition { private String uniqueId; - - private String type; - private String version; - private String derivedFrom; - private List<String> members; - private Map<String, String> metadata; - private String description; + private boolean highestVersion; /** * Timestamp of data type creation @@ -57,30 +43,20 @@ public class GroupTypeDataDefinition extends ToscaDataDefinition implements Seri */ private Long modificationTime; - private boolean highestVersion; - public GroupTypeDataDefinition() { - - } - - public GroupTypeDataDefinition(GroupTypeDataDefinition p) { - this.uniqueId = p.uniqueId; - this.type = p.type; - this.version = p.version; - this.members = p.members; - this.metadata = p.metadata; - // this.derivedFromName = p.derivedFromName; - this.description = p.description; - this.creationTime = p.creationTime; - this.modificationTime = p.modificationTime; - } - - public String getType() { - return type; } - public void setType(String type) { - this.type = type; + public GroupTypeDataDefinition(GroupTypeDataDefinition other) { + super(other); + this.uniqueId = other.uniqueId; + this.version = other.version; + this.members = other.members; + this.metadata = other.metadata; + this.description = other.description; + this.creationTime = other.creationTime; + this.modificationTime = other.modificationTime; + this.highestVersion = other.highestVersion; + this.derivedFrom = other.derivedFrom; } public String getVersion() { @@ -141,7 +117,7 @@ public class GroupTypeDataDefinition extends ToscaDataDefinition implements Seri @Override public String toString() { - return "GroupTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", version=" + version + return "GroupTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version=" + version + ", members=" + members + ", metadata=" + metadata + ", description=" + description + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java index a2440610ae..4b5ed0c140 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java @@ -22,14 +22,7 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; - -public class HeatParameterDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 8995421762148502848L; +public class HeatParameterDataDefinition extends ToscaDataDefinition { String uniqueId; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java index 3406d85c82..c093d171a2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java @@ -22,12 +22,8 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; -public class InputDataDefinition extends PropertyDataDefinition{ +public class InputDataDefinition extends PropertyDataDefinition { - /** - * - */ - private static final long serialVersionUID = 8913646848974511031L; String label; Boolean hidden; Boolean immutable; @@ -38,21 +34,16 @@ public class InputDataDefinition extends PropertyDataDefinition{ public InputDataDefinition(Map<String, Object> pr) { super(pr); - } public InputDataDefinition(InputDataDefinition p) { - super(p); this.setLabel(p.getLabel()); this.setHidden( p.isHidden()); this.setImmutable( p.isImmutable()); - - } public InputDataDefinition(PropertyDataDefinition p) { - super(p); } @@ -79,5 +70,4 @@ public class InputDataDefinition extends PropertyDataDefinition{ public void setLabel(String label) { this.label = label; } - -} +}
\ No newline at end of file diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java index 56f7103f8b..c0505c2b3d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java @@ -20,14 +20,15 @@ package org.openecomp.sdc.be.datatypes.elements; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; - import com.fasterxml.jackson.annotation.JsonCreator; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + import java.io.Serializable; import java.util.HashMap; import java.util.Map; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; public class InterfaceDataDefinition extends ToscaDataDefinition implements Serializable { @@ -94,7 +95,7 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri public Map<String, OperationDataDefinition> getOperations() { return (Map<String, OperationDataDefinition>) - getToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION); + getToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION); } public void setOperations(Map<String, OperationDataDefinition> operations) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java index 0283f4ca46..4607364f53 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java @@ -17,18 +17,12 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonCreator; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.ARTIFACT_UUID; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.DESCRIPTION; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.UNIQUE_ID; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_INPUT_PARAMETERS; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_OPERATION_TYPE; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_OUTPUT_PARAMETERS; +import java.io.Serializable; + +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.*; public class InterfaceOperationDataDefinition extends ToscaDataDefinition implements Serializable { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java index 09dc2a0597..0044ffaf60 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java @@ -16,11 +16,11 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonCreator; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.io.Serializable; + import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_PARAM_ID; import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_PARAM_NAME; 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 ab886fa41f..073635a9f5 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 @@ -24,32 +24,24 @@ import com.fasterxml.jackson.annotation.JsonCreator; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; -public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition implements Serializable { +public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition { protected List<T> listToscaDataDefinition; public ListDataDefinition(ListDataDefinition<T> cdt) { - super(); listToscaDataDefinition = cdt.listToscaDataDefinition; } public ListDataDefinition(List<T> listToscaDataDefinition) { - super(); this.listToscaDataDefinition = listToscaDataDefinition; } @JsonCreator public ListDataDefinition() { - super(); this.listToscaDataDefinition = new ArrayList<>(); } @@ -59,7 +51,7 @@ public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaData public void add(T value) { if (listToscaDataDefinition == null) { - listToscaDataDefinition = new ArrayList<T>(); + listToscaDataDefinition = new ArrayList<>(); } listToscaDataDefinition.add(value); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyProperty.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java index 5f22e6b401..39588524bf 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyProperty.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java @@ -26,12 +26,12 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Map; -public class MapCapabiltyProperty extends MapDataDefinition<MapPropertiesDataDefinition> { +public class MapCapabilityProperty extends MapDataDefinition<MapPropertiesDataDefinition> { @JsonCreator - public MapCapabiltyProperty(Map<String, MapPropertiesDataDefinition > mapToscaDataDefinition) { + public MapCapabilityProperty(Map<String, MapPropertiesDataDefinition > mapToscaDataDefinition) { super(mapToscaDataDefinition); } - public MapCapabiltyProperty() { + public MapCapabilityProperty() { super(); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java index 0900f44cea..0bdb913035 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java @@ -3,7 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.*; /** @@ -13,13 +12,14 @@ import java.util.*; * "workflows" -> { "ref1", "ref2" } * */ -public class MapComponentInstanceExternalRefs extends ToscaDataDefinition implements Serializable { +public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { - private static final long serialVersionUID = 7788408255736272985L; - - //Constructor public MapComponentInstanceExternalRefs() { - this.setComponentInstanceExternalRefs(new HashMap<String, List<String>>()); + setComponentInstanceExternalRefs(new HashMap<>()); + } + + public MapComponentInstanceExternalRefs(Map<String, List<String>> instanceExternalReferences) { + setComponentInstanceExternalRefs(instanceExternalReferences); } public Map<String, List<String>> getComponentInstanceExternalRefs() { @@ -27,8 +27,7 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition implem } public List<String> getExternalRefsByObjectType(String objectType) { - List<String> externalRefsByObjectType = ((Map<String, List<String>>) getToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF)).get(objectType); - return externalRefsByObjectType; + return ((Map<String, List<String>>) getToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF)).get(objectType); } public void setComponentInstanceExternalRefs(Map<String, List<String>> componentInstanceExternalRefs) { @@ -47,7 +46,7 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition implem if (refList == null) { //Create list if does not exist and add it to map - refList = new ArrayList<String>(); + refList = new ArrayList<>(); this.getComponentInstanceExternalRefs().put(objectType, refList); } 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 66b51ed805..0d619ce1b4 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 @@ -20,8 +20,6 @@ package org.openecomp.sdc.be.datatypes.elements; - - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @@ -56,7 +54,7 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa public void put(String key, T value){ if(mapToscaDataDefinition == null){ - mapToscaDataDefinition = new HashMap<String, T>(); + mapToscaDataDefinition = new HashMap<>(); } mapToscaDataDefinition.put(key, value); } @@ -102,7 +100,6 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa MapDataDefinition collectMap = new MapDataDefinition<>(collect); mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId())); - return (T) collectMap; } return (T) new MapDataDefinition(new HashMap<>()); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java index f56b59934a..9f2e13ee78 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java @@ -29,19 +29,19 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -public class MapListCapabiltyDataDefinition extends MapDataDefinition<ListCapabilityDataDefinition> { +public class MapListCapabilityDataDefinition extends MapDataDefinition<ListCapabilityDataDefinition> { - public MapListCapabiltyDataDefinition(MapListCapabiltyDataDefinition cdt) { + public MapListCapabilityDataDefinition(MapListCapabilityDataDefinition cdt) { super(cdt); } @JsonCreator - public MapListCapabiltyDataDefinition(Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition) { + public MapListCapabilityDataDefinition(Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition) { super(mapToscaDataDefinition); } - public MapListCapabiltyDataDefinition() { + public MapListCapabilityDataDefinition() { super(); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java index dc99b7c320..5363cbbb2a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java @@ -21,10 +21,11 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; -import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.io.Serializable; + public class OperationDataDefinition extends ToscaDataDefinition implements Serializable { @@ -91,7 +92,7 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri public ListDataDefinition<OperationInputDefinition> getInputs() { return (ListDataDefinition<OperationInputDefinition>) - getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT); + getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT); } public void setInputs(ListDataDefinition<OperationInputDefinition> inputs) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java index fd34428855..1e0d5935da 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java @@ -3,14 +3,15 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; + /** * public class representing the component policy, * described by the next properties: - * + * <p> * name * uniqueId * type (policy type name) @@ -26,179 +27,184 @@ import java.util.Map; * targets * isFromCsar */ -public class PolicyDataDefinition extends ToscaDataDefinition implements Serializable{ - - /** - * - */ - private static final long serialVersionUID = -4705371580363581255L; - - /** - * public constructor by default - */ - public PolicyDataDefinition() { - super(); - } - - /** - * public constructor from superclass - * @param policy - */ - public PolicyDataDefinition(Map<String, Object> policy) { - super(policy); - } - - /** - * public copy constructor - * @param other - */ - public PolicyDataDefinition(PolicyDataDefinition other){ - this.setName(other.getName()); - this.setUniqueId(other.getUniqueId()); - this.setPolicyTypeName(other.getPolicyTypeName()); - this.setPolicyTypeUid(other.getPolicyTypeUid()); - this.setVersion(other.getVersion()); - this.setDerivedFrom(other.getDerivedFrom()); - this.setDescription(other.getDescription()); - this.setPolicyUUID(other.getPolicyUUID()); - this.setInvariantUUID(other.getInvariantUUID()); - this.setInvariantName(other.getInvariantName()); - this.setComponentName(other.getComponentName()); - this.setIsFromCsar(other.getIsFromCsar()); - if (other.getProperties() != null) { - this.setProperties(other.getProperties()); - } - if (other.getTargets() != null) { - this.setTargets(other.getTargets()); - } - } - - private void setIsFromCsar(Boolean isFromCsar) { - if(isFromCsar == null){ - setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, false); - } else { - setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, isFromCsar); - } - } - - public Boolean getIsFromCsar() { - Boolean isFromCsar = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR); - return ( isFromCsar != null ) ? isFromCsar : false; - } - - public String getComponentName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME); - } - - public void setComponentName(String componentName) { - setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME, componentName); - } - - public String getInvariantName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); - } - - public void setInvariantName(Object invariantName) { - setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName); - } - - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - - public void setName(String name) { - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public String getPolicyTypeName() { - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); - } - - public void setPolicyTypeName(String policyTypeName) { - setToscaPresentationValue(JsonPresentationFields.TYPE, policyTypeName); - } - - public String getPolicyTypeUid() { - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE_UNIQUE_ID); - } - - public void setPolicyTypeUid(String policyTypeUid) { - setToscaPresentationValue(JsonPresentationFields.TYPE_UNIQUE_ID, policyTypeUid); - } - - public String getVersion() { - return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); - } - - public void setVersion(String version) { - setToscaPresentationValue(JsonPresentationFields.VERSION, version); - } - - public String getDerivedFrom() { - return (String) getToscaPresentationValue(JsonPresentationFields.DERIVED_FROM); - } - - public void setDerivedFrom(String derivedFrom) { - setToscaPresentationValue(JsonPresentationFields.DERIVED_FROM, derivedFrom); - } - - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } - - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } - - public String getPolicyUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.UUID); - } - - public void setPolicyUUID(String policyUUID) { - setToscaPresentationValue(JsonPresentationFields.UUID, policyUUID); - } - public String getInvariantUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); - } - - public void setInvariantUUID(String invariantUUID) { - setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); - } - - @SuppressWarnings("unchecked") - public List<PropertyDataDefinition> getProperties() { - return (List<PropertyDataDefinition> ) getToscaPresentationValue(JsonPresentationFields.PROPERTIES); - } - - public void setProperties(List<PropertyDataDefinition> properties) { - setToscaPresentationValue(JsonPresentationFields.PROPERTIES, properties); - } - - @SuppressWarnings("unchecked") - public Map<PolicyTargetType, List<String>> getTargets() { - return (Map<PolicyTargetType, List<String>>) getToscaPresentationValue(JsonPresentationFields.TARGETS); - } - - public void setTargets(Map<PolicyTargetType, List<String>> metadata) { - setToscaPresentationValue(JsonPresentationFields.TARGETS, metadata); - } - - public List<String> resolveComponentInstanceTargets() { - Map<PolicyTargetType, List<String>> targets = getTargets(); - return targets == null ? null: targets.get(PolicyTargetType.COMPONENT_INSTANCES); - } - - public boolean containsCmptInstanceAsTarget(String cmptInstId) { - List<String> componentInstanceTargets = resolveComponentInstanceTargets(); - return componentInstanceTargets != null && componentInstanceTargets.contains(cmptInstId); - } - +public class PolicyDataDefinition extends ToscaDataDefinition { + + /** + * public constructor by default + */ + public PolicyDataDefinition() { + super(); + } + + /** + * public constructor from superclass + * + * @param policy + */ + public PolicyDataDefinition(Map<String, Object> policy) { + super(policy); + } + + /** + * public copy constructor + * + * @param other + */ + public PolicyDataDefinition(PolicyDataDefinition other) { + this.setName(other.getName()); + this.setUniqueId(other.getUniqueId()); + this.setPolicyTypeName(other.getPolicyTypeName()); + this.setPolicyTypeUid(other.getPolicyTypeUid()); + this.setVersion(other.getVersion()); + this.setDerivedFrom(other.getDerivedFrom()); + this.setDescription(other.getDescription()); + this.setPolicyUUID(other.getPolicyUUID()); + this.setInvariantUUID(other.getInvariantUUID()); + this.setInvariantName(other.getInvariantName()); + this.setComponentName(other.getComponentName()); + this.setIsFromCsar(other.getIsFromCsar()); + if (other.getProperties() != null) { + this.setProperties(other.getProperties()); + } + if (other.getTargets() != null) { + this.setTargets(other.getTargets()); + } + } + + private void setIsFromCsar(Boolean isFromCsar) { + if (isFromCsar == null) { + setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, false); + } else { + setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, isFromCsar); + } + } + + public Boolean getIsFromCsar() { + Boolean isFromCsar = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR); + return (isFromCsar != null) ? isFromCsar : false; + } + + public String getComponentName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME); + } + + public void setComponentName(String componentName) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME, componentName); + } + + public String getInvariantName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); + } + + public void setInvariantName(Object invariantName) { + setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getPolicyTypeName() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setPolicyTypeName(String policyTypeName) { + setToscaPresentationValue(JsonPresentationFields.TYPE, policyTypeName); + } + + public String getPolicyTypeUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE_UNIQUE_ID); + } + + public void setPolicyTypeUid(String policyTypeUid) { + setToscaPresentationValue(JsonPresentationFields.TYPE_UNIQUE_ID, policyTypeUid); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setVersion(String version) { + setToscaPresentationValue(JsonPresentationFields.VERSION, version); + } + + public String getDerivedFrom() { + return (String) getToscaPresentationValue(JsonPresentationFields.DERIVED_FROM); + } + + public void setDerivedFrom(String derivedFrom) { + setToscaPresentationValue(JsonPresentationFields.DERIVED_FROM, derivedFrom); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public String getPolicyUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.UUID); + } + + public void setPolicyUUID(String policyUUID) { + setToscaPresentationValue(JsonPresentationFields.UUID, policyUUID); + } + + public String getInvariantUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); + } + + public void setInvariantUUID(String invariantUUID) { + setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); + } + + @SuppressWarnings("unchecked") + public List<PropertyDataDefinition> getProperties() { + return (List<PropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES); + } + + public void setProperties(List<PropertyDataDefinition> properties) { + setToscaPresentationValue(JsonPresentationFields.PROPERTIES, properties); + } + + @SuppressWarnings("unchecked") + public Map<PolicyTargetType, List<String>> getTargets() { + return (Map<PolicyTargetType, List<String>>) getToscaPresentationValue(JsonPresentationFields.TARGETS); + } + + public void setTargets(Map<PolicyTargetType, List<String>> metadata) { + setToscaPresentationValue(JsonPresentationFields.TARGETS, metadata); + } + + public List<String> resolveComponentInstanceTargets() { + return resolveTargetsByType(PolicyTargetType.COMPONENT_INSTANCES); + } + + public List<String> resolveGroupTargets() { + return resolveTargetsByType(PolicyTargetType.GROUPS); + } + + public boolean containsTarget(String targetId, PolicyTargetType policyTargetType) { + return resolveTargetsByType(policyTargetType).contains(targetId); + } + + private List<String> resolveTargetsByType(PolicyTargetType targetType) { + Map<PolicyTargetType, List<String>> targets = getTargets(); + return targets == null || !targets.containsKey(targetType) ? emptyList() : targets.get(targetType); + } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java index 38cb4da1ca..b5c21e5e6d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java @@ -20,31 +20,16 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - -import java.io.Serializable; import java.util.List; import java.util.Map; -public class PolicyTypeDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3783390539788578388L; +public class PolicyTypeDataDefinition extends ToscaTypeDataDefinition { private String uniqueId; - - private String type; - private String version; - private String derivedFrom; - private List<String> targets; - private Map<String, String> metadata; - private String description; /** @@ -56,16 +41,14 @@ public class PolicyTypeDataDefinition extends ToscaDataDefinition implements Ser * Timestamp of the data type last update */ private Long modificationTime; - private boolean highestVersion; public PolicyTypeDataDefinition() { - } public PolicyTypeDataDefinition(PolicyTypeDataDefinition p) { + super(p); this.uniqueId = p.uniqueId; - this.type = p.type; this.version = p.version; this.targets = p.targets; this.metadata = p.metadata; @@ -76,14 +59,6 @@ public class PolicyTypeDataDefinition extends ToscaDataDefinition implements Ser this.highestVersion = p.highestVersion; } - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - public String getVersion() { return version; } @@ -142,7 +117,7 @@ public class PolicyTypeDataDefinition extends ToscaDataDefinition implements Ser @Override public String toString() { - return "PolicyTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", version=" + version + return "PolicyTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version=" + version + ", targets=" + targets + ", metadata=" + metadata + ", description=" + description + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; } @@ -162,5 +137,4 @@ public class PolicyTypeDataDefinition extends ToscaDataDefinition implements Ser public void setHighestVersion(boolean isLatestVersion) { this.highestVersion = isLatestVersion; } - -} +}
\ No newline at end of file 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 62ae62edab..cb9316d6be 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 @@ -22,16 +22,10 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; -public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -1877577227290771160L; +public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition { private String fullName; 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 482933e399..c4a78433f5 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 @@ -23,16 +23,11 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; -import java.util.List; -import java.util.Map; +import java.util.*; -public class PropertyDataDefinition extends ToscaDataDefinition implements Serializable { +import static org.apache.commons.collections.CollectionUtils.isNotEmpty; - /** - * - */ - private static final long serialVersionUID = 5798685557528432389L; +public class PropertyDataDefinition extends ToscaDataDefinition { private String uniqueId; @@ -64,6 +59,8 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria private String inputId; private String instanceUniqueId; private String propertyId; + + private List<Annotation> annotations; /** * The resource id which this property belongs to */ @@ -97,12 +94,15 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria this.setImmutable(p.isImmutable()); this.setParentUniqueId(p.getParentUniqueId()); this.setOwnerId(p.getOwnerId()); - this.setGetInputValues(p.getInputValues); + this.setGetInputValues(p.getGetInputValues()); this.setInputPath(p.getInputPath()); this.setStatus(p.getStatus()); this.setInputId(p.getInputId()); this.setInstanceUniqueId(p.getInstanceUniqueId()); this.setPropertyId(p.getPropertyId()); + if(isNotEmpty(p.annotations)){ + this.setAnnotations(p.annotations); + } } public String getInputPath() { @@ -200,6 +200,14 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria } return null; } + + public PropertyDataDefinition getSchemaProperty() { + if (schema != null) { + return schema.getProperty(); + } + + return null; + } public String getLabel() { return label; @@ -298,15 +306,19 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria } public boolean typeEquals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + 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.getType() == null) { + return other.getType() == null; + } if (!this.type.equals(other.type)) { return false; } @@ -320,57 +332,78 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria @Override public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } PropertyDataDefinition other = (PropertyDataDefinition) obj; if (defaultValue == null) { - if (other.defaultValue != null) - return false; - } else if (!defaultValue.equals(other.defaultValue)) - return false; - if (definition != other.definition) - return false; + if (other.defaultValue != null) { + return false; + } + } else if (!defaultValue.equals(other.defaultValue)) { + return false; + } + if (definition != other.definition) { + return false; + } if (description == null) { - if (other.description != null) - return false; - } else if (!description.equals(other.description)) - return false; - if (password != other.password) - return false; + if (other.description != null) { + return false; + } + } else if (!description.equals(other.description)) { + return false; + } + if (password != other.password) { + return false; + } if (required == null) { - if (other.required != null) - return false; - } else if (!required.equals(other.required)) - return false; + if (other.required != null) { + return false; + } + } else if (!required.equals(other.required)) { + return false; + } if (schema == null) { - if (other.schema != null) - return false; - } else if (!schema.equals(other.schema)) - return false; + if (other.schema != null) { + return false; + } + } else if (!schema.equals(other.schema)) { + return false; + } if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; + if (other.type != null) { + return false; + } + } else if (!type.equals(other.type)) { + return false; + } if (parentUniqueId == null) { - if (other.parentUniqueId != null) - return false; - } else if (!parentUniqueId.equals(other.parentUniqueId)) - return false; + if (other.parentUniqueId != null) { + return false; + } + } else if (!parentUniqueId.equals(other.parentUniqueId)) { + return false; + } if (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; + if (other.uniqueId != null) { + return false; + } + } else if (!uniqueId.equals(other.uniqueId)) { + return false; + } if (status == null) { - if (other.status != null) - return false; - } else if (!status.equals(other.status)) - return false; + if (other.status != null) { + return false; + } + } else if (!status.equals(other.status)) { + return false; + } return true; } @@ -396,6 +429,36 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria } } + @Override + public void setToscaPresentationValue(JsonPresentationFields name, Object value) { + switch (name) { + case NAME: + setName((String)value); + break; + case UNIQUE_ID: + setUniqueId((String)value); + break; + case PASSWORD: + setPassword((Boolean)value); + break; + case TYPE: + setType((String)value); + break; + case DEFINITION: + setDefinition((Boolean)value); + break; + case VALUE: + setValue((String)value); + break; + case DEFAULT_VALUE: + setDefaultValue((String)value); + break; + default: + super.setToscaPresentationValue(name, value); + break; + } + } + 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()); } @@ -406,10 +469,8 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)) { other.setOwnerId(getOwnerId()); - if (allowDefaultValueOverride) { - if (getDefaultValue() != null && !getDefaultValue().isEmpty()) { - other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue()); - } + if (allowDefaultValueOverride && getDefaultValue() != null && !getDefaultValue().isEmpty()) { + other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue()); } return other; } @@ -417,12 +478,29 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria } public void convertPropertyDataToInstancePropertyData() { - if (null != value) - defaultValue = value; + if (null != value) { + defaultValue = value; + } } public boolean isGetInputProperty() { return this.getGetInputValues() != null && !this.getGetInputValues().isEmpty(); } + public void setAnnotations(List<Annotation> newAnnotations) { + Set<Annotation> annotationSet = isNotEmpty(newAnnotations) ? new HashSet<>(newAnnotations) : new HashSet<>(); + //We would to prioritize the new valid annotations over the old ones if the same one existed. + if(this.annotations != null){ + for(Annotation oldInputAnnotation : this.annotations) + annotationSet.add(oldInputAnnotation); + } + + this.annotations = new ArrayList<>(annotationSet); + setToscaPresentationValue(JsonPresentationFields.ANNOTATIONS, this.annotations); + } + + public List<Annotation> getAnnotations() { + return (List<Annotation>) getToscaPresentationValue(JsonPresentationFields.ANNOTATIONS); + } + } 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 d9f913e58b..ee39401391 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 @@ -23,15 +23,9 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonIgnore; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.List; -public class PropertyRule extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3357933382124599996L; +public class PropertyRule extends ToscaDataDefinition { public final static String FORCE_ALL = "FORCE_ALL"; public final static String ALL = "ALL"; @@ -114,7 +108,7 @@ public class PropertyRule extends ToscaDataDefinition implements Serializable { for (int i = 0; i < size; i++) { String item = rule.get(i); String comparedItem = comparedRule.get(i); - if (item == null || false == item.equals(comparedItem)) { + if (item == null || !item.equals(comparedItem)) { isEqual = false; break; } 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 f1fe93f6ba..72d9c36bf6 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 @@ -23,23 +23,17 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.List; -public class RelationshipInstDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1104043358598884458L; +public class RelationshipInstDataDefinition extends ToscaDataDefinition { public RelationshipInstDataDefinition(RelationshipInstDataDefinition cdt) { - super(); this.setUniqueId(cdt.getUniqueId()); this.setDescription(cdt.getDescription()); this.setType(cdt.getType()); this.setValidSourceTypes(cdt.getValidSourceTypes()); this.setVersion(cdt.getVersion()); + this.setOriginUI(cdt.isOriginUI()); this.setCreationTime(cdt.getCreationTime()); this.setModificationTime(cdt.getModificationTime()); this.setCapabilityOwnerId(cdt.getCapabilityOwnerId()); @@ -50,7 +44,6 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition implemen this.setToId(cdt.getToId()); this.setRequirement(cdt.getRequirement()); this.setCapability(cdt.getCapability()); - } public void setRequirement(String requirement) { @@ -158,6 +151,14 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition implemen public void setVersion(String version) { setToscaPresentationValue(JsonPresentationFields.VERSION, version); } + + public Boolean isOriginUI() { + return (Boolean) getToscaPresentationValue(JsonPresentationFields.ORIGIN_UI); + } + + public void setOriginUI(Boolean originUI) { + setToscaPresentationValue(JsonPresentationFields.ORIGIN_UI, originUI); + } public Long getCreationTime() { return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); @@ -183,11 +184,12 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition implemen String type = getType(); List<String> validSourceTypes = getValidSourceTypes(); String version = getVersion(); + Boolean originUI = isOriginUI(); Long creationTime = getCreationTime(); Long modificationTime = getModificationTime(); - return "RelationshipTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime + ", modificationTime=" - + modificationTime + "]"; + return "RelationshipTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes=" + validSourceTypes + + ", version=" + version + ", originUI=" + originUI + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; } } 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 42b828634d..4ede93eaa6 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 @@ -24,26 +24,21 @@ import com.google.common.collect.Lists; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * Represents the requirement of the component or component instance */ -public class RequirementDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ +public class RequirementDataDefinition extends ToscaDataDefinition { + 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); @@ -56,6 +51,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se this.setUniqueId(other.getUniqueId()); this.setName(other.getName()); this.setParentName(other.getParentName()); + this.setPreviousName(other.getPreviousName()); this.setCapability(other.getCapability()); this.setNode(other.getNode()); this.setRelationship(other.getRelationship()); @@ -98,6 +94,14 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se setToscaPresentationValue(JsonPresentationFields.PARENT_NAME, parentName); } + public String getPreviousName() { + return (String) getToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME); + } + + public void setPreviousName(String previousName) { + setToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME, previousName); + } + /** * specify the capability type */ 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 e6c1469233..57fe56412c 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 @@ -22,21 +22,14 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.io.Serializable; -import java.util.HashMap; import java.util.List; import java.util.Map; /** * Schema allows to create new types that can be used along TOSCA definitions. */ -public class SchemaDefinition extends ToscaDataDefinition implements Serializable { +public class SchemaDefinition extends ToscaDataDefinition { - /** - * - */ - private static final long serialVersionUID = 7117891081909380577L; - private String derivedFrom; private List<String> constraints; private Map<String, PropertyDataDefinition> properties; @@ -46,14 +39,10 @@ public class SchemaDefinition extends ToscaDataDefinition implements Serializabl public SchemaDefinition() { - super(); - properties = new HashMap<>(); } public SchemaDefinition(String derivedFrom, List<String> constraints, Map<String, PropertyDataDefinition> properties) { - super(); - this.setDerivedFrom(derivedFrom); this.setConstraints( constraints); this.setProperties( properties); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaTypeDataDefinition.java new file mode 100644 index 0000000000..78b047782a --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaTypeDataDefinition.java @@ -0,0 +1,43 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class ToscaTypeDataDefinition extends ToscaDataDefinition { + + private String name; + private String icon; + private String type; + + ToscaTypeDataDefinition() { + } + + ToscaTypeDataDefinition(ToscaTypeDataDefinition other) { + this.name = other.getName(); + this.icon = other.icon; + this.type = other.type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java index dfbb7a7c37..e44ed5011a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,53 +21,56 @@ package org.openecomp.sdc.be.datatypes.enums; public enum ComponentFieldsEnum { - - PROPERTIES("properties"), - INPUTS("inputs"), - USERS("users"), - GROUPS("groups"), - COMPONENT_INSTANCES("componentInstances"), - COMPONENT_INSTANCES_PROPERTIES("componentInstancesProperties"), - CAPABILITIES("capabilities"), - REQUIREMENTS("requirements"), - ALL_VERSIONS("allVersions"), - ADDITIONAL_INFORMATION("additionalInformation"), - ARTIFACTS("artifacts"), - INTERFACES("interfaces"), - DERIVED_FROM("derivedFrom"), - ATTRIBUTES("attributes"), - COMPONENT_INSTANCES_ATTRIBUTES("componentInstancesAttributes"), - COMPONENT_INSTANCE_INPUTS("componentInstancesInputs"), - COMPONENT_INSTANCE_RELATION("componentInstancesRelations"), - DEPLOYMENT_ARTIFACTS("deploymentArtifacts"), - TOSCA_ARTIFACTS("toscaArtifacts"), - SERVICE_API_ARTIFACTS("serviceApiArtifacts"), - METADATA("metadata"), - CATEGORIES("categories"), - INSTANCE_CAPABILTY_PROPERTIES("instanceCapabiltyProperties"), - FORWARDING_PATHS("forwardingPaths"), - POLICIES("policies"); - - - private String value; - - private ComponentFieldsEnum(String value) { - this.value = value; - } - public String getValue() { - return value; - } - - - public static ComponentFieldsEnum findByValue(String value) { - ComponentFieldsEnum ret = null; - for (ComponentFieldsEnum curr : ComponentFieldsEnum.values()) { - if (curr.getValue().equals(value)) { - ret = curr; - return ret; - } - } - return ret; - } + PROPERTIES("properties"), + INPUTS("inputs"), + USERS("users"), + GROUPS("groups"), + NON_EXCLUDED_GROUPS("nonExcludedGroups"), + COMPONENT_INSTANCES("componentInstances"), + COMPONENT_INSTANCES_PROPERTIES("componentInstancesProperties"), + CAPABILITIES("capabilities"), + REQUIREMENTS("requirements"), + ALL_VERSIONS("allVersions"), + ADDITIONAL_INFORMATION("additionalInformation"), + ARTIFACTS("artifacts"), + INTERFACES("interfaces"), + DERIVED_FROM("derivedFrom"), + ATTRIBUTES("attributes"), + COMPONENT_INSTANCES_ATTRIBUTES("componentInstancesAttributes"), + COMPONENT_INSTANCE_INPUTS("componentInstancesInputs"), + COMPONENT_INSTANCE_RELATION("componentInstancesRelations"), + DEPLOYMENT_ARTIFACTS("deploymentArtifacts"), + TOSCA_ARTIFACTS("toscaArtifacts"), + SERVICE_API_ARTIFACTS("serviceApiArtifacts"), + METADATA("metadata"), + CATEGORIES("categories"), + INSTANCE_CAPABILTY_PROPERTIES("instanceCapabiltyProperties"), + FORWARDING_PATHS("forwardingPaths"), + POLICIES("policies"), + NON_EXCLUDED_POLICIES("nonExcludedPolicies"), + ; + + + private String value; + + private ComponentFieldsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + + public static ComponentFieldsEnum findByValue(String value) { + ComponentFieldsEnum ret = null; + for (ComponentFieldsEnum curr : ComponentFieldsEnum.values()) { + if (curr.getValue().equals(value)) { + ret = curr; + return ret; + } + } + return ret; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java index 45fb003734..d70b38e74a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java @@ -21,92 +21,92 @@ package org.openecomp.sdc.be.datatypes.enums; public enum ComponentTypeEnum { - RESOURCE("Resource"), - SERVICE("Service"), - RESOURCE_INSTANCE("Resource Instance"), - PRODUCT("Product"), - SERVICE_INSTANCE("Service Instance"); + RESOURCE("Resource"), + SERVICE("Service"), + RESOURCE_INSTANCE("Resource Instance"), + PRODUCT("Product"), + SERVICE_INSTANCE("Service Instance"); - private String value; + private String value; - private ComponentTypeEnum(String value) { - this.value = value; - } + private ComponentTypeEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - // Those values cannot be another field in enum, because they are needed - // as constants for Swagger allowedValues param - public static final String RESOURCE_PARAM_NAME = "resources"; - public static final String SERVICE_PARAM_NAME = "services"; - public static final String PRODUCT_PARAM_NAME = "products"; + // Those values cannot be another field in enum, because they are needed + // as constants for Swagger allowedValues param + public static final String RESOURCE_PARAM_NAME = "resources"; + public static final String SERVICE_PARAM_NAME = "services"; + public static final String PRODUCT_PARAM_NAME = "products"; - public NodeTypeEnum getNodeType() { + public NodeTypeEnum getNodeType() { - switch (this) { - case RESOURCE: - return NodeTypeEnum.Resource; - case SERVICE: - return NodeTypeEnum.Service; - case PRODUCT: - return NodeTypeEnum.Product; - case RESOURCE_INSTANCE: - return NodeTypeEnum.ResourceInstance; - default: - throw new UnsupportedOperationException("No nodeType is defined for: " + this.getValue()); - } - } + switch (this) { + case RESOURCE: + return NodeTypeEnum.Resource; + case SERVICE: + return NodeTypeEnum.Service; + case PRODUCT: + return NodeTypeEnum.Product; + case RESOURCE_INSTANCE: + return NodeTypeEnum.ResourceInstance; + default: + throw new UnsupportedOperationException("No nodeType is defined for: " + this.getValue()); + } + } - public static ComponentTypeEnum findByValue(String value) { - ComponentTypeEnum ret = null; - for (ComponentTypeEnum curr : ComponentTypeEnum.values()) { - if (curr.getValue().equals(value)) { - ret = curr; - return ret; - } - } - return ret; - } + public static ComponentTypeEnum findByValue(String value) { + ComponentTypeEnum ret = null; + for (ComponentTypeEnum curr : ComponentTypeEnum.values()) { + if (curr.getValue().equals(value)) { + ret = curr; + return ret; + } + } + return ret; + } - public static ComponentTypeEnum findByParamName(String paramName) { - ComponentTypeEnum ret = null; - switch (paramName) { - case RESOURCE_PARAM_NAME: - ret = RESOURCE; - break; - case SERVICE_PARAM_NAME: - ret = SERVICE; - break; - case PRODUCT_PARAM_NAME: - ret = PRODUCT; - break; - default: - break; - } - return ret; - } + public static ComponentTypeEnum findByParamName(String paramName) { + ComponentTypeEnum ret = null; + switch (paramName) { + case RESOURCE_PARAM_NAME: + ret = RESOURCE; + break; + case SERVICE_PARAM_NAME: + ret = SERVICE; + break; + case PRODUCT_PARAM_NAME: + ret = PRODUCT; + break; + default: + break; + } + return ret; + } - public static String findParamByType(ComponentTypeEnum type) { - String ret = null; + public static String findParamByType(ComponentTypeEnum type) { + String ret = null; if (type == null) { return ret; } - switch (type) { - case RESOURCE: - ret = RESOURCE_PARAM_NAME; - break; - case SERVICE: - ret = SERVICE_PARAM_NAME; - break; - case PRODUCT: - ret = PRODUCT_PARAM_NAME; - break; - default: - break; - } - return ret; - } + switch (type) { + case RESOURCE: + ret = RESOURCE_PARAM_NAME; + break; + case SERVICE: + ret = SERVICE_PARAM_NAME; + break; + case PRODUCT: + ret = PRODUCT_PARAM_NAME; + break; + default: + break; + } + return ret; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java new file mode 100644 index 0000000000..e864650e74 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java @@ -0,0 +1,8 @@ +package org.openecomp.sdc.be.datatypes.enums; + +public enum CreatedFrom { + + UI, + CSAR + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java index f9bb92eade..db41807109 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java @@ -38,7 +38,7 @@ public enum FilterKeyEnum { } public static List<String> getAllFilters() { - return Arrays.stream(FilterKeyEnum.values()).map(f -> f.getName()).collect(Collectors.toList()); + return Arrays.stream(FilterKeyEnum.values()).map(FilterKeyEnum::getName).collect(Collectors.toList()); } public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java index 276fbe24a7..8256cbe1c8 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java @@ -55,7 +55,12 @@ public enum GraphPropertyEnum { EMAIL ("email", String.class, false, false), LAST_LOGIN_TIME ("lastLoginTime", Long.class, false, false), //used for category (old format, no json for categories) - ICONS ("icons", String.class, false, false); + ICONS ("icons", String.class, false, false), + + //Archive/Restore + IS_ARCHIVED ("isArchived", Boolean.class, false, true), + IS_VSP_ARCHIVED ("isVspArchived", Boolean.class, false, true), + ARCHIVE_TIME ("archiveTime", Long.class, false, true); private String property; private Class clazz; @@ -112,7 +117,7 @@ public enum GraphPropertyEnum { public static List<String> getAllProperties() { - List<String> arrayList = new ArrayList<String>(); + List<String> arrayList = new ArrayList<>(); for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) { arrayList.add(graphProperty.getProperty()); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java new file mode 100644 index 0000000000..bb567ae8a3 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java @@ -0,0 +1,31 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import java.util.stream.Stream; + +public enum InstantiationTypes { + + A_LA_CARTE("A-la-carte"), + MACRO("Macro"); + + private String value; + + private InstantiationTypes(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + /** + * Checks if enum with the given type exists. + * + * @param type + * @return bool + */ + + public static boolean containsName(String type) { + return Stream.of(InstantiationTypes.values()) + .anyMatch(instType -> type.equals(instType.getValue())); + } +} 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 6d14078301..98b91c1628 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,249 +19,266 @@ */ package org.openecomp.sdc.be.datatypes.enums; + import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum JsonPresentationFields { - UNIQUE_ID ("uniqueId", GraphPropertyEnum.UNIQUE_ID), - HIGHEST_VERSION ("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION), - LIFECYCLE_STATE ("lifecycleState", GraphPropertyEnum.STATE), - CREATION_DATE ("creationDate", null), - LAST_UPDATE_DATE ("lastUpdateDate", null), - SYSTEM_NAME ("systemName", GraphPropertyEnum.SYSTEM_NAME), - NAME ("name", GraphPropertyEnum.NAME), - VERSION ("version", GraphPropertyEnum.VERSION), - NORMALIZED_NAME ("normalizedName", GraphPropertyEnum.NORMALIZED_NAME), - UUID ("UUID", GraphPropertyEnum.UUID), - RESOURCE_TYPE ("resourceType", GraphPropertyEnum.RESOURCE_TYPE), - COMPONENT_TYPE ("componentType", GraphPropertyEnum.COMPONENT_TYPE), - 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), - 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), - INVARIANT_UUID ("invariantUuid", GraphPropertyEnum.INVARIANT_UUID), - CSAR_UUID ("csarUuid", GraphPropertyEnum.CSAR_UUID), - CSAR_VERSION ("csarVersion", null), - IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", null), - CONTACT_ID ("contactId", null), - PROJECT_CODE ("projectCode", null), - DISTRIBUTION_STATUS ("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS), - DERIVED_FROM_GENERIC_TYPE ("derivedFromGenericType", null), - DERIVED_FROM_GENERIC_VERSION ("derivedFromGenericVersion", null), - - ////Artifact - ARTIFACT_TYPE ("artifactType", null), - ARTIFACT_REF ("artifactRef", null), - ARTIFACT_REPOSITORY ("artifactRepository", null), - ARTIFACT_CHECKSUM ("artifactChecksum", null), - ARTIFACT_CREATOR ("artifactCreator", null), - USER_ID_CREATOR ("userIdCreator", null), - USER_ID_LAST_UPDATER ("userIdLastUpdater", null), - CREATOR_FULL_NAME ("creatorFullName", null), - UPDATER_FULL_NAME ("updaterFullName", null), - IS_FROM_CSAR ("isFromCsar", null), - - ES_ID ("esId", null), - ARTIFACT_LABEL ("artifactLabel", null), - IS_ABSTRACT ("mandatory", null), - ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null), - API_URL ("apiUrl", null), - SERVICE_API ("serviceApi", null), - ARTIFACT_VERSION ("artifactVersion", null), - ARTIFACT_UUID ("artifactUUID", null), - PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null), - HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null), - GENERATED ("generated", null), - ARTIFACT_GROUP_TYPE ("artifactGroupType", null), - ARTIFACT_TIMEOUT ("timeout", null), - REQUIRED_ARTIFACTS ("requiredArtifacts", null), - DUPLICATED ("duplicated", null), - HEAT_PARAMETERS ("heatParameters", null), - GENERATED_FROM_ID ("generatedFromId", null), - - - // end artifacts - - - //property - DEFINITION ("definition", null), - DEFAULT_VALUE ("defaultValue", null), - REQUIRED ("required", null), - PASSWORD ("password", null), - CONSTRAINTS ("constraints", null), - PROPERTIES ("properties", null), - PROPERTY ("property", null), - SCHEMA ("schema", null), - VALUE ("value", null), - PARENT_UNIQUE_ID ("parentUniqueId", null), - - COMPONENT_INSTANCES ("componentInstances", null), - RELATIONS ("relations", null), - - //attribute - STATUS ("status", null), - //capability - VALID_SOURCE_TYPE ("validSourceTypes", null), - CREATION_TIME ("creationTime", null), - MODIFICATION_TIME ("modificationTime", null), - CAPABILITY_SOURCES ("capabilitySources", null), - MAX_OCCURRENCES ("maxOccurrences", null), - MIN_OCCURRENCES ("minOccurrences", null), - OWNER_NAME ("ownerName", null), - OWNER_ID ("ownerId", null), - LEFT_OCCURRENCES ("leftOccurences", null), - CAPABILITY_ID ("capabiltyId", null), - PATH ("path", null), - SOURCE ("source", null), - - //Requirement - CAPAPILITY ("capability", null), - NODE ("node", null), - RELATIONSHIP ("relationship", null), - VALID_SOURCE_TYPES ("validSourceTypes", null), - REQUIREMENT_ID ("requirementId", null), - PARENT_NAME ("parentName", null), - - //Relation - CAPABILTY_OWNER_ID ("capabilityOwnerId", null), - REQUIREMENT_OWNER_ID ("requirementOwnerId", null), - FROM_ID ("fromId", null), - TO_ID ("toId", null), - REQUIREMENT ("requirement", null), - - //Groups - GROUP_INVARIANT_UUID ("invariantUUID", null), - GROUP_UUID ("groupUUID", null), - GROUP_MEMBER ("members", null), - GROUP_ARTIFACTS ("artifacts", null), - GROUP_ARTIFACTS_UUID ("artifactsUuid", null), - GROUP_PROPERTIES ("properties", null), - GROUP_UNIQUE_ID ("groupUid", null), - POS_X ("posX", null), - POS_Y ("posY", null), - PROPERTY_VALUE_COUNTER ("propertyValueCounter", null), - CUSTOMIZATION_UUID ("customizationUUID", null), - GROUP_NAME ("groupName", null), - GROUP_INSTANCE_ARTIFACTS ("groupInstanceArtifacts", null), - GROUP_INSTANCE_ARTIFACTS_UUID ("groupInstanceArtifactsUuid", null), - GROUP_INSTANCE_PROPERTIES ("groupInstancesProperties", null), - - //Component instance - CI_COMPONENT_UID ("componentUid", null), - CI_POS_X ("posX", null), - CI_POS_Y ("posY", null), - CI_PROP_VALUE_COUNTER ("propertyValueCounter", null), - CI_ATTR_VALUE_COUNTER ("attributeValueCounter", null), - CI_INPUT_VALUE_COUNTER ("inputValueCounter", null), - CI_ORIGIN_TYPE ("originType", null), - CI_COMPONENT_NAME ("componentName", null), - CI_COMPONENT_VERSION ("componentVersion", null), - 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), - - //path - FORWARDING_PATH ("forwardingPath", null), - FROM_NODE ("fromNode", null), - TO_NODE ("toNode", null), - PATH_FROM_CP ("fromCP", null), - PATH_TO_CP ("toCP", null), - PATH_TO_CP_ORIGIN ("toCPOrigin", null), - PATH_FROM_CP_ORIGIN ("fromCPOrigin", null), - PATH_NAME ("pathName", null), - PATH_PROTOCOL ("pathProtocol", null), - PATH_DESTINATION_PORT_NUMBER ("destinationPortNumber", null), - PATH_ELEMENT_LIST ("pathElementList", null), - - TYPE_UNIQUE_ID ("typeUniqueId", null), - METADATA ("metadata", null), - TARGETS ("targets", null), - - //External Refs - EXTERNAL_REF ("externalRef", null), - - //Interface Operation - IO_OPERATION_TYPE("operationType",null), - IO_INPUT_PARAMETERS("inputParams",null), - IO_OUTPUT_PARAMETERS("outputParams",null), - IO_PARAM_NAME("paramName", null), - IO_PARAM_ID("paramId", null), - IO_WORKFLOW_ID("workflowId", null), - - //Interface - INTERFACE ("interface", null), - INTERFACE_OPERATION ("operation", null), - OPERATION_IMPLEMENTATION("operationImplementation",null), + + UNIQUE_ID("uniqueId", GraphPropertyEnum.UNIQUE_ID), + HIGHEST_VERSION("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION), + LIFECYCLE_STATE("lifecycleState", GraphPropertyEnum.STATE), + CREATION_DATE("creationDate", null), + LAST_UPDATE_DATE("lastUpdateDate", null), + SYSTEM_NAME("systemName", GraphPropertyEnum.SYSTEM_NAME), + NAME("name", GraphPropertyEnum.NAME), + VERSION("version", GraphPropertyEnum.VERSION), + NORMALIZED_NAME("normalizedName", GraphPropertyEnum.NORMALIZED_NAME), + UUID("UUID", GraphPropertyEnum.UUID), + RESOURCE_TYPE("resourceType", GraphPropertyEnum.RESOURCE_TYPE), + COMPONENT_TYPE("componentType", GraphPropertyEnum.COMPONENT_TYPE), + 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), + 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), + INSTANTIATION_TYPE("instantiationType", null), + CONFORMANCE_LEVEL("conformanceLevel", null), + ICON("icon", null), + TAGS("tags", null), + INVARIANT_UUID("invariantUuid", GraphPropertyEnum.INVARIANT_UUID), + CSAR_UUID("csarUuid", GraphPropertyEnum.CSAR_UUID), + CSAR_VERSION("csarVersion", null), + IMPORTED_TOSCA_CHECKSUM("importedToscaChecksum", null), + CONTACT_ID("contactId", null), + PROJECT_CODE("projectCode", null), + DISTRIBUTION_STATUS("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS), + DERIVED_FROM_GENERIC_TYPE("derivedFromGenericType", null), + DERIVED_FROM_GENERIC_VERSION("derivedFromGenericVersion", null), + + ////Inputs + ANNOTATIONS("annotations", null), + + ////Artifact + ARTIFACT_TYPE("artifactType", null), + ARTIFACT_REF("artifactRef", null), + ARTIFACT_REPOSITORY("artifactRepository", null), + ARTIFACT_CHECKSUM("artifactChecksum", null), + ARTIFACT_CREATOR("artifactCreator", null), + USER_ID_CREATOR("userIdCreator", null), + USER_ID_LAST_UPDATER("userIdLastUpdater", null), + CREATOR_FULL_NAME("creatorFullName", null), + UPDATER_FULL_NAME("updaterFullName", null), + IS_FROM_CSAR("isFromCsar", null), + + ES_ID("esId", null), + ARTIFACT_LABEL("artifactLabel", null), + IS_ABSTRACT("mandatory", null), + ARTIFACT_DISPLAY_NAME("artifactDisplayName", null), + API_URL("apiUrl", null), + SERVICE_API("serviceApi", null), + ARTIFACT_VERSION("artifactVersion", null), + ARTIFACT_UUID("artifactUUID", null), + PAYLOAD_UPDATE_DATE("payloadUpdateDate", null), + HEAT_PARAMS_UPDATE_DATE("heatParamsUpdateDate", null), + GENERATED("generated", null), + ARTIFACT_GROUP_TYPE("artifactGroupType", null), + ARTIFACT_TIMEOUT("timeout", null), + REQUIRED_ARTIFACTS("requiredArtifacts", null), + DUPLICATED("duplicated", null), + HEAT_PARAMETERS("heatParameters", null), + GENERATED_FROM_ID("generatedFromId", null), + + + // end artifacts + + + //property + DEFINITION("definition", null), + DEFAULT_VALUE("defaultValue", null), + REQUIRED("required", null), + PASSWORD("password", null), + CONSTRAINTS("constraints", null), + PROPERTIES("properties", null), + PROPERTY("property", null), + SCHEMA("schema", null), + VALUE("value", null), + PARENT_UNIQUE_ID("parentUniqueId", null), + + COMPONENT_INSTANCES("componentInstances", null), + RELATIONS("relations", null), + + //attribute + STATUS("status", null), + //capability + VALID_SOURCE_TYPE("validSourceTypes", null), + CREATION_TIME("creationTime", null), + MODIFICATION_TIME("modificationTime", null), + CAPABILITY_SOURCES("capabilitySources", null), + MAX_OCCURRENCES("maxOccurrences", null), + MIN_OCCURRENCES("minOccurrences", null), + OWNER_TYPE ("ownerType", null), + OWNER_NAME("ownerName", null), + OWNER_ID("ownerId", null), + LEFT_OCCURRENCES("leftOccurences", null), + CAPABILITY_ID("capabiltyId", null), + PATH("path", null), + SOURCE("source", null), + + //Requirement + CAPAPILITY("capability", null), + NODE("node", null), + RELATIONSHIP("relationship", null), + VALID_SOURCE_TYPES("validSourceTypes", null), + REQUIREMENT_ID("requirementId", null), + PARENT_NAME("parentName", null), + PREVIOUS_NAME("previousName", null), + //Relation + CAPABILTY_OWNER_ID("capabilityOwnerId", null), + REQUIREMENT_OWNER_ID("requirementOwnerId", null), + FROM_ID("fromId", null), + TO_ID("toId", null), + REQUIREMENT("requirement", null), + ORIGIN_UI("originUI",null), + + //Groups + + GROUP_INVARIANT_UUID("invariantUUID", null), + GROUP_UUID("groupUUID", null), + GROUP_MEMBER("members", null), + GROUP_ARTIFACTS("artifacts", null), + GROUP_ARTIFACTS_UUID("artifactsUuid", null), + GROUP_PROPERTIES("properties", null), + GROUP_UNIQUE_ID("groupUid", null), + POS_X("posX", null), + POS_Y("posY", null), + PROPERTY_VALUE_COUNTER("propertyValueCounter", null), + CUSTOMIZATION_UUID("customizationUUID", null), + GROUP_NAME("groupName", null), + GROUP_INSTANCE_ARTIFACTS("groupInstanceArtifacts", null), + GROUP_INSTANCE_ARTIFACTS_UUID("groupInstanceArtifactsUuid", null), + GROUP_INSTANCE_PROPERTIES("groupInstancesProperties", null), + + //Component instance + + CI_COMPONENT_UID("componentUid", null), + CI_POS_X("posX", null), + CI_POS_Y("posY", null), + CI_PROP_VALUE_COUNTER("propertyValueCounter", null), + CI_ATTR_VALUE_COUNTER("attributeValueCounter", null), + CI_INPUT_VALUE_COUNTER("inputValueCounter", null), + CI_ORIGIN_TYPE("originType", null), + CI_COMPONENT_NAME("componentName", null), + CI_COMPONENT_VERSION("componentVersion", null), + 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), + + + //path + FORWARDING_PATH("forwardingPath", null), + FROM_NODE("fromNode", null), + TO_NODE("toNode", null), + PATH_FROM_CP("fromCP", null), + PATH_TO_CP("toCP", null), + PATH_TO_CP_ORIGIN("toCPOrigin", null), + PATH_FROM_CP_ORIGIN("fromCPOrigin", null), + PATH_NAME("pathName", null), + PATH_PROTOCOL("pathProtocol", null), + PATH_DESTINATION_PORT_NUMBER("destinationPortNumber", null), + PATH_ELEMENT_LIST("pathElementList", null), + + TYPE_UNIQUE_ID("typeUniqueId", null), + METADATA("metadata", null), + TARGETS("targets", null), + + //External Refs + EXTERNAL_REF("externalRef", null), + CREATED_FROM("createdFrom", null), + + //Archive + IS_ARCHIVED("isArchived", GraphPropertyEnum.IS_ARCHIVED), + ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME), + IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED), + CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null), + //Interface Operation + IO_OPERATION_TYPE("operationType",null), + IO_INPUT_PARAMETERS("inputParams",null), + IO_OUTPUT_PARAMETERS("outputParams",null), + IO_PARAM_NAME("paramName", null), + IO_PARAM_ID("paramId", null), + IO_WORKFLOW_ID("workflowId", null), + + //Interface + INTERFACE ("interface", null), + INTERFACE_OPERATION ("operation", null), + OPERATION_IMPLEMENTATION("operationImplementation",null), OPERATION_INPUT("operationInput",null), OPERATION_OUTPUT("operationOutput", null) - ; - - - private String presentation; - private GraphPropertyEnum storedAs; - - JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) { - this.presentation = presentation; - this.storedAs = storedAs; - } - - @JsonValue - public String getPresentation() { - return presentation; - } - - public void setPresentation(String presentation) { - this.presentation = presentation; - } - - public GraphPropertyEnum getStoredAs() { - return storedAs; - } - - public void setStoredAs(GraphPropertyEnum storedAs) { - this.storedAs = storedAs; - } - - public static String getPresentationByGraphProperty(GraphPropertyEnum property) { - for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){ - if(currPresentation.getStoredAs() == property){ - return currPresentation.getPresentation(); - } - } - return null; - } - - @Override - public String toString() { - // TODO Auto-generated method stub - return presentation; - } - - @JsonCreator - public static JsonPresentationFields getByPresentation(String presentation) { - for (JsonPresentationFields inst : JsonPresentationFields.values()) { - if (inst.getPresentation().equals(presentation)) { - return inst; - } - } - return null; - } - + ; + + + private String presentation; + private GraphPropertyEnum storedAs; + + JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) { + this.presentation = presentation; + this.storedAs = storedAs; + } + + @JsonValue + public String getPresentation() { + return presentation; + } + + public void setPresentation(String presentation) { + this.presentation = presentation; + } + + public GraphPropertyEnum getStoredAs() { + return storedAs; + } + + public void setStoredAs(GraphPropertyEnum storedAs) { + this.storedAs = storedAs; + } + + public static String getPresentationByGraphProperty(GraphPropertyEnum property) { + for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) { + if (currPresentation.getStoredAs() == property) { + return currPresentation.getPresentation(); + } + } + return null; + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return presentation; + } + + @JsonCreator + public static JsonPresentationFields getByPresentation(String presentation) { + for (JsonPresentationFields inst : JsonPresentationFields.values()) { + if (inst.getPresentation().equals(presentation)) { + return inst; + } + } + return null; + } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java index a2ca46cff4..7e3bf1f265 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java @@ -21,73 +21,75 @@ package org.openecomp.sdc.be.datatypes.enums; public enum NodeTypeEnum { - User("user"), - Service("service"), - Resource("resource"), - Product("product"), - ResourceCategory("resourceCategory"), - ServiceCategory("serviceCategory"), - ServiceNewCategory("serviceNewCategory"), - ResourceNewCategory("resourceNewCategory"), - ProductCategory("productCategory"), - ResourceSubcategory("resourceSubcategory"), - ProductSubcategory("productSubcategory"), - ProductGrouping("productGrouping"), - Tag("tag"), - Property("property"), - Attribute("attribute"), - CapabilityType("capabilityType"), - Requirement("requirement"), - RelationshipType("relationshipType"), - Capability("capability"), - RequirementImpl("requirementImpl"), - CapabilityInst("capabilityInst"), - AttributeValue("attributeValue"), - InputValue("inputValue"), - PropertyValue("propertyValue"), - LockNode("lockNode"), - ArtifactRef("artifactRef"), - Interface("interface"), - InterfaceOperation("interfaceOperation"), - ResourceInstance("resourceInstance"), - RelationshipInst("relationshipInst"), - AdditionalInfoParameters("additionalInfoParameters"), - ConsumerCredentials("consumerCredentials"), - HeatParameter("heatParameter"), - HeatParameterValue("heatParameterValue"), - DataType("dataType"), - GroupType("groupType"), - PolicyType("policyType"), - Group("group"), - UserFunctionalMenu("userFunctionalMenu"), - Input("input"), - GroupInstance("groupInstance"), ; + User("user"), + Service("service"), + Resource("resource"), + Product("product"), + ResourceCategory("resourceCategory"), + ServiceCategory("serviceCategory"), + ServiceNewCategory("serviceNewCategory"), + ResourceNewCategory("resourceNewCategory"), + ProductCategory("productCategory"), + ResourceSubcategory("resourceSubcategory"), + ProductSubcategory("productSubcategory"), + ProductGrouping("productGrouping"), + Tag("tag"), + Property("property"), + Attribute("attribute"), + CapabilityType("capabilityType"), + Requirement("requirement"), + RelationshipType("relationshipType"), + Capability("capability"), + RequirementImpl("requirementImpl"), + CapabilityInst("capabilityInst"), + AttributeValue("attributeValue"), + InputValue("inputValue"), + PropertyValue("propertyValue"), + LockNode("lockNode"), + ArtifactRef("artifactRef"), + Interface("interface"), + InterfaceOperation("interfaceOperation"), + ResourceInstance("resourceInstance"), + RelationshipInst("relationshipInst"), + AdditionalInfoParameters("additionalInfoParameters"), + ConsumerCredentials("consumerCredentials"), + HeatParameter("heatParameter"), + HeatParameterValue("heatParameterValue"), + DataType("dataType"), + GroupType("groupType"), + PolicyType("policyType"), + Group("group"), + UserFunctionalMenu("userFunctionalMenu"), + Input("input"), + GroupInstance("groupInstance"), + AnnotationType("annotationType"), + Component("component"); - private String name; + private String name; - NodeTypeEnum(String name) { - this.name = name; - } + NodeTypeEnum(String name) { + this.name = name; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public static NodeTypeEnum getByName(String name) { - for (NodeTypeEnum inst : NodeTypeEnum.values()) { - if (inst.getName().equals(name)) { - return inst; - } - } - return null; - } + public static NodeTypeEnum getByName(String name) { + for (NodeTypeEnum inst : NodeTypeEnum.values()) { + if (inst.getName().equals(name)) { + return inst; + } + } + return null; + } - public static NodeTypeEnum getByNameIgnoreCase(String name) { - for (NodeTypeEnum inst : NodeTypeEnum.values()) { - if (inst.getName().equalsIgnoreCase(name)) { - return inst; - } - } - return null; - } + public static NodeTypeEnum getByNameIgnoreCase(String name) { + for (NodeTypeEnum inst : NodeTypeEnum.values()) { + if (inst.getName().equalsIgnoreCase(name)) { + return inst; + } + } + return null; + } } 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 8be36e526a..6002bd034c 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,88 +34,101 @@ import java.util.stream.Collectors; public abstract class ToscaDataDefinition { - protected Map<String, Object> toscaPresentation; - - public ToscaDataDefinition() { - toscaPresentation = new HashMap<>(); - } - - @JsonCreator - public ToscaDataDefinition(Map<String, Object> art) { - toscaPresentation = art; - } - - @JsonValue - public Object getToscaPresentationValue(JsonPresentationFields name) { - if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) { - return toscaPresentation.get(name.getPresentation()); - } - return null; - } - - public void setToscaPresentationValue(JsonPresentationFields name, Object value) { - if (toscaPresentation == null && value != null) { - toscaPresentation = new HashMap<String, Object>(); - } - toscaPresentation.put(name.getPresentation(), value); - - } - - public void setOwnerIdIfEmpty(String ownerId) { - if (getOwnerId() == null) { - setOwnerId(ownerId); - } - } - - public void setOwnerId(String ownerId) { - setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); - } - - 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) { - other.setOwnerId(getOwnerId()); - return other; - } - - 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()) { - 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()); - } - 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)); - } - - public boolean findUidMatch(String uid) { - return uid.equals(getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID)); - - } - public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { - return (T) this; - } - 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; - } + protected Map<String, Object> toscaPresentation; + + public ToscaDataDefinition() { + toscaPresentation = new HashMap<>(); + } + + @JsonCreator + public ToscaDataDefinition(Map<String, Object> art) { + toscaPresentation = art; + } + + @JsonValue + public Object getToscaPresentationValue(JsonPresentationFields name) { + if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) { + return toscaPresentation.get(name.getPresentation()); + } + return null; + } + + public void setToscaPresentationValue(JsonPresentationFields name, Object value) { + if (toscaPresentation == null && value != null) { + toscaPresentation = new HashMap<>(); + } + toscaPresentation.put(name.getPresentation(), value); + + } + + public void setOwnerIdIfEmpty(String ownerId) { + if (getOwnerId() == null) { + setOwnerId(ownerId); + } + } + + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setOwnerId(String ownerId) { + setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); + } + + 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) { + other.setOwnerId(getOwnerId()); + return other; + } + + 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()) { + 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()); + } + } + 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)); + } + + public boolean findUidMatch(String uid) { + return uid.equals(getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID)); + + } + + public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { + return (T) this; + } + + 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/utils/PropertyDefinitionUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/PropertyDefinitionUtils.java new file mode 100644 index 0000000000..92aa832278 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/PropertyDefinitionUtils.java @@ -0,0 +1,37 @@ +package org.openecomp.sdc.be.utils; + +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static java.util.Collections.emptyMap; +import static java.util.stream.Collectors.toList; + +public class PropertyDefinitionUtils { + + private PropertyDefinitionUtils() { + } + + public static <T extends PropertyDataDefinition> List<PropertyDataDefinition> convertListOfProperties(List<T> toConvert) { + return toConvert.stream().map(PropertyDataDefinition::new).collect(toList()); + } + + public static Map<String, List<PropertyDataDefinition>> resolveGetInputProperties(Map<String, List<PropertyDataDefinition>> properties) { + if (properties == null) { + return emptyMap(); + } + return properties.entrySet() + .stream() + .collect(Collectors.toMap(Map.Entry::getKey, + entry -> filterGetInputProps(entry.getValue()))); + } + + private static <T extends PropertyDataDefinition> List<PropertyDataDefinition> filterGetInputProps(List<T> propDefinitions) { + return propDefinitions + .stream() + .filter(PropertyDataDefinition::isGetInputProperty) + .collect(Collectors.toList()); + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java new file mode 100644 index 0000000000..d4524d9882 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java @@ -0,0 +1,48 @@ +package org.openecomp.sdc.be.utils; + +import java.util.Map; +import java.util.function.Consumer; + +public class TypeUtils { + + public static final String FIRST_CERTIFIED_VERSION_VERSION = "1.0"; + + public static <FieldType> void setField(Map<String, Object> toscaJson, ToscaTagNamesEnum tagName, Consumer<FieldType> setter) { + String fieldName = tagName.getElementName(); + if (toscaJson.containsKey(fieldName)) { + FieldType fieldValue = (FieldType) toscaJson.get(fieldName); + setter.accept(fieldValue); + } + } + + public enum ToscaTagNamesEnum { + DERIVED_FROM("derived_from"), IS_PASSWORD("is_password"), + // Properties + PROPERTIES("properties"), TYPE("type"), STATUS("status"), ENTRY_SCHEMA("entry_schema"), REQUIRED("required"), DESCRIPTION("description"), DEFAULT_VALUE("default"), VALUE("value"), CONSTRAINTS("constraints"), + // Group Types + MEMBERS("members"), METADATA("metadata"), + // Policy Types + TARGETS("targets"), + // Capabilities + CAPABILITIES("capabilities"), VALID_SOURCE_TYPES("valid_source_types"), + // Requirements + REQUIREMENTS("requirements"), NODE("node"), RELATIONSHIP("relationship"), CAPABILITY("capability"), INTERFACES("interfaces"), + // Heat env Validation + PARAMETERS("parameters"), + // Import Validations + TOSCA_VERSION("tosca_definitions_version"), TOPOLOGY_TEMPLATE("topology_template"), NODE_TYPES("node_types"), OCCURRENCES("occurrences"), NODE_TEMPLATES("node_templates"), GROUPS("groups"), INPUTS("inputs"), + SUBSTITUTION_MAPPINGS("substitution_mappings"), NODE_TYPE("node_type"), + // Attributes + ATTRIBUTES("attributes"), LABEL("label"), HIDDEN("hidden"), IMMUTABLE("immutable"), GET_INPUT("get_input"), ANNOTATIONS("annotations"); + + private String elementName; + + private ToscaTagNamesEnum(String elementName) { + this.elementName = elementName; + } + + public String getElementName() { + return elementName; + } + } +} 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 2243434ce7..8f6445c21a 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,22 +20,16 @@ package org.openecomp.sdc.be.workers; -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 com.google.common.util.concurrent.ThreadFactoryBuilder; +import org.openecomp.sdc.common.log.wrappers.Logger; + +import java.util.concurrent.*; /** * Created by michael on 6/24/2016. */ public class Manager<T extends Job, E> { - private static Logger log = LoggerFactory.getLogger(Manager.class.getName()); + private static Logger log = Logger.getLogger(Manager.class.getName()); private ExecutorService executor; private LinkedBlockingQueue<T> inputQueue; private LinkedBlockingQueue<E> outputQueue; @@ -46,8 +40,8 @@ public class Manager<T extends Job, E> { this.numberOfWorkers = numberOfWorkers; final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Worker-%d").build(); this.executor = Executors.newFixedThreadPool(numberOfWorkers, threadFactory); - this.inputQueue = new LinkedBlockingQueue<T>(); - this.outputQueue = new LinkedBlockingQueue<E>(); + this.inputQueue = new LinkedBlockingQueue<>(); + this.outputQueue = new LinkedBlockingQueue<>(); } public void addJob(T job) { 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 e8957fc9ef..cf2a6d0d6c 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,12 @@ package org.openecomp.sdc.be.workers; +import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.openecomp.sdc.common.log.wrappers.Logger; + 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; - /** * Created by michael on 6/24/2016. */ @@ -37,7 +36,7 @@ public class Worker<T extends Job<E>, E> implements Runnable { private LinkedBlockingQueue<E> outputQueue; - private static Logger log = LoggerFactory.getLogger(Worker.class.getName()); + private static Logger log = Logger.getLogger(Worker.class.getName()); public Worker(String workerName, LinkedBlockingQueue<T> inputQueue, LinkedBlockingQueue<E> outputQueue) { this.workerName = workerName; diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java index 1c7e3e6765..9ea0a3f108 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.category; -import java.util.List; - import org.junit.Assert; import org.junit.Test; +import java.util.List; + public class CategoryDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java index 7ef3e26c63..ed7c320d3a 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.category; -import java.util.List; - import org.junit.Assert; import org.junit.Test; +import java.util.List; + public class SubCategoryDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java index f73858e7b2..e6bd071bbb 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; - import org.junit.Test; +import java.util.List; + public class AdditionalInfoParameterDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java index 04e2461115..a85ccd9f6a 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java @@ -1,13 +1,13 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + public class ArtifactDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java index 72b1196234..24a71fcbf5 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.LinkedList; -import java.util.List; - import org.junit.Assert; import org.junit.Test; +import java.util.LinkedList; +import java.util.List; + public class CapabilityDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinitionTest.java index ea2f205bac..5e3067413b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinitionTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; - import org.junit.Test; +import java.util.List; + public class CapabilityTypeDataDefinitionTest { private CapabilityTypeDataDefinition createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java deleted file mode 100644 index 92faa74f3c..0000000000 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.openecomp.sdc.be.datatypes.elements; - -import java.util.Map; - -import org.junit.Test; - - -public class CompositionDataDefinitionTest { - - private CompositionDataDefinition createTestSubject() { - return new CompositionDataDefinition(); - } - - - @Test - public void testGetComponentInstances() throws Exception { - CompositionDataDefinition testSubject; - Map<String, ComponentInstanceDataDefinition> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstances(); - } - - - @Test - public void testSetComponentInstances() throws Exception { - CompositionDataDefinition testSubject; - Map<String, ComponentInstanceDataDefinition> componentInstances = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentInstances(componentInstances); - } - - - @Test - public void testGetRelations() throws Exception { - CompositionDataDefinition testSubject; - Map<String, RelationshipInstDataDefinition> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelations(); - } - - - @Test - public void testSetRelations() throws Exception { - CompositionDataDefinition testSubject; - Map<String, RelationshipInstDataDefinition> relations = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRelations(relations); - } - - - @Test - public void testAddInstance() throws Exception { - CompositionDataDefinition testSubject; - String key = ""; - ComponentInstanceDataDefinition instance = null; - - // default test - testSubject = createTestSubject(); - testSubject.addInstance(key, instance); - } - - - @Test - public void testAddRelation() throws Exception { - CompositionDataDefinition testSubject; - String key = ""; - RelationshipInstDataDefinition relation = null; - - // default test - testSubject = createTestSubject(); - testSubject.addRelation(key, relation); - } -}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java index bfc9749562..3eeea7768f 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.HashMap; - import org.junit.Assert; import org.junit.Test; +import java.util.HashMap; + public class GetInputValueDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java index c4b7045193..80a703f646 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Test; - public class GroupDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java index 3328f5e46b..1fa9bde852 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import org.junit.Test; - public class GroupInstanceDataDefinitionTest { @@ -491,12 +491,4 @@ public class GroupInstanceDataDefinitionTest { testSubject.setProperties(properties); } - - @Test - public void testGetSerialversionuid() throws Exception { - long result; - - // default test - result = GroupInstanceDataDefinition.getSerialversionuid(); - } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java index ae62dbc339..5bd3515812 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.List; import java.util.Map; -import org.junit.Test; - public class GroupTypeDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java index b8e0a1fd72..35cfb6638a 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.HashMap; - import org.junit.Test; +import java.util.HashMap; + public class InputDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java index 63d4e0ded6..966dce634b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.Map; - import org.junit.Test; +import java.util.Map; + public class InterfaceDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java index 848b553738..15e759b52c 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.LinkedList; import java.util.List; -import org.junit.Test; - public class ListCapabilityDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java index 5b9769ff0d..c0d72872a0 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; -import java.util.Set; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.util.List; +import java.util.Set; + public class ListDataDefinitionTest { private ListDataDefinition createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java index 2939950386..6dab3b2bc7 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.LinkedList; import java.util.List; -import org.junit.Test; - public class ListMapPropertiesDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java index 682c43cc8c..5cdc132f40 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.LinkedList; import java.util.List; -import org.junit.Test; - public class ListRequirementDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java index 0b2366080b..2edf12cf47 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.HashMap; import java.util.Map; -import org.junit.Test; - public class MapArtifactDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyPropertyTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityPropertyTest.java index 914dc11d46..438c5e4083 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyPropertyTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityPropertyTest.java @@ -5,25 +5,25 @@ import java.util.Map; import org.junit.Test; -public class MapCapabiltyPropertyTest { +public class MapCapabilityPropertyTest { - private MapCapabiltyProperty createTestSubject() { - return new MapCapabiltyProperty(); + private MapCapabilityProperty createTestSubject() { + return new MapCapabilityProperty(); } @Test public void testOverloadConstructor() throws Exception { - MapCapabiltyProperty testSubject; + MapCapabilityProperty testSubject; Map<String, MapPropertiesDataDefinition> result; // default test testSubject = createTestSubject(); - new MapCapabiltyProperty(new HashMap<>()); + new MapCapabilityProperty(new HashMap<>()); } @Test public void testGetMapToscaDataDefinition() throws Exception { - MapCapabiltyProperty testSubject; + MapCapabilityProperty testSubject; Map<String, MapPropertiesDataDefinition> result; // default test @@ -33,7 +33,7 @@ public class MapCapabiltyPropertyTest { @Test public void testSetMapToscaDataDefinition() throws Exception { - MapCapabiltyProperty testSubject; + MapCapabilityProperty testSubject; Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition = null; // default test diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefsTest.java index 068ff77b17..6c8cd18a1d 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefsTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefsTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.List; import java.util.Map; -import org.junit.Test; - public class MapComponentInstanceExternalRefsTest { private MapComponentInstanceExternalRefs createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java index ae7f63c505..672b7c2922 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java @@ -1,12 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.util.HashSet; +import java.util.Map; + public class MapDataDefinitionTest { private MapDataDefinition createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinitionTest.java index 0784f6439a..c9a3984178 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.Map; - import org.apache.commons.collections.map.HashedMap; import org.junit.Test; +import java.util.Map; + public class MapGroupsDataDefinitionTest { private MapGroupsDataDefinition createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinitionTest.java index f335c4a45b..a12c51b97b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinitionTest.java @@ -1,30 +1,30 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.Map; - import org.apache.commons.collections.map.HashedMap; import org.junit.Test; +import java.util.Map; + -public class MapListCapabiltyDataDefinitionTest { +public class MapListCapabilityDataDefinitionTest { - private MapListCapabiltyDataDefinition createTestSubject() { - return new MapListCapabiltyDataDefinition(); + private MapListCapabilityDataDefinition createTestSubject() { + return new MapListCapabilityDataDefinition(); } @Test public void testConstructors() throws Exception { - MapListCapabiltyDataDefinition testSubject; + MapListCapabilityDataDefinition testSubject; Map<String, ListCapabilityDataDefinition> result; // default test - new MapListCapabiltyDataDefinition(new HashedMap()); - new MapListCapabiltyDataDefinition(createTestSubject()); + new MapListCapabilityDataDefinition(new HashedMap()); + new MapListCapabilityDataDefinition(createTestSubject()); } @Test public void testGetMapToscaDataDefinition() throws Exception { - MapListCapabiltyDataDefinition testSubject; + MapListCapabilityDataDefinition testSubject; Map<String, ListCapabilityDataDefinition> result; // default test @@ -35,7 +35,7 @@ public class MapListCapabiltyDataDefinitionTest { @Test public void testAdd() throws Exception { - MapListCapabiltyDataDefinition testSubject; + MapListCapabilityDataDefinition testSubject; String key = ""; CapabilityDataDefinition value = null; diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java deleted file mode 100644 index 82f0e0ea06..0000000000 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.openecomp.sdc.be.datatypes.elements; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - - -public class MapListRequirementDataDefinitionTest { - - private MapListRequirementDataDefinition createTestSubject() { - Map map = new HashMap<>(); - return new MapListRequirementDataDefinition(map); - } - - - @Test - public void testGetMapToscaDataDefinition() throws Exception { - MapListRequirementDataDefinition testSubject; - Map<String, ListRequirementDataDefinition> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMapToscaDataDefinition(); - } - - - @Test - public void testAdd() throws Exception { - MapListRequirementDataDefinition testSubject; - String key = ""; - RequirementDataDefinition value = null; - - // default test - testSubject = createTestSubject(); - testSubject.add(key, value); - } -}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java index 56ea2baedb..cfa8123ea9 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.HashMap; import java.util.Map; -import org.junit.Test; - public class MapPropertiesDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinitionTest.java index f3e4f29ae7..b28ba1c62f 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinitionTest.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Test; - public class PolicyDataDefinitionTest { private PolicyDataDefinition createTestSubject() { @@ -311,6 +311,6 @@ public class PolicyDataDefinitionTest { // default test testSubject = createTestSubject(); - result = testSubject.containsCmptInstanceAsTarget(cmptInstId); + result = testSubject.containsTarget(cmptInstId,null); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java index e407229956..5c4ba5b08e 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import org.junit.Test; + import java.util.List; import java.util.Map; -import org.junit.Test; - public class PolicyTypeDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java index 93bc5618de..2d4a2d4e99 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; - import org.junit.Test; +import java.util.List; + public class ProductMetadataDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java index 9b067c9b80..763b245b6b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java @@ -1,13 +1,113 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; - import org.junit.Assert; +import org.junit.Before; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; + +import java.util.List; + +import static org.junit.Assert.*; public class PropertyDataDefinitionTest { + private PropertyDataDefinition propDef; + + @Before + public void setUp() { + propDef = new PropertyDataDefinition(); + } + + @Test + public void setStringField() { + final String name = "name"; + assertNull(propDef.getName()); + assertNull(propDef.getToscaPresentationValue(JsonPresentationFields.NAME)); + propDef.setToscaPresentationValue(JsonPresentationFields.NAME, name); + assertEquals(name, propDef.getName()); + assertEquals(name, propDef.getToscaPresentationValue(JsonPresentationFields.NAME)); + } + + @Test + public void setDefaultValue() { + final String defaultValue = "text"; + assertNull(propDef.getDefaultValue()); + assertNull(propDef.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + propDef.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, defaultValue); + assertEquals(defaultValue, propDef.getDefaultValue()); + assertEquals(defaultValue, propDef.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + } + + @Test + public void setValueNotDefinedInPropDataDefinition() { + final String defaultValue = "VF"; + assertNull(propDef.getToscaPresentationValue(JsonPresentationFields.COMPONENT_TYPE)); + propDef.setToscaPresentationValue(JsonPresentationFields.COMPONENT_TYPE, defaultValue); + assertEquals(defaultValue, propDef.getToscaPresentationValue(JsonPresentationFields.COMPONENT_TYPE)); + } + + @Test + public void setBooleanField() { + assertFalse((Boolean) propDef.getToscaPresentationValue(JsonPresentationFields.PASSWORD)); + assertFalse(propDef.isPassword()); + propDef.setToscaPresentationValue(JsonPresentationFields.PASSWORD, Boolean.TRUE); + assertTrue(propDef.isPassword()); + assertTrue((Boolean) propDef.getToscaPresentationValue(JsonPresentationFields.PASSWORD)); + } + + @Test + public void mergeDefaultValueWhenItWasNullBeforeMerge() { + final String defaultValue = "12345"; + final String type = "1"; + PropertyDataDefinition propForMerge = new PropertyDataDefinition(); + propForMerge.setType(type); + + propDef.setType(type); + propDef.setDefaultValue(defaultValue); + assertNull(propForMerge.getDefaultValue()); + assertNull(propForMerge.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + propDef.mergeFunction(propForMerge, true); + assertEquals(defaultValue, propForMerge.getDefaultValue()); + assertEquals(defaultValue, propForMerge.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + } + + @Test + public void mergeDefaultValueAndOverrideIt() { + final String defaultValue = "12345"; + final String defaultValueForOther = "7890"; + final String type = "1"; + PropertyDataDefinition propForMerge = new PropertyDataDefinition(); + propForMerge.setType(type); + propForMerge.setDefaultValue(defaultValueForOther); + + propDef.setType(type); + propDef.setDefaultValue(defaultValue); + assertEquals(defaultValueForOther, propForMerge.getDefaultValue()); + assertEquals(defaultValueForOther, propForMerge.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + propDef.mergeFunction(propForMerge, true); + assertEquals(defaultValue, propForMerge.getDefaultValue()); + assertEquals(defaultValue, propForMerge.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + } + + @Test + public void mergeDefaultValueWhenOverridingIsNotAllowed() { + final String defaultValue = "12345"; + final String defaultValueForOther = "7890"; + final String type = "1"; + PropertyDataDefinition propForMerge = new PropertyDataDefinition(); + propForMerge.setType(type); + propForMerge.setDefaultValue(defaultValueForOther); + + propDef.setType(type); + propDef.setDefaultValue(defaultValue); + assertEquals(defaultValueForOther, propForMerge.getDefaultValue()); + assertEquals(defaultValueForOther, propForMerge.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + propDef.mergeFunction(propForMerge, false); + assertEquals(defaultValueForOther, propForMerge.getDefaultValue()); + assertEquals(defaultValueForOther, propForMerge.getToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE)); + } + private PropertyDataDefinition createTestSubject() { return new PropertyDataDefinition(); } @@ -21,7 +121,7 @@ public class PropertyDataDefinitionTest { testSubject = createTestSubject(); new PropertyDataDefinition(testSubject); } - + @Test public void testGetInputPath() throws Exception { PropertyDataDefinition testSubject; @@ -32,7 +132,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getInputPath(); } - + @Test public void testSetInputPath() throws Exception { PropertyDataDefinition testSubject; @@ -43,7 +143,7 @@ public class PropertyDataDefinitionTest { testSubject.setInputPath(inputPath); } - + @Test public void testGetName() throws Exception { PropertyDataDefinition testSubject; @@ -54,7 +154,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getName(); } - + @Test public void testSetName() throws Exception { PropertyDataDefinition testSubject; @@ -65,7 +165,7 @@ public class PropertyDataDefinitionTest { testSubject.setName(name); } - + @Test public void testGetValue() throws Exception { PropertyDataDefinition testSubject; @@ -76,7 +176,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getValue(); } - + @Test public void testSetValue() throws Exception { PropertyDataDefinition testSubject; @@ -87,7 +187,7 @@ public class PropertyDataDefinitionTest { testSubject.setValue(value); } - + @Test public void testIsDefinition() throws Exception { PropertyDataDefinition testSubject; @@ -98,7 +198,7 @@ public class PropertyDataDefinitionTest { result = testSubject.isDefinition(); } - + @Test public void testSetDefinition() throws Exception { PropertyDataDefinition testSubject; @@ -109,7 +209,7 @@ public class PropertyDataDefinitionTest { testSubject.setDefinition(definition); } - + @Test public void testGetType() throws Exception { PropertyDataDefinition testSubject; @@ -120,7 +220,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getType(); } - + @Test public void testGetDefaultValue() throws Exception { PropertyDataDefinition testSubject; @@ -131,7 +231,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getDefaultValue(); } - + @Test public void testSetDefaultValue() throws Exception { PropertyDataDefinition testSubject; @@ -142,7 +242,7 @@ public class PropertyDataDefinitionTest { testSubject.setDefaultValue(defaultValue); } - + @Test public void testSetType() throws Exception { PropertyDataDefinition testSubject; @@ -153,7 +253,7 @@ public class PropertyDataDefinitionTest { testSubject.setType(type); } - + @Test public void testIsRequired() throws Exception { PropertyDataDefinition testSubject; @@ -164,7 +264,7 @@ public class PropertyDataDefinitionTest { result = testSubject.isRequired(); } - + @Test public void testSetRequired() throws Exception { PropertyDataDefinition testSubject; @@ -175,7 +275,7 @@ public class PropertyDataDefinitionTest { testSubject.setRequired(required); } - + @Test public void testGetDescription() throws Exception { PropertyDataDefinition testSubject; @@ -186,7 +286,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getDescription(); } - + @Test public void testSetDescription() throws Exception { PropertyDataDefinition testSubject; @@ -197,7 +297,7 @@ public class PropertyDataDefinitionTest { testSubject.setDescription(description); } - + @Test public void testIsPassword() throws Exception { PropertyDataDefinition testSubject; @@ -208,7 +308,7 @@ public class PropertyDataDefinitionTest { result = testSubject.isPassword(); } - + @Test public void testSetPassword() throws Exception { PropertyDataDefinition testSubject; @@ -219,7 +319,7 @@ public class PropertyDataDefinitionTest { testSubject.setPassword(password); } - + @Test public void testGetUniqueId() throws Exception { PropertyDataDefinition testSubject; @@ -230,7 +330,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getUniqueId(); } - + @Test public void testSetUniqueId() throws Exception { PropertyDataDefinition testSubject; @@ -241,7 +341,7 @@ public class PropertyDataDefinitionTest { testSubject.setUniqueId(uniqueId); } - + @Test public void testGetSchema() throws Exception { PropertyDataDefinition testSubject; @@ -252,7 +352,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getSchema(); } - + @Test public void testSetSchema() throws Exception { PropertyDataDefinition testSubject; @@ -263,7 +363,7 @@ public class PropertyDataDefinitionTest { testSubject.setSchema(entrySchema); } - + @Test public void testGetLabel() throws Exception { PropertyDataDefinition testSubject; @@ -274,7 +374,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getLabel(); } - + @Test public void testSetLabel() throws Exception { PropertyDataDefinition testSubject; @@ -285,7 +385,7 @@ public class PropertyDataDefinitionTest { testSubject.setLabel(label); } - + @Test public void testIsHidden() throws Exception { PropertyDataDefinition testSubject; @@ -296,7 +396,7 @@ public class PropertyDataDefinitionTest { result = testSubject.isHidden(); } - + @Test public void testSetHidden() throws Exception { PropertyDataDefinition testSubject; @@ -307,7 +407,7 @@ public class PropertyDataDefinitionTest { testSubject.setHidden(hidden); } - + @Test public void testIsImmutable() throws Exception { PropertyDataDefinition testSubject; @@ -318,7 +418,7 @@ public class PropertyDataDefinitionTest { result = testSubject.isImmutable(); } - + @Test public void testSetImmutable() throws Exception { PropertyDataDefinition testSubject; @@ -329,7 +429,7 @@ public class PropertyDataDefinitionTest { testSubject.setImmutable(immutable); } - + @Test public void testGetParentUniqueId() throws Exception { PropertyDataDefinition testSubject; @@ -340,7 +440,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getParentUniqueId(); } - + @Test public void testSetParentUniqueId() throws Exception { PropertyDataDefinition testSubject; @@ -351,7 +451,7 @@ public class PropertyDataDefinitionTest { testSubject.setParentUniqueId(parentUniqueId); } - + @Test public void testGetGetInputValues() throws Exception { PropertyDataDefinition testSubject; @@ -362,7 +462,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getGetInputValues(); } - + @Test public void testSetGetInputValues() throws Exception { PropertyDataDefinition testSubject; @@ -373,7 +473,7 @@ public class PropertyDataDefinitionTest { testSubject.setGetInputValues(getInputValues); } - + @Test public void testGetStatus() throws Exception { PropertyDataDefinition testSubject; @@ -384,7 +484,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getStatus(); } - + @Test public void testSetStatus() throws Exception { PropertyDataDefinition testSubject; @@ -395,7 +495,7 @@ public class PropertyDataDefinitionTest { testSubject.setStatus(status); } - + @Test public void testGetInputId() throws Exception { PropertyDataDefinition testSubject; @@ -406,7 +506,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getInputId(); } - + @Test public void testSetInputId() throws Exception { PropertyDataDefinition testSubject; @@ -417,7 +517,7 @@ public class PropertyDataDefinitionTest { testSubject.setInputId(inputId); } - + @Test public void testGetInstanceUniqueId() throws Exception { PropertyDataDefinition testSubject; @@ -428,7 +528,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getInstanceUniqueId(); } - + @Test public void testSetInstanceUniqueId() throws Exception { PropertyDataDefinition testSubject; @@ -439,7 +539,7 @@ public class PropertyDataDefinitionTest { testSubject.setInstanceUniqueId(instanceUniqueId); } - + @Test public void testGetPropertyId() throws Exception { PropertyDataDefinition testSubject; @@ -450,7 +550,7 @@ public class PropertyDataDefinitionTest { result = testSubject.getPropertyId(); } - + @Test public void testSetPropertyId() throws Exception { PropertyDataDefinition testSubject; @@ -461,7 +561,7 @@ public class PropertyDataDefinitionTest { testSubject.setPropertyId(propertyId); } - + @Test public void testToString() throws Exception { PropertyDataDefinition testSubject; @@ -472,7 +572,7 @@ public class PropertyDataDefinitionTest { result = testSubject.toString(); } - + @Test public void testHashCode() throws Exception { PropertyDataDefinition testSubject; @@ -483,7 +583,7 @@ public class PropertyDataDefinitionTest { result = testSubject.hashCode(); } - + @Test public void testEquals() throws Exception { PropertyDataDefinition testSubject; @@ -500,7 +600,7 @@ public class PropertyDataDefinitionTest { result = testSubject.equals(createTestSubject()); Assert.assertEquals(true, result); } - + @Test public void testConvertPropertyDataToInstancePropertyData() throws Exception { PropertyDataDefinition testSubject; @@ -509,7 +609,7 @@ public class PropertyDataDefinitionTest { testSubject = createTestSubject(); testSubject.convertPropertyDataToInstancePropertyData(); } - + @Test public void testTypeEquals() throws Exception { PropertyDataDefinition testSubject; @@ -520,7 +620,7 @@ public class PropertyDataDefinitionTest { testSubject.typeEquals(null); testSubject.typeEquals(createTestSubject()); } - + @Test public void testMergeFunction() throws Exception { PropertyDataDefinition testSubject; @@ -528,5 +628,6 @@ public class PropertyDataDefinitionTest { // default test testSubject = createTestSubject(); testSubject.mergeFunction(createTestSubject(), false); + } -}
\ No newline at end of file +} diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyRuleTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyRuleTest.java index f65330e22a..95d2ccd117 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyRuleTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyRuleTest.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.LinkedList; -import java.util.List; - import org.junit.Assert; import org.junit.Test; +import java.util.LinkedList; +import java.util.List; + public class PropertyRuleTest { private PropertyRule createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinitionTest.java index 7c1f18a603..71723fb9c0 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinitionTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; - import org.junit.Test; +import java.util.List; + public class RelationshipInstDataDefinitionTest { private RelationshipInstDataDefinition createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java index 2965e07f7e..1f4da5b5b1 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; - import org.junit.Assert; import org.junit.Test; +import java.util.List; + public class RequirementDataDefinitionTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinitionTest.java index 53b9b8d6f9..d50828e360 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinitionTest.java @@ -1,13 +1,14 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - import org.apache.commons.collections.map.HashedMap; import org.junit.Assert; import org.junit.Test; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + public class SchemaDefinitionTest { private SchemaDefinition createTestSubject() { @@ -112,6 +113,7 @@ public class SchemaDefinitionTest { // default test testSubject = createTestSubject(); + testSubject.setProperties(new HashMap<>() ); testSubject.addProperty("mock", property); } diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnumTest.java index ef02c72c91..3b6a1f604b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnumTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnumTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.enums; -import javax.annotation.Generated; - import org.junit.Test; public class ComponentFieldsEnumTest { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnumTest.java index 66147dc1bf..8c72843707 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnumTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnumTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.enums; -import java.util.List; - import org.junit.Test; +import java.util.List; + public class FilterKeyEnumTest { private FilterKeyEnum createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java index 74bcf172e8..e59d306a9f 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.datatypes.enums; -import java.util.List; - import org.junit.Test; +import java.util.List; + public class GraphPropertyEnumTest { private GraphPropertyEnum createTestSubject() { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java index 07eb1aefb0..dbe17e6968 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java @@ -20,11 +20,12 @@ package org.openecomp.sdc.be.utils; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import org.junit.Test; - public class CommonBeUtilsTest { @Test @@ -43,7 +44,7 @@ public class CommonBeUtilsTest { public void testConformanceLevelCompare() { assertTrue(CommonBeUtils.conformanceLevelCompare("1.1", "0.15") > 0); - assertTrue(CommonBeUtils.conformanceLevelCompare("0.5", "0.5") == 0); + assertEquals(0, CommonBeUtils.conformanceLevelCompare("0.5", "0.5")); assertTrue(CommonBeUtils.conformanceLevelCompare("0.5", "0.6") < 0); assertTrue(CommonBeUtils.conformanceLevelCompare("1.5", "2.6") < 0); assertTrue(CommonBeUtils.conformanceLevelCompare("1.5", "1.5.3") < 0); |