Examples of Voter


Examples of com.agiletec.plugins.jpsurvey.aps.system.services.collect.model.Voter

      this.getVoterManager().deleteVoterById(voter3.getId());
    }
  }
 
  public void testDeleteVoterBySurveyId() throws Throwable {
    Voter v1 = this.getFakeVoter();
    Voter v2 = this.getFakeVoter();
    Survey survey=null;
    List<Integer> list=null;
    try {
      survey = this.getFakeActiveSurvey();
      this.getSurveyManager().saveSurvey(survey);
      list = this.getVoterManager().searchVotersByIds(null, null, null, null, null, survey.getId(), null);
      assertNull(list);
      v1.setSurveyid(survey.getId());
      v2.setSurveyid(survey.getId());
      this.getVoterManager().saveVoter(v1);
      this.getVoterManager().saveVoter(v2);
      list = this.getVoterManager().searchVotersByIds(null, null, null, null, null, survey.getId(), null);
      assertNotNull(list);
      assertEquals(2, list.size());
      this.getVoterManager().deleteVoterBySurveyId(survey.getId());
      list = this.getVoterManager().searchVotersByIds(null, null, null, null, null, survey.getId(), null);
      assertNull(list);
    } catch (Throwable t) {
      throw t;
    } finally {
      this.getVoterManager().deleteVoterById(v1.getId());
      this.getVoterManager().deleteVoterById(v2.getId());
      this.getSurveyManager().deleteSurvey(survey.getId());
    }
  }
View Full Code Here

Examples of com.agiletec.plugins.jpsurvey.aps.system.services.collect.model.Voter

      this.getSurveyManager().deleteSurvey(survey.getId());
    }
  }
 
  private Voter getFakeVoter() {
    Voter voter = new Voter();
    voter.setId(-1);
    voter.setAge(Integer.valueOf("31").shortValue());
    voter.setCountry("it");
    voter.setSex('M');
    voter.setDate(new Date());
    voter.setSurveyid(1);
    voter.setIpaddress("192.168.10.1");
    voter.setUsername(SystemConstants.GUEST_USER_NAME);
    return voter;
  }
View Full Code Here

Examples of com.agiletec.plugins.jpsurvey.aps.system.services.collect.model.Voter

    }
  }
 
  @Override
  public void saveVoterResponse(VoterResponse voterResponse) throws ApsSystemException {
    Voter voter = voterResponse.getVoter();
    try {
      this.getVoterManager().saveVoter(voter);
      int voterId = voter.getId();
      voterResponse.setVoterOnResponses(voterId);
      this.getResponseDAO().submitResponses(voterResponse.getResponses());
    } catch (Throwable t) {
      if (voter.getId() > 0) {
        this.getVoterManager().deleteVoterById(voter.getId());
      }
      ApsSystemUtils.logThrowable(t, this, "saveVoterResponse");
      throw new ApsSystemException("Error saving a vote", t);
    }
  }
View Full Code Here

Examples of com.agiletec.plugins.jpsurvey.aps.system.services.collect.model.Voter

    Survey survey = null;
    try {
      this.getRequest().getSession().removeAttribute(ApsAdminSurveySystemConstants.SURVEY_CURRENT_VOTING_INFO_SESSION_PARAM);
      this.getRequest().getSession().removeAttribute(ApsAdminSurveySystemConstants.SURVEY_CURRENT_QUESTION_INDEX_SESSION_PARAM);
      survey = this.getSurveyManager().loadSurvey(this.getSurveyId());
      Voter voter = this.createVoter();
     
      CurrentVotingInfoBean currentVotingInfoBean = new CurrentVotingInfoBean(survey, voter);
      this.getRequest().getSession().setAttribute(ApsAdminSurveySystemConstants.SURVEY_CURRENT_VOTING_INFO_SESSION_PARAM, currentVotingInfoBean);
      this.getRequest().getSession().setAttribute(ApsAdminSurveySystemConstants.SURVEY_CURRENT_QUESTION_INDEX_SESSION_PARAM, new Integer(-1));
    } catch (Throwable t) {
View Full Code Here

Examples of com.agiletec.plugins.jpsurvey.aps.system.services.collect.model.Voter

    }
    return SUCCESS;
  }
 
  protected Voter createVoter() {
    Voter voter = new Voter();
    voter.setDate(new Date());
    voter.setSurveyid(this.getSurveyId());
    voter.setUsername(this.getCurrentUser().getUsername());
    voter.setIpaddress(this.getRequest().getRemoteAddr());
    return voter;
  }
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.