@RequestMapping(value={"","/"},method=RequestMethod.GET) @ResponseBody public RestWrapper list(@RequestParam(value="pid",defaultValue="0") Integer pid,@RequestParam(value="page",defaultValue="0") int startPage,@RequestParam(value="size",defaultValue="10") int pageSize,Principal principal){
  LOGGER.info("pid = " + pid);
  LOGGER.info("startPage = " + startPage);
  RestWrapper restWrapper=null;
  Integer processId=pid;
  try {
    if (pid == 0) {
      processId=null;
    }
    if (processId != null)     processDAO.securityCheck(processId,principal.getName(),"read");
    List<InstanceExec> instanceExecs=instanceExecDAO.list(processId,startPage,pageSize);
    for (    InstanceExec ie : instanceExecs) {
      ie.setTableStartTs(DateConverter.dateToString(ie.getStartTs()));
      ie.setTableEndTs(DateConverter.dateToString(ie.getEndTs()));
    }
    restWrapper=new RestWrapper(instanceExecs,RestWrapper.OK);
    LOGGER.info("All records listed from InstanceExec by User:" + principal.getName());
  }
 catch (  MetadataException e) {
    LOGGER.error(e);
    restWrapper=new RestWrapper(e.getMessage(),RestWrapper.ERROR);
  }
catch (  SecurityException e) {
    LOGGER.error(e);
    restWrapper=new RestWrapper(e.getMessage(),RestWrapper.ERROR);
  }
  return restWrapper;
}

@ RequestMapping ( value = { "" , "/" } , method = RequestMethod . GET ) @ ResponseBody public RestWrapper list ( @ RequestParam ( value = "pid" , defaultValue = "0" ) Integer pid , @ RequestParam ( value = "page" , defaultValue = "0" ) int startPage , @ RequestParam ( value = "size" , defaultValue = "10" ) int pageSize , Principal principal ) { LOGGER . info ( "pid = " + pid ) ; LOGGER . info ( "startPage = " + startPage ) ; RestWrapper restWrapper = null ; Integer processId = pid ; try { if ( pid == 0 ) { processId = null ; } if ( processId != null ) processDAO . securityCheck ( processId , principal . getName ( ) , "read" ) ; List < InstanceExec > instanceExecs = instanceExecDAO . list ( processId , startPage , pageSize ) ; for ( InstanceExec ie : instanceExecs ) { ie . setTableStartTs ( DateConverter . dateToString ( ie . getStartTs ( ) ) ) ; ie . setTableEndTs ( DateConverter . dateToString ( ie . getEndTs ( ) ) ) ; } restWrapper = new RestWrapper ( instanceExecs , RestWrapper . OK ) ; LOGGER . info ( "All records listed from InstanceExec by User:" + principal . getName ( ) ) ; } catch ( MetadataException e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } catch ( SecurityException e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
this method calls proc listinstanceexec and fetches a list of instances of instanceexec .
