public List < Review > getReviews ( String reviewsUrl , GitHubRepo repo ) throws RestClientException { List < Review > reviews = new ArrayList <> ( ) ; // decrypt password String decryptedPassword = decryptString ( repo . getPassword ( ) , settings . getKey ( ) ) ; String personalAccessToken = ( String ) repo . getOptions ( ) . get ( "personalAccessToken" ) ; String decryptedPersonalAccessToken = decryptString ( personalAccessToken , settings . getKey ( ) ) ; boolean lastPage = false ; String queryUrlPage = reviewsUrl ; while ( ! lastPage ) { ResponseEntity < String > response = makeRestCall ( queryUrlPage , repo . getUserId ( ) , decryptedPassword , decryptedPersonalAccessToken ) ; JSONArray jsonArray = parseAsArray ( response ) ; for ( Object item : jsonArray ) { JSONObject jsonObject = ( JSONObject ) item ; Review review = new Review ( ) ; review . setState ( str ( jsonObject , "state" ) ) ; review . setBody ( str ( jsonObject , "body" ) ) ; // review.setId(asInt(jsonObject, "id")); reviews . add ( review ) ; } if ( CollectionUtils . isEmpty ( jsonArray ) ) { lastPage = true ; } else { if ( isThisLastPage ( response ) ) { lastPage = true ; } else { lastPage = false ; queryUrlPage = getNextPageUrl ( response ) ; } } } return reviews ; }
Get reviews from the given reviews url