question: @ RequestMapping ( value = { "/" , "" } , method = RequestMethod . PUT ) @ ResponseBody public RestWrapper insert ( @ ModelAttribute ( "process" ) @ Valid Process process , 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 . Process insertDaoProcess = new com . wipro . ats . bdre . md . dao . jpa . Process ( ) ; com . wipro . ats . bdre . md . dao . jpa . ProcessType daoProcessType = new com . wipro . ats . bdre . md . dao . jpa . ProcessType ( ) ; daoProcessType . setProcessTypeId ( process . getProcessTypeId ( ) ) ; insertDaoProcess . setProcessType ( daoProcessType ) ; if ( process . getWorkflowId ( ) != null ) { WorkflowType daoWorkflowType = new WorkflowType ( ) ; daoWorkflowType . setWorkflowId ( process . getWorkflowId ( ) ) ; insertDaoProcess . setWorkflowType ( daoWorkflowType ) ; } BusDomain daoBusDomain = new BusDomain ( ) ; daoBusDomain . setBusDomainId ( process . getBusDomainId ( ) ) ; insertDaoProcess . setBusDomain ( daoBusDomain ) ; if ( process . getProcessTemplateId ( ) != null ) { ProcessTemplate daoProcessTemplate = new ProcessTemplate ( ) ; daoProcessTemplate . setProcessTemplateId ( process . getProcessTemplateId ( ) ) ; insertDaoProcess . setProcessTemplate ( daoProcessTemplate ) ; } if ( process . getParentProcessId ( ) != null ) { com . wipro . ats . bdre . md . dao . jpa . Process parentProcess = processDAO . get ( process . getParentProcessId ( ) ) ; insertDaoProcess . setProcess ( parentProcess ) ; } insertDaoProcess . setDescription ( process . getDescription ( ) ) ; insertDaoProcess . setAddTs ( DateConverter . stringToDate ( process . getTableAddTS ( ) ) ) ; insertDaoProcess . setProcessName ( process . getProcessName ( ) ) ; if ( process . getCanRecover ( ) == null ) insertDaoProcess . setCanRecover ( true ) ; else insertDaoProcess . setCanRecover ( process . getCanRecover ( ) ) ; insertDaoProcess . setEnqueuingProcessId ( process . getEnqProcessId ( ) ) ; if ( process . getBatchPattern ( ) != null ) { insertDaoProcess . setBatchCutPattern ( process . getBatchPattern ( ) ) ; } insertDaoProcess . setNextProcessId ( process . getNextProcessIds ( ) ) ; if ( process . getDeleteFlag ( ) == null ) { insertDaoProcess . setDeleteFlag ( false ) ; } else { insertDaoProcess . setDeleteFlag ( process . getDeleteFlag ( ) ) ; } if ( process . getOwnerRoleId ( ) != null ) insertDaoProcess . setUserRoles ( userRolesDAO . get ( process . getOwnerRoleId ( ) ) ) ; else insertDaoProcess . setUserRoles ( userRolesDAO . minUserRoleId ( principal . getName ( ) ) ) ; if ( process . getPermissionTypeByUserAccessId ( ) != null ) insertDaoProcess . setPermissionTypeByUserAccessId ( appPermissionDAO . get ( process . getPermissionTypeByUserAccessId ( ) ) ) ; else insertDaoProcess . setPermissionTypeByUserAccessId ( appPermissionDAO . get ( 7 ) ) ; if ( process . getPermissionTypeByGroupAccessId ( ) != null ) insertDaoProcess . setPermissionTypeByGroupAccessId ( appPermissionDAO . get ( process . getPermissionTypeByGroupAccessId ( ) ) ) ; else insertDaoProcess . setPermissionTypeByGroupAccessId ( appPermissionDAO . get ( 4 ) ) ; if ( process . getPermissionTypeByOthersAccessId ( ) != null ) insertDaoProcess . setPermissionTypeByOthersAccessId ( appPermissionDAO . get ( process . getPermissionTypeByOthersAccessId ( ) ) ) ; else insertDaoProcess . setPermissionTypeByOthersAccessId ( appPermissionDAO . get ( 0 ) ) ; insertDaoProcess . setEditTs ( DateConverter . stringToDate ( process . getTableEditTS ( ) ) ) ; Users users = new Users ( ) ; users . setUsername ( principal . getName ( ) ) ; insertDaoProcess . setUsers ( users ) ; Integer processId = processDAO . insert ( insertDaoProcess ) ; process . setProcessId ( processId ) ; process . setTableAddTS ( DateConverter . dateToString ( insertDaoProcess . getAddTs ( ) ) ) ; process . setTableEditTS ( DateConverter . dateToString ( insertDaoProcess . getEditTs ( ) ) ) ; restWrapper = new RestWrapper ( process , RestWrapper . OK ) ; LOGGER . info ( "Record with ID:" + process . getProcessId ( ) + " inserted in Process by User:" + principal . getName ( ) + process ) ; } catch ( MetadataException e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
target:  This method calls proc InsertProcess and adds a record in process table. it also validates the values passed.