Examples of Vote


Examples of com.arjuna.wst.Vote

    }

    public void testPrepareWithPreparedVote()
        throws Exception
    {
        Vote vote = _preparedVoteStub.prepare();

        assertNotNull(vote);
        assertTrue("Expected vote \"Prepared\" got \"" + vote.getClass().getName() + "\"", vote instanceof com.arjuna.wst.Prepared);
    }
View Full Code Here

Examples of com.sharomank.domain.Vote

        for (Vote v : getVotes()) {
            if (v.getAccount().getId().equals(voteAccount.getId())) {
                return;
            }
        }
        Vote v = new Vote();
        v.setAccount(voteAccount);
        v.setPlus(plus);
        votes.add(v);
        calculateRating();
    }
View Full Code Here

Examples of com.tapestry5book.entities.Vote

    @Persist(PersistenceConstants.FLASH)
    private String message;

    void onPrepare() {
        if (vote == null) {
            vote = new Vote();
        }
    }
View Full Code Here

Examples of com.uphea.domain.Vote

    // find answers question
    question = questionService.findAnswersQuestion(answer.getId());
    answerService.loadAnswers(question);
    userAnswer = question.lookupAnswerById(answer.getId());

    Vote vote;
    // find user vote if exist
    if (userSession != null) {
      // read vote from db, ignore request parameter
      userVote = answerService.findUserVoteForQuestion(userSession.getUser(), question);
    } else {
      // read votes from param
      if ((userVote != null) && (userVote.getId() != null)) {
        userVote = answerService.findVoteById(userVote.getId());
        if (userVote == null) {
          log.info("user vote can't be found.");
        }
      } else {
        userVote = null;
      }
    }

    // update or save a vote
    if (userVote != null) {
      log.info("update vote {}", userVote.getId());
      Answer currentAnswer = question.lookupAnswerById(userVote.getAnswerId());
      if (currentAnswer.equals(userAnswer)) {
        log.debug("vote equals to previous one.");
        statsService.calcAnswerDistribution(question);
        return OK;
      }
      vote = answerService.changeVoteAnswer(userVote, currentAnswer, userAnswer, requestRemoteAddr);
    } else {
      log.info("add new vote {}");
      vote = answerService.voteForAnswer(userAnswer, requestRemoteAddr, userSession == null ? null : userSession.getUser());
    }
    userVoteId = vote.getId();

    // recalc
    statsService.calcAnswerDistribution(question);

    // add cookie
View Full Code Here

Examples of gov.nysenate.openleg.model.Vote

    public void applyVoteMemo(String data, Bill bill, Date date) throws ParseError
    {
        // TODO: Parse out sequence number once LBDC (maybe) includes it, #6531
        // Because sometimes votes are back to back we need to check for headers
        // Example of a double vote entry: SOBI.D110119.T140802.TXT:390
        Vote vote = null;
        for(String line : data.split("\n")) {
            Matcher voteHeader = voteHeaderPattern.matcher(line);
            if (voteHeader.find()) {
                // TODO: this assumes they are the same vote sent twice, what else could happen?
                //Start over if we hit a header, sometimes we get back to back entries.
                try {
                    // Use the old vote if we can find it, otherwise make a new one using now as the publish date
                    vote = new Vote(bill, voteDateFormat.parse(voteHeader.group(2)), Vote.VOTE_TYPE_FLOOR, "1");
                    vote.setPublishDate(date);
                    for (Vote oldVote : bill.getVotes()) {
                        if (oldVote.equals(vote)) {
                            // If we've received this vote before, use the old publish date
                            vote.setPublishDate(oldVote.getPublishDate());
                            break;
                        }
                    }
                    vote.setModifiedDate(date);
                } catch (ParseException e) {
                    throw new ParseError("voteDateFormat not matched: "+line);
                }

            }
            else if (vote!=null){
                //Otherwise, build the existing vote
                Matcher voteLine = votePattern.matcher(line);
                while(voteLine.find()) {
                    String type = voteLine.group(1).trim();
                    Person voter = new Person(voteLine.group(2).trim());

                    if (type.equals("Aye")) {
                        vote.addAye(voter);
                    }
                    else if (type.equals("Nay")) {
                        vote.addNay(voter);
                    }
                    else if (type.equals("Abs")) {
                        vote.addAbsent(voter);
                    }
                    else if (type.equals("Abd")) {
                        vote.addAbstain(voter);
                    }
                    else if (type.equals("Exc")) {
                        vote.addExcused(voter);
                    }
                    else {
                        throw new ParseError("Unknown vote type found: "+line);
                    }
                }
View Full Code Here

Examples of ise.mace.actions.Vote

    public void handle(Input input)
    {
      final ise.mace.inputs.Proposition in = (ise.mace.inputs.Proposition)input;

      Vote.VoteType v = castVote(in);
      ec.act(new Vote(in, v), getId(), authCode);

      logger.log(Level.FINE, "I, agent {0} voted {1} in {2}'s vote of {3}",
              new Object[]
              {
                dm.getName(),
View Full Code Here

Examples of ise.mace.inputs.Vote

      return;
    }

    if (input.getClass().equals(Vote.class))
    {
      final Vote v = (Vote)input;
      if (!voteResult.containsKey(v.getProposition()))
      {
        if (!v.getProposition().getOwnerGroup().equals(getId())) return;
        voteResult.put(v.getProposition(), 0);
      }
      voteResult.put(v.getProposition(),
              voteResult.get(v.getProposition()) + v.getVote().getValue());
      logger.log(Level.FINE,
              "Agent {0} has voted {1} on {2} by {3} as a member of {4}",
              new Object[]
              {
                ec.nameof(v.getAgent()),
                v.getVote(), v.getProposition().getType(),
                ec.nameof(v.getProposition().getProposer()), dm.getName()
              });
      return;
    }

    logger.log(Level.SEVERE, "Group Unable to handle Input of type {0}",
View Full Code Here

Examples of jug.domain.Vote

    @Test
    public void playWithVotes() {
        Subject subject = subjectDao.create("TOMEE_JUG_2", "What do you think about this JUG?");

        final Vote vote = voteDao.create(Value.I_LIKE);
        subject = subjectDao.addVote(subject, vote);
        assertEquals(1, subject.getVotes().size());

        final Vote moreVote = voteDao.create(Value.I_LIKE);
        subject = subjectDao.addVote(subject, moreVote);
        assertEquals(2, subject.getVotes().size());

        final Vote notLiked = voteDao.create(Value.I_DONT_LIKE);
        subject = subjectDao.addVote(subject, notLiked);
        assertEquals(3, subject.getVotes().size());

        final Subject retrievedSubject = subjectDao.findByName("TOMEE_JUG_2");
        assertNotNull(retrievedSubject);
View Full Code Here

Examples of models.Vote

        else
        {
            List<ModuleVersion> moduleVersions = ModuleVersion.findByModule(module);
            User user = currentUser();
            Rate rate = null;
            Vote vote = null;

            if (user != null)
            {
                rate = CollectionUtils.filterFirst(user.rates,
                                                   new Filter<Rate>()
View Full Code Here

Examples of net.bnubot.bot.commands.Vote

    if(bnSubject == null) {
      user.sendChat("User not found", whisperBack);
      return;
    }

    Vote v = new Vote(source, bnSubject, isBan);
    votes.put(source, v);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.