@ SuppressWarnings ( "PMD.NPathComplexity" ) @ Override public DashboardReviewResponse getDashboardReviewResponse ( String dashboardTitle , DashboardType dashboardType , String businessService , String businessApp , long beginDate , long endDate , Set < AuditType > auditTypes ) throws AuditException { validateParameters ( dashboardTitle , dashboardType , businessService , businessApp , beginDate , endDate ) ; DashboardReviewResponse dashboardReviewResponse = new DashboardReviewResponse ( ) ; Dashboard dashboard = getDashboard ( dashboardTitle , dashboardType , businessService , businessApp ) ; if ( dashboard == null ) { dashboardReviewResponse . addAuditStatus ( DashboardAuditStatus . DASHBOARD_NOT_REGISTERED ) ; return dashboardReviewResponse ; } dashboardReviewResponse . setDashboardTitle ( dashboard . getTitle ( ) ) ; dashboardReviewResponse . setBusinessApplication ( StringUtils . isEmpty ( businessApp ) ? dashboard . getConfigurationItemBusAppName ( ) : businessApp ) ; dashboardReviewResponse . setBusinessService ( StringUtils . isEmpty ( businessService ) ? dashboard . getConfigurationItemBusServName ( ) : businessService ) ; if ( auditTypes . contains ( AuditType . ALL ) ) { auditTypes . addAll ( Sets . newHashSet ( AuditType . values ( ) ) ) ; auditTypes . remove ( AuditType . ALL ) ; } auditTypes . forEach ( auditType -> { Evaluator evaluator = auditModel . evaluatorMap ( ) . get ( auditType ) ; try { Collection < AuditReviewResponse > auditResponse = evaluator . evaluate ( dashboard , beginDate , endDate , null ) ; dashboardReviewResponse . addReview ( auditType , auditResponse ) ; dashboardReviewResponse . addAuditStatus ( auditModel . successStatusMap ( ) . get ( auditType ) ) ; } catch ( AuditException e ) { if ( e . getErrorCode ( ) == AuditException . NO_COLLECTOR_ITEM_CONFIGURED ) { dashboardReviewResponse . addAuditStatus ( auditModel . errorStatusMap ( ) . get ( auditType ) ) ; } } } ) ; return dashboardReviewResponse ; }
Calculates audit response for a given dashboard