diff options
Diffstat (limited to 'openecomp-be/api')
2 files changed, 15 insertions, 0 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/VendorSoftwareProducts.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/VendorSoftwareProducts.java index 328c96254f..fbe7d371ca 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/VendorSoftwareProducts.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/VendorSoftwareProducts.java @@ -76,6 +76,12 @@ public interface VendorSoftwareProducts extends VspEntities { @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); @GET + @Path("/{vspId}") + @Parameter(description = "Get details of the latest certified vendor software product") + Response getLatestVsp(@PathParam("vspId") String vspId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @GET @Path("/{vspId}/versions/{versionId}") @Parameter(description = "Get details of a vendor software product") Response getVsp(@PathParam("vspId") String vspId, @PathParam("versionId") String versionId, 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<Version> 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) { |