public String publish(Poll poll) {
    // validate Poll to see if it's ready to get public
    if (validate(poll)) {
      poll.setPollState(PollState.PUBLISHED);
      getFacade().edit(poll);
      // Start Tasks to set the Poll to state started and finished on the according dates
      taskManager.createStartPollTask(poll, getFacade());
      taskManager.createFinishPollTask(poll, getFacade());
      Locale locale = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();

      // create token for every participant
      for (Participant participant : poll.getParticipants()) {
        Token token = new Token();
        while (tokenFacade.countBy("tokenString", token.getTokenString()) > 0) {
          token = new Token();
        }
        token.setPoll(poll);
        tokenFacade.create(token);

        // only link if participationTracking is enabled
        if (poll.isParticipationTracking()) {
          token.setParticipant(participant);
          tokenFacade.edit(token);
          participant.setToken(token);
          participantFacade.edit(participant);
        }
      }
      HttpServletRequest request =
          (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
      String url =
          request.getScheme()
              + "://"
              + request.getServerName()
              + ":"
              + request.getServerPort()
              + "/";
      if (poll.isParticipationTracking() && poll.isReminderEmails()) {
        taskManager.createReminderMailTask(poll, eMailer, locale, url);
      }
      taskManager.createStartedMailTask(poll, eMailer, locale, url);
      ZVotesUtils.addInternationalizedInfoMessage("PollPublishedSuccessfully");
      return UrlsPy.POLL_LIST.getUrl(true);
    } else {
      return UrlsPy.POLL_LIST.getUrl(true);
    }
  }
 public String update() {
   try {
     getFacade().edit(current);
     ZVotesUtils.addInternationalizedInfoMessage("PollUpdated");
     return UrlsPy.POLL_LIST.getUrl(true);
   } catch (Exception e) {
     ZVotesUtils.addInternationalizedErrorMessage("PersistenceErrorOccured");
     return null;
   }
 }
 public String page(String page) {
   getPagination().setPage(Integer.valueOf(page));
   return UrlsPy.POLL_LIST.getUrl(true);
 }
 public String previous() {
   getPagination().previousPage();
   return UrlsPy.POLL_LIST.getUrl(true);
 }
 public String next() {
   getPagination().nextPage();
   return UrlsPy.POLL_LIST.getUrl(true);
 }
 public String destroy(Poll poll) {
   current = poll;
   performDestroy();
   recreatePagination();
   return UrlsPy.POLL_LIST.getUrl(true);
 }
 public String prepareList() {
   return UrlsPy.POLL_LIST.getUrl(true);
 }