ArrayNode result = new ArrayNode(JsonNodeFactory.instance);
for (Proposal proposal : proposals) {
ObjectNode proposalJson = Json.newObject();
proposalJson.put("id", proposal.getId());
proposalJson.put("title", proposal.getTitle());
if (proposal.format != null) {
ObjectNode formatJson = Json.newObject();
formatJson.put("id", proposal.format.getId());
formatJson.put("dureeMinutes", proposal.format.getDureeMinutes());
formatJson.put("libelle", proposal.format.getLibelle());
proposalJson.put("format", formatJson);
} else {
proposalJson.putNull("format");
}
if (proposal.statusProposal != null) {
proposalJson.put("status", proposal.statusProposal.name());
} else {
proposalJson.putNull("status");
}
if (proposal.audience != null) {
proposalJson.put("audience", proposal.audience.getTitle());
} else {
proposalJson.putNull("audience");
}
if (proposal.getSpeaker() != null) {
ObjectNode speakerJson = Json.newObject();
speakerJson.put("id", proposal.getSpeaker().id);
speakerJson.put("fullname", proposal.getSpeaker().getFullname());
speakerJson.put("avatar", proposal.getSpeaker().getAvatar());
proposalJson.put("speaker", speakerJson);
}
Vote voteUser = votes.get(proposal.getId());
if (voteUser != null) {