public List < Module > getModules ( final Map < String , String > filters ) throws GrapesCommunicationException { final Client client = getClient ( ) ; WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . getAllModulesPath ( ) ) ; for ( final Map . Entry < String , String > queryParam : filters . entrySet ( ) ) { resource = resource . queryParam ( queryParam . getKey ( ) , queryParam . getValue ( ) ) ; } final ClientResponse response = resource . accept ( MediaType . APPLICATION_JSON ) . get ( ClientResponse . class ) ; client . destroy ( ) ; if ( ClientResponse . Status . OK . getStatusCode ( ) != response . getStatus ( ) ) { final String message = "Failed to get filtered modules." ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } return response . getEntity ( new GenericType < List < Module > > ( ) { } ) ; }
Get a list of modules regarding filters