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);
}
}
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;
}
}
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;
}
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;
}
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);
}
}
Aggregations