diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2021-03-30 16:24:20 +0100 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-31 06:50:08 +0000 |
commit | a6aac79ddd1ceb9fc1529dab5fae66f7c7efffdb (patch) | |
tree | 67b719113d8b639c0f625373f23f8969b7c94941 /common-be/src | |
parent | f27bba9ad6e8afe8306cdcc4af4f595b1cfff49d (diff) |
Revert "Improve test coverage"
This reverts commit 1da764ea
Issue-ID: SDC-3540
Change-Id: I54b65e1d5323dcc680c5bb65fa1657b7adb6741d
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Diffstat (limited to 'common-be/src')
62 files changed, 1695 insertions, 497 deletions
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 a5e8ade5c4..e92a806032 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 @@ -17,28 +17,29 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor -@ToString +import java.util.List; + public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition { private String uniqueId; + private Long creationTime; + private Long modificationTime; + private Integer lastCreatedCounter = 0; - @ToString.Exclude + private List<AdditionalInfoParameterInfo> parameters; + public AdditionalInfoParameterDataDefinition() { + + } + public AdditionalInfoParameterDataDefinition(AdditionalInfoParameterDataDefinition p) { this.uniqueId = p.uniqueId; this.creationTime = p.creationTime; @@ -46,4 +47,51 @@ public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition { this.lastCreatedCounter = p.lastCreatedCounter; this.parameters = p.parameters; } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + 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; + } + + public Integer getLastCreatedCounter() { + return lastCreatedCounter; + } + + public void setLastCreatedCounter(Integer lastCreatedCounter) { + this.lastCreatedCounter = lastCreatedCounter; + } + + public List<AdditionalInfoParameterInfo> getParameters() { + return parameters; + } + + public void setParameters(List<AdditionalInfoParameterInfo> parameters) { + this.parameters = parameters; + } + + @Override + public String toString() { + return "AdditionalInfoParameterDataDefinition [uniqueId=" + uniqueId + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + ", lastCreatedCounter=" + lastCreatedCounter + "]"; + } + } 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 dc6a07206a..9b9cc497ad 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 @@ -17,28 +17,59 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor -@ToString -@AllArgsConstructor public class AdditionalInfoParameterInfo extends ToscaDataDefinition { private String uniqueId; private String key; private String value; + public AdditionalInfoParameterInfo() { + super(); + } + public AdditionalInfoParameterInfo(String key, String value) { this.key = key; this.value = value; } + + public AdditionalInfoParameterInfo(String uniqueId, String key, String value) { + this.uniqueId = uniqueId; + this.key = key; + this.value = value; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public String toString() { + return "AdditionalInfoParameterInfo [uniqueId=" + uniqueId + ", key=" + key + ", 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 index d24c6d77dd..d77c906243 100644 --- 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 @@ -17,28 +17,69 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import java.util.List; import java.util.Map; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@EqualsAndHashCode(onlyExplicitlyIncluded = true) -public class Annotation { +import java.util.Objects; - @EqualsAndHashCode.Include +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 index 7803690dac..8eba3125e3 100644 --- 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 @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import lombok.Getter; @@ -32,13 +33,13 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class AnnotationTypeDataDefinition extends ToscaDataDefinition { protected String uniqueId; - @ToString.Exclude protected String type; + protected String version; + protected boolean highestVersion; protected String description; + protected Long creationTime; protected Long modificationTime; - protected String version; - protected boolean highestVersion; public AnnotationTypeDataDefinition(AnnotationTypeDataDefinition other) { uniqueId = other.uniqueId; 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 b71a95a1fa..bc9bc3387f 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 @@ -17,14 +17,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; 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.util.ArrayList; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.common.api.ArtifactTypeEnum; public class ArtifactDataDefinition extends ToscaDataDefinition { @@ -38,6 +40,7 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { setArtifactVersion("0"); } + public ArtifactDataDefinition(ArtifactDataDefinition a) { this.setUniqueId(a.getUniqueId()); this.setArtifactType(a.getArtifactType()); @@ -75,30 +78,31 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { } this.setGeneratedFromId(a.getGeneratedFromId()); this.setIsFromCsar(a.getIsFromCsar()); + + } public String getArtifactName() { return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - public void setArtifactName(String artifactName) { - setToscaPresentationValue(JsonPresentationFields.NAME, artifactName); } public String getArtifactType() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE); } + public boolean isHeatEnvType() { + return ArtifactTypeEnum.HEAT_ENV.getType().equals(getArtifactType()); + } + public void setArtifactType(String artifactType) { setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE, artifactType); - } - public boolean isHeatEnvType() { - return ArtifactTypeEnum.HEAT_ENV.getType().equals(getArtifactType()); } public String getArtifactRef() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF); + } public void setArtifactRef(String artifactRef) { @@ -107,12 +111,18 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { public String getArtifactRepository() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY); + } public void setArtifactRepository(String artifactRepository) { setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY, artifactRepository); } + public void setArtifactName(String artifactName) { + setToscaPresentationValue(JsonPresentationFields.NAME, artifactName); + + } + public String getArtifactChecksum() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM); } @@ -122,6 +132,7 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { } public String getUserIdCreator() { + return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR); } @@ -197,14 +208,14 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { return (String) getToscaPresentationValue(JsonPresentationFields.ES_ID); } - public void setEsId(String esId) { - setToscaPresentationValue(JsonPresentationFields.ES_ID, esId); - } - public boolean hasNoMandatoryEsId() { return getEsId() == null && getMandatory(); } + public void setEsId(String esId) { + setToscaPresentationValue(JsonPresentationFields.ES_ID, esId); + } + public String getArtifactCreator() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR); } @@ -340,10 +351,6 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { return (String) getToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID); } - public void setGeneratedFromId(String generatedFromId) { - setToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID, generatedFromId); - } - public boolean getIsFromCsar() { Boolean isFromCsar = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR); return isFromCsar == null ? Boolean.FALSE : isFromCsar; @@ -353,23 +360,25 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, isFromCsar); } + public void setGeneratedFromId(String generatedFromId) { + setToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID, generatedFromId); + } + + @Override public String toString() { - return "ArtifactDataDefinition [uniqueId=" + getUniqueId() + ", artifactType=" + getArtifactType() + ", artifactRef=" + getArtifactRef() - + ", artifactName=" + getArtifactName() + ", artifactRepository=" + getArtifactRepository() + ", artifactChecksum=" - + getArtifactChecksum() + ", userIdCreator=" + getUserIdCreator() + ", userIdLastUpdater=" + getUserIdLastUpdater() + ", creatorFullName=" - + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate() + ", lastUpdateDate=" - + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator=" + getArtifactCreator() - + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName=" + getArtifactDisplayName() - + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType=" + getArtifactGroupType() + ", timeout=" - + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID=" + getArtifactUUID() + ", payloadUpdateDate=" - + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts=" + getRequiredArtifacts() + "]"; + return "ArtifactDataDefinition [uniqueId=" + getUniqueId() + ", artifactType=" + getArtifactType() + ", artifactRef=" + getArtifactRef() + ", artifactName=" + getArtifactName() + ", artifactRepository=" + getArtifactRepository() + ", artifactChecksum=" + + getArtifactChecksum() + ", userIdCreator=" + getUserIdCreator() + ", userIdLastUpdater=" + getUserIdLastUpdater() + ", creatorFullName=" + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate() + + ", lastUpdateDate=" + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator=" + getArtifactCreator() + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName=" + + getArtifactDisplayName() + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType=" + getArtifactGroupType() + ", timeout=" + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID=" + getArtifactUUID() + + ", payloadUpdateDate=" + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts=" + getRequiredArtifacts() + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; + String apiUrl = getApiUrl(); String artifactChecksum = getArtifactChecksum(); String artifactCreator = getArtifactCreator(); @@ -380,23 +389,27 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { String artifactRef = getArtifactRef(); String artifactRepository = getArtifactRepository(); String artifactType = getArtifactType(); + String artifactUUID = getArtifactUUID(); String artifactVersion = getArtifactVersion(); String userIdCreator = getUserIdCreator(); String userIdLastUpdater = getUserIdLastUpdater(); Long creationDate = getCreationDate(); + String creatorFullName = getCreatorFullName(); String description = getDescription(); String esId = getEsId(); Long heatParamsUpdateDate = getHeatParamsUpdateDate(); Long lastUpdateDate = getLastUpdateDate(); Boolean mandatory = getMandatory(); + Long payloadUpdateDate = getPayloadUpdateDate(); List<String> requiredArtifacts = getRequiredArtifacts(); Boolean serviceApi = getServiceApi(); Integer timeout = getTimeout(); String uniqueId = getUniqueId(); String updaterFullName = getUpdaterFullName(); + result = prime * result + ((apiUrl == null) ? 0 : apiUrl.hashCode()); result = prime * result + ((artifactChecksum == null) ? 0 : artifactChecksum.hashCode()); result = prime * result + ((artifactCreator == null) ? 0 : artifactCreator.hashCode()); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java index c16efe9c65..ea693efe40 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @NoArgsConstructor public class AttributeDataDefinition extends ToscaDataDefinition { - private List<GetOutputValueDataDefinition> getOutputValues; + private transient List<GetOutputValueDataDefinition> getOutputValues; private String outputId; private String value; private String outputPath; @@ -81,6 +81,14 @@ public class AttributeDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(final String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + @Override public String getType() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java index 14becbf647..22055e0620 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java @@ -16,10 +16,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 CINodeFilterDataDefinition extends ToscaDataDefinition implements Serializable { @JsonCreator @@ -35,16 +36,17 @@ public class CINodeFilterDataDefinition extends ToscaDataDefinition implements S this.setCapabilities(inData.getCapabilities()); } - public Object getTosca_id() { - return getToscaPresentationValue(JsonPresentationFields.TOSCA_ID); - } - public void setTosca_id(Object tosca_id) { setToscaPresentationValue(JsonPresentationFields.TOSCA_ID, tosca_id); } + public Object getTosca_id() { + return getToscaPresentationValue(JsonPresentationFields.TOSCA_ID); + } + public ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> getProperties() { - return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES); + return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue( + JsonPresentationFields.PROPERTIES); } public void setProperties(ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> properties) { @@ -53,13 +55,21 @@ public class CINodeFilterDataDefinition extends ToscaDataDefinition implements S public ListDataDefinition<RequirementNodeFilterCapabilityDataDefinition> getCapabilities() { return (ListDataDefinition<RequirementNodeFilterCapabilityDataDefinition>) getToscaPresentationValue( - JsonPresentationFields.NODE_FILTER_CAPABILITIES); + JsonPresentationFields.NODE_FILTER_CAPABILITIES); } public void setCapabilities(ListDataDefinition<RequirementNodeFilterCapabilityDataDefinition> capabilities) { setToscaPresentationValue(JsonPresentationFields.NODE_FILTER_CAPABILITIES, capabilities); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public String getID() { return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } @@ -67,4 +77,6 @@ public class CINodeFilterDataDefinition extends ToscaDataDefinition implements S public void setID(String name) { setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, name); } + + } 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 92bfe593b4..78bfe50d5c 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 @@ -17,14 +17,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.List; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.util.ArrayList; +import java.util.List; + /** * Represents the capability of the component or component instance */ @@ -54,27 +56,32 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { 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()); } @@ -161,6 +168,14 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public String getParentName() { return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME); } @@ -177,12 +192,10 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME, previousName); } - @Override public String getType() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } - @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } @@ -205,23 +218,23 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { 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 setPath(List<String> path) { - setToscaPresentationValue(JsonPresentationFields.PATH, path); + public void setSource(String source) { + setToscaPresentationValue(JsonPresentationFields.SOURCE, source); } public String getSource() { return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); } - public void setSource(String source) { - setToscaPresentationValue(JsonPresentationFields.SOURCE, source); - } - /** * Adds the element to the path avoiding duplication * @@ -238,10 +251,12 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { 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(); @@ -249,12 +264,14 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { 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()); @@ -262,6 +279,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { 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()); @@ -273,6 +291,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { @Override public boolean equals(Object obj) { + String uniqueId = this.getUniqueId(); String description = this.getDescription(); String name = this.getName(); @@ -286,6 +305,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { String leftOccurrences = getLeftOccurrences(); List<String> path = this.getPath(); String source = getSource(); + if (this == obj) { return true; } @@ -401,19 +421,29 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { 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 + "]"; + + + 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 + "]"; } public enum OwnerType { - GROUP("group"), COMPONENT_INSTANCE("component instance"), RESOURCE("resource"); + GROUP("group"), + COMPONENT_INSTANCE("component instance"), + RESOURCE("resource"); + private String value; OwnerType(String value) { this.value = value; } + public String getValue() { + return value; + } + public static OwnerType getByValue(String value) { for (OwnerType type : values()) { if (type.getValue().equals(value)) { @@ -423,8 +453,6 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { return null; } - public String getValue() { - return value; - } } + } 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 9369616710..36b3f0d9bc 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 @@ -17,14 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; -import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@NoArgsConstructor +import java.util.List; + public class CapabilityTypeDataDefinition extends ToscaDataDefinition { public CapabilityTypeDataDefinition(CapabilityTypeDataDefinition cdt) { @@ -37,6 +37,10 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition { this.setModificationTime(cdt.getModificationTime()); } + public CapabilityTypeDataDefinition() { + super(); + } + public String getUniqueId() { return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } @@ -53,12 +57,10 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } - @Override public String getType() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } - @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } @@ -71,7 +73,6 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); } - @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -105,7 +106,10 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition { String version = getVersion(); Long creationTime = getCreationTime(); Long modificationTime = getModificationTime(); - return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes=" - + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; + + return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + + ", validSourceTypes=" + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + "]"; } + } 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 46e6687cd6..afcc0e6d9f 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 @@ -17,14 +17,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; @@ -32,6 +27,13 @@ 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.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + public class ComponentInstanceDataDefinition extends ToscaDataDefinition { public ComponentInstanceDataDefinition() { @@ -99,17 +101,17 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { public void setModificationTime(Long modificationTime) { setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); - } + } - public CreatedFrom getCreatedFrom() { - String createdFrom = (String) getToscaPresentationValue(JsonPresentationFields.CREATED_FROM); - return Objects.nonNull(createdFrom) ? CreatedFrom.valueOf(createdFrom) : null; - } + public CreatedFrom getCreatedFrom() { + String createdFrom = (String) getToscaPresentationValue(JsonPresentationFields.CREATED_FROM); + return Objects.nonNull(createdFrom) ? CreatedFrom.valueOf(createdFrom) : null; + } - public void setCreatedFrom(CreatedFrom createdFrom) { - if (Objects.nonNull(createdFrom)) { - setToscaPresentationValue(JsonPresentationFields.CREATED_FROM, createdFrom.name()); - } + public void setCreatedFrom(CreatedFrom createdFrom) { + if (Objects.nonNull(createdFrom)){ + setToscaPresentationValue(JsonPresentationFields.CREATED_FROM, createdFrom.name()); + } } public String getDescription() { @@ -144,6 +146,10 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, resourceUid); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + public void setName(String name) { if (this.getInvariantName() == null && name != null) { this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name)); @@ -179,6 +185,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { OriginTypeEnum originType = null; String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE); if (origType != null && !origType.isEmpty()) { + originType = OriginTypeEnum.findByValue(origType); } return originType; @@ -226,10 +233,6 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION); } - public void setComponentVersion(String resourceVersion) { - setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion); - } - public String getToscaComponentName() { return (String) getToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME); } @@ -238,41 +241,40 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME, toscaComponentName); } - public String getSourceModelUuid() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); + public void setComponentVersion(String resourceVersion) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion); } public void setSourceModelUuid(String targetModelUuid) { setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid); } - public String getSourceModelUid() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); - } - public void setSourceModelUid(String targetModelUid) { setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid); } - public String getSourceModelName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); - } - public void setSourceModelName(String targetModelName) { setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName); } - public String getSourceModelInvariant() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); - } - public void setSourceModelInvariant(String targetModelInvariant) { setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant); } - public Boolean getIsProxy() { - Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY); - return (isProxy != null) ? isProxy : false; + public String getSourceModelUuid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); + } + + public String getSourceModelUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); + } + + public String getSourceModelName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); + } + + public String getSourceModelInvariant() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); } public void setIsProxy(Boolean isProxy) { @@ -283,6 +285,11 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { } } + public Boolean getIsProxy() { + Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY); + return (isProxy != null) ? isProxy : false; + } + public Boolean isServiceSubstitution() { return getOriginType() == OriginTypeEnum.ServiceSubstitution; } @@ -306,12 +313,12 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives); } - public Map<String, ToscaArtifactDataDefinition> getToscaArtifacts() { - return (Map<String, ToscaArtifactDataDefinition>) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS); + public Map<String, ToscaArtifactDataDefinition> getToscaArtifacts() { + return ( Map<String, ToscaArtifactDataDefinition>) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS); } - public void setToscaArtifacts(Map<String, ToscaArtifactDataDefinition> artifacts) { - if (artifacts == null) { + public void setToscaArtifacts(Map<String, ToscaArtifactDataDefinition> artifacts) { + if (artifacts == null){ artifacts = new HashMap<>(); } setToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS, artifacts); @@ -331,12 +338,15 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { @Override public String toString() { - return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" + getName() + ", normalizedName=" - + getNormalizedName() + ", componentUid=" + getComponentUid() + ", creationTime=" + getCreationTime() + ", modificationTime=" - + getModificationTime() + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() + ", propertyValueCounter=" - + getPropertyValueCounter() + ", attributeValueCounter=" + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() - + ", originType=" + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + getComponentName() - + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" + getToscaComponentName() + ", directives =" - + getDirectivesString() + "]"; + return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" + + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid() + + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime() + + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() + + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter=" + + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType=" + + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" + + getToscaComponentName() + ", directives =" + getDirectivesString() + "]"; } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java index 5a3c8921fd..b40bd3965d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java @@ -19,11 +19,12 @@ */ package org.openecomp.sdc.be.datatypes.elements; -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 java.util.HashMap; +import java.util.Map; + public class CompositionDataDefinition extends ToscaDataDefinition { public Map<String, ComponentInstanceDataDefinition> getComponentInstances() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java index 1bf19c0043..f92e4727ae 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java @@ -24,6 +24,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.builder.HashCodeExclude; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @Getter 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 8220ebfc1c..7baf8c8f3f 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 @@ -19,13 +19,14 @@ */ package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.util.List; + @Getter @Setter @NoArgsConstructor diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java new file mode 100644 index 0000000000..36e3452e53 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.sdc.tosca.datatypes.model.Constraint; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class EntrySchemaDataDefinition extends ToscaDataDefinition { + + private String description; + private String type; + private List<Constraint> constraints; + +} 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 4f28aee1ad..c57deff8f2 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 @@ -19,6 +19,9 @@ */ package org.openecomp.sdc.be.datatypes.elements; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + 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; @@ -27,17 +30,17 @@ import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_P 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 org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - public class ForwardingPathDataDefinition extends ToscaDataDefinition { @JsonCreator public ForwardingPathDataDefinition() { + super(); } public ForwardingPathDataDefinition(String name) { + super(); setName(name); + } public ForwardingPathDataDefinition(ForwardingPathDataDefinition path) { 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 42e9c78313..52e653d3f9 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 @@ -17,22 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.google.common.base.MoreObjects; -import java.util.Objects; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { +import java.util.Objects; +public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { @JsonCreator public ForwardingPathElementDataDefinition() { + super(); } - public ForwardingPathElementDataDefinition(String fromNode, String toNode, String fromCPName, String toCPName, String fromCPOriginId, - String toCPOriginId) { + public ForwardingPathElementDataDefinition(String fromNode, String toNode, String fromCPName, String toCPName, String fromCPOriginId, String toCPOriginId) { super(); setFromNode(fromNode); setToNode(toNode); @@ -109,8 +110,8 @@ public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { return false; } ForwardingPathElementDataDefinition that = (ForwardingPathElementDataDefinition) o; - return Objects.equals(getFromNode(), that.getFromNode()) && Objects.equals(getToNode(), that.getToNode()) && Objects - .equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId()); + return Objects.equals(getFromNode(), that.getFromNode()) && Objects.equals(getToNode(), that.getToNode()) + && Objects.equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId()); } @Override @@ -120,7 +121,9 @@ public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { @Override public String toString() { - return MoreObjects.toStringHelper(this).add("fromNode", getFromNode()).add("toNode", getToNode()).add("fromCPOriginId", getFromCPOriginId()) - .add("toCPOriginId", getToCPOriginId()).add("fromCPName", getFromCP()).add("toCPName", getToCP()).toString(); + return MoreObjects.toStringHelper(this) + .add("fromNode", getFromNode()).add("toNode", getToNode()) + .add("fromCPOriginId", getFromCPOriginId()).add("toCPOriginId", getToCPOriginId()) + .add("fromCPName", getFromCP()).add("toCPName", getToCP()).toString(); } } 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 df0c105999..010840eaee 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 @@ -17,32 +17,27 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import java.util.Map; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor -@EqualsAndHashCode -@ToString +import java.util.Map; + public class GetInputValueDataDefinition extends ToscaDataDefinition { private String propName; private String inputName; - @EqualsAndHashCode.Exclude - @ToString.Exclude private String inputId; private Integer indexValue; private GetInputValueDataDefinition getInputIndex; + private boolean isList = false; + public GetInputValueDataDefinition() { + super(); + } + public GetInputValueDataDefinition(Map<String, Object> pr) { super(pr); } @@ -54,5 +49,120 @@ public class GetInputValueDataDefinition extends ToscaDataDefinition { this.setIndexValue(p.getIndexValue()); this.setGetInputIndex(p.getGetInputIndex()); this.setList(p.isList()); + + + } + + public String getPropName() { + return propName; + } + + public void setPropName(String propName) { + this.propName = propName; + } + + public String getInputName() { + return inputName; + } + + public void setInputName(String inputName) { + this.inputName = inputName; + } + + public Integer getIndexValue() { + return indexValue; + } + + public void setIndexValue(Integer indexValue) { + this.indexValue = indexValue; } + + public GetInputValueDataDefinition getGetInputIndex() { + return getInputIndex; + } + + public void setGetInputIndex(GetInputValueDataDefinition getInputIndex) { + this.getInputIndex = getInputIndex; + } + + public boolean isList() { + return isList; + } + + public void setList(boolean isList) { + this.isList = isList; + } + + + public String getInputId() { + return inputId; + } + + public void setInputId(String inputId) { + this.inputId = inputId; + } + + @Override + public String toString() { + return "GetInputValueDataDefinition [propName=" + propName + ", inputName=" + inputName + ", indexValue=" + indexValue + ", getInputIndex=" + getInputIndex + ", isList=" + isList + "]"; + } + + @Override + public int hashCode() { + final int hashingNumerList = 1231; + final int hashingNumerNoList = 1237; + final int prime = 31; + int result = 1; + result = prime * result + ((getInputIndex == null) ? 0 : getInputIndex.hashCode()); + result = prime * result + ((indexValue == null) ? 0 : indexValue.hashCode()); + result = prime * result + ((inputName == null) ? 0 : inputName.hashCode()); + result = prime * result + (isList ? hashingNumerList : hashingNumerNoList); + result = prime * result + ((propName == null) ? 0 : propName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + GetInputValueDataDefinition other = (GetInputValueDataDefinition) obj; + if (getInputIndex == null) { + if (other.getInputIndex != null) { + return false; + } + } else if (!getInputIndex.equals(other.getInputIndex)) { + return false; + } + if (indexValue == null) { + if (other.indexValue != null) { + return false; + } + } else if (!indexValue.equals(other.indexValue)) { + return false; + } + if (inputName == null) { + if (other.inputName != null) { + return false; + } + } else if (!inputName.equals(other.inputName)) { + return false; + } + if (isList != other.isList) { + return false; + } + if (propName == null) { + return other.propName == null; + } else { + return propName.equals(other.propName); + } + } + + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetOutputValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetOutputValueDataDefinition.java index a3d32c6dfa..a295489875 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetOutputValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetOutputValueDataDefinition.java @@ -22,14 +22,12 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; import lombok.EqualsAndHashCode; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @Getter @Setter -@NoArgsConstructor @EqualsAndHashCode @ToString public class GetOutputValueDataDefinition extends ToscaDataDefinition { @@ -41,6 +39,10 @@ public class GetOutputValueDataDefinition extends ToscaDataDefinition { private GetOutputValueDataDefinition getOutputIndex; private boolean isList; + public GetOutputValueDataDefinition() { + super(); + } + public GetOutputValueDataDefinition(Map<String, Object> pr) { super(pr); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java index 3393a79e20..39745443a3 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java @@ -21,15 +21,12 @@ package org.openecomp.sdc.be.datatypes.elements; import lombok.EqualsAndHashCode; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; @Getter @Setter -@NoArgsConstructor @EqualsAndHashCode public class GetPolicyValueDataDefinition { - private String policyId; private String propertyName; private String origPropertyValue; 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 ec92ae6bf0..ad61426583 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 @@ -17,32 +17,31 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.be.datatypes.elements; -import static java.util.Collections.emptyMap; +package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonInclude; +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.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor -public class GroupDataDefinition extends ToscaDataDefinition { +import static java.util.Collections.emptyMap; + +public class GroupDataDefinition extends ToscaDataDefinition { @JsonInclude private String typeUid; @JsonInclude private Integer propertyValueCounter = 0; + public GroupDataDefinition() { + } + public GroupDataDefinition(Map<String, Object> gr) { super(gr); propertyValueCounter = 0; @@ -59,12 +58,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { 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())); } @@ -74,6 +75,15 @@ public class GroupDataDefinition extends ToscaDataDefinition { 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; @@ -100,17 +110,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } - @Override public String getType() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } - @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } - @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -135,6 +142,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { 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); } @@ -147,10 +162,6 @@ public class GroupDataDefinition extends ToscaDataDefinition { return (Map<String, String>) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER); } - public void setMembers(Map<String, String> members) { - setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); - } - //this is used by GroupCompositionMixin public Map<String, String> resolveMembersList() { Map<String, String> members = getMembers(); @@ -158,6 +169,11 @@ public class GroupDataDefinition extends ToscaDataDefinition { return members; } return emptyMap(); + + } + + public void setMembers(Map<String, String> members) { + setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); } public List<String> getArtifacts() { @@ -184,6 +200,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { 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()); } @@ -194,13 +218,13 @@ public class GroupDataDefinition extends ToscaDataDefinition { @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() + "]"; + 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 82305a60c3..e471265761 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 @@ -19,16 +19,19 @@ */ 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.util.ArrayList; import java.util.List; import java.util.Map; -import lombok.NoArgsConstructor; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@NoArgsConstructor public class GroupInstanceDataDefinition extends ToscaDataDefinition { + public GroupInstanceDataDefinition() { + super(); + } + public GroupInstanceDataDefinition(Map<String, Object> gi) { super(gi); } @@ -75,6 +78,14 @@ public class GroupInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public String getNormalizedName() { return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME); } @@ -155,12 +166,10 @@ public class GroupInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); } - @Override public String getType() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } - @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } @@ -173,7 +182,6 @@ public class GroupInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, groupUUID); } - @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } 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 0bc318238f..19f88b3196 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 @@ -17,19 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import java.util.List; import java.util.Map; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@ToString + public class GroupTypeDataDefinition extends ToscaTypeDataDefinition { private String uniqueId; @@ -39,15 +32,20 @@ public class GroupTypeDataDefinition extends ToscaTypeDataDefinition { private Map<String, String> metadata; private String description; private boolean highestVersion; + /** * Timestamp of data type creation */ private Long creationTime; + /** * Timestamp of the data type last update */ private Long modificationTime; + public GroupTypeDataDefinition() { + } + public GroupTypeDataDefinition(GroupTypeDataDefinition other) { super(other); this.uniqueId = other.uniqueId; @@ -60,4 +58,84 @@ public class GroupTypeDataDefinition extends ToscaTypeDataDefinition { this.highestVersion = other.highestVersion; this.derivedFrom = other.derivedFrom; } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public List<String> getMembers() { + return members; + } + + public void setMembers(List<String> members) { + this.members = members; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + 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 toString() { + return "GroupTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version=" + version + + ", members=" + members + ", metadata=" + metadata + ", description=" + description + ", creationTime=" + + creationTime + ", modificationTime=" + modificationTime + "]"; + } + + public String getDerivedFrom() { + return derivedFrom; + } + + public void setDerivedFrom(String derivedFrom) { + this.derivedFrom = derivedFrom; + } + + public boolean isHighestVersion() { + return highestVersion; + } + + public void setHighestVersion(boolean isLatestVersion) { + this.highestVersion = isLatestVersion; + } + } 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 aa9c7c88ae..da6e63d110 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 @@ -17,29 +17,25 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor -@EqualsAndHashCode -@ToString public class HeatParameterDataDefinition extends ToscaDataDefinition { private String uniqueId; + private String name; private String type; private String description; + private String currentValue; private String defaultValue; + public HeatParameterDataDefinition() { + } + public HeatParameterDataDefinition(HeatParameterDataDefinition hp) { this.uniqueId = hp.uniqueId; this.name = hp.name; @@ -48,4 +44,126 @@ public class HeatParameterDataDefinition extends ToscaDataDefinition { this.currentValue = hp.currentValue; this.defaultValue = hp.defaultValue; } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + 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 String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCurrentValue() { + return currentValue; + } + + public void setCurrentValue(String currentValue) { + this.currentValue = currentValue; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String toString() { + return "HeatParameterDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", type=" + type + + ", description=" + description + ", currentValue=" + currentValue + ", defaultValue=" + defaultValue + + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((currentValue == null) ? 0 : currentValue.hashCode()); + result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + HeatParameterDataDefinition other = (HeatParameterDataDefinition) obj; + if (currentValue == null) { + if (other.currentValue != null) { + return false; + } + } else if (!currentValue.equals(other.currentValue)) { + return false; + } + if (defaultValue == null) { + if (other.defaultValue != null) { + return false; + } + } else if (!defaultValue.equals(other.defaultValue)) { + return false; + } + if (description == null) { + if (other.description != null) { + return false; + } + } else if (!description.equals(other.description)) { + return false; + } + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + if (type == null) { + if (other.type != null) { + return false; + } + } else if (!type.equals(other.type)) { + return false; + } + if (uniqueId == null) { + return other.uniqueId == null; + } else { + return uniqueId.equals(other.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 38083837f2..0ebc9065dc 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 @@ -20,11 +20,13 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; -import lombok.NoArgsConstructor; -@NoArgsConstructor public class InputDataDefinition extends PropertyDataDefinition { + InputDataDefinition() { + super(); + } + InputDataDefinition(Map<String, Object> pr) { super(pr); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java index 23992ef319..3300c5dae0 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java @@ -17,18 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor public class InputsValueDataDefinition extends ToscaDataDefinition { - private String name; private String value; private String uniqueId; @@ -38,4 +32,33 @@ public class InputsValueDataDefinition extends ToscaDataDefinition { this.name = name; this.value = value; } + + public InputsValueDataDefinition() { + super(); + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } 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 0047765f76..b8237d3678 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 @@ -19,14 +19,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 { @@ -59,7 +60,6 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } - @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } @@ -88,10 +88,6 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME); } - public void setToscaResourceName(String toscaResourceName) { - setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName); - } - public Map<String, OperationDataDefinition> getOperations() { return (Map<String, OperationDataDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATIONS); } @@ -100,6 +96,10 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations); } + public void setToscaResourceName(String toscaResourceName) { + setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName); + } + public Long getCreationDate() { return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java index 5430c37f80..d5f4f3ccbb 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java @@ -13,20 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + 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.HashMap; import java.util.Map; import java.util.Objects; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class InterfaceInstanceDataDefinition extends ToscaDataDefinition implements Serializable { - public InterfaceInstanceDataDefinition(InterfaceInstanceDataDefinition inter) { + public InterfaceInstanceDataDefinition( + InterfaceInstanceDataDefinition inter) { this.toscaPresentation = null; - setInputs(inter.getInputs() == null ? new HashMap<String, Object>() : new HashMap<>(inter.getInputs())); + setInputs(inter.getInputs() == null ? new HashMap() : new HashMap<>(inter.getInputs())); setOperations(new HashMap<>(inter.getOperations())); } @@ -64,6 +67,8 @@ public class InterfaceInstanceDataDefinition extends ToscaDataDefinition impleme @Override public int hashCode() { + return Objects.hash(this.getInputs()); } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java index 720971795d..96a38ba926 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java @@ -21,10 +21,9 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.List; -import lombok.NoArgsConstructor; -@NoArgsConstructor public class ListCapabilityDataDefinition extends ListDataDefinition<CapabilityDataDefinition> { public ListCapabilityDataDefinition(ListCapabilityDataDefinition cdt) { @@ -36,6 +35,11 @@ public class ListCapabilityDataDefinition extends ListDataDefinition<CapabilityD super(listToscaDataDefinition); } + public ListCapabilityDataDefinition() { + super(); + + } + @JsonValue @Override public List<CapabilityDataDefinition> getListToscaDataDefinition() { 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 f28654e5fd..d23c1b16ad 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 @@ -20,14 +20,15 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition { @@ -75,8 +76,7 @@ public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaData Map<String, T> mapByName = listToMapByName(listToscaDataDefinition); List<T> otherList = ((ListDataDefinition) other).getListToscaDataDefinition(); for (T item : otherList) { - mapByName.merge((String) item.getToscaPresentationValue(JsonPresentationFields.NAME), item, - (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); + mapByName.merge((String) item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); } ((ListDataDefinition) other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList()); return other; @@ -101,8 +101,7 @@ public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaData list.forEach(e -> { String nameFromPrev = (String) e.getToscaPresentationValue(JsonPresentationFields.NAME); if (nameFromPrev != null) { - Optional<T> findAny = (Optional<T>) listToscaDataDefinition.stream() - .filter(o -> nameFromPrev.equals(e.getToscaPresentationValue(JsonPresentationFields.NAME))).findAny(); + Optional<T> findAny = (Optional<T>) listToscaDataDefinition.stream().filter(o -> nameFromPrev.equals(e.getToscaPresentationValue(JsonPresentationFields.NAME))).findAny(); if (findAny.isPresent()) { e.mergeFunction(findAny.get(), allowDefaultValueOverride); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java index 149a757e71..0acf8de34e 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java @@ -21,14 +21,9 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.List; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@NoArgsConstructor public class ListMapPropertiesDataDefinition extends ListDataDefinition<MapPropertiesDataDefinition> { public ListMapPropertiesDataDefinition(ListMapPropertiesDataDefinition cdt) { @@ -40,6 +35,11 @@ public class ListMapPropertiesDataDefinition extends ListDataDefinition<MapPrope super(listToscaDataDefinition); } + public ListMapPropertiesDataDefinition() { + super(); + + } + @JsonValue @Override public List<MapPropertiesDataDefinition> getListToscaDataDefinition() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java index 7dd699c52e..ad9064c0c7 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java @@ -21,10 +21,9 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.List; -import lombok.NoArgsConstructor; -@NoArgsConstructor public class ListRequirementDataDefinition extends ListDataDefinition<RequirementDataDefinition> { public ListRequirementDataDefinition(ListRequirementDataDefinition cdt) { @@ -36,6 +35,11 @@ public class ListRequirementDataDefinition extends ListDataDefinition<Requiremen super(listToscaDataDefinition); } + public ListRequirementDataDefinition() { + super(); + + } + @JsonValue @Override public List<RequirementDataDefinition> getListToscaDataDefinition() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java index ba174bd68a..ab54fcf226 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java @@ -17,18 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.Map; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@NoArgsConstructor public class MapArtifactDataDefinition extends MapDataDefinition<ArtifactDataDefinition> { private String parentName; @@ -43,13 +39,29 @@ public class MapArtifactDataDefinition extends MapDataDefinition<ArtifactDataDef super(mapToscaDataDefinition); } + public MapArtifactDataDefinition() { + super(); + + } + @JsonValue @Override public Map<String, ArtifactDataDefinition> getMapToscaDataDefinition() { return mapToscaDataDefinition; } + public void setMapToscaDataDefinition(Map<String, ArtifactDataDefinition> mapToscaDataDefinition) { this.mapToscaDataDefinition = mapToscaDataDefinition; } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapAttributesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapAttributesDataDefinition.java index 1425007a75..e34fad5ac8 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapAttributesDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapAttributesDataDefinition.java @@ -17,8 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; + import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; @@ -54,7 +56,6 @@ public class MapAttributesDataDefinition extends MapDataDefinition<AttributeData this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition); } - @JsonValue @Override public Map<String, AttributeDataDefinition> getMapToscaDataDefinition() { @@ -64,4 +65,5 @@ public class MapAttributesDataDefinition extends MapDataDefinition<AttributeData public void setMapToscaDataDefinition(Map<String, AttributeDataDefinition> mapToscaDataDefinition) { this.mapToscaDataDefinition = mapToscaDataDefinition; } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java index 89dd793ede..87edbbcfc7 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java @@ -21,17 +21,20 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.Map; -import lombok.NoArgsConstructor; -@NoArgsConstructor public class MapCapabilityProperty extends MapDataDefinition<MapPropertiesDataDefinition> { - @JsonCreator public MapCapabilityProperty(Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition) { super(mapToscaDataDefinition); } + public MapCapabilityProperty() { + super(); + + } + @JsonValue @Override public Map<String, MapPropertiesDataDefinition> getMapToscaDataDefinition() { 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 b90a406abb..727d43c622 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 @@ -19,18 +19,20 @@ */ 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.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; /** * Maps an object type (e.g. "monitoring", "workflows" etc) to a list of external references. - * <p> - * "monitoring" -> { "ref1", "ref2" }, "workflows" -> { "ref1", "ref2" } + * + * "monitoring" -> { "ref1", "ref2" }, + * "workflows" -> { "ref1", "ref2" } */ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { @@ -46,14 +48,14 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { return (Map<String, List<String>>) getToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF); } - public void setComponentInstanceExternalRefs(Map<String, List<String>> componentInstanceExternalRefs) { - setToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF, componentInstanceExternalRefs); - } - public List<String> getExternalRefsByObjectType(String objectType) { return ((Map<String, List<String>>) getToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF)).get(objectType); } + public void setComponentInstanceExternalRefs(Map<String, List<String>> componentInstanceExternalRefs) { + setToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF, componentInstanceExternalRefs); + } + /** * Adds a reference to the given object type. Will do nothing if already exist. * 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 4c5e17c87a..9801e3b83f 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 @@ -17,18 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + 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; + import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import lombok.NoArgsConstructor; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@NoArgsConstructor public class MapDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition { protected Map<String, T> mapToscaDataDefinition; @@ -36,6 +36,7 @@ public class MapDataDefinition<T extends ToscaDataDefinition> extends ToscaDataD public MapDataDefinition(MapDataDefinition<T> cdt) { super(); mapToscaDataDefinition = cdt.mapToscaDataDefinition; + } @JsonCreator @@ -44,6 +45,10 @@ public class MapDataDefinition<T extends ToscaDataDefinition> extends ToscaDataD this.mapToscaDataDefinition = mapToscaDataDefinition; } + public MapDataDefinition() { + super(); + } + @JsonValue public Map<String, T> getMapToscaDataDefinition() { return mapToscaDataDefinition; @@ -77,11 +82,14 @@ public class MapDataDefinition<T extends ToscaDataDefinition> extends ToscaDataD } } + public String findKeyByItemUidMatch(String uid) { if (null == mapToscaDataDefinition || uid == null) { return null; } - Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e -> e.getValue().findUidMatch(uid)).findAny().orElse(null); + Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e -> + e.getValue().findUidMatch(uid)) + .findAny().orElse(null); if (null == entry) { return null; } @@ -91,9 +99,12 @@ public class MapDataDefinition<T extends ToscaDataDefinition> extends ToscaDataD @Override public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { if (mapToscaDataDefinition != null) { - Map<String, T> collect = (Map<String, T>) mapToscaDataDefinition.entrySet().stream() - .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); + Map<String, T> collect = (Map<String, T>) mapToscaDataDefinition.entrySet() + .stream() + .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); + MapDataDefinition collectMap = new MapDataDefinition<>(collect); + mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId())); return (T) collectMap; } @@ -102,6 +113,7 @@ public class MapDataDefinition<T extends ToscaDataDefinition> extends ToscaDataD @Override public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { + Map<String, T> map = ((MapDataDefinition) other).getMapToscaDataDefinition(); if (map != null) { map.entrySet().forEach(e -> { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java index 34674bf66f..6b490a3505 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java @@ -17,18 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; + import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.Map; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@NoArgsConstructor public class MapGroupsDataDefinition extends MapDataDefinition<GroupInstanceDataDefinition> { private String parentName; @@ -43,13 +40,29 @@ public class MapGroupsDataDefinition extends MapDataDefinition<GroupInstanceData super(mapToscaDataDefinition); } + public MapGroupsDataDefinition() { + super(); + + } + @JsonValue @Override public Map<String, GroupInstanceDataDefinition> getMapToscaDataDefinition() { return mapToscaDataDefinition; } + public void setMapToscaDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) { this.mapToscaDataDefinition = mapToscaDataDefinition; } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java index 1b7c80b980..ef03ad7a4c 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java @@ -17,12 +17,15 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.Map; -import lombok.NoArgsConstructor; -@NoArgsConstructor public class MapInterfaceDataDefinition extends MapDataDefinition<InterfaceDataDefinition> { + public MapInterfaceDataDefinition() { + + } + @JsonCreator public MapInterfaceDataDefinition(Map<String, InterfaceDataDefinition> mapToscaDataDefinition) { super(mapToscaDataDefinition); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java index 1bb394d118..5d8f1cc396 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java @@ -21,11 +21,10 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.HashMap; import java.util.Map; -import lombok.NoArgsConstructor; -@NoArgsConstructor public class MapListCapabilityDataDefinition extends MapDataDefinition<ListCapabilityDataDefinition> { public MapListCapabilityDataDefinition(MapListCapabilityDataDefinition cdt) { @@ -37,6 +36,11 @@ public class MapListCapabilityDataDefinition extends MapDataDefinition<ListCapab super(mapToscaDataDefinition); } + public MapListCapabilityDataDefinition() { + super(); + + } + @JsonValue @Override public Map<String, ListCapabilityDataDefinition> getMapToscaDataDefinition() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java index b15135b096..79887738f9 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java @@ -21,11 +21,10 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.HashMap; import java.util.Map; -import lombok.NoArgsConstructor; -@NoArgsConstructor public class MapListRequirementDataDefinition extends MapDataDefinition<ListRequirementDataDefinition> { public MapListRequirementDataDefinition(MapListRequirementDataDefinition cdt) { @@ -37,6 +36,11 @@ public class MapListRequirementDataDefinition extends MapDataDefinition<ListRequ super(mapToscaDataDefinition); } + public MapListRequirementDataDefinition() { + super(); + + } + @JsonValue @Override public Map<String, ListRequirementDataDefinition> getMapToscaDataDefinition() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java index 8483b695af..075806a709 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java @@ -17,19 +17,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; + import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.util.HashMap; import java.util.Map; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@NoArgsConstructor public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataDefinition> { private String parentName; @@ -49,10 +46,13 @@ public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataD */ public MapPropertiesDataDefinition(MapPropertiesDataDefinition toBeDeepCopiedMapPropertiesDataDefinition) { this.parentName = toBeDeepCopiedMapPropertiesDataDefinition.parentName; - this.toscaPresentation = toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation == null ? null - : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation); - this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null - : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition); + this.toscaPresentation = toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation); + this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition); + } + + public MapPropertiesDataDefinition() { + super(); + } @JsonValue @@ -61,7 +61,18 @@ public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataD return mapToscaDataDefinition; } + public void setMapToscaDataDefinition(Map<String, PropertyDataDefinition> mapToscaDataDefinition) { this.mapToscaDataDefinition = mapToscaDataDefinition; } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + } 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 17b0131ec6..f93e41cf51 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 @@ -17,21 +17,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; +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 static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ASSOCIATION_TYPE; import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ID; import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_NAME; import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_VERSION; import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_VERSION_ID; -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; - public class OperationDataDefinition extends ToscaDataDefinition implements Serializable { + @JsonCreator public OperationDataDefinition() { super(); @@ -73,7 +76,8 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri } public ListDataDefinition<OperationInputDefinition> getInputs() { - return (ListDataDefinition<OperationInputDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUTS); + return (ListDataDefinition<OperationInputDefinition>) getToscaPresentationValue( + JsonPresentationFields.OPERATION_INPUTS); } public void setInputs(ListDataDefinition<OperationInputDefinition> inputs) { @@ -81,13 +85,18 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri } public ListDataDefinition<OperationOutputDefinition> getOutputs() { - return (ListDataDefinition<OperationOutputDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS); + return (ListDataDefinition<OperationOutputDefinition>) getToscaPresentationValue( + JsonPresentationFields.OPERATION_OUTPUTS); } public void setOutputs(ListDataDefinition<OperationOutputDefinition> outputs) { setToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS, outputs); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + public String getUniqueId() { return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } @@ -136,6 +145,10 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri setToscaPresentationValue(IO_WORKFLOW_ASSOCIATION_TYPE, workflowAssociationType); } + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public Long getCreationDate() { return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java index 6bc88b5c41..2364ff4e3b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java @@ -13,20 +13,49 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.openecomp.sdc.be.datatypes.elements; +import java.util.HashSet; import java.util.List; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@EqualsAndHashCode +import java.util.Objects; + public class OperationImplementation { private String primary; private List<String> dependencies; + + public String getPrimary() { + return primary; + } + + public void setPrimary(String primary) { + this.primary = primary; + } + + public List<String> getDependencies() { + return dependencies; + } + + public void setDependencies(List<String> dependencies) { + this.dependencies = dependencies; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof OperationImplementation)) { + return false; + } + OperationImplementation that = (OperationImplementation) o; + return Objects.equals(primary, that.primary) + && Objects.equals(new HashSet<>(dependencies), new HashSet<>(that.dependencies)); + } + + @Override + public int hashCode() { + return Objects.hash(primary, dependencies); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java index 3a91094028..0fcdd9ce36 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java @@ -15,15 +15,12 @@ */ package org.openecomp.sdc.be.datatypes.elements; + import com.fasterxml.jackson.annotation.JsonCreator; -import lombok.Getter; -import lombok.Setter; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -@Getter -@Setter -public class OperationInputDefinition extends InputDataDefinition { +public class OperationInputDefinition extends InputDataDefinition { private String source; private String sourceProperty; private String toscaDefaultValue; @@ -55,13 +52,35 @@ public class OperationInputDefinition extends InputDataDefinition { setType(type); } - @Override public String getLabel() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL); } - @Override public void setLabel(String name) { setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, name); } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getSourceProperty() { + return sourceProperty; + } + + public void setSourceProperty(String sourceProperty) { + this.sourceProperty = sourceProperty; + } + + public String getToscaDefaultValue() { + return toscaDefaultValue; + } + + public void setToscaDefaultValue(String toscaDefaultValue) { + this.toscaDefaultValue = toscaDefaultValue; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java index 7caedacd40..80c86d8d78 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java @@ -13,20 +13,49 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@EqualsAndHashCode -public class OperationInstance { +import java.util.Objects; +public class OperationInstance/* extends Operation*/ { private OperationImplementation implementation; private Map<String, Object> inputs; + + + public OperationImplementation getImplementation() { + return implementation; + } + + public void setImplementation(OperationImplementation implementation) { + this.implementation = implementation; + } + + public Map<String, Object> getInputs() { + return inputs; + } + + public void setInputs(Map<String, Object> inputs) { + this.inputs = inputs; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof OperationInstance)) { + return false; + } + OperationInstance that = (OperationInstance) o; + return Objects.equals(implementation, that.implementation) + && Objects.equals(inputs, that.inputs); + } + + @Override + public int hashCode() { + + return Objects.hash(implementation, 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 438b756925..cce56128bd 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 @@ -19,22 +19,41 @@ */ package org.openecomp.sdc.be.datatypes.elements; -import static java.util.Collections.emptyList; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import java.util.List; import java.util.Map; -import lombok.NoArgsConstructor; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; + +import static java.util.Collections.emptyList; /** - * public class representing the component policy, described by the next properties: - * <p> - * name uniqueId type (policy type name) typeUid (policy type uniqueId) version (version) derivedFrom (policy type derivedFrom) description policyUUID - * invariantUUID members metadata properties targets isFromCsar + * public class representing the component policy, + * described by the next properties: + * + * name + * uniqueId + * type (policy type name) + * typeUid (policy type uniqueId) + * version (version) + * derivedFrom (policy type derivedFrom) + * description + * policyUUID + * invariantUUID + * members + * metadata + * properties + * targets + * isFromCsar */ -@NoArgsConstructor public class PolicyDataDefinition extends PropertyDataDefinition { + /** + * public constructor by default + */ + public PolicyDataDefinition() { + super(); + } + public PolicyDataDefinition(PropertyDataDefinition propertyDataDefinition) { super(propertyDataDefinition); } @@ -80,11 +99,6 @@ public class PolicyDataDefinition extends PropertyDataDefinition { } } - public Boolean getIsFromCsar() { - Boolean isFromCsar = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR); - return (isFromCsar != null) ? isFromCsar : false; - } - private void setIsFromCsar(Boolean isFromCsar) { if (isFromCsar == null) { setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, false); @@ -93,6 +107,11 @@ public class PolicyDataDefinition extends PropertyDataDefinition { } } + 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); } @@ -125,7 +144,6 @@ public class PolicyDataDefinition extends PropertyDataDefinition { setToscaPresentationValue(JsonPresentationFields.TYPE_UNIQUE_ID, policyTypeUid); } - @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -142,12 +160,10 @@ public class PolicyDataDefinition extends PropertyDataDefinition { setToscaPresentationValue(JsonPresentationFields.DERIVED_FROM, derivedFrom); } - @Override public String getDescription() { return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); } - @Override public void setDescription(String description) { setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java index 3193d276da..30ad169a88 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java @@ -17,16 +17,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.be.datatypes.elements; -import lombok.AllArgsConstructor; -import lombok.Getter; +package org.openecomp.sdc.be.datatypes.elements; -@AllArgsConstructor public enum PolicyTargetType { - GROUPS("GROUPS"), COMPONENT_INSTANCES("COMPONENT_INSTANCES"), TYPE_DOES_NOT_EXIST("TYPE_DOES_NOT_EXIST"); - @Getter - private final String name; + + GROUPS("GROUPS"), + COMPONENT_INSTANCES("COMPONENT_INSTANCES"), + TYPE_DOES_NOT_EXIST("TYPE_DOES_NOT_EXIST"); + + private String name; + + PolicyTargetType(String name) { + this.name = name; + } + + public String getName() { + return name; + } public static PolicyTargetType getByNameIgnoreCase(String name) { for (PolicyTargetType inst : PolicyTargetType.values()) { @@ -37,3 +45,4 @@ public enum PolicyTargetType { return null; } } + 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 82f0869869..8a663374b2 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 @@ -17,17 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import java.util.List; import java.util.Map; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@NoArgsConstructor public class PolicyTypeDataDefinition extends ToscaTypeDataDefinition { private String uniqueId; @@ -36,16 +31,21 @@ public class PolicyTypeDataDefinition extends ToscaTypeDataDefinition { private List<String> targets; private Map<String, String> metadata; private String description; + /** * Timestamp of data type creation */ private Long creationTime; + /** * 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; @@ -59,10 +59,82 @@ public class PolicyTypeDataDefinition extends ToscaTypeDataDefinition { this.highestVersion = p.highestVersion; } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public List<String> getTargets() { + return targets; + } + + public void setTargets(List<String> members) { + this.targets = members; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + 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 toString() { - return "PolicyTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version=" - + version + ", targets=" + targets + ", metadata=" + metadata + ", description=" + description + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + "]"; + return "PolicyTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version=" + version + + ", targets=" + targets + ", metadata=" + metadata + ", description=" + description + ", creationTime=" + + creationTime + ", modificationTime=" + modificationTime + "]"; + } + + public String getDerivedFrom() { + return derivedFrom; + } + + public void setDerivedFrom(String derivedFrom) { + this.derivedFrom = derivedFrom; + } + + public boolean isHighestVersion() { + return highestVersion; + } + + public void setHighestVersion(boolean isLatestVersion) { + this.highestVersion = isLatestVersion; } } 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 0f6524d868..6507536d2c 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 @@ -19,29 +19,30 @@ */ package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; -import java.util.List; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; -@Getter -@Setter -@NoArgsConstructor -@EqualsAndHashCode(callSuper = true) -@ToString +import java.util.ArrayList; +import java.util.List; + public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition { private String fullName; + private List<String> contacts; + private Boolean isActive; - public ProductMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) { - super(extractor); + public ProductMetadataDataDefinition() { + super(); + } + + public ProductMetadataDataDefinition(ProductMetadataDataDefinition other) { + super(other); + } + + public ProductMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){ + super(extractor); } public Boolean getIsActive() { @@ -52,6 +53,14 @@ public class ProductMetadataDataDefinition extends ComponentMetadataDataDefiniti isActive = active; } + public List<String> getContacts() { + return contacts; + } + + public void setContacts(List<String> contacts) { + this.contacts = contacts; + } + public void addContact(String contact) { if (contact != null) { if (contacts == null) { @@ -61,6 +70,67 @@ public class ProductMetadataDataDefinition extends ComponentMetadataDataDefiniti } } + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + @Override + public String toString() { + return "ProductMetadataDataDefinition [fullName=" + fullName + ", contacts=" + contacts + ", isActive=" + + isActive + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + + result = prime * result + ((contacts == null) ? 0 : contacts.hashCode()); + result = prime * result + ((fullName == null) ? 0 : fullName.hashCode()); + result = prime * result + ((isActive == null) ? 0 : isActive.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ProductMetadataDataDefinition other = (ProductMetadataDataDefinition) obj; + if (contacts == null) { + if (other.contacts != null) { + return false; + } + } else if (!contacts.equals(other.contacts)) { + return false; + } + if (fullName == null) { + if (other.fullName != null) { + return false; + } + } else if (!fullName.equals(other.fullName)) { + return false; + } + if (isActive == null) { + if (other.isActive != null) { + return false; + } + } else if (!isActive.equals(other.isActive)) { + return false; + } + return super.equals(obj); + } + @Override public String getActualComponentType() { return getComponentType() != null ? getComponentType().getValue() : null; 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 c7307833b4..fdd3b585f6 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 @@ -17,9 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import static org.apache.commons.collections.CollectionUtils.isNotEmpty; +import org.apache.commons.collections.CollectionUtils; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import java.util.ArrayList; import java.util.HashMap; @@ -29,10 +32,9 @@ import java.util.Map; import java.util.Set; import lombok.Data; import lombok.EqualsAndHashCode; -import org.apache.commons.collections.CollectionUtils; + import org.apache.commons.collections.MapUtils; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import static org.apache.commons.collections.CollectionUtils.isNotEmpty; @EqualsAndHashCode(callSuper = false) @Data @@ -132,17 +134,17 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return required; } - public String getSchemaType() { + public void setSchemaType(String schemaType) { if (schema != null && schema.getProperty() != null) { - return schema.getProperty().getType(); + schema.getProperty().setType(schemaType); } - return null; } - public void setSchemaType(String schemaType) { + public String getSchemaType() { if (schema != null && schema.getProperty() != null) { - schema.getProperty().setType(schemaType); + return schema.getProperty().getType(); } + return null; } public PropertyDataDefinition getSchemaProperty() { @@ -281,10 +283,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return this.getGetInputValues() != null && !this.getGetInputValues().isEmpty(); } - public List<Annotation> getAnnotations() { - return (List<Annotation>) getToscaPresentationValue(JsonPresentationFields.ANNOTATIONS); - } - 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. @@ -294,4 +292,8 @@ public class PropertyDataDefinition extends ToscaDataDefinition { 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 8a20c16d38..9bb83ddf41 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 @@ -20,39 +20,56 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonIgnore; -import java.util.List; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor +import java.util.List; + public class PropertyRule extends ToscaDataDefinition { private static final String FORCE_ALL = "FORCE_ALL"; private static final String ALL = "ALL"; private static final String RULE_ANY_MATCH = ".+"; + + public static String getForceAll() { + return FORCE_ALL; + } + + public static String getALL() { + return ALL; + } + + public static String getRuleAnyMatch() { + return RULE_ANY_MATCH; + } + + private List<String> rule; private String value; + public PropertyRule() { + super(); + } + public PropertyRule(List<String> rule, String value) { super(); this.rule = rule; this.value = value; } - public static String getForceAll() { - return FORCE_ALL; + public List<String> getRule() { + return rule; } - public static String getALL() { - return ALL; + public void setRule(List<String> rule) { + this.rule = rule; } - public static String getRuleAnyMatch() { - return RULE_ANY_MATCH; + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; } @JsonIgnore 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 539914c496..8dd00c4370 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 @@ -17,14 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import java.util.List; -import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@NoArgsConstructor +import java.util.List; + public class RelationshipInstDataDefinition extends ToscaDataDefinition { public RelationshipInstDataDefinition(RelationshipInstDataDefinition cdt) { @@ -47,68 +47,71 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { this.setCapability(cdt.getCapability()); } - public String getRequirement() { - return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT); - } - public void setRequirement(String requirement) { setToscaPresentationValue(JsonPresentationFields.REQUIREMENT, requirement); } - public String getCapability() { - return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); + public String getRequirement() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT); } public void setCapability(String capability) { setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); } - public String getToId() { - return (String) getToscaPresentationValue(JsonPresentationFields.TO_ID); + public String getCapability() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); } public void setToId(Object toId) { setToscaPresentationValue(JsonPresentationFields.TO_ID, toId); } - public String getFromId() { - return (String) getToscaPresentationValue(JsonPresentationFields.FROM_ID); - } - public void setFromId(Object fromId) { setToscaPresentationValue(JsonPresentationFields.FROM_ID, fromId); } - public String getRequirementId() { - return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID); + public String getToId() { + return (String) getToscaPresentationValue(JsonPresentationFields.TO_ID); + } + + public String getFromId() { + return (String) getToscaPresentationValue(JsonPresentationFields.FROM_ID); } public void setRequirementId(Object requirementId) { setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID, requirementId); } + public void setCapabilityId(Object capabilityId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabilityId); + } + + public String getRequirementId() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID); + } + public String getCapabilityId() { return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID); } - public void setCapabilityId(Object capabilityId) { - setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabilityId); + public void setRequirementOwnerId(Object requirementOwnerId) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID, requirementOwnerId); } public String getRequirementOwnerId() { return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID); } - public void setRequirementOwnerId(Object requirementOwnerId) { - setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID, requirementOwnerId); + public void setCapabilityOwnerId(Object capabilityOwnerId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID, capabilityOwnerId); } public String getCapabilityOwnerId() { return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID); } - public void setCapabilityOwnerId(Object capabilityOwnerId) { - setToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID, capabilityOwnerId); + public RelationshipInstDataDefinition() { } public String getUniqueId() { @@ -130,12 +133,10 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { /** * Identifies the type of the capability. */ - @Override public String getType() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } - @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } @@ -156,7 +157,6 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES, validTargetTypes); } - @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -175,6 +175,7 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { public Long getCreationTime() { return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + } public void setCreationTime(Long creationTime) { @@ -189,15 +190,15 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); } + public void setInterfaces(final ListDataDefinition<InterfaceDataDefinition> operations) { + setToscaPresentationValue(JsonPresentationFields.INTERFACES, operations); + } + @SuppressWarnings("unchecked") public ListDataDefinition<InterfaceDataDefinition> getInterfaces() { return (ListDataDefinition<InterfaceDataDefinition>) getToscaPresentationValue(JsonPresentationFields.INTERFACES); } - public void setInterfaces(final ListDataDefinition<InterfaceDataDefinition> operations) { - setToscaPresentationValue(JsonPresentationFields.INTERFACES, operations); - } - @Override public String toString() { String uniqueId = getUniqueId(); @@ -208,8 +209,9 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { Boolean originUI = isOriginUI(); Long creationTime = getCreationTime(); Long modificationTime = getModificationTime(); - return "RelationshipTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes=" - + validSourceTypes + ", version=" + version + ", originUI=" + originUI + ", 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 40dd517e60..4b7b6aa413 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 @@ -17,11 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @@ -29,6 +28,9 @@ import lombok.ToString; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.util.ArrayList; +import java.util.List; + /** * Represents the requirement of the component or component instance */ @@ -39,6 +41,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition { public static final String MIN_OCCURRENCES = "0"; public static final String MAX_OCCURRENCES = "UNBOUNDED"; public static final String MAX_DEFAULT_OCCURRENCES = "1"; + @Getter @Setter public boolean external = false; @@ -90,6 +93,14 @@ public class RequirementDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public String getParentName() { return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME); } @@ -109,6 +120,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition { /** * specify the capability type */ + public String getCapability() { return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); } @@ -184,23 +196,23 @@ public class RequirementDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); } + public void setPath(List<String> path) { + setToscaPresentationValue(JsonPresentationFields.PATH, path); + } + @SuppressWarnings({"unchecked"}) public List<String> getPath() { return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); } - public void setPath(List<String> path) { - setToscaPresentationValue(JsonPresentationFields.PATH, path); + public void setSource(String source) { + setToscaPresentationValue(JsonPresentationFields.SOURCE, source); } public String getSource() { return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); } - public void setSource(String source) { - setToscaPresentationValue(JsonPresentationFields.SOURCE, source); - } - /** * Adds the element to the path avoiding duplication * @@ -216,4 +228,5 @@ public class RequirementDataDefinition extends ToscaDataDefinition { } setPath(path); } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java index afec4d4a72..34dc43760f 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java @@ -13,18 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.openecomp.sdc.be.datatypes.elements; -import java.io.Serializable; -import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@NoArgsConstructor +import java.io.Serializable; + public class RequirementNodeFilterCapabilityDataDefinition extends ToscaDataDefinition implements Serializable { + /** + * Default Constructor + */ + public RequirementNodeFilterCapabilityDataDefinition() { + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> getProperties() { - return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES); + return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue( + JsonPresentationFields.PROPERTIES); } public void setProperties(ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> properties) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java index ed3056cca7..fff5dce9da 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java @@ -15,11 +15,12 @@ */ package org.openecomp.sdc.be.datatypes.elements; -import java.io.Serializable; -import java.util.List; 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 RequirementNodeFilterPropertyDataDefinition extends ToscaDataDefinition implements Serializable { public List<String> getConstraints() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementSubstitutionFilterCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementSubstitutionFilterCapabilityDataDefinition.java index d6c9a86561..242eb490ef 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementSubstitutionFilterCapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementSubstitutionFilterCapabilityDataDefinition.java @@ -16,18 +16,32 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; -import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@NoArgsConstructor public class RequirementSubstitutionFilterCapabilityDataDefinition extends ToscaDataDefinition implements Serializable { + /** + * Default Constructor + */ + public RequirementSubstitutionFilterCapabilityDataDefinition() { + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(final String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> getProperties() { - return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES); + return (ListDataDefinition<RequirementNodeFilterPropertyDataDefinition>) getToscaPresentationValue( + JsonPresentationFields.PROPERTIES); } public void setProperties(final ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> properties) { 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 5e7b0abadf..1e4fc58ffe 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 @@ -17,43 +17,128 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + import java.util.List; import java.util.Map; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; /** * Schema allows to create new types that can be used along TOSCA definitions. */ -@Getter -@Setter -@NoArgsConstructor -@EqualsAndHashCode public class SchemaDefinition extends ToscaDataDefinition { private String derivedFrom; private List<String> constraints; private Map<String, PropertyDataDefinition> properties; + private PropertyDataDefinition property; - public SchemaDefinition(String derivedFrom, List<String> constraints, Map<String, PropertyDataDefinition> properties) { + + public SchemaDefinition() { + } + + public SchemaDefinition(String derivedFrom, List<String> constraints, + Map<String, PropertyDataDefinition> properties) { this.setDerivedFrom(derivedFrom); this.setConstraints(constraints); this.setProperties(properties); + + } + + public String getDerivedFrom() { + return derivedFrom; + } + + public void setProperty(PropertyDataDefinition property) { + this.property = property; + } + + public PropertyDataDefinition getProperty() { + return this.property; + } + + public void setDerivedFrom(String derivedFrom) { + this.derivedFrom = derivedFrom; + } + + public List<String> getConstraints() { + return constraints; + } + + public void setConstraints(List<String> constraints) { + this.constraints = constraints; + } + + public Map<String, PropertyDataDefinition> getProperties() { + return properties; + } + + public void setProperties(Map<String, PropertyDataDefinition> properties) { + this.properties = properties; } public void addProperty(String key, PropertyDataDefinition property) { + properties.put(key, property); } @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((constraints == null) ? 0 : constraints.hashCode()); + result = prime * result + ((derivedFrom == null) ? 0 : derivedFrom.hashCode()); + result = prime * result + ((properties == null) ? 0 : properties.hashCode()); + result = prime * result + ((property == null) ? 0 : property.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SchemaDefinition other = (SchemaDefinition) obj; + if (constraints == null) { + if (other.constraints != null) { + return false; + } + } else if (!constraints.equals(other.constraints)) { + return false; + } + if (derivedFrom == null) { + if (other.derivedFrom != null) { + return false; + } + } else if (!derivedFrom.equals(other.derivedFrom)) { + return false; + } + if (properties == null) { + if (other.properties != null) { + return false; + } + } else if (!properties.equals(other.properties)) { + return false; + } + if (property == null) { + return other.property == null; + } else { + return property.equals(other.property); + } + } + + @Override public String toString() { - return "SchemaDefinition [" + "derivedFrom='" + derivedFrom + ", constraints=" + constraints + ", properties=" + properties + ", property=" - + property + ']'; + return "SchemaDefinition [" + "derivedFrom='" + derivedFrom + ", constraints=" + constraints + ", properties=" + + properties + ", property=" + property + ']'; } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SubstitutionFilterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SubstitutionFilterDataDefinition.java index 7efeb0fea5..beb5aac1d0 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SubstitutionFilterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SubstitutionFilterDataDefinition.java @@ -38,16 +38,17 @@ public class SubstitutionFilterDataDefinition extends ToscaDataDefinition implem this.setCapabilities(substitutionFilterDataDefinition.getCapabilities()); } - public Object getTosca_id() { - return getToscaPresentationValue(JsonPresentationFields.TOSCA_ID); - } - public void setTosca_id(final Object tosca_id) { setToscaPresentationValue(JsonPresentationFields.TOSCA_ID, tosca_id); } + public Object getTosca_id() { + return getToscaPresentationValue(JsonPresentationFields.TOSCA_ID); + } + public ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition> getProperties() { - return (ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.PROPERTIES); + return (ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition>) getToscaPresentationValue( + JsonPresentationFields.PROPERTIES); } public void setProperties(final ListDataDefinition<RequirementSubstitutionFilterPropertyDataDefinition> properties) { @@ -56,13 +57,21 @@ public class SubstitutionFilterDataDefinition extends ToscaDataDefinition implem public ListDataDefinition<RequirementSubstitutionFilterCapabilityDataDefinition> getCapabilities() { return (ListDataDefinition<RequirementSubstitutionFilterCapabilityDataDefinition>) getToscaPresentationValue( - JsonPresentationFields.NODE_FILTER_CAPABILITIES); + JsonPresentationFields.NODE_FILTER_CAPABILITIES); } public void setCapabilities(ListDataDefinition<RequirementSubstitutionFilterCapabilityDataDefinition> capabilities) { setToscaPresentationValue(JsonPresentationFields.NODE_FILTER_CAPABILITIES, capabilities); } + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(final String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public String getID() { return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } @@ -70,4 +79,6 @@ public class SubstitutionFilterDataDefinition extends ToscaDataDefinition implem public void setID(final String name) { setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, name); } + + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java index 058f8aac77..554d37e13a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.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,12 +20,10 @@ package org.openecomp.sdc.be.datatypes.elements; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; @Getter @Setter -@NoArgsConstructor public class ToscaArtifactDataDefinition { private String file; 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 index a21510be45..b6f9fa236d 100644 --- 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 @@ -17,25 +17,47 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.datatypes.elements; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor 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/tosca/ToscaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java index a5ac0c71d6..0b142d5306 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 @@ -77,14 +77,6 @@ public abstract class ToscaDataDefinition { return null; } - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - - public void setName(String name) { - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - public void setToscaPresentationValue(JsonPresentationFields name, Object value) { if (name != null) { if (toscaPresentation == null) { 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 c3a127c8ff..bcd04bc1b2 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 @@ -31,6 +31,51 @@ public class ProductMetadataDataDefinitionTest { return new ProductMetadataDataDefinition(); } + + @Test + public void testGetIsActive() throws Exception { + ProductMetadataDataDefinition testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIsActive(); + } + + + @Test + public void testSetIsActive() throws Exception { + ProductMetadataDataDefinition testSubject; + Boolean active = null; + + // default test + testSubject = createTestSubject(); + testSubject.setIsActive(active); + } + + + @Test + public void testGetContacts() throws Exception { + ProductMetadataDataDefinition testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getContacts(); + } + + + @Test + public void testSetContacts() throws Exception { + ProductMetadataDataDefinition testSubject; + List<String> contacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setContacts(contacts); + } + + @Test public void testAddContact() throws Exception { ProductMetadataDataDefinition testSubject; @@ -47,6 +92,64 @@ public class ProductMetadataDataDefinitionTest { testSubject.addContact(contact); } + + @Test + public void testGetFullName() throws Exception { + ProductMetadataDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFullName(); + } + + + @Test + public void testSetFullName() throws Exception { + ProductMetadataDataDefinition testSubject; + String fullName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setFullName(fullName); + } + + + @Test + public void testToString() throws Exception { + ProductMetadataDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + + @Test + public void testHashCode() throws Exception { + ProductMetadataDataDefinition testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + ProductMetadataDataDefinition testSubject; + Object obj = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(obj); + result = testSubject.equals(testSubject); + result = testSubject.equals(createTestSubject()); + } + @Test public void testGetActualComponentType() throws Exception { ProductMetadataDataDefinition testSubject; |