Package org.drools.guvnor.client.modeldriven.brl

Examples of org.drools.guvnor.client.modeldriven.brl.RuleModel


    /* (non-Javadoc)
     * @see org.drools.guvnor.server.util.BRLPersistence#toModel(java.lang.String)
     */
    public RuleModel unmarshal(final String xml) {
        if ( xml == null ) {
            return new RuleModel();
        }
        if ( xml.trim().equals( "" ) ) {
            return new RuleModel();
        }
        RuleModel rm = (RuleModel) this.xt.fromXML( xml );
        //Fixme , hack for a upgrade to add Metadata
        if(rm.metadataList == null){
          rm.metadataList = new RuleMetadata[0];
        }
        return rm;
View Full Code Here


    for (int i = 0; i < dt.data.length; i++) {
      String[] row = dt.data[i];
      String num = row[0];
      String desc = row[1];

      RuleModel rm = new RuleModel();
      rm.name = getName(dt.tableName, num);
       
      doMetadata(dt.getMetadataCols(), row, rm);
      doAttribs(dt.getMetadataCols().size(), dt.attributeCols, row, rm);
      doConditions(dt.getMetadataCols().size() + dt.attributeCols.size(), dt.conditionCols, row, rm);
View Full Code Here

        try {

      if (fileName.endsWith(DroolsCompilerAntTask.BRLFILEEXTENSION)) {

        RuleModel model = BRXMLPersistence.getInstance().unmarshal(
            loadResource(fileName));
        String packagefile = loadResource(resolvePackageFile(this.srcdir
            .getAbsolutePath()));
        model.name = fileName.replace(DroolsCompilerAntTask.BRLFILEEXTENSION,
            "");
View Full Code Here

  public void testAttribs() {
    GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
    String[] row = new String[] {"1", "desc", "a", ""};

    List<AttributeCol> attributeCols = new ArrayList<AttributeCol>();
    RuleModel rm = new RuleModel();
    RuleAttribute[] orig = rm.attributes;
    p.doAttribs(0,attributeCols, row, rm);

    assertSame(orig, rm.attributes);
View Full Code Here

  public void testMetaData() {
    GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
    String[] row = new String[] {"1", "desc", "bar", ""};

    List<MetadataCol> metadataCols = new ArrayList<MetadataCol>();
    RuleModel rm = new RuleModel();
    RuleMetadata[] orig = rm.metadataList;
//    RuleAttribute[] orig = rm.attributes;
    p.doMetadata(metadataCols, row, rm);
//    p.doAttribs(0,metadataCols, row, rm);
View Full Code Here

    col4.factField = "type";
    col4.operator = "==";
    col4.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
    cols.add(col4);

    RuleModel rm = new RuleModel();

    p.doConditions(1, cols, row, rm);
    assertEquals(2, rm.lhs.length);

    assertEquals("Person", ((FactPattern)rm.lhs[0]).factType);
View Full Code Here

    ins2.factField = "type";
    ins2.type = SuggestionCompletionEngine.TYPE_NUMERIC;
    cols.add(ins2);


    RuleModel rm = new RuleModel();
    p.doActions(2, cols, row, rm);
    assertEquals(3, rm.rhs.length);

    //examine the set field action that is produced
    ActionSetField a1 = (ActionSetField) rm.rhs[0];
View Full Code Here

    col2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
    col2.operator = "";
    cols.add(col2);


    RuleModel rm = new RuleModel();

    p.doConditions(1, cols, row, rm);


    String drl = BRDRLPersistence.getInstance().marshal(rm);
View Full Code Here

    public void addPackageFromBrl(final Resource resource)
      throws DroolsParserException, IOException {
    this.resource = resource;

        String brl = loadBrlFile(resource.getReader());
    RuleModel model = BRXMLPersistence.getInstance().unmarshal(brl);
    String drl = BRDRLPersistence.getInstance().marshal(model);
        final DrlParser parser = new DrlParser();
        DefaultExpander expander = getDslExpander();

        try {
View Full Code Here

    for (int i = 0; i < dt.data.length; i++) {
      String[] row = dt.data[i];
      String num = row[0];
      String desc = row[1];

      RuleModel rm = new RuleModel();
      rm.name = getName(dt.tableName, num);

      doMetadata(dt.getMetadataCols(), row, rm);
      doAttribs(dt.getMetadataCols().size(), dt.attributeCols, row, rm);
      doConditions(dt.getMetadataCols().size() + dt.attributeCols.size(), dt.conditionCols, row, rm);
View Full Code Here

TOP

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