/** * Return all subscriptions and related nodes. Very light data are returned there since a lot of subscriptions * there. Parameters values are not fetch. * * @return Status of each subscription of each project and each node. */ @GET @org.springframework.transaction.annotation.Transactional(readOnly = true) public SubscriptionListVo findAll() { final SubscriptionListVo result = new SubscriptionListVo(); // First, list visible projects having at least one subscription final List<Object[]> projects = projectRepository.findAllHavingSubscription(securityHelper.getLogin()); // Fill the projects final Map<Integer, SubscribingProjectVo> projectsMap = toProjects(projects); result.setProjects(projectsMap.values()); /* * List visible projects having at least one subscription, return involved subscriptions relating theses * projects. SQL "IN" is not used, because of size limitations. Structure : id, project.id, service.id */ result.setSubscriptions(toSubscriptions(repository.findAllLight(), projectsMap)); /* * Then, fetch all nodes. SQL "IN" is not used, because of size limitations. They will be filtered against * subscriptions associated to a visible project. */ result.setNodes(toNodes(nodeResource.findAll(), result.getSubscriptions()).values()); return result; }