Search in sources :

Example 1 with CriterionStatistics

use of org.asqatasun.entity.statistics.CriterionStatistics in project Asqatasun by Asqatasun.

the class WebResourceStatisticsDataServiceImpl method addResultToCriterionCounterMap.

/**
 * @param testSolution
 * @param criterion
 * @param wrs
 */
private void addResultToCriterionCounterMap(TestSolution testSolution, Criterion criterion, WebResourceStatistics wrs, Map<Criterion, CriterionStatistics> csMap) {
    if (csMap.containsKey(criterion)) {
        CriterionStatistics cs = csMap.get(criterion);
        incrementCriterionCounterFromTestSolution(cs, testSolution);
    } else {
        CriterionStatistics cs = new CriterionStatisticsImpl();
        cs.setCriterion(criterion);
        incrementCriterionCounterFromTestSolution(cs, testSolution);
        csMap.put(criterion, cs);
    }
}
Also used : CriterionStatistics(org.asqatasun.entity.statistics.CriterionStatistics) CriterionStatisticsImpl(org.asqatasun.entity.statistics.CriterionStatisticsImpl)

Example 2 with CriterionStatistics

use of org.asqatasun.entity.statistics.CriterionStatistics in project Asqatasun by Asqatasun.

the class CriterionStatisticsDAOImpl method findCriterionStatisticsByWebResource.

/**
 * {@inheritDoc}
 */
@Override
public CriterionStatistics findCriterionStatisticsByWebResource(Criterion criterion, WebResourceStatistics webResourceStatistics) {
    StringBuilder strb = new StringBuilder();
    strb.append("SELECT cs FROM ");
    strb.append(getEntityClass().getName());
    strb.append(" cs ");
    strb.append(" WHERE cs.webResourceStatistics=:webResourceId ");
    strb.append(" AND cs.criterion=:criterion ");
    Query query = entityManager.createQuery(strb.toString());
    query.setParameter("webResourceId", webResourceStatistics);
    query.setParameter("criterion", criterion);
    try {
        return (CriterionStatistics) query.getSingleResult();
    } catch (NoResultException e) {
        return null;
    }
}
Also used : Query(javax.persistence.Query) CriterionStatistics(org.asqatasun.entity.statistics.CriterionStatistics) NoResultException(javax.persistence.NoResultException)

Example 3 with CriterionStatistics

use of org.asqatasun.entity.statistics.CriterionStatistics in project Asqatasun by Asqatasun.

the class CriterionResultFactory method prepareThemeResultMap.

/**
     * 
     * @param netResultList
     * @return
     */
private Map<Theme, List<CriterionResult>> prepareThemeResultMap(List<CriterionStatistics> criterionStatList) {
    // Map that associates a list of results with a theme
    Map<Theme, List<CriterionResult>> criterionResultMap = new LinkedHashMap<Theme, List<CriterionResult>>();
    sortCollection(criterionStatList);
    for (CriterionStatistics crs : criterionStatList) {
        CriterionResult testResult = getCriterionResult(crs);
        Theme theme = crs.getCriterion().getTheme();
        if (criterionResultMap.containsKey(theme)) {
            criterionResultMap.get(theme).add(testResult);
        } else {
            List<CriterionResult> criterionResultList = new ArrayList<CriterionResult>();
            criterionResultList.add(testResult);
            criterionResultMap.put(theme, criterionResultList);
        }
    }
    return criterionResultMap;
}
Also used : Theme(org.asqatasun.entity.reference.Theme) CriterionStatistics(org.asqatasun.entity.statistics.CriterionStatistics) CriterionResult(org.asqatasun.webapp.presentation.data.CriterionResult)

Example 4 with CriterionStatistics

use of org.asqatasun.entity.statistics.CriterionStatistics in project Asqatasun by Asqatasun.

the class AuditStatisticsFactory method getResultCounterByThemeForCriterion.

/**
     *
     * @param webResource
     * @param theme
     * @return
     */
private ResultCounter getResultCounterByThemeForCriterion(WebResource webResource, Theme theme) {
    ResultCounter resultCounter = ResultCounterFactory.getInstance().getResultCounter();
    int passedCount = 0;
    int failedCount = 0;
    int nmiCount = 0;
    int naCount = 0;
    int ntCount = 0;
    Collection<CriterionStatistics> csc = criterionStatisticsDataService.getCriterionStatisticsByWebResource(webResource, theme.getCode(), new ArrayList<String>());
    for (CriterionStatistics cs : csc) {
        switch(cs.getCriterionResult()) {
            case FAILED:
                failedCount++;
                break;
            case PASSED:
                passedCount++;
                break;
            case NEED_MORE_INFO:
                nmiCount++;
                break;
            case NOT_APPLICABLE:
                naCount++;
                break;
            case NOT_TESTED:
                ntCount++;
                break;
        }
    }
    resultCounter.setPassedCount(passedCount);
    resultCounter.setFailedCount(failedCount);
    resultCounter.setNmiCount(nmiCount);
    resultCounter.setNaCount(naCount);
    resultCounter.setNtCount(ntCount);
    return resultCounter;
}
Also used : CriterionStatistics(org.asqatasun.entity.statistics.CriterionStatistics) ResultCounter(org.asqatasun.webapp.presentation.data.ResultCounter)

Example 5 with CriterionStatistics

use of org.asqatasun.entity.statistics.CriterionStatistics in project Asqatasun by Asqatasun.

the class AnalyserImpl method addResultToCriterionCounterMap.

/**
 * @param testSolution
 * @param criterion
 */
private void addResultToCriterionCounterMap(TestSolution testSolution, Criterion criterion) {
    if (csMap == null) {
        csMap = new HashMap();
    }
    if (csMap.containsKey(criterion)) {
        CriterionStatistics cs = csMap.get(criterion);
        incrementCriterionCounterFromTestSolution(cs, testSolution);
    } else {
        CriterionStatistics cs = criterionStatisticsDataService.create();
        cs.setCriterion(criterion);
        incrementCriterionCounterFromTestSolution(cs, testSolution);
        csMap.put(criterion, cs);
    }
}
Also used : CriterionStatistics(org.asqatasun.entity.statistics.CriterionStatistics)

Aggregations

CriterionStatistics (org.asqatasun.entity.statistics.CriterionStatistics)10 Theme (org.asqatasun.entity.reference.Theme)3 ProcessResult (org.asqatasun.entity.audit.ProcessResult)2 TestSolution (org.asqatasun.entity.audit.TestSolution)2 Criterion (org.asqatasun.entity.reference.Criterion)2 ThemeStatistics (org.asqatasun.entity.statistics.ThemeStatistics)2 HashMap (java.util.HashMap)1 NoResultException (javax.persistence.NoResultException)1 Query (javax.persistence.Query)1 WebResourceStatisticsDAO (org.asqatasun.entity.dao.statistics.WebResourceStatisticsDAO)1 CriterionStatisticsImpl (org.asqatasun.entity.statistics.CriterionStatisticsImpl)1 WebResourceStatistics (org.asqatasun.entity.statistics.WebResourceStatistics)1 CriterionResult (org.asqatasun.webapp.dto.CriterionResult)1 ResultCounter (org.asqatasun.webapp.dto.ResultCounter)1 CriterionResult (org.asqatasun.webapp.presentation.data.CriterionResult)1 ResultCounter (org.asqatasun.webapp.presentation.data.ResultCounter)1