use of org.xel.PhasingVote in project elastic-core-maven by OrdinaryDude.
the class GetPhasingPollVotes method processRequest.
@Override
protected JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {
long transactionId = ParameterParser.getUnsignedLong(req, "transaction", true);
int firstIndex = ParameterParser.getFirstIndex(req);
int lastIndex = ParameterParser.getLastIndex(req);
PhasingPoll phasingPoll = PhasingPoll.getPoll(transactionId);
if (phasingPoll != null) {
JSONObject response = new JSONObject();
JSONArray votesJSON = new JSONArray();
try (DbIterator<PhasingVote> votes = PhasingVote.getVotes(transactionId, firstIndex, lastIndex)) {
for (PhasingVote vote : votes) {
votesJSON.add(JSONData.phasingPollVote(vote));
}
}
response.put("votes", votesJSON);
return response;
}
return JSONResponses.UNKNOWN_TRANSACTION;
}
use of org.xel.PhasingVote in project elastic-core-maven by OrdinaryDude.
the class GetPhasingPollVote method processRequest.
@Override
protected JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {
long transactionId = ParameterParser.getUnsignedLong(req, "transaction", true);
long accountId = ParameterParser.getAccountId(req, true);
PhasingVote phasingVote = PhasingVote.getVote(transactionId, accountId);
if (phasingVote != null) {
return JSONData.phasingPollVote(phasingVote);
}
return JSON.emptyJSON;
}
Aggregations