Examples of FactTemplateImpl


Examples of org.drools.core.facttemplates.FactTemplateImpl

                     " System.out.println( \"Hello World\" ); " +
                     " end ";

        KnowledgePackageImpl kPackage = new KnowledgePackageImpl("com.testfacttemplate");
        FieldTemplate fieldTemplate = new FieldTemplateImpl("status", 0, Integer.class);
        FactTemplate factTemplate = new FactTemplateImpl(kPackage, "TestFactTemplate", new FieldTemplate[]{fieldTemplate});

        KnowledgeBuilder kBuilder = new KnowledgeBuilderImpl(kPackage);
        StringReader rule = new StringReader(drl);
        try {
            ((KnowledgeBuilderImpl) kBuilder).addPackageFromDrl(rule);
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                                                          "Unable to resolve Class '" + fieldTemplateDescr.getClassType() + "'" ) );
            }
            fields.add( fieldTemplate );
        }

        new FactTemplateImpl( pkgRegistry.getPackage(),
                              factTemplateDescr.getName(),
                              fields.toArray( new FieldTemplate[fields.size()] ) );
    }
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                                                                String.class );
        final FieldTemplate cheesePrice = new FieldTemplateImpl( "price",
                                                                 1,
                                                                 Integer.class );
        final FieldTemplate[] fields = new FieldTemplate[]{cheeseName, cheesePrice};
        final FactTemplate cheese = new FactTemplateImpl( pkg,
                                                          "Cheese",
                                                          fields );

        final ObjectType type = new FactTemplateObjectType( cheese );

        final Pattern col = new Pattern( 0,
                                       type,
                                       "foo" );
        final Declaration dec = col.getDeclaration();
        final InternalReadAccessor ext = dec.getExtractor();
        assertEquals( Fact.class,
                      ext.getExtractToClass() );

        final Fact stilton = cheese.createFact( 10 );
        stilton.setFieldValue( "name",
                               "stilton" );
        stilton.setFieldValue( "price",
                               new Integer( 200 ) );
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                                                                String.class );
        final FieldTemplate cheesePrice = new FieldTemplateImpl( "price",
                                                                 1,
                                                                 Integer.class );
        final FieldTemplate[] fields = new FieldTemplate[]{cheeseName, cheesePrice};
        final FactTemplate cheese = new FactTemplateImpl( pkg,
                                                          "Cheese",
                                                          fields );

        final ObjectType type = new FactTemplateObjectType( cheese );

        final Pattern col = new Pattern( 0,
                                       type,
                                       "foo" );
        final Declaration dec = col.getDeclaration();
        final InternalReadAccessor ext = dec.getExtractor();
        assertEquals( Fact.class,
                      ext.getExtractToClass() );

        final Fact stilton = cheese.createFact( 10 );
        stilton.setFieldValue( "name",
                               "stilton" );
        stilton.setFieldValue( "price",
                               new Integer( 200 ) );
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                     " System.out.println( \"Hello World\" ); " +
                     " end ";

        KnowledgePackageImpl kPackage = new KnowledgePackageImpl("com.testfacttemplate");
        FieldTemplate fieldTemplate = new FieldTemplateImpl("status", 0, Integer.class);
        FactTemplate factTemplate = new FactTemplateImpl(kPackage, "TestFactTemplate", new FieldTemplate[]{fieldTemplate});

        KnowledgeBuilder kBuilder = new KnowledgeBuilderImpl(kPackage);
        StringReader rule = new StringReader(drl);
        try {
            ((KnowledgeBuilderImpl) kBuilder).addPackageFromDrl(rule);
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                                                          "Unable to resolve Class '" + fieldTemplateDescr.getClassType() + "'"));
            }
            fields.add(fieldTemplate);
        }

        new FactTemplateImpl( pkgRegistry.getPackage(),
                              factTemplateDescr.getName(),
                              fields.toArray( new FieldTemplate[fields.size()] ) );
    }
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                                                          "Unable to resolve Class '" + fieldTemplateDescr.getClassType() + "'"));
            }
            fields.add(fieldTemplate);
        }

        new FactTemplateImpl( pkgRegistry.getPackage(),
                              factTemplateDescr.getName(),
                              fields.toArray( new FieldTemplate[fields.size()] ) );
    }
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                                                          "Unable to resolve Class '" + fieldTemplateDescr.getClassType() + "'" ) );
            }
            fields.add( fieldTemplate );
        }

        new FactTemplateImpl( pkgRegistry.getPackage(),
                              factTemplateDescr.getName(),
                              fields.toArray( new FieldTemplate[fields.size()] ) );
    }
View Full Code Here

Examples of org.drools.core.facttemplates.FactTemplateImpl

                                                          "Unable to resolve Class '" + fieldTemplateDescr.getClassType() + "'"));
            }
            fields.add(fieldTemplate);
        }

        new FactTemplateImpl( pkgRegistry.getPackage(),
                              factTemplateDescr.getName(),
                              fields.toArray( new FieldTemplate[fields.size()] ) );
    }
View Full Code Here

Examples of org.drools.facttemplates.FactTemplateImpl

                                                          "Unable to resolve Class '" + fieldTemplateDescr.getClassType() + "'" ) );
            }
            fields.add( fieldTemplate );
        }

        final FactTemplate factTemplate = new FactTemplateImpl( pkgRegistry.getPackage(),
                                                                factTemplateDescr.getName(),
                                                                (FieldTemplate[]) fields.toArray( new FieldTemplate[fields.size()] ) );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.