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

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


            System.setProperty( "drools.dateformat",
                                "dd-MMM-yyyy" );

            RuleModel m = new RuleModel();
            m.name = "RHS SetMethodCallsMethod";
            m.addAttribute( new RuleAttribute( "dialect",
                                               "java" ) );

            FactPattern p = new FactPattern( "Person" );
            p.setBoundName( "$p" );
            m.addLhsItem( p );
View Full Code Here


    public void testBasics2() {
        final RuleModelPersistence p = RuleModelDRLPersistenceImpl.getInstance();
        final RuleModel m = new RuleModel();
        m.addLhsItem( new FactPattern( "Person" ) );
        m.addLhsItem( new FactPattern( "Accident" ) );
        m.addAttribute( new RuleAttribute( "no-loop",
                                           "true" ) );

        m.addRhsItem( new ActionInsertFact( "Report" ) );
        ActionGlobalCollectionAdd ag = new ActionGlobalCollectionAdd();
        ag.setFactName( "x" );
View Full Code Here

        assertEquals( m.rhs.length,
                      m2.rhs.length );
        assertEquals( 1,
                      m.attributes.length );

        final RuleAttribute at = m.attributes[ 0 ];
        assertEquals( "no-loop",
                      at.getAttributeName() );
        assertEquals( "true",
                      at.getValue() );

        final String drl2 = RuleModelDRLPersistenceImpl.getInstance().marshal( m2 );
        assertEquals( drl,
                      drl2 );
View Full Code Here

    private RuleModel getComplexModel() {
        final RuleModel m = new RuleModel();
        m.name = "complex";

        m.addAttribute( new RuleAttribute( "no-loop",
                                           "true" ) );

        final FactPattern pat = new FactPattern( "Person" );
        pat.setBoundName( "p1" );
        final SingleFieldConstraint con = new SingleFieldConstraint();
View Full Code Here

            HorizontalPanel hp = new HorizontalPanel();
            hp.add( new SmallLabel( GuidedRuleEditorResources.CONSTANTS.Attributes1() ) );
            layout.addRow( hp );
        }
        for ( int i = 0; i < attrs.length; i++ ) {
            RuleAttribute at = attrs[ i ];
            layout.addAttribute( at.getAttributeName(),
                                 getEditorWidget( at,
                                                  i,
                                                  isReadOnly ) );
        }
View Full Code Here

                //If instance of "otherwise" column then flag RuleModel as being negated
                if ( at.getAttribute().equals( GuidedDecisionTable52.NEGATE_RULE_ATTR ) ) {
                    rm.setNegated( Boolean.valueOf( cell ) );
                } else {
                    attribs.add( new RuleAttribute( at.getAttribute(),
                                                    cell ) );
                }
            }
        }
        if ( attribs.size() > 0 ) {
View Full Code Here

        final TemplateModel model = new TemplateModel();
        model.getImports().getImports().addAll( imports );
        model.setPackageName( packageName );
        model.name = name;

        model.addAttribute( new RuleAttribute( "ruleflow-group",
                                               "myRuleFlowGroup" ) );
        return model;
    }
View Full Code Here

    }

    @Test
    public void testAttributes() {
        final RuleModel m = new RuleModel();
        final RuleAttribute at = new RuleAttribute( "salience",
                "42" );
        m.addAttribute( at );
        assertEquals( 1,
                m.attributes.length );
        assertEquals( at,
                m.attributes[0] );

        final RuleAttribute at2 = new RuleAttribute( "agenda-group",
                "x" );
        m.addAttribute( at2 );
        assertEquals( 2,
                m.attributes.length );
        assertEquals( at2,
View Full Code Here

        String expected = "rule \"my rule\"\n\tno-loop true\n\tdialect \"mvel\"\n\twhen\n\t\tPerson( )\n"
                + "\t\tAccident( )\n\tthen\n\t\tinsert( new Report() );\n\t\tresults.add(f);\nend\n";
        final RuleModel m = new RuleModel();
        m.addLhsItem( new FactPattern( "Person" ) );
        m.addLhsItem( new FactPattern( "Accident" ) );
        m.addAttribute( new RuleAttribute( "no-loop",
                                           "true" ) );

        m.addRhsItem( new ActionInsertFact( "Report" ) );
        ActionGlobalCollectionAdd add = new ActionGlobalCollectionAdd();
        add.setGlobalName( "results" );
View Full Code Here

            System.setProperty( "drools.dateformat",
                                "dd-MMM-yyyy" );

            RuleModel m = new RuleModel();
            m.name = "RHS SetMethodCallsMethod";
            m.addAttribute( new RuleAttribute( "dialect",
                                               "mvel" ) );

            FactPattern p = new FactPattern( "Person" );
            p.setBoundName( "$p" );
            m.addLhsItem( p );
View Full Code Here

TOP

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

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.