question: @ SuppressWarnings ( "rawtypes" ) public DataResponse paginateList ( Map < String , String > requestParams , PaginateRequest paginateRequest , Object query , String defaultSort , Map properties ) { if ( paginateRequest == null ) { paginateRequest = new PaginateRequest ( ) ; } if ( paginateRequest . getStart ( ) == null ) { paginateRequest . setStart ( RequestUtil . getInteger ( requestParams , "start" , 0 ) ) ; } if ( paginateRequest . getSize ( ) == null ) { paginateRequest . setSize ( RequestUtil . getInteger ( requestParams , "size" , 10 ) ) ; } if ( paginateRequest . getOrder ( ) == null ) { paginateRequest . setOrder ( requestParams . get ( "order" ) ) ; } if ( paginateRequest . getSort ( ) == null ) { paginateRequest . setSort ( requestParams . get ( "sort" ) ) ; } Integer start = paginateRequest . getStart ( ) ; if ( start == null || start < 0 ) { start = 0 ; } Integer size = paginateRequest . getSize ( ) ; if ( size == null || size < 0 ) { size = 10 ; } String sort = paginateRequest . getSort ( ) ; if ( sort == null ) { sort = defaultSort ; } String order = paginateRequest . getOrder ( ) ; if ( order == null ) { order = "asc" ; } if ( sort != null && ! properties . isEmpty ( ) ) { Object qp = properties . get ( sort ) ; if ( qp == null ) { throw new ActivitiIllegalArgumentException ( "Value for param 'sort' is not valid, '" + sort + "' is not a valid property" ) ; } if ( query instanceof AbstractQuery ) { AbstractQuery queryObject = ( AbstractQuery ) query ; QueryProperty queryProperty = ( QueryProperty ) qp ; queryObject . orderBy ( queryProperty ) ; if ( order . equals ( "asc" ) ) { queryObject . asc ( ) ; } else if ( order . equals ( "desc" ) ) { queryObject . desc ( ) ; } else { throw new ActivitiIllegalArgumentException ( "Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'" ) ; } } else if ( query instanceof org . activiti . idm . engine . impl . AbstractQuery ) { org . activiti . idm . engine . impl . AbstractQuery queryObject = ( org . activiti . idm . engine . impl . AbstractQuery ) query ; org . activiti . idm . api . QueryProperty queryProperty = ( org . activiti . idm . api . QueryProperty ) qp ; queryObject . orderBy ( queryProperty ) ; if ( order . equals ( "asc" ) ) { queryObject . asc ( ) ; } else if ( order . equals ( "desc" ) ) { queryObject . desc ( ) ; } else { throw new ActivitiIllegalArgumentException ( "Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'" ) ; } } } DataResponse response = new DataResponse ( ) ; response . setStart ( start ) ; response . setSort ( sort ) ; response . setOrder ( order ) ; if ( query instanceof AbstractQuery ) { AbstractQuery queryObject = ( AbstractQuery ) query ; List list = processList ( queryObject . listPage ( start , size ) ) ; response . setTotal ( queryObject . count ( ) ) ; response . setSize ( list . size ( ) ) ; response . setData ( list ) ; } else if ( query instanceof org . activiti . idm . engine . impl . AbstractQuery ) { org . activiti . idm . engine . impl . AbstractQuery queryObject = ( org . activiti . idm . engine . impl . AbstractQuery ) query ; List list = processList ( queryObject . listPage ( start , size ) ) ; response . setTotal ( queryObject . count ( ) ) ; response . setSize ( list . size ( ) ) ; response . setData ( list ) ; } return response ; }
target:  uses the pagination parameters form the request and makes sure to order the result and set all pagination attributes for the response to render