@RequestMapping(value={"","/"},method=RequestMethod.GET) @ResponseBody public RestWrapper list(@RequestParam(value="page",defaultValue="0") int startPage,@RequestParam(value="size",defaultValue="10") int pageSize,Principal principal){
  RestWrapper restWrapper=null;
  try {
    Integer counter=serversDAO.totalRecordCount();
    List<com.wipro.ats.bdre.md.dao.jpa.Servers> jpaServersList=serversDAO.list(startPage,pageSize);
    List<Servers> servers=new ArrayList<Servers>();
    for (    com.wipro.ats.bdre.md.dao.jpa.Servers server : jpaServersList) {
      Servers returnServer=new Servers();
      returnServer.setServerId(server.getServerId());
      returnServer.setServerName(server.getServerName());
      returnServer.setServerType(server.getServerType());
      returnServer.setLoginUser(server.getLoginUser());
      returnServer.setLoginPassword(server.getLoginPassword());
      returnServer.setServerMetaInfo(server.getServerMetainfo());
      returnServer.setServerIp(server.getServerIp());
      returnServer.setSshPrivateKey(server.getSshPrivateKey());
      returnServer.setCounter(counter);
      servers.add(returnServer);
    }
    restWrapper=new RestWrapper(servers,RestWrapper.OK);
    LOGGER.info("All records listed from Servers by User:" + principal.getName());
  }
 catch (  Exception e) {
    LOGGER.error(e);
    restWrapper=new RestWrapper(e.getMessage(),RestWrapper.ERROR);
  }
  return restWrapper;
}

@ RequestMapping ( value = { "" , "/" } , method = RequestMethod . GET ) @ ResponseBody public RestWrapper list ( @ RequestParam ( value = "page" , defaultValue = "0" ) int startPage , @ RequestParam ( value = "size" , defaultValue = "10" ) int pageSize , Principal principal ) { RestWrapper restWrapper = null ; try { Integer counter = serversDAO . totalRecordCount ( ) ; List < com . wipro . ats . bdre . md . dao . jpa . Servers > jpaServersList = serversDAO . list ( startPage , pageSize ) ; List < Servers > servers = new ArrayList < Servers > ( ) ; for ( com . wipro . ats . bdre . md . dao . jpa . Servers server : jpaServersList ) { Servers returnServer = new Servers ( ) ; returnServer . setServerId ( server . getServerId ( ) ) ; returnServer . setServerName ( server . getServerName ( ) ) ; returnServer . setServerType ( server . getServerType ( ) ) ; returnServer . setLoginUser ( server . getLoginUser ( ) ) ; returnServer . setLoginPassword ( server . getLoginPassword ( ) ) ; returnServer . setServerMetaInfo ( server . getServerMetainfo ( ) ) ; returnServer . setServerIp ( server . getServerIp ( ) ) ; returnServer . setSshPrivateKey ( server . getSshPrivateKey ( ) ) ; returnServer . setCounter ( counter ) ; servers . add ( returnServer ) ; } restWrapper = new RestWrapper ( servers , RestWrapper . OK ) ; LOGGER . info ( "All records listed from Servers by User:" + principal . getName ( ) ) ; } catch ( Exception e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
this method calls proc listservers and returns a list of instances of servers .
