Package org.drools.ide.common.client.modeldriven.brl

Examples of org.drools.ide.common.client.modeldriven.brl.RuleAttribute


    }

    private RuleModel getComplexModel() {
        final RuleModel m = new RuleModel();

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

        final FactPattern pat = new FactPattern("Person");
        pat.boundName = "p1";
        final SingleFieldConstraint con = new SingleFieldConstraint();
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, m.attributes[1]);

    m.removeAttribute(0);
View Full Code Here

    List<RuleAttribute> attribs = new ArrayList<RuleAttribute>();
    for (int j = 0; j < attributeCols.size(); j++) {
      AttributeCol at = attributeCols.get(j);
      String cell = row[j + GuidedDecisionTable.INTERNAL_ELEMENTS + numOfMeta];
      if (validCell(cell)) {
        attribs.add(new RuleAttribute(at.attr, cell));
      } else if (at.defaultValue != null) {
                attribs.add(new RuleAttribute(at.attr, at.defaultValue));               
            }
    }
    if (attribs.size() > 0) {
      rm.attributes = attribs.toArray(new RuleAttribute[attribs.size()]);
    }
View Full Code Here

    List<RuleAttribute> attribs = new ArrayList<RuleAttribute>();
    for (int j = 0; j < attributeCols.size(); j++) {
      AttributeCol at = attributeCols.get(j);
      String cell = row[j + GuidedDecisionTable.INTERNAL_ELEMENTS + numOfMeta];
      if (validCell(cell)) {
        attribs.add(new RuleAttribute(at.attr, cell));
      } else if (at.defaultValue != null) {
                attribs.add(new RuleAttribute(at.attr, at.defaultValue));               
            }
    }
    if (attribs.size() > 0) {
      rm.attributes = attribs.toArray(new RuleAttribute[attribs.size()]);
    }
View Full Code Here

    public void testBasics() {
        final BRLPersistence p = BRXMLPersistence.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.factName = "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.attributeName );
        assertEquals( "true",
                      at.value );
View Full Code Here

    }

    private RuleModel getComplexModel() {
        final RuleModel m = new RuleModel();

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

        final FactPattern pat = new FactPattern();
        pat.boundName = "p1";
        pat.factType = "Person";
View Full Code Here

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

                String attr = list.getItemText( list.getSelectedIndex() );
                if ( attr.equals( RuleAttributeWidget.LOCK_LHS ) || attr.equals( RuleAttributeWidget.LOCK_RHS ) ) {
                    model.addMetadata( new RuleMetadata( attr,
                                                         "true" ) );
                } else {
                    model.addAttribute( new RuleAttribute( attr,
                                                           "" ) );
                }
                refresh.execute();
                hide();
            }
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() );\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"));
    m.name = "my rule";

    final String drl = p.marshal(m);
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.brl.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.