@ SuppressWarnings ( "PMD.NPathComplexity" ) public static void addAuditResultByAuditType ( Dashboard dashboard , Map < AuditType , Audit > auditMap , CmdbRepository cmdbRepository , long timestamp ) { if ( CollectionUtils . isEmpty ( auditMap ) ) { return ; } Cmdb cmdb = cmdbRepository . findByConfigurationItem ( dashboard . getConfigurationItemBusServName ( ) ) ; ObjectId dashboardId = dashboard . getId ( ) ; String dashboardTitle = dashboard . getTitle ( ) ; String ownerDept = ( ( cmdb == null || cmdb . getOwnerDept ( ) == null ) ? "" : cmdb . getOwnerDept ( ) ) ; String appService = ( dashboard . getConfigurationItemBusServName ( ) == null ? "" : dashboard . getConfigurationItemBusServName ( ) ) ; String appBusApp = ( dashboard . getConfigurationItemBusAppName ( ) == null ? "" : dashboard . getConfigurationItemBusAppName ( ) ) ; String appServiceOwner = ( ( cmdb == null || cmdb . getAppServiceOwner ( ) == null ) ? "" : cmdb . getAppServiceOwner ( ) ) ; String appBusAppOwner = ( ( cmdb == null || cmdb . getBusinessOwner ( ) == null ) ? "" : cmdb . getBusinessOwner ( ) ) ; Arrays . stream ( AuditType . values ( ) ) . forEach ( ( AuditType auditType ) -> { if ( ! ( auditType . equals ( AuditType . ALL ) || auditType . equals ( AuditType . BUILD_REVIEW ) ) ) { Audit audit = auditMap . get ( auditType ) ; AuditResult auditResult = new AuditResult ( dashboardId , dashboardTitle , ownerDept , appService , appBusApp , appServiceOwner , appBusAppOwner , auditType , audit . getDataStatus ( ) . name ( ) , audit . getAuditStatus ( ) . name ( ) , String . join ( "," , audit . getAuditStatusCodes ( ) ) , String . join ( "," , audit . getUrl ( ) ) , timestamp ) ; auditResult . setOptions ( audit . getOptions ( ) != null ? audit . getOptions ( ) : null ) ; auditResults . add ( auditResult ) ; } } ) ; }
Add audit result by audit type