Ejemplo n.º 1
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;
  }