Package org.openmeetings.app.persistence.beans.poll

Examples of org.openmeetings.app.persistence.beans.poll.RoomPoll


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


          Long polltypeid = importLongType(unformatString(roompollObject
              .element("polltypeid").getText()));
          Long roomid = importLongType(unformatString(roompollObject
              .element("roomid").getText()));
         
          RoomPoll roomPoll = new RoomPoll();
          roomPoll.setPollName(pollname);
          roomPoll.setPollQuestion(pollquestion);
          if (archived != null) {
            roomPoll.setArchived(archived.booleanValue());
          } else {
            roomPoll.setArchived(true);
          }
          roomPoll.setCreated(created);
          roomPoll.setCreatedBy(usersDao.getUser(getNewId(createdbyuserid, Maps.USERS)));
          roomPoll.setPollType(pollManagement.getPollType(polltypeid));
          roomPoll.setRoom(roommanagement.getRoomById(getNewId(roomid, Maps.ROOMS)));
          roomPoll.setRoomPollAnswerList(new LinkedList<RoomPollAnswers>());
         
          Element roompollanswers = roompollObject
              .element("roompollanswers");

          for (Iterator<Element> innerIterAnswers = roompollanswers
              .elementIterator("roompollanswer"); innerIterAnswers
              .hasNext();) {

            Element innerIterAnswerObj = innerIterAnswers.next();

            Integer pointlist = importIntegerType(unformatString(innerIterAnswerObj
                .element("pointlist").getText()));
            Boolean answer = importBooleanType(unformatString(innerIterAnswerObj
                .element("answer").getText()));
            Date votedate = CalendarPatterns
                .parseImportDate(unformatString(innerIterAnswerObj
                    .element("votedate").getText()));
            Long voteduserid = importLongType(unformatString(innerIterAnswerObj
                .element("voteduserid").getText()));
           
            RoomPollAnswers roomPollAnswers = new RoomPollAnswers();
            roomPollAnswers.setPointList(pointlist);
            roomPollAnswers.setAnswer(answer);
            roomPollAnswers.setVoteDate(votedate);
            roomPollAnswers.setVotedUser(usersDao.getUser(getNewId(voteduserid, Maps.USERS)));
           
            roomPoll.getRoomPollAnswerList().add(roomPollAnswers);
          }
         
          roomPollList.add(roomPoll);

        }
View Full Code Here

      if (pollManagement.hasVoted(roomId, rc.getUser_id())) {
        log.debug("hasVoted: true");
        return -1;
      }
      // get Poll
      RoomPoll roomP = pollManagement.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(usermanagement.getUserById(rc.getUser_id()));
      rpA.setVoteDate(new Date());
      rpA.setRoomPoll(roomP);
      roomP.getRoomPollAnswerList().add(rpA);
      pollManagement.updatePoll(roomP);
      return 1;
    } catch (Exception err) {
      log.error("[vote]", err);
    }
View Full Code Here

TOP

Related Classes of org.openmeetings.app.persistence.beans.poll.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.