diff options
author | andre.schmid <andre.schmid@est.tech> | 2021-08-18 14:34:33 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2021-08-26 12:13:58 +0000 |
commit | aea64ba99fa9c9b51112b30aeb0872c4cdb89759 (patch) | |
tree | 8645ba4b820f8615e54ecd053f7232c2fcd7dca9 /common-be/src | |
parent | 5a0703ffad1492ec6b6c78143f63dca83ee030d2 (diff) |
Validate the Resource Model before importing VSP
Validates the Resource Model selected during the Import VSP.
This model must be aligned with one of the models that the
imported VSP relates to.
Fix VSP package retrieval to get the exact version from the
VSP chosen during the Import VSP process.
Introduces a client in the Catalog to retrieve from the
Onboarding backend a VSP information using its Id and
version Id.
Change-Id: Ic8fb52b6daadc0e7203c81a9c15c3e46d5b9fffb
Issue-ID: SDC-3675
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'common-be/src')
4 files changed, 22 insertions, 135 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java index 849153b1ac..d6588e96e1 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java @@ -37,106 +37,45 @@ import org.openecomp.sdc.common.log.wrappers.Logger; @NoArgsConstructor @EqualsAndHashCode @ToString +@Getter +@Setter public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition { private static final Logger LOGGER = Logger.getLogger(ComponentMetadataDataDefinition.class.getName()); - @Getter private String uniqueId; - @Getter - @Setter private String name; // archiveName - @Getter - @Setter private String version; // archiveVersion - @Getter - @Setter private Boolean highestVersion; - @Getter - @Setter private Long creationDate; - @Getter - @Setter private Long lastUpdateDate; - @Getter - @Setter private String description; - @Getter - @Setter private String state; - @Getter - @Setter private List<String> tags; - @Getter - @Setter private String conformanceLevel; - @Getter - @Setter private String icon; - @Getter private String UUID; - @Getter - @Setter private String normalizedName; - @Getter - @Setter private String systemName; - @Getter - @Setter private String contactId; - @Getter - @Setter private Map<String, String> allVersions; - @Getter - @Setter private Boolean isDeleted; - @Getter - @Setter private String projectCode; - @Getter - @Setter private String csarUUID; - @Getter - @Setter private String csarVersion; - @Getter - @Setter private String importedToscaChecksum; - @Getter private String invariantUUID; - @Getter - @Setter protected ComponentTypeEnum componentType; - // USER - @Getter - @Setter private String creatorUserId; - @Getter - @Setter private String creatorFullName; - @Getter - @Setter private String lastUpdaterUserId; - @Getter - @Setter private String lastUpdaterFullName; - //Archive/Restore - @Getter - @Setter private Boolean isArchived = false; - @Getter - @Setter private Long archiveTime; - @Getter - @Setter private Boolean isVspArchived = false; - @Getter - @Setter private Map<String, String> categorySpecificMetadata; - @Getter - @Setter private String model; - public ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) { + protected ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) { this.uniqueId = other.getUniqueId(); this.name = other.getName(); this.version = other.getVersion(); @@ -165,7 +104,7 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio this.model = other.getModel(); } - public ComponentMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) { + protected ComponentMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) { this.uniqueId = extractor.getUniqueId(); this.name = extractor.getName(); this.version = extractor.getVersion(); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java index ced5a679d7..57279ada0e 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java @@ -20,24 +20,27 @@ package org.openecomp.sdc.be.datatypes.components; import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @EqualsAndHashCode(callSuper = true) +@Getter +@Setter +@ToString(callSuper = true) public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition { private String vendorName; private String vendorRelease; private String resourceVendorModelNumber; - private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC - - // is - - // default + private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; private Boolean isAbstract; private String cost; private String licenseType; private String toscaResourceName; + private String csarVersionId; public ResourceMetadataDataDefinition() { super(); @@ -52,6 +55,7 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit this.isAbstract = other.isHighestVersion(); this.resourceType = other.getResourceType(); this.toscaResourceName = other.getToscaResourceName(); + this.csarVersionId = other.getCsarVersionId(); } public ResourceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) { @@ -62,76 +66,15 @@ public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinit this.isAbstract = extractor.isAbstract(); this.resourceType = extractor.getResourceType(); this.toscaResourceName = extractor.getToscaResourceName(); - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; - } - - public String getVendorRelease() { - return vendorRelease; - } - - public void setVendorRelease(String vendorRelease) { - this.vendorRelease = vendorRelease; - } - - public String getResourceVendorModelNumber() { - return resourceVendorModelNumber; - } - - public void setResourceVendorModelNumber(String resourceVendorModelNumber) { - this.resourceVendorModelNumber = resourceVendorModelNumber; - } - - public ResourceTypeEnum getResourceType() { - return resourceType; - } - - public void setResourceType(ResourceTypeEnum resourceType) { - this.resourceType = resourceType; + this.csarVersionId = extractor.getCsarVersionId(); } public Boolean isAbstract() { - return isAbstract; - } - - public void setAbstract(Boolean isAbstract) { - this.isAbstract = isAbstract; - } - - public String getCost() { - return cost; - } - - public void setCost(String cost) { - this.cost = cost; - } - - public String getLicenseType() { - return licenseType; - } - - public void setLicenseType(String licenseType) { - this.licenseType = licenseType; - } - - public String getToscaResourceName() { - return toscaResourceName; - } - - public void setToscaResourceName(String toscaResourceName) { - this.toscaResourceName = toscaResourceName; + return getIsAbstract(); } - @Override - public String toString() { - return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease + ", resourceVendorModelNumber=" - + resourceVendorModelNumber + ", resourceType=" + resourceType + ", isAbstract=" + isAbstract + super.toString() + "]"; + public void setAbstract(final Boolean isAbstract) { + setIsAbstract(isAbstract);; } @Override diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java index 1e8e842656..8fce664686 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java @@ -61,6 +61,7 @@ public enum JsonPresentationFields { INVARIANT_UUID("invariantUuid", GraphPropertyEnum.INVARIANT_UUID), CSAR_UUID("csarUuid", GraphPropertyEnum.CSAR_UUID), CSAR_VERSION("csarVersion", null), + CSAR_VERSION_ID("csarVersionId", null), IMPORTED_TOSCA_CHECKSUM("importedToscaChecksum", null), CONTACT_ID("contactId", null), PROJECT_CODE("projectCode", null), diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java index 2fc2c52404..a0b2143a5f 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java @@ -105,6 +105,10 @@ public class JsonPresentationFieldsExtractor { return (String) properties.get(JsonPresentationFields.CSAR_VERSION.getPresentation()); } + public String getCsarVersionId() { + return (String) properties.get(JsonPresentationFields.CSAR_VERSION_ID.getPresentation()); + } + public String getImportedToscaChecksum() { return (String) properties.get(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM.getPresentation()); } |