예제 #1
0
파일: QnaService.java 프로젝트: shinC/slipp
  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;
  }
예제 #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;
 }
예제 #3
0
파일: QnaService.java 프로젝트: shinC/slipp
  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;
  }
예제 #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";
 }