class RepositorySearchServiceImpl implements RepositorySearchService, Diagnostic {

    @Override
    public Map<DiagnosticAttribute, DiagnosticCallback> getDiagnosticData() {
        final RepositorySearchCriteria repositorySearchCriteria = new RepositorySearchCriteriaImpl.Builder().setFolderUri("/")
                .setSearchText(null).setStartIndex(0).setMaxCount(0)
                .setSearchMode(SearchMode.SEARCH).setSortBy("name").getCriteria();
        final RepositorySearchConfiguration configuration = getConfiguration(repositorySearchCriteria.getSearchMode());
        final SearchCriteriaFactory factory = defaultSearchCriteriaFactory.newFactory(Resource.class.getCanonicalName());
        final SearchSorter searchSorter = this.getSorter();

        return new DiagnosticAttributeBuilder()
            .addDiagnosticAttribute(DiagnosticAttributeBuilder.TOTAL_REPORTS_COUNT, new DiagnosticCallback<Integer>() {
                @Override
                public Integer getDiagnosticAttributeValue() {
                    final List<SearchFilter> allFiltersList = new ArrayList<SearchFilter>(createAllFiltersList(configuration, repositorySearchCriteria));
                    repositorySearchCriteria.setResourceTypes(filterOptionToResourceTypes.get("resourceTypeFilter-reports"));
                    return repositoryService.getResourcesCount(putCriteriaToContext(null, repositorySearchCriteria), factory, allFiltersList,
                            searchSorter, transformerFactory);
                }
            })
            .addDiagnosticAttribute(DiagnosticAttributeBuilder.TOTAL_REPORT_OUTPUTS_COUNT, new DiagnosticCallback<Integer>() {
                @Override
                public Integer getDiagnosticAttributeValue() {
                    final List<SearchFilter> allFiltersList = new ArrayList<SearchFilter>(createAllFiltersList(configuration, repositorySearchCriteria));
                    repositorySearchCriteria.setResourceTypes(filterOptionToResourceTypes.get("resourceTypeFilter-reportOutput"));
                    return repositoryService.getResourcesCount(putCriteriaToContext(null, repositorySearchCriteria), factory, allFiltersList,
                            searchSorter, transformerFactory);
                }
            })
            .addDiagnosticAttribute(DiagnosticAttributeBuilder.TOTAL_FOLDERS_COUNT, new DiagnosticCallback<Integer>() {
                @Override
                public Integer getDiagnosticAttributeValue() {
                    return repositoryService.getFoldersCount(null);
                }
            })
            .addDiagnosticAttribute(DiagnosticAttributeBuilder.TOTAL_OLAP_VIEWS_COUNT, new DiagnosticCallback<Integer>() {
                @Override
                public Integer getDiagnosticAttributeValue() {
                    final List<SearchFilter> allFiltersList = new ArrayList<SearchFilter>(createAllFiltersList(configuration, repositorySearchCriteria));
                    repositorySearchCriteria.setResourceTypes(filterOptionToResourceTypes.get("resourceTypeFilter-view"));
                    return repositoryService.getResourcesCount(putCriteriaToContext(null, repositorySearchCriteria), factory, allFiltersList,
                            searchSorter, transformerFactory);
                }
            })
            .addDiagnosticAttribute(DiagnosticAttributeBuilder.TOTAL_DATA_SOURCES_COUNT, new DiagnosticCallback<Integer>() {
                @Override
                public Integer getDiagnosticAttributeValue() {
                    final List<SearchFilter> allFiltersList = new ArrayList<SearchFilter>(createAllFiltersList(configuration, repositorySearchCriteria));
                    repositorySearchCriteria.setResourceTypes(filterOptionToResourceTypes.get("resourceTypeFilter-dataSources"));
                    return repositoryService.getResourcesCount(putCriteriaToContext(null, repositorySearchCriteria), factory, allFiltersList,
                            searchSorter, transformerFactory);
                }
            }).build();
    }

}