aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2021-08-18 14:34:33 +0100
committerMichael Morris <michael.morris@est.tech>2021-08-26 12:13:58 +0000
commitaea64ba99fa9c9b51112b30aeb0872c4cdb89759 (patch)
tree8645ba4b820f8615e54ecd053f7232c2fcd7dca9 /openecomp-be/api/openecomp-sdc-rest-webapp
parent5a0703ffad1492ec6b6c78143f63dca83ee030d2 (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 'openecomp-be/api/openecomp-sdc-rest-webapp')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index 74d2fde097..5367e1ea75 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -335,16 +335,18 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
}
@Override
- public Response getTranslatedFile(String vspId, String versionName, String user) {
- List<Version> versions = versioningManager.list(vspId);
- Version version;
- if (versionName == null) {
+ public Response getTranslatedFile(String vspId, String versionId, String user) {
+ final List<Version> versions = versioningManager.list(vspId);
+ final Version version;
+ if (versionId == null) {
version = versions.stream().filter(ver -> VersionStatus.Certified == ver.getStatus())
.max(Comparator.comparingDouble(o -> Double.parseDouble(o.getName())))
.orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId).build()));
} else {
- version = versions.stream().filter(ver -> versionName.equals(ver.getName())).findFirst()
- .orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId).build()));
+ version = versions.stream()
+ .filter(ver -> versionId.equals(ver.getName()) || versionId.equals(ver.getId()))
+ .findFirst()
+ .orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId, versionId).build()));
if (version.getStatus() != VersionStatus.Certified) {
throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
}