@RequestMapping(value = "/edit", method = RequestMethod.POST)
 public String editOnSubmit(@Valid Person person, BindingResult bindingResult, Model model) {
   LOGGER.debug("edit person={}", person);
   if (bindingResult.hasErrors()) {
     LOGGER.warn("validation error={}", bindingResult.getModel());
     model.addAllAttributes(bindingResult.getModel());
     return "/person/form";
   }
   personService.update(person);
   return "redirect:/person/list";
 }
  /**
   * Handles the user's request to update their experiment.
   *
   * @param command SequencerRun command object
   * @param request a {@link javax.servlet.http.HttpServletRequest} object.
   * @param response a {@link javax.servlet.http.HttpServletResponse} object.
   * @return a {@link org.springframework.web.servlet.ModelAndView} object.
   * @throws java.lang.Exception if any.
   */
  public ModelAndView handleUpdate(
      HttpServletRequest request, HttpServletResponse response, SequencerRun command)
      throws Exception {

    Registration registration = Security.getRegistration(request);
    if (registration == null) return new ModelAndView("redirect:/login.htm");

    ModelAndView modelAndView = null;
    BindingResult errors = this.validateSequencerRun(request, command);
    if (errors.hasErrors()) {
      Map model = errors.getModel();
      modelAndView = new ModelAndView("SequencerRunUpdate", model);
    } else {
      SequencerRun newSequencerRun = command;
      SequencerRun oldSequencerRun = getCurrentSequencerRun(request);
      if (newSequencerRun != null && oldSequencerRun != null) {
        new ServletRequestDataBinder(oldSequencerRun).bind(request);
        getSequencerRunService().update(oldSequencerRun);
        modelAndView = new ModelAndView("redirect:/sequencerRunList.htm");
      } else {
        modelAndView = new ModelAndView("redirect:/Error.htm");
      }
    }

    request.getSession(false).removeAttribute("sequencerRun");

    return modelAndView;
  }
 @RequestMapping(value = "update", method = RequestMethod.POST)
 public ModelAndView update(@Valid Item item, BindingResult bindingResult) {
   if (bindingResult.hasErrors()) {
     ModelAndView modelAndView = new ModelAndView("update");
     modelAndView.getModel().putAll(bindingResult.getModel());
     return modelAndView;
   }
   this.itemService.updateItem(item);
   return this.index();
 }
  /**
   * Handles the user's request to submit a new experiment.
   *
   * @param request HttpServletRequest
   * @param response HttpServletResponse
   * @param command SequencerRun command object
   * @return ModelAndView
   * @throws java.lang.Exception if any.
   */
  public ModelAndView handleSubmit(
      HttpServletRequest request, HttpServletResponse response, SequencerRun command)
      throws Exception {

    Registration registration = Security.getRegistration(request);
    if (registration == null) return new ModelAndView("redirect:/login.htm");

    ModelAndView modelAndView = null;
    BindingResult errors = this.validateSequencerRun(request, command);
    if (errors.hasErrors()) {
      Map model = errors.getModel();
      modelAndView = new ModelAndView("SequencerRun1", model);
    } else {
      Debug.put("HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1");
      getSequencerRunService().insert(command);
      // command.setOwnerId(registration.getRegistrationId());
      modelAndView = new ModelAndView("redirect:/sequencerRunList.htm");
    }

    request.getSession(false).removeAttribute("sequencerRun");

    return modelAndView;
  }
  /**
   * Handles the user's request to submit a new study.
   *
   * @param request HttpServletRequest
   * @param response HttpServletResponse
   * @param command Study command object
   * @return ModelAndView
   * @throws java.lang.Exception if any.
   */
  public ModelAndView handleSubmit(
      HttpServletRequest request, HttpServletResponse response, UploadFile command)
      throws Exception {

    Registration registration = Security.getRegistration(request);
    if (registration == null) return new ModelAndView("redirect:/login.htm");

    ServletContext context = this.getServletContext();
    command.setFolderStore(context.getInitParameter("path.to.upload.directory"));
    command.setStrStartURL(context.getInitParameter("true.protocols"));

    ModelAndView modelAndView = null;
    BindingResult errors = this.validate(request, command);
    if (errors.hasErrors()) {
      Map model = errors.getModel();
      Integer id = getRequestedId(request);
      String typeNode = getRequestedTypeNode(request);
      String nameNode = getNameNode(id, typeNode);
      List<FileType> listFileType = getFileTypeService().list();

      model.put("id", id);
      model.put("tn", typeNode);
      model.put("nameNode", nameNode);
      model.put("listFileType", listFileType);

      modelAndView = new ModelAndView("UploadFile", model);
    } else {
      String folderStore = context.getInitParameter("path.to.upload.directory");

      // MultipartFile file = command.getFile();

      // MultipartFile file = command.getFileFromURL();

      Log.info("URL = " + command.getFileURL());
      Log.info("USE URL ? = " + command.getUseURL());

      FileType fileType = getFileTypeService().findByID(command.getFileTypeId());

      Integer id = getRequestedId(request);
      String typeNode = getRequestedTypeNode(request);

      Log.info("ID = " + id);
      Log.info("typeNode = " + typeNode);

      if ("st".equals(typeNode)) {
        Study study = getStudyService().findByID(id);
        getFileUploadService().uploadFile(study, command, fileType, registration);
      }

      if ("exp".equals(typeNode)) {
        Experiment experiment = getExperimentService().findByID(id);
        getFileUploadService().uploadFile(experiment, command, fileType, registration);
      }
      if ("sam".equals(typeNode)) {
        Sample sample = getSampleService().findByID(id);
        getFileUploadService().uploadFile(sample, command, fileType, registration);
      }
      if ("seq".equals(typeNode)) {
        Lane lane = getLaneService().findByID(id);
        getFileUploadService().uploadFile(lane, command, fileType, registration);
      }
      if ("ius".equals(typeNode)) {
        IUS ius = getIUSService().findByID(id);
        getFileUploadService().uploadFile(ius, command, fileType, registration);
      }
      if ("ae".equals(typeNode)) {
        Processing processing = getProcessingService().findByID(id);
        getFileUploadService().uploadFile(processing, command, fileType, registration);
      }
      if ("sr".equals(typeNode)) {
        SequencerRun sequencerRun = getSequencerRunService().findByID(id);
        getFileUploadService().uploadFile(sequencerRun, command, fileType, registration);
      }
      modelAndView = new ModelAndView(getViewName(request));
    }

    return modelAndView;
  }