public static Map<String,Object> performFindList(DispatchContext dctx,Map<String,Object> context){
  Integer viewSize=(Integer)context.get("viewSize");
  if (viewSize == null)   viewSize=Integer.valueOf(20);
  context.put("viewSize",viewSize);
  Integer viewIndex=(Integer)context.get("viewIndex");
  if (viewIndex == null)   viewIndex=Integer.valueOf(0);
  context.put("viewIndex",viewIndex);
  Map<String,Object> result=performFind(dctx,context);
  int start=viewIndex.intValue() * viewSize.intValue();
  List<GenericValue> list=null;
  Integer listSize=null;
  try {
    EntityListIterator it=(EntityListIterator)result.get("listIt");
    list=it.getPartialList(start + 1,viewSize);
    listSize=it.getResultsSizeAfterPartialList();
    it.close();
  }
 catch (  Exception e) {
    Debug.logInfo("Problem getting partial list" + e,module);
  }
  result.put("listSize",listSize);
  result.put("list",list);
  result.remove("listIt");
  return result;
}

public static Map < String , Object > performFindList ( DispatchContext dctx , Map < String , Object > context ) { Integer viewSize = ( Integer ) context . get ( "viewSize" ) ; if ( viewSize == null ) viewSize = Integer . valueOf ( 20 ) ; context . put ( "viewSize" , viewSize ) ; Integer viewIndex = ( Integer ) context . get ( "viewIndex" ) ; if ( viewIndex == null ) viewIndex = Integer . valueOf ( 0 ) ; context . put ( "viewIndex" , viewIndex ) ; Map < String , Object > result = performFind ( dctx , context ) ; int start = viewIndex . intValue ( ) * viewSize . intValue ( ) ; List < GenericValue > list = null ; Integer listSize = null ; try { EntityListIterator it = ( EntityListIterator ) result . get ( "listIt" ) ; list = it . getPartialList ( start + 1 , viewSize ) ; listSize = it . getResultsSizeAfterPartialList ( ) ; it . close ( ) ; } catch ( Exception e ) { Debug . logInfo ( "Problem getting partial list" + e , module ) ; } result . put ( "listSize" , listSize ) ; result . put ( "list" , list ) ; result . remove ( "listIt" ) ; return result ; }
same as performfind but now returning a list instead of an iterator extra parameters viewindex : startpage of the partial list ( 0 = first page ) viewsize : the length of the page ( number of records ) extra output parameter : listsize : size of the totallist list : the list itself .
