コード例 #1
0
ファイル: AnswerProcessService.java プロジェクト: jmini/mcqs
  @Override
  public void delete(Long answerNr) throws ProcessingException {
    if (!ACCESS.check(new DeleteAnswerPermission())) {
      throw new VetoException(TEXTS.get("AuthorizationFailed"));
    }

    if (answerNr == null) {
      throw new ProcessingException("AnswerNr can no be null");
    }

    SQL.delete(
        "delete from answers_choices where answer_id = :AnswerNr",
        new NVPair("AnswerNr", answerNr));
    SQL.delete("delete from answers where answer_id = :AnswerNr", new NVPair("AnswerNr", answerNr));
  }
コード例 #2
0
ファイル: AnswerProcessService.java プロジェクト: jmini/mcqs
  @Override
  public AnswerFormData store(AnswerFormData formData) throws ProcessingException {
    if (!ACCESS.check(new UpdateAnswerPermission())) {
      throw new VetoException(TEXTS.get("AuthorizationFailed"));
    }

    if (formData.getAnswerNr() == null) {
      throw new ProcessingException("AnswerNr can no be null");
    }

    SQL.update("update answers set name = :YourName where answer_id = :AnswerNr", formData);

    SQL.delete("delete from answers_choices where answer_id = :AnswerNr", formData);

    storeAnswerChoice(formData);

    return formData;
  }