@RequestMapping(value={"/",""},method=RequestMethod.POST) @ResponseBody public RestWrapper update(@ModelAttribute("processtype") @Valid ProcessType processType,BindingResult bindingResult,Principal principal){
  RestWrapper restWrapper=null;
  if (bindingResult.hasErrors()) {
    BindingResultError bindingResultError=new BindingResultError();
    return bindingResultError.errorMessage(bindingResult);
  }
  try {
    com.wipro.ats.bdre.md.dao.jpa.ProcessType jpaProcessType=new com.wipro.ats.bdre.md.dao.jpa.ProcessType();
    jpaProcessType.setProcessTypeId(processType.getProcessTypeId());
    jpaProcessType.setParentProcessTypeId(processType.getParentProcessTypeId());
    jpaProcessType.setProcessTypeName(processType.getProcessTypeName());
    processTypeDAO.update(jpaProcessType);
    restWrapper=new RestWrapper(processType,RestWrapper.OK);
    LOGGER.info("Record with ID: " + processType.getProcessTypeId() + " updated in ProcessType by User:"+ principal.getName()+ processType);
  }
 catch (  MetadataException e) {
    LOGGER.error(e);
    restWrapper=new RestWrapper(e.getMessage(),RestWrapper.ERROR);
  }
  return restWrapper;
}

@ RequestMapping ( value = { "/" , "" } , method = RequestMethod . POST ) @ ResponseBody public RestWrapper update ( @ ModelAttribute ( "processtype" ) @ Valid ProcessType processType , BindingResult bindingResult , Principal principal ) { RestWrapper restWrapper = null ; if ( bindingResult . hasErrors ( ) ) { BindingResultError bindingResultError = new BindingResultError ( ) ; return bindingResultError . errorMessage ( bindingResult ) ; } try { com . wipro . ats . bdre . md . dao . jpa . ProcessType jpaProcessType = new com . wipro . ats . bdre . md . dao . jpa . ProcessType ( ) ; jpaProcessType . setProcessTypeId ( processType . getProcessTypeId ( ) ) ; jpaProcessType . setParentProcessTypeId ( processType . getParentProcessTypeId ( ) ) ; jpaProcessType . setProcessTypeName ( processType . getProcessTypeName ( ) ) ; processTypeDAO . update ( jpaProcessType ) ; restWrapper = new RestWrapper ( processType , RestWrapper . OK ) ; LOGGER . info ( "Record with ID: " + processType . getProcessTypeId ( ) + " updated in ProcessType by User:" + principal . getName ( ) + processType ) ; } catch ( MetadataException e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
this method calls proc updateprocesstype and updates the values of the record passed . it also validates the values passed .
