Package org.drools.workbench.models.guided.dtree.shared.model

Examples of org.drools.workbench.models.guided.dtree.shared.model.GuidedDecisionTree


                "then\n" +
                "  $p.setAge( 25 );\n" +
                "  $p.setName( \"Michael\" );\n" +
                "end";

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
View Full Code Here


                "when\n" +
                "  $p : Person( )\n" +
                "then\n" +
                "end";

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        type.addChild( action );
View Full Code Here

                "then\n" +
                "  java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(\"dd-MMM-yyyy\");\n" +
                "  $p.setDateOfBirth( sdf.parse(\"15-Jul-1985\") );\n" +
                "end";

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        final Calendar dob = Calendar.getInstance();
        dob.set( Calendar.YEAR,
View Full Code Here

                "  Person $var0 = new Person();\n" +
                "  $var0.setAge( 25 );\n" +
                "  insert( $var0 );\n" +
                "end";

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        model.setRoot( type );

        final ActionInsertNode action = new ActionInsertNodeImpl( "Person" );
        action.setLogicalInsertion( false );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
View Full Code Here

                "  Person $var0 = new Person();\n" +
                "  $var0.setAge( 25 );\n" +
                "  insertLogical( $var0 );\n" +
                "end";

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        model.setRoot( type );

        final ActionInsertNode action = new ActionInsertNodeImpl( "Person" );
        action.setLogicalInsertion( true );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
View Full Code Here

                "  Person $var0 = new Person();\n" +
                "  $var0.setDateOfBirth( sdf.parse(\"15-Jul-1985\") );\n" +
                "  insert( $var0 );\n" +
                "end";

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        model.setRoot( type );

        final ActionInsertNode action = new ActionInsertNodeImpl( "Person" );
        action.setLogicalInsertion( false );
        final Calendar dob = Calendar.getInstance();
        dob.set( Calendar.YEAR,
View Full Code Here

                "  Person $var0 = new Person();\n" +
                "  $var0.setDateOfBirth( sdf.parse(\"15-Jul-1985\") );\n" +
                "  insertLogical( $var0 );\n" +
                "end";

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        model.setRoot( type );

        final ActionInsertNode action = new ActionInsertNodeImpl( "Person" );
        action.setLogicalInsertion( true );
        final Calendar dob = Calendar.getInstance();
        dob.set( Calendar.YEAR,
View Full Code Here

                "when \n" +
                "  Person( this.name == \"Michael\" )\n" +
                "then \n" +
                "end";

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "name",
                       String.class.getName(),
                       DataType.TYPE_STRING );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof UnsupportedFieldConstraintParserMessage );

        final String drl2 = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( drl,
                                      drl2 );
    }
View Full Code Here

                "when \n" +
                "  Person( name == \"Michael\" || name == \"John\" )\n" +
                "then \n" +
                "end";

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "name",
                       String.class.getName(),
                       DataType.TYPE_STRING );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof UnsupportedFieldConstraintParserMessage );

        final String drl2 = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( drl,
                                      drl2 );
    }
View Full Code Here

                "when \n" +
                "  Person( age == (25 + 10) )\n" +
                "then \n" +
                "end";

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "age",
                       Integer.class.getName(),
                       DataType.TYPE_NUMERIC_INTEGER );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof UnsupportedFieldConstraintTypeParserMessage );

        final String drl2 = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( drl,
                                      drl2 );
    }
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtree.shared.model.GuidedDecisionTree

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.