Examples of RuleModel


Examples of es.iiia.shapegrammar.rule.RuleModel

      if (selection != null && selection instanceof IStructuredSelection) {
        Object obj = ((IStructuredSelection) selection)
            .getFirstElement();
        // If we had a selection lets open the editor
        if (obj != null) {
          RuleModel rule = (RuleModel) obj;
          ShapeGrammarModel grammar = (ShapeGrammarModel) rule
              .getParent();
          grammar.deleteRule(rule);

          // now close the editor holding this rule
          for (IEditorReference editor : window.getActivePage()
              .getEditorReferences()) {
            if (editor.getEditor(false) instanceof RuleEditor) {
              RuleModel model = (RuleModel) ((RuleEditor) editor.getEditor(false))
                  .getModel();
              if (model.equals(rule)) {
                window.getActivePage().closeEditor(
                    editor.getEditor(false), false);
              }
            }
          }
View Full Code Here

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

        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

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

Examples of org.drools.guvnor.models.commons.shared.rule.RuleModel

                    }
                }

            } else if ( col instanceof BRLConditionColumn ) {
                //Delegate to super class's implementation
                final RuleModel rm = new RuleModel();
                final BRLConditionColumn brl = (BRLConditionColumn) col;
                rm.lhs = brl.getDefinition().toArray( new IPattern[ brl.getDefinition().size() ] );
                variables.addAll( rm.getBoundVariablesInScope( con ) );
            }
        }
        variables.addAll( super.getBoundVariablesInScope( con ) );
        return new ArrayList<String>( variables );
    }
View Full Code Here

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

    private List<DroolsBuildMarker> parseBRLFile(final IFile file) {
      return parseResource(new ResourceParser() {
        public DRLInfo parseResource() throws DroolsParserException, CoreException, IOException {
                String brl = convertToString( file.getContents() );
                RuleModel model = BRXMLPersistence.getInstance().unmarshal( brl );
                String drl = BRDRLPersistence.getInstance().marshal( model );

                // TODO pass this through DSL converter in case brl is based on dsl

                return DroolsEclipsePlugin.getDefault().parseBRLResource( drl, file );
View Full Code Here

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

*/
public class RuleModelCloneVisitorTests {

    @Test
    public void testRuleModel() {
        RuleModel model = new RuleModel();
        model.modelVersion = "1";
        model.name = "ruleModelName";
        model.parentName = "ruleModelParentName";

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertNotSame( model,
                       clone );

        assertEquals( "1",
View Full Code Here

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

    }

    @Test
    public void testRuleAttributes() {

        RuleModel model = new RuleModel();
        model.attributes = new RuleAttribute[2];
        model.attributes[0] = new RuleAttribute( "attr0",
                                                 "attr0Value" );
        model.attributes[1] = new RuleAttribute( "attr1",
                                                 "attr1Value" );

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.attributes.length );

        assertNotSame( model.attributes[0],
View Full Code Here

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

    }

    @Test
    public void testRuleMetadata() {

        RuleModel model = new RuleModel();
        model.metadataList = new RuleMetadata[2];
        model.metadataList[0] = new RuleMetadata( "md0",
                                                  "md0Value" );
        model.metadataList[1] = new RuleMetadata( "md1",
                                                  "md1Value" );

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.metadataList.length );

        assertNotSame( model.metadataList[0],
View Full Code Here

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

                      clone.metadataList[1].value );
    }

    @Test
    public void testActionInsertFact() {
        RuleModel model = new RuleModel();

        model.rhs = new IAction[2];
        ActionInsertFact aif0 = new ActionInsertFact( "AIF0" );
        aif0.setBoundName( "$t0" );
        ActionFieldValue aif0f0 = new ActionFieldValue( "AIF0F0",
                                                        "AIF0F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif0.addFieldValue( aif0f0 );
        ActionFieldValue aif0f1 = new ActionFieldValue( "AIF0F1",
                                                        "AIF0F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif0.addFieldValue( aif0f1 );
        model.rhs[0] = aif0;

        ActionInsertFact aif1 = new ActionInsertFact( "AIF1" );
        aif1.setBoundName( "$t1" );
        ActionFieldValue aif1f0 = new ActionFieldValue( "AIF1F0",
                                                        "AIF1F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif1f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif1.addFieldValue( aif1f0 );
        ActionFieldValue aif1f1 = new ActionFieldValue( "AIF1F1",
                                                        "AIF1F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif1f1.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif1.addFieldValue( aif1f1 );
        model.rhs[1] = aif1;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.rhs.length );

        assertNotSame( model.rhs[0],
View Full Code Here

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

                      aif1f1Clone.value );
    }

    @Test
    public void testActionSetField() {
        RuleModel model = new RuleModel();

        model.rhs = new IAction[2];
        ActionSetField asf0 = new ActionSetField( "ASF0" );
        asf0.variable = "$t0";
        ActionFieldValue asf0f0 = new ActionFieldValue( "ASF0F0",
                                                        "ASF0F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf0.addFieldValue( asf0f0 );
        ActionFieldValue asf0f1 = new ActionFieldValue( "ASF0F1",
                                                        "ASF0F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf0.addFieldValue( asf0f1 );
        model.rhs[0] = asf0;

        ActionSetField asf1 = new ActionSetField( "ASF1" );
        asf1.variable = "$t1";
        ActionFieldValue asf1f0 = new ActionFieldValue( "ASF1F0",
                                                        "ASF1F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf1f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf1.addFieldValue( asf1f0 );
        ActionFieldValue asf1f1 = new ActionFieldValue( "ASF1F1",
                                                        "ASF1F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf1f1.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf1.addFieldValue( asf1f1 );
        model.rhs[1] = asf1;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.rhs.length );

        assertNotSame( model.rhs[0],
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.