Search in sources :

Example 6 with DrlRuleParser

use of org.drools.verifier.misc.DrlRuleParser 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 7 with DrlRuleParser

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

the class DroolsDocsBuilder method writePDF.

public void writePDF(OutputStream out) {
    // TODO: Use i18n!
    Document document = new Document();
    try {
        PdfWriter.getInstance(document, out);
        HeaderFooter footer = DroolsDocsComponentFactory.createFooter(packageData.getName());
        document.setFooter(footer);
        document.addTitle(packageData.getName().toUpperCase());
        document.open();
        // First page, documentation info.
        DroolsDocsComponentFactory.createFirstPage(document, currentDate, packageData);
        document.newPage();
        // List index of the rules
        document.add(new Phrase("Table of Contents"));
        document.add(DroolsDocsComponentFactory.createContents(packageData.getRules()));
        document.newPage();
        for (DrlRuleParser ruleData : packageData.getRules()) {
            DroolsDocsComponentFactory.newRulePage(document, packageData.getName(), ruleData);
        }
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    }
    document.close();
}
Also used : DocumentException(com.lowagie.text.DocumentException) HeaderFooter(com.lowagie.text.HeaderFooter) Phrase(com.lowagie.text.Phrase) Document(com.lowagie.text.Document) DrlRuleParser(org.drools.verifier.misc.DrlRuleParser)

Aggregations

DrlRuleParser (org.drools.verifier.misc.DrlRuleParser)7 Test (org.junit.Test)3 Chunk (com.lowagie.text.Chunk)1 Document (com.lowagie.text.Document)1 DocumentException (com.lowagie.text.DocumentException)1 HeaderFooter (com.lowagie.text.HeaderFooter)1 List (com.lowagie.text.List)1 ListItem (com.lowagie.text.ListItem)1 Phrase (com.lowagie.text.Phrase)1 ParseException (java.text.ParseException)1 VerifierRule (org.drools.verifier.components.VerifierRule)1 DrlPackageParser (org.drools.verifier.misc.DrlPackageParser)1