Search in sources :

Example 1 with OptionElement

use of org.asqatasun.entity.option.OptionElement in project Asqatasun by Asqatasun.

the class AuditLauncherController method setUserParameters.

/**
 * Some user options have to be converted as parameters and added to the
 * general audit parameters.
 *
 * @param paramSet
 * @param referentialKey
 * @return
 */
private Set<Parameter> setUserParameters(Set<Parameter> paramSet, String referentialKey) {
    User user = getCurrentUser();
    Collection<OptionElement> optionElementSet = new HashSet<>();
    for (String optionFamily : USER_OPTION_DEPENDING_ON_REFERENTIAL) {
        optionElementSet.addAll(optionElementDataService.getOptionElementFromUserAndFamilyCode(user, referentialKey + "_" + optionFamily));
    }
    for (String optionFamily : userOption) {
        optionElementSet.addAll(optionElementDataService.getOptionElementFromUserAndFamilyCode(user, optionFamily));
    }
    paramSet.addAll(parameterDataService.getParameterSetFromOptionElementSet(optionElementSet));
    return paramSet;
}
Also used : User(org.asqatasun.entity.user.User) OptionElement(org.asqatasun.entity.option.OptionElement)

Example 2 with OptionElement

use of org.asqatasun.entity.option.OptionElement in project Asqatasun by Asqatasun.

the class ParameterDataServiceImpl method getParameterSetFromOptionElementSet.

public Collection<Parameter> getParameterSetFromOptionElementSet(Collection<OptionElement> optionElementSet) {
    Set<Parameter> paramSet = new HashSet<>();
    for (OptionElement optionElement : optionElementSet) {
        ParameterElement pe = parameterElementDataService.getParameterElement(optionElement.getOption().getCode());
        if (pe != null) {
            Parameter p = getParameter(pe, optionElement.getValue());
            p = saveOrUpdate(p);
            paramSet.add(p);
        }
    }
    return paramSet;
}
Also used : OptionElement(org.asqatasun.entity.option.OptionElement) Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement) HashSet(java.util.HashSet)

Aggregations

OptionElement (org.asqatasun.entity.option.OptionElement)2 HashSet (java.util.HashSet)1 Parameter (org.asqatasun.entity.parameterization.Parameter)1 ParameterElement (org.asqatasun.entity.parameterization.ParameterElement)1 User (org.asqatasun.entity.user.User)1