From d6b83fce723703f4dea0bce3675ecbf6996aaf9a Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Fri, 17 Sep 2021 15:48:43 +0100 Subject: Fix Update VSP when no version id is provided Issue-ID: SDC-3730 Change-Id: Ic5a5a6ecf3b6775e022be649145e44b0907cbecf Signed-off-by: andre.schmid --- .../sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to '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') 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 5367e1ea75..76e3f674dd 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 @@ -208,6 +208,15 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { return Response.ok(vspDetailsDto).build(); } + @Override + public Response getLatestVsp(final String vspId, final String user) { + final List versions = versioningManager.list(vspId); + final Version version = versions.stream().filter(ver -> VersionStatus.Certified == ver.getStatus()) + .max(Comparator.comparingDouble(o -> Double.parseDouble(o.getName()))) + .orElseThrow(() -> new CoreException(new PackageNotFoundErrorBuilder(vspId).build())); + return getVsp(vspId, version.getId(), user); + } + private void submitHealedVersion(VspDetails vspDetails, String baseVersionId, String user) { try { if (vspDetails.getVlmVersion() != null) { -- cgit 1.2.3-korg