Search in sources :

Example 1 with FailedThemeInfo

use of org.asqatasun.webapp.presentation.data.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>) getStatisticsDataService().getResultCountByResultTypeAndTheme(site, audit, TestSolution.FAILED, nbOfDisplayedFailedTest);
    for (FailedThemeInfo tfi : tfiCollection) {
        ResultCounter failedCounter = ResultCounterFactory.getInstance().getResultCounter();
        failedCounter.setFailedCount(tfi.getResultCounter().intValue());
        top5SortedThemeMap.put(AuditStatisticsFactory.getInstance().getTheme(tfi.getThemeId()), failedCounter);
    }
    model.addAttribute(TgolKeyStore.AUDITED_PAGES_COUNT_KEY, getStatisticsDataService().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, getStatisticsDataService().getFailedWebResourceSortedByTest(site, audit, nbOfDisplayedFailedPages));
    model.addAttribute(TgolKeyStore.FAILED_PAGE_INFO_BY_OCCURRENCE_SET_KEY, getStatisticsDataService().getFailedWebResourceSortedByOccurrence(site, audit, nbOfDisplayedFailedPages));
    model.addAttribute(TgolKeyStore.FAILED_TEST_INFO_BY_OCCURRENCE_SET_KEY, getStatisticsDataService().getFailedTestByOccurrence(site, audit, nbOfDisplayedFailedTest));
    model.addAttribute(TgolKeyStore.HAS_SITE_SCOPE_TEST_KEY, processResultDataService.hasAuditSiteScopeResult(site, getSiteScope()));
    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.presentation.data.FailedThemeInfo) Theme(org.asqatasun.entity.reference.Theme) ResultCounter(org.asqatasun.webapp.presentation.data.ResultCounter)

Example 2 with FailedThemeInfo

use of org.asqatasun.webapp.presentation.data.FailedThemeInfo in project Asqatasun by Asqatasun.

the class StatisticsDAOImpl 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.getInstance().getFailedThemeInfo(((BigInteger) obj[0]).longValue(), ((Integer) obj[1]).longValue());
        failedThemeInfoSet.add(fti);
    }
    return failedThemeInfoSet;
}
Also used : FailedThemeInfo(org.asqatasun.webapp.presentation.data.FailedThemeInfo)

Aggregations

FailedThemeInfo (org.asqatasun.webapp.presentation.data.FailedThemeInfo)2 Theme (org.asqatasun.entity.reference.Theme)1 Site (org.asqatasun.entity.subject.Site)1 ResultCounter (org.asqatasun.webapp.presentation.data.ResultCounter)1