public void open(AerialParams params) throws Exception {
        content = new ArrayList<String>();

        DefaultHttpClient client = new DefaultHttpClient();
        client.getCredentialsProvider().setCredentials(
                AuthScope.ANY,
                new UsernamePasswordCredentials(userName, password));

        for (String query : params.getValueParams()) {
            URI uri = UriBuilder.fromUri(url)
                    .path("/rest/api/2/search")
                    .queryParam("jql", query)
                    .queryParam("fields", "key," + fieldName).build();
            HttpGet request = new HttpGet(uri);
            HttpResponse response = client.execute(request);
            String responseText = EntityUtils.toString(response.getEntity());
            JSONObject json = new JSONObject(responseText);
            JSONArray array = json.getJSONArray("issues");
            for (int i = 0; i < array.length(); i++) {
                String value = null;
                if (!array.getJSONObject(i).has("fields")) {
                    continue;
                }
                if (!array.getJSONObject(i).getJSONObject("fields").has(fieldName)) {
                    continue;
                }
                value = array.getJSONObject(i).getJSONObject("fields").getString(fieldName);
                if (value != null && !value.equals("null")) {
                    content.add(value);
                }
                String tag = null;
                tag = array.getJSONObject(i).getString("key");
                if (tag != null) {
                    this.getTags().add(tag);
                }
            }
        }
        client.getConnectionManager().shutdown();
        this.iterator = content.iterator();
    }
public void open ( AerialParams params ) throws Exception { content = new ArrayList < String > ( ) ; DefaultHttpClient client = new DefaultHttpClient ( ) ; client . getCredentialsProvider ( ) . setCredentials ( AuthScope . ANY , new UsernamePasswordCredentials ( userName , password ) ) ; for ( String query : params . getValueParams ( ) ) { URI uri = UriBuilder . fromUri ( url ) . path ( "/rest/api/2/search" ) . queryParam ( "jql" , query ) . queryParam ( "fields" , "key," + fieldName ) . build ( ) ; HttpGet request = new HttpGet ( uri ) ; HttpResponse response = client . execute ( request ) ; String responseText = EntityUtils . toString ( response . getEntity ( ) ) ; JSONObject json = new JSONObject ( responseText ) ; JSONArray array = json . getJSONArray ( "issues" ) ; for ( int i = 0 ; i < array . length ( ) ; i ++ ) { String value = null ; if ( ! array . getJSONObject ( i ) . has ( "fields" ) ) { continue ; } if ( ! array . getJSONObject ( i ) . getJSONObject ( "fields" ) . has ( fieldName ) ) { continue ; } value = array . getJSONObject ( i ) . getJSONObject ( "fields" ) . getString ( fieldName ) ; if ( value != null && ! value . equals ( "null" ) ) { content . add ( value ) ; } String tag = null ; tag = array . getJSONObject ( i ) . getString ( "key" ) ; if ( tag != null ) { this . getTags ( ) . add ( tag ) ; } } } client . getConnectionManager ( ) . shutdown ( ) ; this . iterator = content . iterator ( ) ; }
/* (non-Javadoc)
@see com.github.mkolisnyk.aerial.AerialReader#open(java.lang.Object[])