Search in sources :

Example 1 with FailedThemeInfo

use of org.asqatasun.webapp.dto.FailedThemeInfo in project Asqatasun by Asqatasun.

the class AuditSynthesisController method prepareSynthesisSiteData.

/**
 * This method prepares data for the synthesis page. Only multi pages audit
 * are considered here
 *
 * @param audit
 * @param model
 * @return
 * @throws IOException
 */
private String prepareSynthesisSiteData(Audit audit, Model model) {
    // Add this step, we are sure that the audit subject
    // is a site, we can trustly cast it
    Site site = (Site) audit.getSubject();
    // TODO cas manual
    addAuditStatisticsToModel(site, model, TgolKeyStore.TEST_DISPLAY_SCOPE_VALUE);
    Map<Theme, ResultCounter> top5SortedThemeMap = new LinkedHashMap<>();
    @SuppressWarnings("unchecked") Collection<FailedThemeInfo> tfiCollection = (Collection<FailedThemeInfo>) statisticsDataService.getResultCountByResultTypeAndTheme(site, audit, TestSolution.FAILED, nbOfDisplayedFailedTest);
    for (FailedThemeInfo tfi : tfiCollection) {
        ResultCounter failedCounter = resultCounterFactory.getResultCounter();
        failedCounter.setFailedCount(tfi.getResultCounter().intValue());
        top5SortedThemeMap.put(auditStatisticsFactory.getTheme(tfi.getThemeId()), failedCounter);
    }
    model.addAttribute(TgolKeyStore.AUDITED_PAGES_COUNT_KEY, statisticsDataService.getWebResourceCountByAuditAndHttpStatusCode(audit.getId(), HttpStatusCodeFamily.f2xx, null, null).intValue());
    model.addAttribute(TgolKeyStore.TOP5_SORTED_THEME_MAP, top5SortedThemeMap);
    model.addAttribute(TgolKeyStore.FAILED_PAGE_INFO_BY_TEST_SET_KEY, statisticsDataService.getFailedWebResourceSortedByTest(site, audit, nbOfDisplayedFailedPages));
    model.addAttribute(TgolKeyStore.FAILED_PAGE_INFO_BY_OCCURRENCE_SET_KEY, statisticsDataService.getFailedWebResourceSortedByOccurrence(site, audit, nbOfDisplayedFailedPages));
    model.addAttribute(TgolKeyStore.FAILED_TEST_INFO_BY_OCCURRENCE_SET_KEY, statisticsDataService.getFailedTestByOccurrence(site, audit, nbOfDisplayedFailedTest));
    model.addAttribute(TgolKeyStore.HAS_SITE_SCOPE_TEST_KEY, processResultDataService.hasAuditSiteScopeResult(site, siteScope));
    model.addAttribute(TgolKeyStore.STATUS_KEY, computeAuditStatus(site.getAudit()));
    return TgolKeyStore.SYNTHESIS_SITE_VIEW_NAME;
}
Also used : Site(org.asqatasun.entity.subject.Site) FailedThemeInfo(org.asqatasun.webapp.dto.FailedThemeInfo) Theme(org.asqatasun.entity.reference.Theme) Collection(java.util.Collection) ResultCounter(org.asqatasun.webapp.dto.ResultCounter) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with FailedThemeInfo

use of org.asqatasun.webapp.dto.FailedThemeInfo in project Asqatasun by Asqatasun.

the class StatisticsDAO method convertRawResultAsFailedThemeInfo.

/**
 * @param result
 * @return a collection of FailedThemeInfo from a raw result collection
 */
private Set<FailedThemeInfo> convertRawResultAsFailedThemeInfo(Collection<Object[]> result) {
    Set<FailedThemeInfo> failedThemeInfoSet = new LinkedHashSet();
    for (Object[] obj : result) {
        FailedThemeInfo fti = failedThemeInfoFactory.getFailedThemeInfo(((BigInteger) obj[0]).longValue(), ((Integer) obj[1]).longValue());
        failedThemeInfoSet.add(fti);
    }
    return failedThemeInfoSet;
}
Also used : FailedThemeInfo(org.asqatasun.webapp.dto.FailedThemeInfo)

Aggregations

FailedThemeInfo (org.asqatasun.webapp.dto.FailedThemeInfo)2 Collection (java.util.Collection)1 LinkedHashMap (java.util.LinkedHashMap)1 Theme (org.asqatasun.entity.reference.Theme)1 Site (org.asqatasun.entity.subject.Site)1 ResultCounter (org.asqatasun.webapp.dto.ResultCounter)1