From 1da764ea13793535597dc6518b5e953393e9dbe0 Mon Sep 17 00:00:00 2001 From: vasraz Date: Mon, 15 Mar 2021 15:53:01 +0000 Subject: Improve test coverage Change-Id: Ib5c9e148bfba2167f65130d71c3a633f03dfa71e Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3428 --- .../AdditionalInfoParameterDataDefinition.java | 65 ++-------- .../elements/AdditionalInfoParameterInfo.java | 49 ++------ .../sdc/be/datatypes/elements/Annotation.java | 62 ++-------- .../elements/AnnotationTypeDataDefinition.java | 9 +- .../datatypes/elements/ArtifactDataDefinition.java | 59 ++++----- .../elements/AttributeDataDefinition.java | 10 +- .../elements/CINodeFilterDataDefinition.java | 24 ++-- .../elements/CapabilityDataDefinition.java | 42 +++---- .../elements/CapabilityTypeDataDefinition.java | 16 +-- .../elements/ComponentInstanceDataDefinition.java | 101 ++++++++------- .../elements/CompositionDataDefinition.java | 5 +- .../datatypes/elements/ConsumerDataDefinition.java | 1 - .../datatypes/elements/DataTypeDataDefinition.java | 3 +- .../elements/EntrySchemaDataDefinition.java | 21 ---- .../elements/ForwardingPathDataDefinition.java | 9 +- .../ForwardingPathElementDataDefinition.java | 16 +-- .../elements/GetInputValueDataDefinition.java | 135 +++------------------ .../elements/GetOutputValueDataDefinition.java | 6 +- .../elements/GetPolicyValueDataDefinition.java | 3 + .../be/datatypes/elements/GroupDataDefinition.java | 70 ++++------- .../elements/GroupInstanceDataDefinition.java | 22 ++-- .../elements/GroupTypeDataDefinition.java | 92 ++------------ .../elements/HeatParameterDataDefinition.java | 134 ++------------------ .../be/datatypes/elements/InputDataDefinition.java | 6 +- .../elements/InputsValueDataDefinition.java | 35 ++---- .../elements/InterfaceDataDefinition.java | 18 +-- .../elements/InterfaceInstanceDataDefinition.java | 9 +- .../elements/ListCapabilityDataDefinition.java | 8 +- .../be/datatypes/elements/ListDataDefinition.java | 11 +- .../elements/ListMapPropertiesDataDefinition.java | 12 +- .../elements/ListRequirementDataDefinition.java | 8 +- .../elements/MapArtifactDataDefinition.java | 21 +--- .../elements/MapAttributesDataDefinition.java | 12 +- .../datatypes/elements/MapCapabilityProperty.java | 9 +- .../elements/MapComponentInstanceExternalRefs.java | 18 ++- .../be/datatypes/elements/MapDataDefinition.java | 18 ++- .../elements/MapGroupsDataDefinition.java | 21 +--- .../elements/MapInterfaceDataDefinition.java | 7 +- .../elements/MapListCapabilityDataDefinition.java | 8 +- .../elements/MapListRequirementDataDefinition.java | 8 +- .../elements/MapPropertiesDataDefinition.java | 27 ++--- .../elements/OperationDataDefinition.java | 24 ++-- .../elements/OperationImplementation.java | 45 ++----- .../elements/OperationInputDefinition.java | 31 ++--- .../be/datatypes/elements/OperationInstance.java | 47 ++----- .../datatypes/elements/PolicyDataDefinition.java | 48 +++----- .../be/datatypes/elements/PolicyTargetType.java | 16 +-- .../elements/PolicyTypeDataDefinition.java | 87 ++----------- .../elements/ProductMetadataDataDefinition.java | 98 +++------------ .../datatypes/elements/PropertyDataDefinition.java | 56 ++++----- .../sdc/be/datatypes/elements/PropertyRule.java | 43 ++----- .../elements/RelationshipInstDataDefinition.java | 64 +++++----- .../elements/RequirementDataDefinition.java | 27 ++--- ...uirementNodeFilterCapabilityDataDefinition.java | 21 +--- ...equirementNodeFilterPropertyDataDefinition.java | 5 +- ...SubstitutionFilterCapabilityDataDefinition.java | 18 +-- .../be/datatypes/elements/SchemaDefinition.java | 102 ++-------------- .../elements/SubstitutionFilterDataDefinition.java | 21 +--- .../elements/ToscaArtifactDataDefinition.java | 6 +- .../elements/ToscaTypeDataDefinition.java | 32 +---- .../be/datatypes/tosca/ToscaDataDefinition.java | 8 ++ .../ProductMetadataDataDefinitionTest.java | 103 ---------------- 62 files changed, 529 insertions(+), 1583 deletions(-) delete mode 100644 common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java (limited to 'common-be') 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 e92a806032..10881e325a 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 @@ -20,26 +20,27 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - 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 public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition { private String uniqueId; - private Long creationTime; - private Long modificationTime; - private Integer lastCreatedCounter = 0; + @ToString.Exclude private List parameters; - public AdditionalInfoParameterDataDefinition() { - - } - public AdditionalInfoParameterDataDefinition(AdditionalInfoParameterDataDefinition p) { this.uniqueId = p.uniqueId; this.creationTime = p.creationTime; @@ -48,50 +49,4 @@ public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition { 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 getParameters() { - return parameters; - } - - public void setParameters(List 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 9b9cc497ad..53bf3da5fc 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 @@ -20,56 +20,27 @@ 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 d77c906243..6e561184ff 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 @@ -22,64 +22,26 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; import java.util.Map; -import java.util.Objects; - +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@EqualsAndHashCode(onlyExplicitlyIncluded = true) public class Annotation { + + @EqualsAndHashCode.Include private String name; + private String type; private String description; private List 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 getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public static void setAnnotationsName(Map 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 8eba3125e3..8088d8a8a9 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 @@ -33,14 +33,18 @@ 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; type = other.type; @@ -50,4 +54,5 @@ public class AnnotationTypeDataDefinition extends ToscaDataDefinition { modificationTime = other.modificationTime; highestVersion = other.highestVersion; } + } 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 bc9bc3387f..3b1b26659f 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 @@ -20,13 +20,12 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; - 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 org.openecomp.sdc.common.api.ArtifactTypeEnum; public class ArtifactDataDefinition extends ToscaDataDefinition { @@ -40,7 +39,6 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { setArtifactVersion("0"); } - public ArtifactDataDefinition(ArtifactDataDefinition a) { this.setUniqueId(a.getUniqueId()); this.setArtifactType(a.getArtifactType()); @@ -87,12 +85,13 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { } - public String getArtifactType() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE); + public void setArtifactName(String artifactName) { + setToscaPresentationValue(JsonPresentationFields.NAME, artifactName); + } - public boolean isHeatEnvType() { - return ArtifactTypeEnum.HEAT_ENV.getType().equals(getArtifactType()); + public String getArtifactType() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE); } public void setArtifactType(String artifactType) { @@ -100,6 +99,10 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { } + public boolean isHeatEnvType() { + return ArtifactTypeEnum.HEAT_ENV.getType().equals(getArtifactType()); + } + public String getArtifactRef() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF); @@ -118,11 +121,6 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY, artifactRepository); } - public void setArtifactName(String artifactName) { - setToscaPresentationValue(JsonPresentationFields.NAME, artifactName); - - } - public String getArtifactChecksum() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM); } @@ -208,14 +206,14 @@ public class ArtifactDataDefinition extends ToscaDataDefinition { return (String) getToscaPresentationValue(JsonPresentationFields.ES_ID); } - public boolean hasNoMandatoryEsId() { - return getEsId() == null && getMandatory(); - } - public void setEsId(String esId) { setToscaPresentationValue(JsonPresentationFields.ES_ID, esId); } + public boolean hasNoMandatoryEsId() { + return getEsId() == null && getMandatory(); + } + public String getArtifactCreator() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR); } @@ -351,6 +349,10 @@ 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; @@ -360,18 +362,19 @@ 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 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 d90f6bece5..7be02e77e7 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 transient List getOutputValues; + private List getOutputValues; private String outputId; private String value; private String outputPath; @@ -82,14 +82,6 @@ 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 22055e0620..1a9c7e55af 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,11 +16,10 @@ 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 @@ -36,17 +35,17 @@ public class CINodeFilterDataDefinition extends ToscaDataDefinition implements S this.setCapabilities(inData.getCapabilities()); } - public void setTosca_id(Object tosca_id) { - setToscaPresentationValue(JsonPresentationFields.TOSCA_ID, tosca_id); - } - public Object getTosca_id() { return getToscaPresentationValue(JsonPresentationFields.TOSCA_ID); } + public void setTosca_id(Object tosca_id) { + setToscaPresentationValue(JsonPresentationFields.TOSCA_ID, tosca_id); + } + public ListDataDefinition getProperties() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.PROPERTIES); + JsonPresentationFields.PROPERTIES); } public void setProperties(ListDataDefinition properties) { @@ -55,21 +54,13 @@ public class CINodeFilterDataDefinition extends ToscaDataDefinition implements S public ListDataDefinition getCapabilities() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.NODE_FILTER_CAPABILITIES); + JsonPresentationFields.NODE_FILTER_CAPABILITIES); } public void setCapabilities(ListDataDefinition 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); } @@ -78,5 +69,4 @@ public class CINodeFilterDataDefinition extends ToscaDataDefinition implements S 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 78bfe50d5c..cc8131b13e 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 @@ -21,11 +21,10 @@ package org.openecomp.sdc.be.datatypes.elements; import com.google.common.collect.Lists; -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 org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; /** * Represents the capability of the component or component instance @@ -168,14 +167,6 @@ 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); } @@ -192,10 +183,12 @@ 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); } @@ -218,23 +211,23 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES, capabilitySources); } - public void setPath(List path) { - setToscaPresentationValue(JsonPresentationFields.PATH, path); - } - @SuppressWarnings("unchecked") public List getPath() { return (List) getToscaPresentationValue(JsonPresentationFields.PATH); } - public void setSource(String source) { - setToscaPresentationValue(JsonPresentationFields.SOURCE, source); + public void setPath(List path) { + setToscaPresentationValue(JsonPresentationFields.PATH, path); } 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 * @@ -422,11 +415,10 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { 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 + "]"; + + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" + + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName + + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path + ", source=" + source + "]"; } public enum OwnerType { @@ -440,10 +432,6 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { this.value = value; } - public String getValue() { - return value; - } - public static OwnerType getByValue(String value) { for (OwnerType type : values()) { if (type.getValue().equals(value)) { @@ -453,6 +441,10 @@ 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 36b3f0d9bc..7c04e57904 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 @@ -20,11 +20,12 @@ 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; -import java.util.List; - +@NoArgsConstructor public class CapabilityTypeDataDefinition extends ToscaDataDefinition { public CapabilityTypeDataDefinition(CapabilityTypeDataDefinition cdt) { @@ -37,10 +38,6 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition { this.setModificationTime(cdt.getModificationTime()); } - public CapabilityTypeDataDefinition() { - super(); - } - public String getUniqueId() { return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } @@ -57,10 +54,12 @@ 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); } @@ -73,6 +72,7 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); } + @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -108,8 +108,8 @@ public class CapabilityTypeDataDefinition extends ToscaDataDefinition { Long modificationTime = getModificationTime(); return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type - + ", validSourceTypes=" + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + "]"; + + ", 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 afcc0e6d9f..c049d77872 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 @@ -20,19 +20,18 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.apache.commons.collections.CollectionUtils; -import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.common.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; +import org.apache.commons.collections.CollectionUtils; +import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import org.openecomp.sdc.common.util.ValidationUtils; public class ComponentInstanceDataDefinition extends ToscaDataDefinition { @@ -101,17 +100,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() { @@ -146,10 +145,6 @@ 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)); @@ -233,6 +228,10 @@ 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); } @@ -241,40 +240,41 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME, toscaComponentName); } - public void setComponentVersion(String resourceVersion) { - setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion); + public String getSourceModelUuid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); } public void setSourceModelUuid(String targetModelUuid) { setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid); } - public void setSourceModelUid(String targetModelUid) { - setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid); + public String getSourceModelUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); } - public void setSourceModelName(String targetModelName) { - setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName); + public void setSourceModelUid(String targetModelUid) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid); } - public void setSourceModelInvariant(String targetModelInvariant) { - setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant); + public String getSourceModelName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); } - public String getSourceModelUuid() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); + public void setSourceModelName(String targetModelName) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName); } - public String getSourceModelUid() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); + public String getSourceModelInvariant() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); } - public String getSourceModelName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); + public void setSourceModelInvariant(String targetModelInvariant) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant); } - public String getSourceModelInvariant() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); + public Boolean getIsProxy() { + Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY); + return (isProxy != null) ? isProxy : false; } public void setIsProxy(Boolean isProxy) { @@ -285,11 +285,6 @@ 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; } @@ -313,12 +308,12 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives); } - public Map getToscaArtifacts() { - return ( Map) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS); + public Map getToscaArtifacts() { + return (Map) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS); } - public void setToscaArtifacts(Map artifacts) { - if (artifacts == null){ + public void setToscaArtifacts(Map artifacts) { + if (artifacts == null) { artifacts = new HashMap<>(); } setToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS, artifacts); @@ -339,14 +334,14 @@ 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() + "]"; + + 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 0061213253..5ea3b789dd 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 @@ -20,11 +20,10 @@ 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.HashMap; import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class CompositionDataDefinition extends ToscaDataDefinition { 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 80eadc2489..a2ac3c5ac1 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 @@ -25,7 +25,6 @@ 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 0574d1377c..672f2d6d73 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 @@ -20,14 +20,13 @@ 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 deleted file mode 100644 index 36e3452e53..0000000000 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java +++ /dev/null @@ -1,21 +0,0 @@ -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 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 499d523119..c549d8f10c 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 @@ -20,9 +20,6 @@ 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; @@ -31,17 +28,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 52e653d3f9..f56a13b16b 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 @@ -22,18 +22,18 @@ 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; -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); @@ -111,7 +111,7 @@ public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { } 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()); + && Objects.equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId()); } @Override @@ -122,8 +122,8 @@ 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(); + .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 010840eaee..a409c7f5ef 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 @@ -20,24 +20,33 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - 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 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 pr) { super(pr); } @@ -49,120 +58,6 @@ 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 534aa232c8..7318dbd5d3 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 @@ -23,12 +23,14 @@ 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 { @@ -40,10 +42,6 @@ public class GetOutputValueDataDefinition extends ToscaDataDefinition { private GetOutputValueDataDefinition getOutputIndex; private boolean isList; - public GetOutputValueDataDefinition() { - super(); - } - public GetOutputValueDataDefinition(Map 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 064f356290..f752949ad9 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 @@ -22,13 +22,16 @@ 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 ad61426583..f61801288f 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 @@ -20,28 +20,30 @@ 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 static java.util.Collections.emptyMap; +import com.fasterxml.jackson.annotation.JsonInclude; 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; -import static java.util.Collections.emptyMap; - - +@Getter +@Setter +@NoArgsConstructor public class GroupDataDefinition extends ToscaDataDefinition { + @JsonInclude private String typeUid; @JsonInclude private Integer propertyValueCounter = 0; - public GroupDataDefinition() { - } - public GroupDataDefinition(Map gr) { super(gr); propertyValueCounter = 0; @@ -75,15 +77,6 @@ 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; @@ -110,14 +103,17 @@ 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); } @@ -142,14 +138,6 @@ 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); } @@ -162,6 +150,10 @@ public class GroupDataDefinition extends ToscaDataDefinition { return (Map) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER); } + public void setMembers(Map members) { + setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); + } + //this is used by GroupCompositionMixin public Map resolveMembersList() { Map members = getMembers(); @@ -172,10 +164,6 @@ public class GroupDataDefinition extends ToscaDataDefinition { } - public void setMembers(Map members) { - setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); - } - public List getArtifacts() { return (List) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS); } @@ -200,14 +188,6 @@ 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()); } @@ -218,13 +198,15 @@ 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 c1cfa31412..5f62b75c43 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 @@ -20,19 +20,16 @@ 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 gi) { super(gi); } @@ -79,14 +76,6 @@ 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); } @@ -167,10 +156,12 @@ 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); } @@ -183,6 +174,7 @@ 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 19f88b3196..1014023639 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 @@ -22,7 +22,15 @@ 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; @@ -43,9 +51,6 @@ public class GroupTypeDataDefinition extends ToscaTypeDataDefinition { */ private Long modificationTime; - public GroupTypeDataDefinition() { - } - public GroupTypeDataDefinition(GroupTypeDataDefinition other) { super(other); this.uniqueId = other.uniqueId; @@ -59,83 +64,4 @@ public class GroupTypeDataDefinition extends ToscaTypeDataDefinition { this.derivedFrom = other.derivedFrom; } - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public List getMembers() { - return members; - } - - public void setMembers(List members) { - this.members = members; - } - - public Map getMetadata() { - return metadata; - } - - public void setMetadata(Map 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 da6e63d110..e3e4191385 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 @@ -20,8 +20,18 @@ 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; @@ -33,9 +43,6 @@ public class HeatParameterDataDefinition extends ToscaDataDefinition { private String currentValue; private String defaultValue; - public HeatParameterDataDefinition() { - } - public HeatParameterDataDefinition(HeatParameterDataDefinition hp) { this.uniqueId = hp.uniqueId; this.name = hp.name; @@ -45,125 +52,4 @@ public class HeatParameterDataDefinition extends ToscaDataDefinition { 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 ef2932a50b..e70f52cedb 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 @@ -21,13 +21,11 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; +import lombok.NoArgsConstructor; +@NoArgsConstructor public class InputDataDefinition extends PropertyDataDefinition { - InputDataDefinition() { - super(); - } - InputDataDefinition(Map 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 3300c5dae0..4f3de0c1c6 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 @@ -20,9 +20,16 @@ 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; @@ -33,32 +40,4 @@ public class InputsValueDataDefinition extends ToscaDataDefinition { 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 760802ec39..e93deab7fc 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java @@ -20,15 +20,14 @@ 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 static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; +import com.fasterxml.jackson.annotation.JsonCreator; import java.io.Serializable; import java.util.HashMap; import java.util.Map; - -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class InterfaceDataDefinition extends ToscaDataDefinition implements Serializable { @@ -61,6 +60,7 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } + @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } @@ -89,6 +89,10 @@ 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 getOperations() { return (Map) getToscaPresentationValue(JsonPresentationFields.OPERATIONS); } @@ -97,10 +101,6 @@ 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 d5f4f3ccbb..42a7dbafe7 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 @@ -16,20 +16,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.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) { + InterfaceInstanceDataDefinition inter) { this.toscaPresentation = null; - setInputs(inter.getInputs() == null ? new HashMap() : new HashMap<>(inter.getInputs())); + setInputs(inter.getInputs() == null ? new HashMap() : new HashMap<>(inter.getInputs())); setOperations(new HashMap<>(inter.getOperations())); } 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 2f97cad243..9c92c350a7 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 @@ -22,9 +22,10 @@ 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 { public ListCapabilityDataDefinition(ListCapabilityDataDefinition cdt) { @@ -37,11 +38,6 @@ public class ListCapabilityDataDefinition extends ListDataDefinition 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 b6b75de678..892448d9d8 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java @@ -21,15 +21,14 @@ 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 extends ToscaDataDefinition { @@ -78,7 +77,8 @@ public class ListDataDefinition extends ToscaData Map mapByName = listToMapByName(listToscaDataDefinition); List 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; @@ -105,7 +105,8 @@ public class ListDataDefinition extends ToscaData list.forEach(e -> { String nameFromPrev = (String) e.getToscaPresentationValue(JsonPresentationFields.NAME); if (nameFromPrev != null) { - Optional findAny = (Optional) listToscaDataDefinition.stream().filter(o -> nameFromPrev.equals(e.getToscaPresentationValue(JsonPresentationFields.NAME))).findAny(); + Optional findAny = (Optional) 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 a9b57ac801..8ce14044fa 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 @@ -22,9 +22,14 @@ 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 { public ListMapPropertiesDataDefinition(ListMapPropertiesDataDefinition cdt) { @@ -37,11 +42,6 @@ public class ListMapPropertiesDataDefinition extends ListDataDefinition 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 ccf3dd82cf..594f6eb28b 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 @@ -22,9 +22,10 @@ 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 { public ListRequirementDataDefinition(ListRequirementDataDefinition cdt) { @@ -37,11 +38,6 @@ public class ListRequirementDataDefinition extends ListDataDefinition 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 ab54fcf226..9f025d2d05 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 @@ -22,9 +22,14 @@ 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 { private String parentName; @@ -39,11 +44,6 @@ public class MapArtifactDataDefinition extends MapDataDefinition getMapToscaDataDefinition() { @@ -55,13 +55,4 @@ public class MapArtifactDataDefinition extends MapDataDefinition getMapToscaDataDefinition() { return mapToscaDataDefinition; } - public void setMapToscaDataDefinition(Map 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 2cd075afad..2ed37aee80 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 @@ -23,20 +23,17 @@ 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 { + @JsonCreator public MapCapabilityProperty(Map mapToscaDataDefinition) { super(mapToscaDataDefinition); } - public MapCapabilityProperty() { - super(); - - } - @JsonValue @Override public Map 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 47ecde228e..2a23ff84e3 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 @@ -20,20 +20,18 @@ 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. - * - * "monitoring" -> { "ref1", "ref2" }, - * "workflows" -> { "ref1", "ref2" } + *

+ * "monitoring" -> { "ref1", "ref2" }, "workflows" -> { "ref1", "ref2" } */ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { @@ -49,14 +47,14 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { return (Map>) getToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF); } - public List getExternalRefsByObjectType(String objectType) { - return ((Map>) getToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF)).get(objectType); - } - public void setComponentInstanceExternalRefs(Map> componentInstanceExternalRefs) { setToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF, componentInstanceExternalRefs); } + public List getExternalRefsByObjectType(String objectType) { + return ((Map>) getToscaPresentationValue(JsonPresentationFields.EXTERNAL_REF)).get(objectType); + } + /** * 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 9801e3b83f..062e5aa53d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java @@ -22,13 +22,14 @@ 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 extends ToscaDataDefinition { protected Map mapToscaDataDefinition; @@ -45,10 +46,6 @@ public class MapDataDefinition extends ToscaDataD this.mapToscaDataDefinition = mapToscaDataDefinition; } - public MapDataDefinition() { - super(); - } - @JsonValue public Map getMapToscaDataDefinition() { return mapToscaDataDefinition; @@ -82,14 +79,13 @@ public class MapDataDefinition extends ToscaDataD } } - public String findKeyByItemUidMatch(String uid) { if (null == mapToscaDataDefinition || uid == null) { return null; } Map.Entry entry = mapToscaDataDefinition.entrySet().stream().filter(e -> - e.getValue().findUidMatch(uid)) - .findAny().orElse(null); + e.getValue().findUidMatch(uid)) + .findAny().orElse(null); if (null == entry) { return null; } @@ -100,8 +96,8 @@ public class MapDataDefinition extends ToscaDataD public T removeByOwnerId(Set ownerIdList) { if (mapToscaDataDefinition != null) { Map collect = (Map) mapToscaDataDefinition.entrySet() - .stream() - .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); + .stream() + .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); MapDataDefinition collectMap = new MapDataDefinition<>(collect); 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 6b490a3505..813da54c72 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 @@ -23,9 +23,14 @@ 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 { private String parentName; @@ -40,11 +45,6 @@ public class MapGroupsDataDefinition extends MapDataDefinition getMapToscaDataDefinition() { @@ -56,13 +56,4 @@ public class MapGroupsDataDefinition extends MapDataDefinition { - public MapInterfaceDataDefinition() { - - } - @JsonCreator public MapInterfaceDataDefinition(Map 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 2bf5920758..b8b899aa09 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 @@ -23,10 +23,11 @@ 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 { public MapListCapabilityDataDefinition(MapListCapabilityDataDefinition cdt) { @@ -39,11 +40,6 @@ public class MapListCapabilityDataDefinition extends MapDataDefinition 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 ada4411d03..1f830b53b5 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 @@ -23,10 +23,11 @@ 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 { public MapListRequirementDataDefinition(MapListRequirementDataDefinition cdt) { @@ -39,11 +40,6 @@ public class MapListRequirementDataDefinition extends MapDataDefinition 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 075806a709..456ac7f75f 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 @@ -23,10 +23,15 @@ 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 { private String parentName; @@ -46,13 +51,10 @@ public class MapPropertiesDataDefinition extends MapDataDefinition 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 f93e41cf51..eb7b6af3b3 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 @@ -20,20 +20,18 @@ 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; -public class OperationDataDefinition extends ToscaDataDefinition implements Serializable { +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() { @@ -77,7 +75,7 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri public ListDataDefinition getInputs() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.OPERATION_INPUTS); + JsonPresentationFields.OPERATION_INPUTS); } public void setInputs(ListDataDefinition inputs) { @@ -86,17 +84,13 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri public ListDataDefinition getOutputs() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.OPERATION_OUTPUTS); + JsonPresentationFields.OPERATION_OUTPUTS); } public void setOutputs(ListDataDefinition outputs) { setToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS, outputs); } - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - public String getUniqueId() { return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } @@ -145,10 +139,6 @@ 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 2364ff4e3b..ef3d8f943c 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 @@ -16,46 +16,19 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.HashSet; import java.util.List; -import java.util.Objects; - +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@EqualsAndHashCode public class OperationImplementation { private String primary; private List dependencies; - public String getPrimary() { - return primary; - } - - public void setPrimary(String primary) { - this.primary = primary; - } - - public List getDependencies() { - return dependencies; - } - - public void setDependencies(List 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 0fcdd9ce36..53b1a1e036 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 @@ -17,10 +17,14 @@ 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 { + private String source; private String sourceProperty; private String toscaDefaultValue; @@ -52,35 +56,14 @@ 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 80c86d8d78..aae9f724df 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 @@ -17,45 +17,18 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; -import java.util.Objects; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@EqualsAndHashCode +public class OperationInstance { -public class OperationInstance/* extends Operation*/ { private OperationImplementation implementation; private Map inputs; - - public OperationImplementation getImplementation() { - return implementation; - } - - public void setImplementation(OperationImplementation implementation) { - this.implementation = implementation; - } - - public Map getInputs() { - return inputs; - } - - public void setInputs(Map 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 44d76fb42f..b0760c7d55 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 @@ -20,41 +20,22 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import static java.util.Collections.emptyList; import java.util.List; import java.util.Map; - -import static java.util.Collections.emptyList; +import lombok.NoArgsConstructor; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; /** - * 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 + * 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); } @@ -100,6 +81,11 @@ 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); @@ -108,11 +94,6 @@ 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); } @@ -145,6 +126,7 @@ public class PolicyDataDefinition extends PropertyDataDefinition { setToscaPresentationValue(JsonPresentationFields.TYPE_UNIQUE_ID, policyTypeUid); } + @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -161,10 +143,12 @@ 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 30ad169a88..187e4d4bfc 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 @@ -20,21 +20,18 @@ package org.openecomp.sdc.be.datatypes.elements; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor public enum PolicyTargetType { 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; - } + @Getter + private final String name; public static PolicyTargetType getByNameIgnoreCase(String name) { for (PolicyTargetType inst : PolicyTargetType.values()) { @@ -45,4 +42,3 @@ 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 8a663374b2..197260bc0b 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 @@ -22,7 +22,13 @@ 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; @@ -43,9 +49,6 @@ public class PolicyTypeDataDefinition extends ToscaTypeDataDefinition { private Long modificationTime; private boolean highestVersion; - public PolicyTypeDataDefinition() { - } - public PolicyTypeDataDefinition(PolicyTypeDataDefinition p) { super(p); this.uniqueId = p.uniqueId; @@ -59,82 +62,12 @@ public class PolicyTypeDataDefinition extends ToscaTypeDataDefinition { this.highestVersion = p.highestVersion; } - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public List getTargets() { - return targets; - } - - public void setTargets(List members) { - this.targets = members; - } - - public Map getMetadata() { - return metadata; - } - - public void setMetadata(Map 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 2d8350b9ef..5e1c42cc62 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 @@ -20,30 +20,29 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; - 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 public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition { private String fullName; - private List contacts; - private Boolean isActive; - public ProductMetadataDataDefinition() { - super(); - } - - public ProductMetadataDataDefinition(ProductMetadataDataDefinition other) { - super(other); - } - - public ProductMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){ - super(extractor); + public ProductMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) { + super(extractor); } public Boolean getIsActive() { @@ -54,14 +53,6 @@ public class ProductMetadataDataDefinition extends ComponentMetadataDataDefiniti isActive = active; } - public List getContacts() { - return contacts; - } - - public void setContacts(List contacts) { - this.contacts = contacts; - } - public void addContact(String contact) { if (contact != null) { if (contacts == null) { @@ -71,67 +62,6 @@ 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 d9e053f454..3f68a3cc76 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 @@ -20,9 +20,7 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.apache.commons.collections.CollectionUtils; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import static org.apache.commons.collections.CollectionUtils.isNotEmpty; import java.util.ArrayList; import java.util.HashMap; @@ -32,37 +30,28 @@ 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 static org.apache.commons.collections.CollectionUtils.isNotEmpty; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @EqualsAndHashCode(callSuper = false) @Data public class PropertyDataDefinition extends ToscaDataDefinition { + protected boolean definition = false; + protected Boolean hidden = Boolean.FALSE; private String uniqueId; - // "boolean", "string", "float", "integer", "version" }) private String type; - private Boolean required = Boolean.FALSE; - - protected boolean definition = false; - private String defaultValue; - private String description; - private SchemaDefinition schema; - private boolean password; - private String name; - private String value; - private String label; - protected Boolean hidden = Boolean.FALSE; private Boolean immutable = Boolean.FALSE; private String inputPath; @@ -86,7 +75,7 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private List getPolicyValues; private List propertyConstraints; - + private Map metadata; public PropertyDataDefinition() { @@ -130,7 +119,7 @@ public class PropertyDataDefinition extends ToscaDataDefinition { if (MapUtils.isNotEmpty(propertyDataDefinition.getMetadata())) { setMetadata(new HashMap<>(propertyDataDefinition.getMetadata())); } - if(isNotEmpty(propertyDataDefinition.getPropertyConstraints())){ + if (isNotEmpty(propertyDataDefinition.getPropertyConstraints())) { setPropertyConstraints(new ArrayList<>(propertyDataDefinition.getPropertyConstraints())); } this.setIsDeclaredListInput(propertyDataDefinition.getIsDeclaredListInput()); @@ -149,17 +138,17 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return required; } - 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 String getSchemaType() { + public void setSchemaType(String schemaType) { if (schema != null && schema.getProperty() != null) { - return schema.getProperty().getType(); + schema.getProperty().setType(schemaType); } - return null; } public PropertyDataDefinition getSchemaProperty() { @@ -268,18 +257,19 @@ public class PropertyDataDefinition extends ToscaDataDefinition { } private boolean compareSchemaType(T other) { - return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType().equals(((PropertyDataDefinition) other).getSchema().getProperty().getType()); + return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType() + .equals(((PropertyDataDefinition) other).getSchema().getProperty().getType()); } @Override public T mergeFunction(T other, boolean allowDefaultValueOverride) { if (this.getType() != null - && this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) - && compareSchemaType(other)) { + && this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) + && compareSchemaType(other)) { other.setOwnerId(getOwnerId()); if (allowDefaultValueOverride - && getDefaultValue() != null - && !getDefaultValue().isEmpty()) { + && getDefaultValue() != null + && !getDefaultValue().isEmpty()) { other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue()); } return other; @@ -297,6 +287,10 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return this.getGetInputValues() != null && !this.getGetInputValues().isEmpty(); } + public List getAnnotations() { + return (List) getToscaPresentationValue(JsonPresentationFields.ANNOTATIONS); + } + public void setAnnotations(List newAnnotations) { Set 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. @@ -307,8 +301,4 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.annotations = new ArrayList<>(annotationSet); setToscaPresentationValue(JsonPresentationFields.ANNOTATIONS, this.annotations); } - - public List getAnnotations() { - return (List) 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 f0fc8b7dac..8a99bf812d 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 @@ -21,56 +21,39 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - import java.util.List; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +@Getter +@Setter +@NoArgsConstructor 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 rule; private String value; - public PropertyRule() { - super(); - } - public PropertyRule(List rule, String value) { super(); this.rule = rule; this.value = value; } - public List getRule() { - return rule; - } - - public void setRule(List rule) { - this.rule = rule; + public static String getForceAll() { + return FORCE_ALL; } - public String getValue() { - return value; + public static String getALL() { + return ALL; } - public void setValue(String value) { - this.value = value; + public static String getRuleAnyMatch() { + return RULE_ANY_MATCH; } @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 8dd00c4370..8c1d44b7b2 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 @@ -20,11 +20,12 @@ 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; -import java.util.List; - +@NoArgsConstructor public class RelationshipInstDataDefinition extends ToscaDataDefinition { public RelationshipInstDataDefinition(RelationshipInstDataDefinition cdt) { @@ -47,71 +48,68 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { this.setCapability(cdt.getCapability()); } - public void setRequirement(String requirement) { - setToscaPresentationValue(JsonPresentationFields.REQUIREMENT, requirement); - } - public String getRequirement() { return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT); } - public void setCapability(String capability) { - setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); + public void setRequirement(String requirement) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT, requirement); } public String getCapability() { return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); } - public void setToId(Object toId) { - setToscaPresentationValue(JsonPresentationFields.TO_ID, toId); - } - - public void setFromId(Object fromId) { - setToscaPresentationValue(JsonPresentationFields.FROM_ID, fromId); + public void setCapability(String capability) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); } public String getToId() { return (String) getToscaPresentationValue(JsonPresentationFields.TO_ID); } - public String getFromId() { - return (String) getToscaPresentationValue(JsonPresentationFields.FROM_ID); + public void setToId(Object toId) { + setToscaPresentationValue(JsonPresentationFields.TO_ID, toId); } - public void setRequirementId(Object requirementId) { - setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID, requirementId); + public String getFromId() { + return (String) getToscaPresentationValue(JsonPresentationFields.FROM_ID); } - public void setCapabilityId(Object capabilityId) { - setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabilityId); + public void setFromId(Object fromId) { + setToscaPresentationValue(JsonPresentationFields.FROM_ID, fromId); } public String getRequirementId() { return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID); } + public void setRequirementId(Object requirementId) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID, requirementId); + } + public String getCapabilityId() { return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID); } - public void setRequirementOwnerId(Object requirementOwnerId) { - setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID, requirementOwnerId); + public void setCapabilityId(Object capabilityId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabilityId); } public String getRequirementOwnerId() { return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID); } - public void setCapabilityOwnerId(Object capabilityOwnerId) { - setToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID, capabilityOwnerId); + public void setRequirementOwnerId(Object requirementOwnerId) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID, requirementOwnerId); } public String getCapabilityOwnerId() { return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID); } - public RelationshipInstDataDefinition() { + public void setCapabilityOwnerId(Object capabilityOwnerId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID, capabilityOwnerId); } public String getUniqueId() { @@ -133,10 +131,12 @@ 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); } @@ -157,6 +157,7 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES, validTargetTypes); } + @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -190,15 +191,15 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); } - public void setInterfaces(final ListDataDefinition operations) { - setToscaPresentationValue(JsonPresentationFields.INTERFACES, operations); - } - @SuppressWarnings("unchecked") public ListDataDefinition getInterfaces() { return (ListDataDefinition) getToscaPresentationValue(JsonPresentationFields.INTERFACES); } + public void setInterfaces(final ListDataDefinition operations) { + setToscaPresentationValue(JsonPresentationFields.INTERFACES, operations); + } + @Override public String toString() { String uniqueId = getUniqueId(); @@ -210,8 +211,9 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { 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 4b7b6aa413..ae289b7e36 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 @@ -21,6 +21,8 @@ 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; @@ -28,9 +30,6 @@ 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 */ @@ -41,7 +40,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; @@ -93,14 +92,6 @@ 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); } @@ -196,23 +187,23 @@ public class RequirementDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); } - public void setPath(List path) { - setToscaPresentationValue(JsonPresentationFields.PATH, path); - } - @SuppressWarnings({"unchecked"}) public List getPath() { return (List) getToscaPresentationValue(JsonPresentationFields.PATH); } - public void setSource(String source) { - setToscaPresentationValue(JsonPresentationFields.SOURCE, source); + public void setPath(List path) { + setToscaPresentationValue(JsonPresentationFields.PATH, path); } 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 * 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 34dc43760f..8ce9865880 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 @@ -16,30 +16,17 @@ 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; -import java.io.Serializable; - +@NoArgsConstructor 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 getProperties() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.PROPERTIES); + JsonPresentationFields.PROPERTIES); } public void setProperties(ListDataDefinition 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 ce27e3ba44..1ee33eeafe 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,10 @@ */ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - import java.io.Serializable; import java.util.List; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class RequirementNodeFilterPropertyDataDefinition extends ToscaDataDefinition implements Serializable { 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 242eb490ef..21f133a25d 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 @@ -20,28 +20,16 @@ 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 getProperties() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.PROPERTIES); + JsonPresentationFields.PROPERTIES); } public void setProperties(final ListDataDefinition 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 1e4fc58ffe..c17e7fa3b5 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 @@ -20,26 +20,28 @@ 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 constraints; private Map properties; - private PropertyDataDefinition property; - - public SchemaDefinition() { - } - public SchemaDefinition(String derivedFrom, List constraints, Map properties) { this.setDerivedFrom(derivedFrom); @@ -48,97 +50,13 @@ public class SchemaDefinition extends ToscaDataDefinition { } - 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 getConstraints() { - return constraints; - } - - public void setConstraints(List constraints) { - this.constraints = constraints; - } - - public Map getProperties() { - return properties; - } - - public void setProperties(Map 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 + ']'; + + 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 beb5aac1d0..d51822b27d 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,17 +38,17 @@ public class SubstitutionFilterDataDefinition extends ToscaDataDefinition implem this.setCapabilities(substitutionFilterDataDefinition.getCapabilities()); } - public void setTosca_id(final Object tosca_id) { - setToscaPresentationValue(JsonPresentationFields.TOSCA_ID, tosca_id); - } - public Object getTosca_id() { return getToscaPresentationValue(JsonPresentationFields.TOSCA_ID); } + public void setTosca_id(final Object tosca_id) { + setToscaPresentationValue(JsonPresentationFields.TOSCA_ID, tosca_id); + } + public ListDataDefinition getProperties() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.PROPERTIES); + JsonPresentationFields.PROPERTIES); } public void setProperties(final ListDataDefinition properties) { @@ -57,21 +57,13 @@ public class SubstitutionFilterDataDefinition extends ToscaDataDefinition implem public ListDataDefinition getCapabilities() { return (ListDataDefinition) getToscaPresentationValue( - JsonPresentationFields.NODE_FILTER_CAPABILITIES); + JsonPresentationFields.NODE_FILTER_CAPABILITIES); } public void setCapabilities(ListDataDefinition 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); } @@ -80,5 +72,4 @@ public class SubstitutionFilterDataDefinition extends ToscaDataDefinition implem 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 607292f7eb..b0a73a27df 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. @@ -21,10 +21,12 @@ 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 b6f9fa236d..c4ca549a85 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 @@ -20,44 +20,24 @@ 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 518e5eb8cf..e89537deef 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 @@ -52,6 +52,14 @@ 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 bcd04bc1b2..c3a127c8ff 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,51 +31,6 @@ 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 result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getContacts(); - } - - - @Test - public void testSetContacts() throws Exception { - ProductMetadataDataDefinition testSubject; - List contacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setContacts(contacts); - } - - @Test public void testAddContact() throws Exception { ProductMetadataDataDefinition testSubject; @@ -92,64 +47,6 @@ 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; -- cgit 1.2.3-korg