@ Override public List < LibraryPolicyReport > getApplicationReport ( NexusIQApplication application ) { List < LibraryPolicyReport > applicationReports = new ArrayList <> ( ) ; String appReportLinkUrl = String . format ( application . getInstanceUrl ( ) + API_V2_REPORTS_LINKS , application . getApplicationId ( ) ) ; try { JSONArray reports = parseAsArray ( appReportLinkUrl ) ; if ( ( reports == null ) || ( reports . isEmpty ( ) ) ) return null ; for ( Object element : reports ) { LibraryPolicyReport appReport = new LibraryPolicyReport ( ) ; String stage = str ( ( JSONObject ) element , "stage" ) ; appReport . setStage ( stage ) ; appReport . setEvaluationDate ( timestamp ( ( JSONObject ) element , "evaluationDate" ) ) ; appReport . setReportDataUrl ( application . getInstanceUrl ( ) + "/" + str ( ( JSONObject ) element , "reportDataUrl" ) ) ; appReport . setReportUIUrl ( application . getInstanceUrl ( ) + "/" + str ( ( JSONObject ) element , "reportHtmlUrl" ) ) ; applicationReports . add ( appReport ) ; } } catch ( ParseException e ) { LOG . error ( "Could not parse response from: " + appReportLinkUrl , e ) ; } catch ( RestClientException rce ) { LOG . error ( "RestClientException: " + appReportLinkUrl + ". Error code=" + rce . getMessage ( ) ) ; } return applicationReports ; }
Get report links for a given application .