Search in sources :

Example 1 with MissingDependencyException

use of org.drools.core.common.MissingDependencyException in project drools by kiegroup.

the class AbstractASMConsequenceBuilder method consequenceContext.

private Map<String, Object> consequenceContext(RuleBuildContext context, String consequenceName) {
    String className = consequenceName + "Consequence";
    Map<String, Declaration> decls = context.getDeclarationResolver().getDeclarations(context.getRule(), consequenceName);
    JavaAnalysisResult analysis = JavaRuleBuilderHelper.createJavaAnalysisResult(context, consequenceName, decls);
    if (analysis == null) {
        // not possible to get the analysis results
        return null;
    }
    // this will fix modify, retract, insert, update, entrypoints and channels
    try {
        String fixedConsequence = KnowledgeHelperFixer.fix(AsmUtil.fixBlockDescr(context, analysis, decls));
        return JavaRuleBuilderHelper.createConsequenceContext(context, consequenceName, className, fixedConsequence, decls, analysis.getBoundIdentifiers());
    } catch (MissingDependencyException e) {
        context.addError(new MissingDependencyError(context.getRuleDescr().getResource(), e));
    }
    return null;
}
Also used : JavaAnalysisResult(org.drools.mvel.java.JavaAnalysisResult) MissingDependencyError(org.drools.compiler.compiler.MissingDependencyError) Declaration(org.drools.core.rule.Declaration) MissingDependencyException(org.drools.core.common.MissingDependencyException)

Aggregations

MissingDependencyError (org.drools.compiler.compiler.MissingDependencyError)1 MissingDependencyException (org.drools.core.common.MissingDependencyException)1 Declaration (org.drools.core.rule.Declaration)1 JavaAnalysisResult (org.drools.mvel.java.JavaAnalysisResult)1