Search in sources :

Example 1 with ParameterFamily

use of org.asqatasun.entity.parameterization.ParameterFamily in project Asqatasun by Asqatasun.

the class AbstractRuleImplementationTestCase method createParameter.

/**
     * 
     * @param familyValue
     * @param elementValue
     * @param value
     * @return 
     */
protected Parameter createParameter(String familyValue, String elementValue, String value) {
    ParameterFamily parameterFamily = PARAMETER_FAMILY_FACTORY.create();
    parameterFamily.setParameterFamilyCode(familyValue);
    ParameterElement parameterElement = PARAMETER_ELEMENT_FACTORY.create();
    parameterElement.setParameterFamily(parameterFamily);
    parameterElement.setParameterElementCode(elementValue);
    Parameter parameter = PARAMETER_FACTORY.create();
    parameter.setValue(value);
    parameter.setParameterElement(parameterElement);
    return parameter;
}
Also used : ParameterFamily(org.asqatasun.entity.parameterization.ParameterFamily) Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement)

Example 2 with ParameterFamily

use of org.asqatasun.entity.parameterization.ParameterFamily in project Asqatasun by Asqatasun.

the class ParameterDataServiceImplTest method getParameter.

private Parameter getParameter(String family, String element, String value) {
    ParameterFamily pf = new ParameterFamilyImpl();
    pf.setParameterFamilyCode(family);
    //ELEMENT1
    ParameterElement pe = new ParameterElementImpl();
    pe.setParameterElementCode(element);
    Parameter p = new ParameterImpl();
    p.setParameterElement(pe);
    p.setValue(value);
    return p;
}
Also used : ParameterFamily(org.asqatasun.entity.parameterization.ParameterFamily) ParameterImpl(org.asqatasun.entity.parameterization.ParameterImpl) Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement) ParameterFamilyImpl(org.asqatasun.entity.parameterization.ParameterFamilyImpl) ParameterElementImpl(org.asqatasun.entity.parameterization.ParameterElementImpl)

Example 3 with ParameterFamily

use of org.asqatasun.entity.parameterization.ParameterFamily in project Asqatasun by Asqatasun.

the class ParameterFamilyDAOImpl method findParameterFamilyFromCode.

@Override
public ParameterFamily findParameterFamilyFromCode(String parameterFamilyCode) {
    Query query = entityManager.createQuery("SELECT pf FROM " + getEntityClass().getName() + " pf" + " WHERE pf.paramFamilyCode = :parameterFamilyCode");
    query.setParameter("parameterFamilyCode", parameterFamilyCode);
    try {
        return (ParameterFamily) query.getSingleResult();
    } catch (NoResultException nre) {
        return null;
    } catch (NonUniqueResultException nure) {
        return null;
    }
}
Also used : NonUniqueResultException(javax.persistence.NonUniqueResultException) Query(javax.persistence.Query) ParameterFamily(org.asqatasun.entity.parameterization.ParameterFamily) NoResultException(javax.persistence.NoResultException)

Aggregations

ParameterFamily (org.asqatasun.entity.parameterization.ParameterFamily)3 Parameter (org.asqatasun.entity.parameterization.Parameter)2 ParameterElement (org.asqatasun.entity.parameterization.ParameterElement)2 NoResultException (javax.persistence.NoResultException)1 NonUniqueResultException (javax.persistence.NonUniqueResultException)1 Query (javax.persistence.Query)1 ParameterElementImpl (org.asqatasun.entity.parameterization.ParameterElementImpl)1 ParameterFamilyImpl (org.asqatasun.entity.parameterization.ParameterFamilyImpl)1 ParameterImpl (org.asqatasun.entity.parameterization.ParameterImpl)1