use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterFactoryImpl method createParameter.
@Override
public Parameter createParameter(ParameterElement parameterElement, String value, Audit audit) {
Parameter parameter = createParameter(parameterElement, value);
audit.addParameter(parameter);
return parameter;
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDAOImplTest method testFindDefaultParameter.
@Test
public void testFindDefaultParameter() {
ParameterElement paramElement = parameterElementDAO.read(Long.valueOf(1));
Parameter param = parameterDAO.findDefaultParameter(paramElement);
assertEquals(Long.valueOf(1), param.getId());
paramElement = parameterElementDAO.read(Long.valueOf(2));
param = parameterDAO.findDefaultParameter(paramElement);
assertEquals(Long.valueOf(5), param.getId());
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDAOImplTest method testFindParameterSetFromAudit.
@Test
public void testFindParameterSetFromAudit() {
Audit audit = auditDAO.read(Long.valueOf(1));
Set<Parameter> paramSet = parameterDAO.findParameterSetFromAudit(audit);
assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size()));
audit = auditDAO.read(Long.valueOf(2));
paramSet = parameterDAO.findParameterSetFromAudit(audit);
assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size()));
audit = auditDAO.read(Long.valueOf(3));
paramSet = parameterDAO.findParameterSetFromAudit(audit);
assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size()));
audit = auditDAO.read(Long.valueOf(4));
paramSet = parameterDAO.findParameterSetFromAudit(audit);
assertEquals(Integer.valueOf(2), Integer.valueOf(paramSet.size()));
audit = auditDAO.read(Long.valueOf(5));
paramSet = parameterDAO.findParameterSetFromAudit(audit);
assertEquals(Integer.valueOf(0), Integer.valueOf(paramSet.size()));
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDAOImplTest method testFindParameter.
@Test
public void testFindParameter() {
ParameterElement paramElement = parameterElementDAO.read(Long.valueOf(1));
Parameter param = parameterDAO.findParameter(paramElement, "0");
assertNull(param);
for (int i = 1; i < 5; i++) {
param = parameterDAO.findParameter(paramElement, "Value" + i);
assertEquals(i, param.getId().intValue());
}
paramElement = parameterElementDAO.read(Long.valueOf(2));
param = parameterDAO.findParameter(paramElement, "4");
assertNull(param);
for (int i = 5; i < 9; i++) {
param = parameterDAO.findParameter(paramElement, "Value" + i);
assertEquals(i, param.getId().intValue());
}
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDAOImpl method findParameter.
@Override
public Parameter findParameter(ParameterElement parameterElement, String parameterValue) {
Query query = entityManager.createQuery("SELECT p FROM " + getEntityClass().getName() + " p" + " WHERE p.parameterElement = :parameterElement" + " AND p.parameterValue = :parameterValue");
query.setParameter("parameterElement", parameterElement);
query.setParameter("parameterValue", parameterValue);
try {
return (Parameter) (query.getSingleResult());
} catch (NoResultException nre) {
return null;
}
}
Aggregations