Package org.drools.workbench.models.datamodel.rule

Examples of org.drools.workbench.models.datamodel.rule.RuleModel


                "  dialect \"mvel\"\n" +
                "  when\n" +
                "  then\n" +
                "end\n";

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );

        assertNotNull( m.attributes[ 0 ] );
        RuleAttribute attribute = m.attributes[ 0 ];
View Full Code Here


        addModelField( "org.mortgages.Itinerario",
                       "destino",
                       "String",
                       DataType.TYPE_STRING );

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );
        assertTrue( m.lhs[ 1 ] instanceof FromCompositeFactPattern );
        FromCompositeFactPattern factPattern = (FromCompositeFactPattern) m.lhs[ 1 ];
        assertNotNull( factPattern.getFactPattern().getConstraintList() );
View Full Code Here

        addModelField( "org.pkg2.Fact",
                       "someOtherField",
                       "org.pkg2.SubFact",
                       "SubFact" );

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );
        assertEquals( 1, m.lhs.length );
    }
View Full Code Here

        addModelField( "org.pkg2.Fact",
                       "someOtherField",
                       "org.pkg2.SubFact",
                       "SubFact" );

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );
        assertEquals( 1, m.lhs.length );
    }
View Full Code Here

        addModelField( "org.drools.workbench.models.commons.backend.rule.Counter",
                       "number",
                       "java.lang.Number",
                       DataType.TYPE_NUMERIC );

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );

        assertNotNull( m );
        assertEquals( "rule1",
View Full Code Here

        addModelField( "org.mortgages.Applicant",
                       "age",
                       "java.lang.Integer",
                       DataType.TYPE_NUMERIC );

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );

        assertNotNull( m );
View Full Code Here

     */
    public RuleModel unmarshal( final String str,
                                final List<String> globals,
                                final PackageDataModelOracle dmo ) {
        if ( str == null || str.isEmpty() ) {
            return new RuleModel();
        }
        return getRuleModel( preprocessDRL( str,
                                            false ).registerGlobals( dmo,
                                                                     globals ),
                             dmo );
View Full Code Here

    public RuleModel unmarshalUsingDSL( final String str,
                                        final List<String> globals,
                                        final PackageDataModelOracle dmo,
                                        final String... dsls ) {
        if ( str == null || str.isEmpty() ) {
            return new RuleModel();
        }
        return getRuleModel( parseDSLs( preprocessDRL( str,
                                                       true ),
                                        dsls ).registerGlobals( dmo,
                                                                globals ),
View Full Code Here

    private RuleModel getRuleModel( final ExpandedDRLInfo expandedDRLInfo,
                                    final PackageDataModelOracle dmo ) {
        //De-serialize model
        RuleDescr ruleDescr = parseDrl( expandedDRLInfo );
        RuleModel model = new RuleModel();
        model.name = ruleDescr.getName();
        model.parentName = ruleDescr.getParentName();

        for ( AnnotationDescr annotation : ruleDescr.getAnnotations() ) {
            model.addMetadata( new RuleMetadata( annotation.getName(),
                                                 annotation.getValuesAsString() ) );
        }

        //De-serialize Package name
        final String packageName = PackageNameParser.parsePackageName( expandedDRLInfo.plainDrl );
        model.setPackageName( packageName );

        //De-serialize imports
        final Imports imports = ImportsParser.parseImports( expandedDRLInfo.plainDrl );
        for ( Import item : imports.getImports() ) {
            model.getImports().addImport( item );
        }

        boolean isJavaDialect = parseAttributes( model,
                                                 ruleDescr.getAttributes() );
        Map<String, String> boundParams = parseLhs( model,
View Full Code Here

        final String dslFile = "[condition][vertrag]" + dslDefinition + "=vertrag : Vertrag()";

        final String dslDefinition2 = "- Rabatt nicht mehr als {rabatt}";
        final String dslFile2 = "[condition][vertrag]" + dslDefinition2 + "=rabatt < {rabatt}";

        final RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshalUsingDSL( drl,
                                                                                         new ArrayList<String>(),
                                                                                         dmo,
                                                                                         new String[]{ dslFile, dslFile2 } );

        assertNotNull( m );
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.datamodel.rule.RuleModel

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.