Search in sources :

Example 1 with ResultSeverity

use of org.kie.internal.builder.ResultSeverity in project drools by kiegroup.

the class KnowledgeBuilderConfigurationImpl method getProperty.

public String getProperty(String name) {
    name = name.trim();
    if (StringUtils.isEmpty(name)) {
        return null;
    }
    if (name.equals(DefaultDialectOption.PROPERTY_NAME)) {
        return getDefaultDialect();
    } else if (name.equals(DefaultPackageNameOption.PROPERTY_NAME)) {
        return getDefaultPackageName();
    } else if (name.startsWith(AccumulateFunctionOption.PROPERTY_NAME)) {
        int index = AccumulateFunctionOption.PROPERTY_NAME.length();
        AccumulateFunction function = this.accumulateFunctions.get(name.substring(index));
        return function != null ? function.getClass().getName() : null;
    } else if (name.startsWith(EvaluatorOption.PROPERTY_NAME)) {
        String key = name.substring(name.lastIndexOf('.') + 1);
        EvaluatorDefinition evalDef = this.evaluatorRegistry.getEvaluatorDefinition(key);
        return evalDef != null ? evalDef.getClass().getName() : null;
    } else if (name.equals(DumpDirOption.PROPERTY_NAME)) {
        return this.dumpDirectory != null ? this.dumpDirectory.toString() : null;
    } else if (name.equals(ProcessStringEscapesOption.PROPERTY_NAME)) {
        return String.valueOf(isProcessStringEscapes());
    } else if (name.equals(ClassLoaderCacheOption.PROPERTY_NAME)) {
        return String.valueOf(isClassLoaderCacheEnabled());
    } else if (name.startsWith(KBuilderSeverityOption.PROPERTY_NAME)) {
        String key = name.substring(name.lastIndexOf('.') + 1);
        ResultSeverity severity = this.severityMap.get(key);
        return severity.toString();
    } else if (name.equals(LanguageLevelOption.PROPERTY_NAME)) {
        return "" + getLanguageLevel();
    }
    return null;
}
Also used : EvaluatorDefinition(org.drools.core.base.evaluators.EvaluatorDefinition) AccumulateFunction(org.kie.api.runtime.rule.AccumulateFunction) ResultSeverity(org.kie.internal.builder.ResultSeverity)

Example 2 with ResultSeverity

use of org.kie.internal.builder.ResultSeverity in project drools by kiegroup.

the class KnowledgeBuilderImpl method getResultList.

private List<KnowledgeBuilderResult> getResultList(ResultSeverity... severities) {
    List<ResultSeverity> typesToFetch = Arrays.asList(severities);
    ArrayList<KnowledgeBuilderResult> problems = new ArrayList<KnowledgeBuilderResult>();
    for (KnowledgeBuilderResult problem : results) {
        if (typesToFetch.contains(problem.getSeverity())) {
            problems.add(problem);
        }
    }
    return problems;
}
Also used : ArrayList(java.util.ArrayList) ResultSeverity(org.kie.internal.builder.ResultSeverity) KnowledgeBuilderResult(org.kie.internal.builder.KnowledgeBuilderResult)

Aggregations

ResultSeverity (org.kie.internal.builder.ResultSeverity)2 ArrayList (java.util.ArrayList)1 EvaluatorDefinition (org.drools.core.base.evaluators.EvaluatorDefinition)1 AccumulateFunction (org.kie.api.runtime.rule.AccumulateFunction)1 KnowledgeBuilderResult (org.kie.internal.builder.KnowledgeBuilderResult)1