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

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


                                                 ac.getBoundName() );
        if ( a == null ) {
            a = new LabelledAction();
            a.boundName = ac.getBoundName();
            if ( !ac.isInsertLogical() ) {
                ActionInsertFact ins = new ActionInsertFact( ac.getFactType() );
                ins.setBoundName( ac.getBoundName() );
                a.action = ins;
            } else {
                ActionInsertLogicalFact ins = new ActionInsertLogicalFact( ac.getFactType() );
                ins.setBoundName( ac.getBoundName() );
                a.action = ins;
            }
            actions.add( a );
        }
        ActionInsertFact ins = (ActionInsertFact) a.action;
        ActionFieldValue val = new ActionFieldValue( ac.getFactField(),
                                                     cell,
                                                     ac.getType() );
        ins.addFieldValue( val );
    }
View Full Code Here


                }
            } else if ( line.startsWith( "insert" ) ) {
                String fact = unwrapParenthesis( line );
                String type = getStatementType( fact, factsType );
                if ( type != null ) {
                    ActionInsertFact action = new ActionInsertFact( type );
                    m.addRhsItem( action );
                    if ( factsType.containsKey( fact ) ) {
                        action.setBoundName( fact );
                        addSettersToAction( setStatements,
                                            fact,
                                            action,
                                            boundParams,
                                            dmo,
                                            m.getImports(),
                                            isJavaDialect );
                    }
                }
            } else if ( line.startsWith( "update" ) ) {
                String variable = unwrapParenthesis( line );
                ActionUpdateField action = new ActionUpdateField();
                action.setVariable( variable );
                m.addRhsItem( action );
                addSettersToAction( setStatements,
                                    variable,
                                    action,
                                    boundParams,
View Full Code Here

    protected void fixActionInsertFactBindings( final IAction[] rhs ) {
        final Set<String> existingBindings = extractExistingActionBindings( rhs );
        for ( IAction action : rhs ) {
            if ( action instanceof ActionInsertFact ) {
                final ActionInsertFact aif = (ActionInsertFact) action;
                if ( aif.getFieldValues().length > 0 && aif.getBoundName() == null ) {
                    int idx = 0;
                    String binding = "fact" + idx;
                    while ( existingBindings.contains( binding ) ) {
                        idx++;
                        binding = "fact" + idx;
                    }
                    existingBindings.add( binding );
                    aif.setBoundName( binding );
                }
            }
        }
    }
View Full Code Here

    private Set<String> extractExistingActionBindings( final IAction[] rhs ) {
        final Set<String> bindings = new HashSet<String>();
        for ( IAction action : rhs ) {
            if ( action instanceof ActionInsertFact ) {
                final ActionInsertFact aif = (ActionInsertFact) action;
                if ( aif.getBoundName() != null ) {
                    bindings.add( aif.getBoundName() );
                }
            }
        }
        return bindings;
    }
View Full Code Here

    private void fixActionInsertFactBindings( final IAction[] rhs ) {
        final Set<String> existingBindings = extractExistingActionBindings( rhs );
        for ( IAction action : rhs ) {
            if ( action instanceof ActionInsertFact ) {
                final ActionInsertFact aif = (ActionInsertFact) action;
                if ( aif.getFieldValues().length > 0 && aif.getBoundName() == null ) {
                    int idx = 0;
                    String binding = "fact" + idx;
                    while ( existingBindings.contains( binding ) ) {
                        idx++;
                        binding = "fact" + idx;
                    }
                    existingBindings.add( binding );
                    aif.setBoundName( binding );
                }
            }
        }
    }
View Full Code Here

    private Set<String> extractExistingActionBindings( final IAction[] rhs ) {
        final Set<String> bindings = new HashSet<String>();
        for ( IAction action : rhs ) {
            if ( action instanceof ActionInsertFact ) {
                final ActionInsertFact aif = (ActionInsertFact) action;
                if ( aif.getBoundName() != null ) {
                    bindings.add( aif.getBoundName() );
                }
            }
        }
        return bindings;
    }
View Full Code Here

                }
            } else if ( line.startsWith( "insert" ) ) {
                String fact = unwrapParenthesis( line );
                String type = getStatementType( fact, factsType );
                if ( type != null ) {
                    ActionInsertFact action = new ActionInsertFact( type );
                    m.addRhsItem( action );
                    if ( factsType.containsKey( fact ) ) {
                        action.setBoundName( fact );
                        addSettersToAction( setStatements, fact, action, isJavaDialect );
                    }
                }
            } else if ( line.startsWith( "update" ) ) {
                String variable = unwrapParenthesis( line );
                ActionUpdateField action = new ActionUpdateField();
                action.setVariable( variable );
                m.addRhsItem( action );
                addSettersToAction( setStatements, variable, action, isJavaDialect );
            } else if ( line.startsWith( "retract" ) ) {
                String variable = unwrapParenthesis( line );
                m.addRhsItem( new ActionRetractFact( variable ) );
View Full Code Here

    protected void fixActionInsertFactBindings( final IAction[] rhs ) {
        final Set<String> existingBindings = extractExistingActionBindings( rhs );
        for ( IAction action : rhs ) {
            if ( action instanceof ActionInsertFact ) {
                final ActionInsertFact aif = (ActionInsertFact) action;
                if ( aif.getFieldValues().length > 0 && aif.getBoundName() == null ) {
                    int idx = 0;
                    String binding = "fact" + idx;
                    while ( existingBindings.contains( binding ) ) {
                        idx++;
                        binding = "fact" + idx;
                    }
                    existingBindings.add( binding );
                    aif.setBoundName( binding );
                }
            }
        }
    }
View Full Code Here

    private Set<String> extractExistingActionBindings( final IAction[] rhs ) {
        final Set<String> bindings = new HashSet<String>();
        for ( IAction action : rhs ) {
            if ( action instanceof ActionInsertFact ) {
                final ActionInsertFact aif = (ActionInsertFact) action;
                if ( aif.getBoundName() != null ) {
                    bindings.add( aif.getBoundName() );
                }
            }
        }
        return bindings;
    }
View Full Code Here

            } else if ( line.startsWith( "insert" ) ) {
                String fact = unwrapParenthesis( line );
                String type = getStatementType( fact,
                                                factsType );
                if ( type != null ) {
                    ActionInsertFact action = new ActionInsertFact( type );
                    m.addRhsItem( action );
                    if ( factsType.containsKey( fact ) ) {
                        action.setBoundName( fact );
                        addSettersToAction( setStatements,
                                            fact,
                                            action,
                                            boundParams,
                                            dmo,
                                            m.getImports(),
                                            isJavaDialect );
                    }
                }
            } else if ( line.startsWith( "update" ) ) {
                String variable = unwrapParenthesis( line );
                ActionUpdateField action = new ActionUpdateField();
                action.setVariable( variable );
                m.addRhsItem( action );
                addSettersToAction( setStatements,
                                    variable,
                                    action,
                                    boundParams,
                                    dmo,
                                    m.getImports(),
                                    isJavaDialect );
            } else if ( line.startsWith( "modify" ) ) {
                int modifyBlockEnd = line.lastIndexOf( '}' );
                if ( modifyBlockEnd > 0 ) {
                    String variable = line.substring( line.indexOf( '(' ) + 1,
                                                      line.indexOf( ')' ) ).trim();
                    ActionUpdateField action = new ActionUpdateField();
                    action.setVariable( variable );
                    m.addRhsItem( action );
                    addModifiersToAction( line.substring( line.indexOf( '{' ) + 1,
                                                          modifyBlockEnd ).trim(),
                                          action,
                                          boundParams,
View Full Code Here

TOP

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

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.