예제 #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
파일: 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;
  }