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

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


                break;
            }
            return fac;
        } else if ( patternSource instanceof CollectDescr ) {
            CollectDescr collect = (CollectDescr) patternSource;
            FromCollectCompositeFactPattern fac = new FromCollectCompositeFactPattern();
            fac.setRightPattern( parseBaseDescr( m, collect.getInputPattern(), boundParams, dmo ) );
            fac.setFactPattern( new FactPattern( pattern.getObjectType() ) );
            return fac;
        } else if ( patternSource instanceof EntryPointDescr ) {
            EntryPointDescr entryPoint = (EntryPointDescr) patternSource;
            FromEntryPointFactPattern fep = new FromEntryPointFactPattern();
            fep.setEntryPointName( entryPoint.getText() );
View Full Code Here


                break;
            }
            return fac;
        } else if ( patternSource instanceof CollectDescr ) {
            CollectDescr collect = (CollectDescr) patternSource;
            FromCollectCompositeFactPattern fac = new FromCollectCompositeFactPattern();
            fac.setRightPattern( parseBaseDescr( m,
                                                 collect.getInputPattern(),
                                                 boundParams,
                                                 dmo ) );
            fac.setFactPattern( getFactPattern( m,
                                                pattern,
                                                boundParams,
                                                dmo ) );
            return fac;
        } else if ( patternSource instanceof EntryPointDescr ) {
View Full Code Here

                break;
            }
            return fac;
        } else if ( patternSource instanceof CollectDescr ) {
            CollectDescr collect = (CollectDescr) patternSource;
            FromCollectCompositeFactPattern fac = new FromCollectCompositeFactPattern();
            fac.setRightPattern( parseBaseDescr( collect.getInputPattern(), boundParams, dmo ) );
            fac.setFactPattern( new FactPattern( pattern.getObjectType() ) );
            return fac;
        } else if ( patternSource instanceof EntryPointDescr ) {
            EntryPointDescr entryPoint = (EntryPointDescr) patternSource;
            FromEntryPointFactPattern fep = new FromEntryPointFactPattern();
            fep.setEntryPointName( entryPoint.getText() );
View Full Code Here

                break;
            }
            return fac;
        } else if ( patternSource instanceof CollectDescr ) {
            CollectDescr collect = (CollectDescr) patternSource;
            FromCollectCompositeFactPattern fac = new FromCollectCompositeFactPattern();
            fac.setRightPattern( parseBaseDescr( m,
                                                 collect.getInputPattern(),
                                                 isJavaDialect,
                                                 boundParams,
                                                 dmo ) );
            fac.setFactPattern( getFactPattern( m,
                                                pattern,
                                                isJavaDialect,
                                                boundParams,
                                                dmo ) );
            return fac;
View Full Code Here

        assertEquals( 0,
                      fp0.getNumberOfConstraints() );

        IPattern p1 = m.lhs[ 1 ];
        assertTrue( p1 instanceof FromCollectCompositeFactPattern );
        FromCollectCompositeFactPattern fp1 = (FromCollectCompositeFactPattern) p1;
        assertEquals( "java.util.List",
                      fp1.getFactPattern().getFactType() );
        assertEquals( "$transactions",
                      fp1.getFactPattern().getBoundName() );
        assertEquals( 1,
                      fp1.getFactPattern().getNumberOfConstraints() );
        assertTrue( fp1.getFactPattern().getConstraint( 0 ) instanceof SingleFieldConstraint );
        SingleFieldConstraint fp1sfc = (SingleFieldConstraint) fp1.getFactPattern().getConstraint( 0 );
        assertEquals( "size > 0",
                      fp1sfc.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      fp1sfc.getConstraintValueType() );

        assertTrue( fp1.getRightPattern() instanceof FromCompositeFactPattern );
        FromCompositeFactPattern fp2 = (FromCompositeFactPattern) fp1.getRightPattern();
        assertNotNull( fp2.getFactPattern() );

        FactPattern fp3 = fp2.getFactPattern();
        assertEquals( "Transaction",
                      fp3.getFactType() );
View Full Code Here

        assertEquals( 0,
                      fp0.getNumberOfConstraints() );

        IPattern p1 = m.lhs[ 1 ];
        assertTrue( p1 instanceof FromCollectCompositeFactPattern );
        FromCollectCompositeFactPattern fp1 = (FromCollectCompositeFactPattern) p1;
        assertEquals( "java.util.List",
                      fp1.getFactPattern().getFactType() );
        assertEquals( "$transactions",
                      fp1.getFactPattern().getBoundName() );
        assertEquals( 1,
                      fp1.getFactPattern().getNumberOfConstraints() );
        assertTrue( fp1.getFactPattern().getConstraint( 0 ) instanceof SingleFieldConstraint );
        SingleFieldConstraint fp1sfc = (SingleFieldConstraint) fp1.getFactPattern().getConstraint( 0 );
        assertEquals( "size > 0",
                      fp1sfc.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      fp1sfc.getConstraintValueType() );

        assertTrue( fp1.getRightPattern() instanceof FromCompositeFactPattern );
        FromCompositeFactPattern fp2 = (FromCompositeFactPattern) fp1.getRightPattern();
        assertNotNull( fp2.getFactPattern() );

        FactPattern fp3 = fp2.getFactPattern();
        assertEquals( "Transaction",
                      fp3.getFactType() );
View Full Code Here

                      fp.getBoundName() );
        assertEquals( 0,
                      fp.getNumberOfConstraints() );

        assertTrue( m.lhs[ 1 ] instanceof FromCollectCompositeFactPattern );
        final FromCollectCompositeFactPattern fcfp = (FromCollectCompositeFactPattern) m.lhs[ 1 ];
        assertNotNull( fcfp.getFactPattern() );
        assertEquals( "java.util.List",
                      fcfp.getFactPattern().getFactType() );
        assertEquals( "items",
                      fcfp.getFactPattern().getBoundName() );
        assertEquals( 1,
                      fcfp.getFactPattern().getNumberOfConstraints() );
        assertTrue( fcfp.getFactPattern().getConstraint( 0 ) instanceof SingleFieldConstraint );
        final SingleFieldConstraint sfc0 = (SingleFieldConstraint) fcfp.getFactPattern().getConstraint( 0 );
        assertNull( sfc0.getFactType() );
        assertNull( sfc0.getFieldName() );
        assertEquals( "size == c.items.size",
                      sfc0.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      sfc0.getConstraintValueType() );

        assertNotNull( fcfp.getRightPattern() );
        assertTrue( fcfp.getRightPattern() instanceof FactPattern );
        final FactPattern rfp = (FactPattern) fcfp.getRightPattern();
        assertEquals( "Item",
                      rfp.getFactType() );
        assertEquals( "var",
                      rfp.getBoundName() );
        assertEquals( 1,
View Full Code Here

                      fp.getBoundName() );
        assertEquals( 0,
                      fp.getNumberOfConstraints() );

        assertTrue( m.lhs[ 1 ] instanceof FromCollectCompositeFactPattern );
        final FromCollectCompositeFactPattern fcfp = (FromCollectCompositeFactPattern) m.lhs[ 1 ];
        assertNotNull( fcfp.getFactPattern() );
        assertEquals( "List",
                      fcfp.getFactPattern().getFactType() );
        assertEquals( "items",
                      fcfp.getFactPattern().getBoundName() );
        assertEquals( 1,
                      fcfp.getFactPattern().getNumberOfConstraints() );
        assertTrue( fcfp.getFactPattern().getConstraint( 0 ) instanceof SingleFieldConstraint );
        final SingleFieldConstraint sfc0 = (SingleFieldConstraint) fcfp.getFactPattern().getConstraint( 0 );
        assertNull( sfc0.getFactType() );
        assertNull( sfc0.getFieldName() );
        assertEquals( "size == c.items.size",
                      sfc0.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      sfc0.getConstraintValueType() );

        assertNotNull( fcfp.getRightPattern() );
        assertTrue( fcfp.getRightPattern() instanceof FactPattern );
        final FactPattern rfp = (FactPattern) fcfp.getRightPattern();
        assertEquals( "Item",
                      rfp.getFactType() );
        assertEquals( "var",
                      rfp.getBoundName() );
        assertEquals( 1,
View Full Code Here

                break;
            }
            return fac;
        } else if ( patternSource instanceof CollectDescr ) {
            CollectDescr collect = (CollectDescr) patternSource;
            FromCollectCompositeFactPattern fac = new FromCollectCompositeFactPattern();
            fac.setRightPattern( parseBaseDescr( m,
                                                 collect.getInputPattern(),
                                                 isJavaDialect,
                                                 boundParams,
                                                 dmo ) );
            fac.setFactPattern( getFactPattern( m,
                                                pattern,
                                                isJavaDialect,
                                                boundParams,
                                                dmo ) );
            return fac;
View Full Code Here

        sfc.setOperator( "==" );
        sfc.setValue( "$f1" );

        fp.addConstraint( sfc );

        FromCollectCompositeFactPattern fac = new FromCollectCompositeFactPattern();
        fac.setRightPattern( fp );
        fac.setFactPattern( new FactPattern( "java.util.List" ) );
        m.addLhsItem( fac );

        String expected = "rule \"r1_0\"\n"
                + "dialect \"mvel\"\n"
                + "when\n"
View Full Code Here

TOP

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

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.