@RequestMapping(value={"/",""},method=RequestMethod.PUT) @ResponseBody public RestWrapper insert(@ModelAttribute("servers") @Valid Servers server,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.Servers jpaServers=new com.wipro.ats.bdre.md.dao.jpa.Servers();
    jpaServers.setServerId(server.getServerId());
    jpaServers.setServerName(server.getServerName());
    jpaServers.setServerType(server.getServerType());
    jpaServers.setServerIp(server.getServerIp());
    jpaServers.setSshPrivateKey(server.getSshPrivateKey());
    jpaServers.setLoginUser(server.getLoginUser());
    jpaServers.setLoginPassword(server.getLoginPassword());
    jpaServers.setServerMetainfo(server.getServerMetaInfo());
    Integer serversId=serversDAO.insert(jpaServers);
    server.setServerId(serversId);
    restWrapper=new RestWrapper(server,RestWrapper.OK);
    LOGGER.info("Record with ID:" + server.getServerId() + " inserted in Servers by User:"+ principal.getName()+ server);
  }
 catch (  Exception e) {
    LOGGER.error(e);
    restWrapper=new RestWrapper(e.getMessage(),RestWrapper.ERROR);
  }
  return restWrapper;
}

@ RequestMapping ( value = { "/" , "" } , method = RequestMethod . PUT ) @ ResponseBody public RestWrapper insert ( @ ModelAttribute ( "servers" ) @ Valid Servers server , 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 . Servers jpaServers = new com . wipro . ats . bdre . md . dao . jpa . Servers ( ) ; jpaServers . setServerId ( server . getServerId ( ) ) ; jpaServers . setServerName ( server . getServerName ( ) ) ; jpaServers . setServerType ( server . getServerType ( ) ) ; jpaServers . setServerIp ( server . getServerIp ( ) ) ; jpaServers . setSshPrivateKey ( server . getSshPrivateKey ( ) ) ; jpaServers . setLoginUser ( server . getLoginUser ( ) ) ; jpaServers . setLoginPassword ( server . getLoginPassword ( ) ) ; jpaServers . setServerMetainfo ( server . getServerMetaInfo ( ) ) ; Integer serversId = serversDAO . insert ( jpaServers ) ; server . setServerId ( serversId ) ; restWrapper = new RestWrapper ( server , RestWrapper . OK ) ; LOGGER . info ( "Record with ID:" + server . getServerId ( ) + " inserted in Servers by User:" + principal . getName ( ) + server ) ; } catch ( Exception e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
thsi method calls proc insertservers and adds a record of servers .
