Search in sources :

Example 1 with ParameterElement

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

the class Asqatasun method getAuditPageParameterSet.

/**
     * The default parameter set embeds a depth value that corresponds to the
     * site audit. We need here to replace this parameter by a parameter value
     * equals to 0.
     *
     * @return
     */
private Set<Parameter> getAuditPageParameterSet(Set<Parameter> defaultParameterSet) {
    ParameterElement parameterElement = parameterElementDataService.getParameterElement("DEPTH");
    Parameter depthParameter = parameterDataService.getParameter(parameterElement, "0");
    Set<Parameter> auditPageParamSet = parameterDataService.updateParameter(defaultParameterSet, depthParameter);
    return auditPageParamSet;
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement)

Example 2 with ParameterElement

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

the class Asqatasun method getParameterSetFromAuditLevel.

/**
     * 
     * @param auditLevel
     * @return 
     */
private Set<Parameter> getParameterSetFromAuditLevel(String ref, String level) {
    if (ref.equalsIgnoreCase(RGAA30_REF) || ref.equalsIgnoreCase(RGAA32016_REF)) {
        if (level.equalsIgnoreCase(BRONZE_LEVEL)) {
            level = A_LEVEL;
        } else if (level.equalsIgnoreCase(SILVER_LEVEL)) {
            level = AA_LEVEL;
        } else if (level.equalsIgnoreCase(GOLD_LEVEL)) {
            level = AAA_LEVEL;
        }
    }
    if (level.equalsIgnoreCase(BRONZE_LEVEL) || level.equalsIgnoreCase(A_LEVEL)) {
        level = LEVEL_1;
    } else if (level.equalsIgnoreCase(SILVER_LEVEL) || level.equalsIgnoreCase(AA_LEVEL)) {
        level = LEVEL_2;
    } else if (level.equalsIgnoreCase(GOLD_LEVEL) || level.equalsIgnoreCase(AAA_LEVEL)) {
        level = LEVEL_3;
    }
    ParameterElement levelParameterElement = parameterElementDataService.getParameterElement(LEVEL_PARAMETER_ELEMENT_CODE);
    Parameter levelParameter = parameterDataService.getParameter(levelParameterElement, ref + ";" + level);
    Set<Parameter> paramSet = parameterDataService.getDefaultParameterSet();
    return parameterDataService.updateParameter(paramSet, levelParameter);
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement)

Example 3 with ParameterElement

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

the class ParameterElementFactoryImpl method createParameter.

@Override
public ParameterElement createParameter(ParameterFamily parameterFamily) {
    ParameterElement parameterElement = new ParameterElementImpl();
    parameterElement.setParameterFamily(parameterFamily);
    return parameterElement;
}
Also used : ParameterElement(org.asqatasun.entity.parameterization.ParameterElement) ParameterElementImpl(org.asqatasun.entity.parameterization.ParameterElementImpl)

Example 4 with ParameterElement

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

the class ParameterElementDAOImpl method findParameterElementFromCode.

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

Example 5 with ParameterElement

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

the class AuditLauncherController method getAuditPageParameterSet.

/**
 * The default parameter set embeds a depth value that corresponds to the
 * site audit. We need here to replace this parameter by a parameter value
 * equals to 0.
 *
 * @return
 */
private Set<Parameter> getAuditPageParameterSet(int nbOfPages) {
    Set<Parameter> paramSet = new HashSet<>();
    ParameterElement depthParameterElement = parameterElementDataService.getParameterElement(TgolKeyStore.DEPTH_PARAM_KEY);
    ParameterElement maxDocParameterElement = parameterElementDataService.getParameterElement(TgolKeyStore.MAX_DOCUMENT_PARAM_KEY);
    Parameter depthParameter = parameterDataService.getParameter(depthParameterElement, TgolKeyStore.DEPTH_PAGE_PARAM_VALUE);
    Parameter maxDocParameter = parameterDataService.getParameter(maxDocParameterElement, String.valueOf(nbOfPages));
    paramSet.add(depthParameter);
    paramSet.add(maxDocParameter);
    return parameterDataService.updateParameterSet(getDefaultParamSet(), paramSet);
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement)

Aggregations

ParameterElement (org.asqatasun.entity.parameterization.ParameterElement)16 Parameter (org.asqatasun.entity.parameterization.Parameter)13 ParameterElementImpl (org.asqatasun.entity.parameterization.ParameterElementImpl)5 ParameterImpl (org.asqatasun.entity.parameterization.ParameterImpl)3 HashSet (java.util.HashSet)2 ParameterFamily (org.asqatasun.entity.parameterization.ParameterFamily)2 Test (org.junit.Test)2 NoResultException (javax.persistence.NoResultException)1 NonUniqueResultException (javax.persistence.NonUniqueResultException)1 Query (javax.persistence.Query)1 OptionElement (org.asqatasun.entity.option.OptionElement)1 ParameterFamilyImpl (org.asqatasun.entity.parameterization.ParameterFamilyImpl)1 OptionElement (org.asqatasun.webapp.entity.option.OptionElement)1