Package org.apache.openmeetings.db.entity.room

Examples of org.apache.openmeetings.db.entity.room.RoomPoll


    q.setParameter("pollTypesId", typeId);
    return q.getSingleResult();
  }
 
  public RoomPoll createPoll(Client rc, String pollName, String pollQuestion, Long pollTypeId) {
    RoomPoll roomP = new RoomPoll();
   
    roomP.setCreatedBy(userDao.get(rc.getUser_id()));
    roomP.setCreated(new Date());
    roomP.setPollName(pollName);
    roomP.setPollQuestion(pollQuestion);
    roomP.setPollType(getPollType(pollTypeId));
    roomP.setRoom(roomDao.get(rc.getRoom_id()));
   
    em.persist(roomP);
    return roomP;
  }
View Full Code Here


      if (pollManager.hasVoted(roomId, rc.getUser_id())) {
        log.debug("hasVoted: true");
        return -1;
      }
      // get Poll
      RoomPoll roomP = pollManager.getPoll(roomId);

      log.debug("vote: " + pollvalue + " " + pollTypeId + " "
          + roomP.getPollQuestion());

      log.debug("hasVoted: false");
      RoomPollAnswers rpA = new RoomPollAnswers();
      if (roomP.getPollType().getIsNumericAnswer()) {
        log.debug("numeric");
        rpA.setPointList(pollvalue);
      } else {
        log.debug("boolean");
        // Is boolean Question
        rpA.setAnswer(new Boolean(pollvalue == 1));
      }
      rpA.setVotedUser(userManager.getUserById(rc.getUser_id()));
      rpA.setVoteDate(new Date());
      rpA.setRoomPoll(roomP);
      roomP.getRoomPollAnswerList().add(rpA);
      pollManager.updatePoll(roomP);
      return 1;
    } catch (Exception err) {
      log.error("[vote]", err);
    }
View Full Code Here

      if (pollManager.hasVoted(roomId, rc.getUser_id())) {
        log.debug("hasVoted: true");
        return -1;
      }
      // get Poll
      RoomPoll roomP = pollManager.getPoll(roomId);

      log.debug("vote: " + pollvalue + " " + pollTypeId + " "
          + roomP.getPollQuestion());

      log.debug("hasVoted: false");
      RoomPollAnswers rpA = new RoomPollAnswers();
      if (roomP.getPollType().getIsNumericAnswer()) {
        log.debug("numeric");
        rpA.setPointList(pollvalue);
      } else {
        log.debug("boolean");
        // Is boolean Question
        rpA.setAnswer(new Boolean(pollvalue == 1));
      }
      rpA.setVotedUser(userDao.get(rc.getUser_id()));
      rpA.setVoteDate(new Date());
      rpA.setRoomPoll(roomP);
      roomP.getRoomPollAnswerList().add(rpA);
      pollManager.updatePoll(roomP);
      return 1;
    } catch (Exception err) {
      log.error("[vote]", err);
    }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.room.RoomPoll

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.