diff --git a/src/main/java/net/geant/nmaas/portal/api/market/ApplicationController.java b/src/main/java/net/geant/nmaas/portal/api/market/ApplicationController.java index 38ab004726d458a1a5dac6551cab35c433a6bb0f..4d1c58ba03218d0cb7173aa00d46800c4c313ef5 100644 --- a/src/main/java/net/geant/nmaas/portal/api/market/ApplicationController.java +++ b/src/main/java/net/geant/nmaas/portal/api/market/ApplicationController.java @@ -68,6 +68,15 @@ public class ApplicationController extends AppBaseController { private ApplicationView application; } + @AllArgsConstructor + @NoArgsConstructor + @Getter + @Setter + public static class ApplicationDTOVersionList { + private ApplicationBaseView applicationBase; + private List<ApplicationView> applications; + } + private final ApplicationEventPublisher eventPublisher; private final RatingRepository ratingRepository; @@ -198,6 +207,18 @@ public class ApplicationController extends AppBaseController { ); } + @GetMapping(value="/base/allversions/{id}") + @Transactional + public ApplicationDTOVersionList getApplicationDTOWithAllVersions(@PathVariable Long id) { + ApplicationBase base = appBaseService.getBaseApp(id); + List<Application> versionList = this.applicationService.findAll().stream().filter(app -> app.getName().equalsIgnoreCase(base.getName())).collect(Collectors.toList()); + return new ApplicationDTOVersionList( + modelMapper.map(base, ApplicationBaseView.class), + versionList.stream().map(app->modelMapper.map(app, ApplicationView.class)).collect(Collectors.toList()) + ); + } + + @GetMapping(value="/versions/{id}") @Transactional public Set<ApplicationVersion> getApplicationVersion(@PathVariable Long id) {