Package org.drools.template.parser

Examples of org.drools.template.parser.TemplateDataListener


    @Test
    public void testPricing() throws Exception {
        final ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
        final List<DataListener> listeners = new ArrayList<DataListener>();
        TemplateDataListener l1 = new TemplateDataListener(10, 3, "/templates/test_pricing1.drl");
        listeners.add(l1);
        TemplateDataListener l2 = new TemplateDataListener(30, 3, "/templates/test_pricing2.drl");
        listeners.add(l2);
        converter.compile("/data/ExamplePolicyPricing.xls", InputType.XLS, listeners);

        //COMPILE
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newByteArrayResource(l1.renderDRL().getBytes()), ResourceType.DRL);
        kbuilder.add(ResourceFactory.newByteArrayResource(l2.renderDRL().getBytes()), ResourceType.DRL);
        assertFalse(kbuilder.hasErrors());

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
        StatefulKnowledgeSession kSession = kbase.newStatefulKnowledgeSession();
View Full Code Here


                          int startCol) {
        TemplateContainer tc = new DefaultTemplateContainer( templateStream );
        closeStream( templateStream );
        return compile( xlsStream,
                        type,
                        new TemplateDataListener( startRow,
                                                  startCol,
                                                  tc ) );
    }
View Full Code Here

                          int startCol) {
        TemplateContainer tc = new DefaultTemplateContainer( templateStream );
        closeStream( templateStream );
        return compile( xlsStream,
                        worksheetName,
                        new TemplateDataListener( startRow,
                                                  startCol,
                                                  tc ) );
    }
View Full Code Here

                          int startCol) {
        TemplateContainer tc = new DefaultTemplateContainer( templateStream );
        closeStream( templateStream );
        return compile( xlsStream,
                        type,
                        new TemplateDataListener( startRow,
                                                  startCol,
                                                  tc ) );
    }
View Full Code Here

                          int startCol) {
        TemplateContainer tc = new DefaultTemplateContainer( templateStream );
        closeStream( templateStream );
        return compile( xlsStream,
                        worksheetName,
                        new TemplateDataListener( startRow,
                                                  startCol,
                                                  tc ) );
    }
View Full Code Here

    public String compile(final DataProvider dataProvider,
                          final InputStream templateStream) {
        TemplateContainer tc = new DefaultTemplateContainer(templateStream);
        closeStream(templateStream);
        return compile(dataProvider,
                       new TemplateDataListener(tc));
    }
View Full Code Here

    public String compile(final Collection<?> objs,
                          final InputStream templateStream) {
        TemplateContainer tc = new DefaultTemplateContainer(templateStream);
        closeStream(templateStream);
        return compile(new ObjectDataProvider(tc, objs),
                       new TemplateDataListener(tc));
    }
View Full Code Here

    public String compile(final ResultSet rs,
                          final InputStream templateStream) {
        TemplateContainer tc = new DefaultTemplateContainer(templateStream);
        closeStream(templateStream);
        return compile(rs,
                       new TemplateDataListener(tc));
    }
View Full Code Here

                          final InputStream templateStream,
                          boolean replaceOptionals) {
        DefaultTemplateContainer tc = new DefaultTemplateContainer(templateStream, replaceOptionals);
        closeStream(templateStream);
        return compile(dataProvider,
                       new TemplateDataListener(tc));
    }
View Full Code Here

  public String compile(final Collection<?> objs,
      final InputStream templateStream) {
    TemplateContainer tc = new DefaultTemplateContainer( templateStream );
    closeStream( templateStream );
    return compile( new ObjectDataProvider( tc, objs ),
                new TemplateDataListener( tc ) );
  }
View Full Code Here

TOP

Related Classes of org.drools.template.parser.TemplateDataListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.