if (rc==null){
log.error("RoomClient IS NULL for ClientID: "+current.getClient().getId());
return -1;
}
//get Poll
RoomPoll roomP = pollList.get(rc.getRoom_id());
if (roomP==null){
log.error("POLL IS NULL for RoomId: "+rc.getRoom_id());
return -1;
}
log.debug("vote: "+pollvalue+" "+pollTypeId+" "+roomP.getPollQuestion());
//Check if this user has already voted
if(this.hasVoted(roomP,rc.getStreamid())){
log.debug("hasVoted: true");
return -1;
} else {
log.debug("hasVoted: false");
RoomPollAnswers rpA = new RoomPollAnswers();
if (pollTypeId==1){
log.debug("boolean");
//Is boolean Question
if (pollvalue==1){
rpA.setAnswer(new Boolean(true));
} else {
rpA.setAnswer(new Boolean(false));
}
} else if(pollTypeId==2){
log.debug("numeric");
rpA.setPointList(pollvalue);
}
rpA.setVotedClients(rc);
rpA.setVoteDate(new Date());
roomP.getRoomPollAnswerList().add(rpA);
return 1;
}
} catch (Exception err){
log.error("vote");
log.error("[vote]",err);