コード例 #1
0
  @Override
  public Answer edit(AnswerForm answerForm, User user) {
    AnswerContent content = convertToAnswerContent(answerForm, user);
    answerContentRepository.save(content);

    Answer answer = answerRepository.findOne(answerForm.getId());
    answer.setContent(content);
    answer.getContentHistory().add(content);
    answerRepository.save(answer);

    return answer;
  }
コード例 #2
0
  @Override
  public Answer create(AnswerForm answerForm, Question question, User user) {
    AnswerContent content = convertToAnswerContent(answerForm, user);
    answerContentRepository.save(content);

    Answer answer = new Answer();
    answer.setContent(content);
    answer.getContentHistory().add(content);
    answer.setQuestion(question);
    answerRepository.save(answer);

    return answer;
  }