@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
 public String update(@PathVariable Integer id, Model model) {
   model.addAttribute("types", EnumUtils.enumProp2NameMap(LocatorType.class, "name"));
   model.addAttribute(locatorService.getLocatorBean(id));
   model.addAttribute(new LocatorDTO());
   return "locator/edit";
 }
  @RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
  public String update(
      @PathVariable Integer id, @Valid LocatorDTO locatorDTO, BindingResult br, Model model) {
    if (br.hasErrors()) {
      return "locator/edit";
    }
    CaseBean caseBean = new CaseBean();
    caseBean.setId(locatorDTO.getCaseId());

    LocatorBean locatorBean = locatorService.getLocatorBean(id);
    locatorBean.setCaseBean(caseBean);
    locatorBean.setLocatorData(locatorDTO.getLocatorData());
    locatorBean.setLocatorDataName(locatorDTO.getLocatorDataName());
    locatorBean.setLocatorType(locatorDTO.getLocatorType());
    locatorService.updateLocator(locatorBean);
    return "redirect:/locator/case/" + locatorDTO.getCaseId();
  }
 @RequestMapping("/delete/{id}")
 public String delete(@PathVariable Integer id) {
   LocatorBean locatorBean = locatorService.getLocatorBean(id);
   locatorService.delLocator(id);
   return "redirect:/locator/case/" + locatorBean.getCaseBean().getId();
 }