/** * 更新 * * @return * @throws InvalidParamException * @throws IOException * @throws JSONException * @throws IllegalAccessException * @throws InstantiationException */ @Post @Auth(roles = "admin") public Boundary update() throws InstantiationException, IllegalAccessException, JSONException, IOException, InvalidParamException { List<ValidateError> errors = new ArrayList<ValidateError>(); TemplateMastersEntity template = loadParams(errors); if (!errors.isEmpty()) { return sendValidateError(errors); } // 保存 try { template = TemplateLogic.get().updateTemplate(template, getLoginedUser()); } catch (InvalidParamException e) { // エラーメッセージ送信 return send(e.getMessageResult()); } // メッセージ送信 return sendMsg( MessageStatus.Success, HttpStatus.SC_OK, String.valueOf(template.getTypeId()), "message.success.update"); }
/** * 登録 画面遷移すると再度画面を作るのが面倒なので、Ajaxアクセスとする * * @return * @throws InvalidParamException * @throws IOException * @throws JSONException * @throws IllegalAccessException * @throws InstantiationException */ @Post @Auth(roles = "admin") public Boundary create() throws InstantiationException, IllegalAccessException, JSONException, IOException, InvalidParamException { List<ValidateError> errors = new ArrayList<ValidateError>(); TemplateMastersEntity template = loadParams(errors); if (!errors.isEmpty()) { return sendValidateError(errors); } template.setTypeId(null); // 自動採番する // 保存 template = TemplateLogic.get().addTemplate(template, getLoginedUser()); // メッセージ送信 return sendMsg( MessageStatus.Success, HttpStatus.SC_OK, String.valueOf(template.getTypeId()), "message.success.insert"); }