Package com.liferay.portlet.polls.model

Examples of com.liferay.portlet.polls.model.PollsQuestion


    throws PortalException, SystemException {

    Iterator itr = PollsQuestionUtil.findByGroupId(groupId).iterator();

    while (itr.hasNext()) {
      PollsQuestion question = (PollsQuestion)itr.next();

      deleteQuestion(question.getQuestionId());
    }
  }
View Full Code Here


  }

  public void deleteQuestion(String questionId)
    throws PortalException, SystemException {

    PollsQuestion question = PollsQuestionUtil.findByPrimaryKey(questionId);

    // Delete all displays associated with this question

    PollsDisplayUtil.removeByQuestionId(questionId);
View Full Code Here

    _validate(title, description, choices);

    User user = UserLocalManagerUtil.getUserById(userId);

    PollsQuestion question = PollsQuestionUtil.findByPrimaryKey(questionId);

    Date expirationDate = null;
    if (!neverExpires) {
      expirationDate = PortalUtil.getDate(
        expMonth, expDay, expYear,
        new QuestionExpirationDateException());
    }

    question.setModifiedDate(new Date());
    question.setTitle(title);
    question.setDescription(description);
    question.setExpirationDate(expirationDate);

    PollsQuestionUtil.update(question);

    // Delete old choices
View Full Code Here

  }

  public void vote(String userId, String questionId, String choiceId)
    throws PortalException, SystemException {

    PollsQuestion question = PollsQuestionUtil.findByPrimaryKey(questionId);

    Date now = new Date();

    question.setLastVoteDate(now);

    PollsQuestionUtil.update(question);

    PollsVotePK votePK = new PollsVotePK(questionId, userId);
View Full Code Here

      String cmd = ParamUtil.getString(req, Constants.CMD);

      if (cmd.equals(Constants.UPDATE)) {
        String questionId = ParamUtil.getString(req, "question_id");

        PollsQuestion question = null;

        try {
          question = PollsQuestionManagerUtil.getQuestion(questionId);

          PollsDisplay display =
            PollsDisplayManagerUtil.updateDisplay(config.getPortletName(),
              question.getQuestionId());

          PortletAction pa = (PortletAction)InstancePool.get(
            ViewAction.class.getName());

          return pa.render(mapping, form, config, req, res);
View Full Code Here

    List questions = PollsQuestionUtil.findAll();

    Date now = new Date();

    for (int i = 0; i < questions.size(); i++) {
      PollsQuestion question = (PollsQuestion)questions.get(i);

      if (question.getExpirationDate() != null &&
        question.getExpirationDate().before(now)) {

        PollsQuestionUtil.remove(question.getQuestionId());
      }
    }
  }
View Full Code Here

  public void vote(String questionId, String choiceId)
    throws PortalException, SystemException {

    User user = getUser();

    PollsQuestion question = getQuestion(questionId);

    if (!question.getCompanyId().equals(user.getCompanyId())) {
      throw new PrincipalException();
    }

    PollsQuestionLocalManagerUtil.vote(
      user.getUserId(), questionId, choiceId);
View Full Code Here

  // Permission methods

  public boolean hasAdmin(String questionId)
    throws PortalException, SystemException {

    PollsQuestion question = PollsQuestionUtil.findByPrimaryKey(questionId);

    try {
      if ((question.getUserId().equals(getUserId())) ||
        (getUser().getCompanyId().equals(question.getCompanyId()) &&
        APILocator.getRoleAPI().doesUserHaveRole(APILocator.getUserAPI().loadUserById(getUserId(),APILocator.getUserAPI().getSystemUser(),true), Role.POLLS_ADMIN))) {

        return true;
      }
      else {
View Full Code Here

  public static void getQuestion(HttpServletRequest req) throws Exception {
    String questionId = req.getParameter("question_id");

    // Find question

    PollsQuestion question = null;

    if (Validator.isNotNull(questionId)) {
      question = PollsQuestionManagerUtil.getQuestion(questionId);
    }
View Full Code Here

TOP

Related Classes of com.liferay.portlet.polls.model.PollsQuestion

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.