@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=usersDAO.totalRecordCount();
    List<com.wipro.ats.bdre.md.dao.jpa.Users> jpaUsers=usersDAO.list(startPage,pageSize);
    List<Users> usersList=new ArrayList<Users>();
    for (    com.wipro.ats.bdre.md.dao.jpa.Users users : jpaUsers) {
      Users returnUsers=new Users();
      returnUsers.setUsername(users.getUsername());
      returnUsers.setPassword(users.getPassword());
      returnUsers.setEnabled((users.getEnabled()) ? (short)1 : 0);
      returnUsers.setCounter(counter);
      usersList.add(returnUsers);
    }
    restWrapper=new RestWrapper(usersList,RestWrapper.OK);
    LOGGER.info("All records listed from Users 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 = usersDAO . totalRecordCount ( ) ; List < com . wipro . ats . bdre . md . dao . jpa . Users > jpaUsers = usersDAO . list ( startPage , pageSize ) ; List < Users > usersList = new ArrayList < Users > ( ) ; for ( com . wipro . ats . bdre . md . dao . jpa . Users users : jpaUsers ) { Users returnUsers = new Users ( ) ; returnUsers . setUsername ( users . getUsername ( ) ) ; returnUsers . setPassword ( users . getPassword ( ) ) ; returnUsers . setEnabled ( ( users . getEnabled ( ) ) ? ( short ) 1 : 0 ) ; returnUsers . setCounter ( counter ) ; usersList . add ( returnUsers ) ; } restWrapper = new RestWrapper ( usersList , RestWrapper . OK ) ; LOGGER . info ( "All records listed from Users by User:" + principal . getName ( ) ) ; } catch ( Exception e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
this method calls proc listusers and returns a list of instances of users .
