org.apache.sling.discovery.impl.cluster.voting

## Class VotingHelper

- java.lang.Object
- - org.apache.sling.discovery.impl.cluster.voting.VotingHelper

    public class VotingHelper
    extends Object

Helper class for voting

### Constructor Summary

Constructors
Constructor and Description
`VotingHelper()`

### Method Summary

All Methods Static Methods Concrete Methods
`static VotingView` `getWinningVoting(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config)` Return the still valid (ongoing) and winning (received a yes vote from everybody) voting
`static List<VotingView>` `getYesVotingsOf(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config, String slingId)` Returns the voting for which the given slingId has vote yes or was the initiator (which is equal to yes).
`static List<VotingView>` `listOpenNonWinningVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config)` List all the votings that are currently 'open' but 'not winning'.
`static List<VotingView>` `listTimedoutVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config)` List all the votings that have timed out
`static List<VotingView>` `listVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### VotingHelper

    public VotingHelper()

### Method Detail

#### listOpenNonWinningVotings

    public static List<VotingView> listOpenNonWinningVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                             Config config)

List all the votings that are currently 'open' but 'not winning'.

'Open' means that they have not expired yet, have zero no-votes, and match the view that this instance has of the cluster.

'Not winning' means that a voting still did not receive a vote from everybody

Returns:
  the list of matching votings - never returns null

#### listTimedoutVotings

    public static List<VotingView> listTimedoutVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                       Config config)

List all the votings that have timed out

Returns:
  the list of matching votings

#### getWinningVoting

    public static VotingView getWinningVoting(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                              Config config)

Return the still valid (ongoing) and winning (received a yes vote from everybody) voting

Returns:
  the valid and winning voting

#### getYesVotingsOf

    public static List<VotingView> getYesVotingsOf(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                   Config config,
                                                   String slingId)

Returns the voting for which the given slingId has vote yes or was the initiator (which is equal to yes).

Parameters:
  `slingId` - the instance for which its yes vote should be looked up
Returns:
  the voting for which the given slingId has votes yes or was the initiator

#### listVotings

    public static List<VotingView> listVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                               Config config)