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

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


     * @see RuleModelPersistence#unmarshal(String, PackageDataModelOracle)
     */
    public RuleModel unmarshal( final String str,
                                final PackageDataModelOracle dmo ) {
        if ( str == null || str.isEmpty() ) {
            return new RuleModel();
        }
        return getRuleModel( preprocessDRL( str ).registerGlobals( dmo, null ), dmo );
    }
View Full Code Here


    public RuleModel unmarshalUsingDSL( final String str,
                                        final List<String> globals,
                                        final PackageDataModelOracle dmo,
                                        final String... dsls ) {
        if ( str == null || str.isEmpty() ) {
            return new RuleModel();
        }
        return getRuleModel( parseDSLs( preprocessDRL( str ), dsls ).registerGlobals( dmo, globals ), dmo );
    }
View Full Code Here

    private RuleModel getRuleModel( ExpandedDRLInfo expandedDRLInfo,
                                    PackageDataModelOracle dmo ) {
        //De-serialize model
        RuleDescr ruleDescr = parseDrl( expandedDRLInfo );
        RuleModel model = new RuleModel();
        model.name = ruleDescr.getName();
        model.parentName = ruleDescr.getParentName();

        Map<String, AnnotationDescr> annotations = ruleDescr.getAnnotations();
        if ( annotations != null ) {
            for ( AnnotationDescr annotation : annotations.values() ) {
                model.addMetadata( new RuleMetadata( annotation.getName(), annotation.getValuesAsString() ) );
            }
        }

        //De-serialize Package name
        final String packageName = PackageNameParser.parsePackageName( expandedDRLInfo.plainDrl );
        model.setPackageName( packageName );

        //De-serialize imports
        final Imports imports = ImportsParser.parseImports( expandedDRLInfo.plainDrl );
        for ( Import item : imports.getImports() ) {
            model.getImports().addImport( item );
        }

        boolean isJavaDialect = parseAttributes( model,
                                                 ruleDescr.getAttributes() );
        Map<String, String> boundParams = parseLhs( model, ruleDescr.getLhs(), expandedDRLInfo, dmo );
View Full Code Here

    }

    private boolean hasVariables( BRLActionColumn column ) {
        Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>();
        RuleModel rm = new RuleModel();
        for ( IAction action : column.getDefinition() ) {
            rm.addRhsItem( action );
        }
        RuleModelVisitor rmv = new RuleModelVisitor( ivs );
        rmv.visit( rm );
        return ivs.size() > 0;
    }
View Full Code Here

    }

    private boolean hasVariables( BRLConditionColumn column ) {
        Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>();
        RuleModel rm = new RuleModel();
        for ( IPattern pattern : column.getDefinition() ) {
            rm.addLhsItem( pattern );
        }
        RuleModelVisitor rmv = new RuleModelVisitor( ivs );
        rmv.visit( rm );
        return ivs.size() > 0;
    }
View Full Code Here

                    }
                }

            } 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

    }

    private boolean hasVariables( BRLActionColumn column ) {
        Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>();
        RuleModel rm = new RuleModel();
        for ( IAction action : column.getDefinition() ) {
            rm.addRhsItem( action );
        }
        RuleModelVisitor rmv = new RuleModelVisitor( ivs );
        rmv.visit( rm );
        return ivs.size() > 0;
    }
View Full Code Here

    }

    private boolean hasVariables( BRLConditionColumn column ) {
        Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>();
        RuleModel rm = new RuleModel();
        for ( IPattern pattern : column.getDefinition() ) {
            rm.addLhsItem( pattern );
        }
        RuleModelVisitor rmv = new RuleModelVisitor( ivs );
        rmv.visit( rm );
        return ivs.size() > 0;
    }
View Full Code Here

     */
    public RuleModel unmarshal( final String str,
                                final List<String> globals,
                                final PackageDataModelOracle dmo ) {
        if ( str == null || str.isEmpty() ) {
            return new RuleModel();
        }
        return getRuleModel( preprocessDRL( str,
                                            false ).registerGlobals( dmo,
                                                                     globals ),
                             dmo );
View Full Code Here

    public RuleModel unmarshalUsingDSL( final String str,
                                        final List<String> globals,
                                        final PackageDataModelOracle dmo,
                                        final String... dsls ) {
        if ( str == null || str.isEmpty() ) {
            return new RuleModel();
        }
        return getRuleModel( parseDSLs( preprocessDRL( str,
                                                       true ),
                                        dsls ).registerGlobals( dmo,
                                                                globals ),
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.datamodel.rule.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.