@RequestMapping(value={"","/"},method=RequestMethod.GET) @ResponseBody public RestWrapper list(@RequestParam(value="page",defaultValue="0") int startPage,@RequestParam(value="size",defaultValue="10") int pageSize,@RequestParam(value="pid",defaultValue="0") Integer pid,Principal principal){
  RestWrapper restWrapper=null;
  Integer processId=pid;
  try {
    if (pid == 0) {
      processId=null;
    }
    Integer counter=processTemplateDAO.totalRecordCount();
    List<ProcessTemplate> processes=processTemplateDAO.list(startPage,pageSize,processId);
    for (    ProcessTemplate p : processes) {
      p.setCounter(counter);
      p.setTableAddTS(DateConverter.dateToString(p.getAddTS()));
    }
    restWrapper=new RestWrapper(processes,RestWrapper.OK);
    LOGGER.info("All records listed from ProcessTemplate by User:" + principal.getName());
  }
 catch (  MetadataException 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 , @ RequestParam ( value = "pid" , defaultValue = "0" ) Integer pid , Principal principal ) { RestWrapper restWrapper = null ; Integer processId = pid ; try { if ( pid == 0 ) { processId = null ; } Integer counter = processTemplateDAO . totalRecordCount ( ) ; List < ProcessTemplate > processes = processTemplateDAO . list ( startPage , pageSize , processId ) ; for ( ProcessTemplate p : processes ) { p . setCounter ( counter ) ; p . setTableAddTS ( DateConverter . dateToString ( p . getAddTS ( ) ) ) ; } restWrapper = new RestWrapper ( processes , RestWrapper . OK ) ; LOGGER . info ( "All records listed from ProcessTemplate by User:" + principal . getName ( ) ) ; } catch ( MetadataException e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
this method calls proc listprocess and fetches a list of instances of process .
