예제 #1
0
 public void execute(Event<UIVoteQuestion> event) throws Exception {
   UIVoteQuestion voteQuestion = event.getSource();
   double markVote = Double.parseDouble(event.getRequestContext().getRequestParameter(OBJECTID));
   FAQService faqService_ =
       (FAQService) PortalContainer.getInstance().getComponentInstanceOfType(FAQService.class);
   Answer answer = null;
   if (voteQuestion.language_ != null
       && voteQuestion.language_.trim().length() > 0
       && !voteQuestion.language_.equals(voteQuestion.question_.getLanguage())) {
     answer =
         faqService_.getAnswerById(
             voteQuestion.question_.getPath(), voteQuestion.answerId_, voteQuestion.language_);
     answer.setMarksVoteAnswer(markVote);
     faqService_.saveAnswer(voteQuestion.question_.getPath(), answer, voteQuestion.language_);
   } else {
     answer =
         faqService_.getAnswerById(voteQuestion.question_.getPath(), voteQuestion.answerId_);
     answer.setMarksVoteAnswer(markVote);
     faqService_.saveAnswer(voteQuestion.question_.getPath(), answer, false);
   }
   UIAnswersPortlet portlet = voteQuestion.getAncestorOfType(UIAnswersPortlet.class);
   UIPopupAction popupAction = portlet.getChild(UIPopupAction.class);
   UIQuestions questions =
       portlet.getChild(UIAnswersContainer.class).getChild(UIQuestions.class);
   // questions.setIsNotChangeLanguage() ;
   event.getRequestContext().addUIComponentToUpdateByAjax(questions);
   popupAction.deActivate();
   event.getRequestContext().addUIComponentToUpdateByAjax(popupAction);
 }