public static List listVotings()

in src/main/java/org/apache/sling/discovery/impl/cluster/voting/VotingHelper.java [243:270]


    public static List<VotingView> listVotings(ResourceResolver resourceResolver, Config config) {
        if (config==null) {
            logger.info("listVotings: config is null, bundle likely deactivated.");
            return new ArrayList<VotingView>();
        }
        final String ongoingVotingsPath = config.getOngoingVotingsPath();
        final Resource ongoingVotingsResource = resourceResolver
                .getResource(ongoingVotingsPath);
        if (ongoingVotingsResource == null) {
            // it is legal that at this stage there is no ongoingvotings node yet 
            // for example when there was never a voting yet
            logger.debug("listVotings: no ongoing votings parent resource found");
            return new ArrayList<VotingView>();
        }
        final Iterable<Resource> children = ongoingVotingsResource.getChildren();
        final Iterator<Resource> it = children.iterator();
        final List<VotingView> result = new LinkedList<VotingView>();
        while (it.hasNext()) {
            Resource aChild = it.next();
            VotingView c = new VotingView(aChild);
            result.add(c);
        }
        if (logger.isDebugEnabled()) {
            logger.debug("listVotings: votings found: "
                    + result.size());
        }
        return result;
    }