コード例 #1
0
  /**
   * GET
   *
   * <p>GET list of accounting systems
   *
   * @param model
   * @return String ( years )
   */
  @RequestMapping(value = "/list")
  public String shopListPage(ModelMap model) {
    List<AccountingSystem> accountingSystems = accountingSystemService.findAll();
    model.addAttribute("acsList", accountingSystems);

    return "accountingSystems";
  }
コード例 #2
0
  /**
   * POST
   *
   * <p>Update exist accountingSystem
   *
   * @param accountingSystem
   * @param id
   * @return String ( years list )
   */
  @RequestMapping(value = "/update/{ID}", method = RequestMethod.POST)
  public String update(
      @PathVariable("ID") Long id,
      @Valid @ModelAttribute AccountingSystem accountingSystem,
      BindingResult result,
      ModelMap model) {
    AccountingSystem updatedAccountingSystem = accountingSystemService.find(id);

    if (result.hasErrors()) {
      model.addAttribute("accountingSystem", accountingSystem);
      return "updateAccountingSystem";
    }
    updatedAccountingSystem.setName(accountingSystem.getName());

    accountingSystemService.update(updatedAccountingSystem);
    return REDIRECT_ACS_LIST;
  }
コード例 #3
0
 /**
  * DELETE
  *
  * <p>Delete exist year
  *
  * @param id
  */
 @RequestMapping(value = "/{ID}")
 public String delete(@PathVariable("ID") Long id) {
   try {
     accountingSystemService.delete(id);
   } catch (ConstraintViolationException e) {
     Error error;
   }
   return REDIRECT_ACS_LIST;
 }
コード例 #4
0
  /**
   * POST
   *
   * <p>Create accounting system
   *
   * @param accountingSystem
   * @return String ( years list )
   */
  @RequestMapping(value = "/", method = RequestMethod.POST)
  public String create(
      @Valid @ModelAttribute AccountingSystem accountingSystem, BindingResult result) {

    if (result.hasErrors()) {
      return "createAccountingSystem";
    }
    try {
      AccountingSystem newAccountingSystem1 = new AccountingSystem();
      newAccountingSystem1.setName(accountingSystem.getName());
      accountingSystemService.create(newAccountingSystem1);
    } catch (Exception e) {
      Error error;
    }
    return REDIRECT_ACS_LIST;
  }
コード例 #5
0
 /**
  * Get update form for accounting system
  *
  * @param id
  * @param model
  * @return
  */
 @RequestMapping(value = "/updateForm/{ID}")
 public String getUpdatePage(@PathVariable("ID") Long id, ModelMap model) {
   AccountingSystem accountingSystem = accountingSystemService.find(id);
   model.addAttribute("accountingSystem", accountingSystem);
   return "updateAccountingSystem";
 }