use of org.asqatasun.entity.reference.Reference in project Asqatasun by Asqatasun.
the class ReferenceDAOImpl method retrieveByCode.
@Override
public Reference retrieveByCode(String code) {
Query query = entityManager.createQuery("SELECT r FROM " + getEntityClass().getName() + " r WHERE r.code = :code");
query.setParameter("code", code);
return (Reference) query.getSingleResult();
}
use of org.asqatasun.entity.reference.Reference in project Asqatasun by Asqatasun.
the class TestDAOImplTest method testRetrieveAllByReferenceAndLevel.
public void testRetrieveAllByReferenceAndLevel() {
Reference ref = referenceDAO.read(Long.valueOf(1));
// bronze level ref 1
Level level = levelDAO.read(Long.valueOf(1));
assertEquals(7, testDAO.retrieveAllByReferenceAndLevel(ref, level).size());
// silver level ref 1
level = levelDAO.read(Long.valueOf(2));
assertEquals(10, testDAO.retrieveAllByReferenceAndLevel(ref, level).size());
// gold level ref 1
level = levelDAO.read(Long.valueOf(3));
assertEquals(10, testDAO.retrieveAllByReferenceAndLevel(ref, level).size());
// gold level ref 2
ref = referenceDAO.read(Long.valueOf(2));
assertEquals(5, testDAO.retrieveAllByReferenceAndLevel(ref, level).size());
// silver level ref 2
level = levelDAO.read(Long.valueOf(2));
assertEquals(5, testDAO.retrieveAllByReferenceAndLevel(ref, level).size());
// bronze level ref 2
level = levelDAO.read(Long.valueOf(1));
assertEquals(3, testDAO.retrieveAllByReferenceAndLevel(ref, level).size());
}
use of org.asqatasun.entity.reference.Reference in project Asqatasun by Asqatasun.
the class TestDAOImplTest method testRetrieveAll_Reference.
public void testRetrieveAll_Reference() {
Reference ref = referenceDAO.read(Long.valueOf(1));
assertEquals(10, testDAO.retrieveAll(ref).size());
ref = referenceDAO.read(Long.valueOf(2));
assertEquals(5, testDAO.retrieveAll(ref).size());
}
use of org.asqatasun.entity.reference.Reference in project Asqatasun by Asqatasun.
the class ReferenceDataServiceImpl method getByCode.
@Override
public Reference getByCode(String code) {
if (referenceMap.containsKey(code)) {
return referenceMap.get(code);
}
Reference reference = ((ReferenceDAO) entityDao).retrieveByCode(code);
referenceMap.put(code, reference);
return reference;
}
use of org.asqatasun.entity.reference.Reference in project Asqatasun by Asqatasun.
the class TestDataServiceImpl method getTestListFromParamSet.
/**
* The parameter set contains a unique parameter that combines the referential
* and the level parameters.
* This method extracts these parameters to retrieve the appropriate tests.
*
* @param paramSet
* @return
*/
@Override
public List<Test> getTestListFromParamSet(Set<Parameter> paramSet) {
Reference reference = null;
Level level = null;
for (Parameter param : paramSet) {
String paramElemcode = param.getParameterElement().getParameterElementCode();
if (paramElemcode.equals(levelParameterCode)) {
String[] referentialAndLevel = param.getValue().split(";");
reference = referenceDataService.getByCode(referentialAndLevel[0]);
level = levelDataService.getByCode(referentialAndLevel[1]);
break;
}
}
List<Test> testList = getAllByReferenceAndLevel(reference, level);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Retrieved " + testList.size() + " test for the referential " + reference.getLabel() + " and the level " + level.getLabel());
}
return testList;
}
Aggregations