Example #1
0
  public Question updateQuestion(SocialUser loginUser, QuestionDto questionDto) {
    Assert.notNull(loginUser, "loginUser should be not null!");
    Assert.notNull(questionDto, "question should be not null!");

    Question question = questionRepository.findOne(questionDto.getQuestionId());

    Set<Tag> tags = tagService.processTags(questionDto.getPlainTags());
    question.update(loginUser, questionDto.getTitle(), questionDto.getContents(), tags);
    return question;
  }
Example #2
0
 @RequestMapping("/search")
 public @ResponseBody List<TagForm> searchByTagName(String name) {
   logger.debug("search tag by name : {}", name);
   List<Tag> searchedTags = tagService.findsBySearch(name);
   List<TagForm> tags = new ArrayList<TagForm>();
   for (Tag tag : searchedTags) {
     tags.add(new TagForm(tag.getName()));
   }
   return tags;
 }
Example #3
0
  public Question createQuestion(SocialUser loginUser, QuestionDto questionDto) {
    Assert.notNull(loginUser, "loginUser should be not null!");
    Assert.notNull(questionDto, "question should be not null!");

    Set<Tag> tags = tagService.processTags(questionDto.getPlainTags());

    Question newQuestion =
        new Question(loginUser, questionDto.getTitle(), questionDto.getContents(), tags);
    Question savedQuestion = questionRepository.saveAndFlush(newQuestion);

    if (questionDto.isConnected()) {
      log.info("firing sendMessageToFacebook!");
      facebookService.sendToQuestionMessage(loginUser, savedQuestion.getQuestionId());
    }
    return savedQuestion;
  }
Example #4
0
 public String tags(Integer page, ModelMap model) throws Exception {
   model.addAttribute("tags", tagService.findPooledTags(createPageable(page)));
   model.addAttribute("parentTags", tagService.findPooledTags());
   return "tags/tags";
 }