예제 #1
0
  @RequestMapping(value = "/contact/view.action")
  public @ResponseBody Map<String, ? extends Object> view(
      @RequestParam int start, @RequestParam int limit) throws Exception {

    try {
      List<Contact> contacts = contactService.getContactList(start, limit);
      int total = contactService.getTotalContacts();
      return ExtJSReturn.mapOK(contacts, total);
    } catch (Exception e) {
      return ExtJSReturn.mapError("Error retrieving Contacts from database.");
    }
  }
예제 #2
0
  @RequestMapping(value = "/contact/update.action")
  public @ResponseBody Map<String, ? extends Object> update(@RequestBody ContactWrapper data)
      throws Exception {
    try {

      List<Contact> contacts = contactService.update(data.getData());

      return ExtJSReturn.mapOK(contacts);

    } catch (Exception e) {

      return ExtJSReturn.mapError("Error trying to update contact.");
    }
  }
예제 #3
0
  @RequestMapping(value = "/contact/delete.action")
  public @ResponseBody Map<String, ? extends Object> delete(@RequestBody ContactWrapper data)
      throws Exception {

    try {

      contactService.delete(data.getData());

      Map<String, Object> modelMap = new HashMap<String, Object>(3);
      modelMap.put("success", true);

      return modelMap;

    } catch (Exception e) {

      return ExtJSReturn.mapError("Error trying to delete contact.");
    }
  }