Search in sources :

Example 1 with DrlPackageParser

use of org.drools.verifier.misc.DrlPackageParser in project drools by kiegroup.

the class VerifierImpl method addDrlData.

/**
 * Adds meta data from DRL to package and rule.
 *
 * @param drl Package DRL
 */
private void addDrlData(String drl) {
    List<DrlRuleParser> rules;
    try {
        DrlPackageParser pData = addDrlPackageData(drl);
        rules = pData.getRules();
    } catch (ParseException e) {
        rules = DrlRuleParser.findRulesDataFromDrl(drl);
    }
    addDrlRulesData(rules);
}
Also used : DrlPackageParser(org.drools.verifier.misc.DrlPackageParser) ParseException(java.text.ParseException) DrlRuleParser(org.drools.verifier.misc.DrlRuleParser)

Example 2 with DrlPackageParser

use of org.drools.verifier.misc.DrlPackageParser in project drools by kiegroup.

the class VerifierImpl method addDrlPackageData.

private DrlPackageParser addDrlPackageData(String drl) throws ParseException {
    DrlPackageParser pData = DrlPackageParser.findPackageDataFromDrl(drl);
    RulePackage rPackage = this.result.getVerifierData().getPackageByName(pData.getName());
    rPackage.getGlobals().addAll(pData.getGlobals());
    rPackage.setDescription(pData.getDescription());
    rPackage.getMetadata().addAll(pData.getMetadata());
    rPackage.getOtherInfo().putAll(pData.getOtherInformation());
    return pData;
}
Also used : DrlPackageParser(org.drools.verifier.misc.DrlPackageParser) RulePackage(org.drools.verifier.components.RulePackage)

Aggregations

DrlPackageParser (org.drools.verifier.misc.DrlPackageParser)2 ParseException (java.text.ParseException)1 RulePackage (org.drools.verifier.components.RulePackage)1 DrlRuleParser (org.drools.verifier.misc.DrlRuleParser)1