public static Map < String , QueryParameter > getUsedParametersMap ( Query query , Map < String , QueryParameter > allParameters ) { Set < String > paramNames = new HashSet < String > ( Arrays . asList ( query . getParameterNames ( ) ) ) ; for ( QueryParameter p : allParameters . values ( ) ) { paramNames . addAll ( p . getDependentParameterNames ( ) ) ; } LinkedHashMap < String , QueryParameter > params = new LinkedHashMap < String , QueryParameter > ( ) ; for ( String name : allParameters . keySet ( ) ) { boolean found = false ; for ( String pName : paramNames ) { if ( pName . equals ( name ) ) { found = true ; break ; } } QueryParameter qp = allParameters . get ( name ) ; if ( found || qp . isHidden ( ) ) { params . put ( name , qp ) ; } } return params ; }
Get used parameters map where the key is the parameter name and the value is the parameter Not all the report parameters have to be used some may only be defined for further usage . The result will contain also the hidden parameters and all parameters used just inside other parameters .