Search in sources :

Example 11 with Parameter

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

the class ParameterDAOImpl method findLevelParameter.

@Override
public Parameter findLevelParameter(String parameterValue) {
    Query query = entityManager.createQuery("SELECT p FROM " + getEntityClass().getName() + " p" + " WHERE p.parameterElement.parameterElementCode = :parameterElementCode" + " AND p.parameterValue = :parameterValue");
    query.setParameter("parameterValue", parameterValue);
    query.setParameter("parameterElementCode", "LEVEL");
    try {
        return (Parameter) (query.getSingleResult());
    } catch (NoResultException nre) {
        return null;
    }
}
Also used : Query(javax.persistence.Query) Parameter(org.asqatasun.entity.parameterization.Parameter) NoResultException(javax.persistence.NoResultException)

Example 12 with Parameter

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

the class ParameterDAOImpl method findParameterSetFromAudit.

@Override
public Set<Parameter> findParameterSetFromAudit(Audit audit) {
    if (audit != null) {
        Query query = entityManager.createQuery("SELECT a FROM " + AuditImpl.class.getName() + " a" + " WHERE a.id = :idAudit");
        query.setParameter("idAudit", audit.getId());
        try {
            audit = (Audit) (query.getSingleResult());
            Set<Parameter> paramSet = new HashSet<Parameter>();
            paramSet.addAll(audit.getParameterSet());
            return paramSet;
        } catch (NoResultException nre) {
            return null;
        }
    }
    return null;
}
Also used : Query(javax.persistence.Query) Parameter(org.asqatasun.entity.parameterization.Parameter) NoResultException(javax.persistence.NoResultException)

Example 13 with Parameter

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

the class ParameterDAOImpl method findDefaultParameter.

@Override
public Parameter findDefaultParameter(ParameterElement parameterElement) {
    Query query = entityManager.createQuery("SELECT p FROM " + getEntityClass().getName() + " p" + " WHERE p.isDefaultParameterValue = :isDefault" + " AND p.parameterElement = :parameterElement");
    query.setParameter("isDefault", true);
    query.setParameter("parameterElement", parameterElement);
    try {
        return (Parameter) query.getSingleResult();
    } catch (NoResultException nre) {
        return null;
    } catch (NonUniqueResultException nure) {
        return (Parameter) query.getResultList().iterator().next();
    }
}
Also used : NonUniqueResultException(javax.persistence.NonUniqueResultException) Query(javax.persistence.Query) Parameter(org.asqatasun.entity.parameterization.Parameter) NoResultException(javax.persistence.NoResultException)

Example 14 with Parameter

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) {
    Parameter parameter = new ParameterImpl();
    parameter.setDefaultParameterValue(false);
    parameter.setParameterElement(parameterElement);
    parameter.setValue(value);
    return parameter;
}
Also used : ParameterImpl(org.asqatasun.entity.parameterization.ParameterImpl) Parameter(org.asqatasun.entity.parameterization.Parameter)

Example 15 with Parameter

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

the class AuditLauncherController method setLevelParameter.

/**
 * @param paramSet
 * @param level
 * @return
 */
private Set<Parameter> setLevelParameter(Set<Parameter> paramSet, String level) {
    Parameter levelParameter = parameterDataService.getLevelParameter(level);
    paramSet = parameterDataService.updateParameter(paramSet, levelParameter);
    return paramSet;
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter)

Aggregations

Parameter (org.asqatasun.entity.parameterization.Parameter)59 ParameterElement (org.asqatasun.entity.parameterization.ParameterElement)13 Audit (org.asqatasun.entity.audit.Audit)8 ParameterImpl (org.asqatasun.entity.parameterization.ParameterImpl)6 NoResultException (javax.persistence.NoResultException)5 Query (javax.persistence.Query)5 HashSet (java.util.HashSet)4 AuditCommand (org.asqatasun.service.command.AuditCommand)4 AuditCommandFactory (org.asqatasun.service.command.factory.AuditCommandFactory)4 Test (org.junit.Test)4 File (java.io.File)3 IOException (java.io.IOException)3 Crawler (org.asqatasun.crawler.Crawler)3 ParameterElementImpl (org.asqatasun.entity.parameterization.ParameterElementImpl)3 LinkedHashSet (java.util.LinkedHashSet)2 ParameterFamily (org.asqatasun.entity.parameterization.ParameterFamily)2 WebResourceStatisticsDataService (org.asqatasun.entity.service.statistics.WebResourceStatisticsDataService)2 WebResourceStatisticsDataServiceImpl (org.asqatasun.entity.service.statistics.WebResourceStatisticsDataServiceImpl)2 WebResourceStatistics (org.asqatasun.entity.statistics.WebResourceStatistics)2 WebResourceStatisticsFactory (org.asqatasun.entity.statistics.factory.WebResourceStatisticsFactory)2