Package org.drools.runtime

Examples of org.drools.runtime.ExecutionResults


        MyObject myObject = new MyObject("obj1");
        cmds.add(CommandFactory.newInsert(myObject));
        cmds.add(CommandFactory.newFireAllRules());
        AsyncBatchExecutionCommandImpl batch = new AsyncBatchExecutionCommandImpl(cmds);
       
        ExecutionResults results = ksession.execute(batch);
       
      
       
        Assert.assertNull(results);
       
View Full Code Here


       
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
       
        ExecutionResults results = ksession.execute( new FireAllRulesCommand( "fired" ) );
      
        assertEquals( 2, (int ) ( Integer) results.getValue( "fired" ) );
    }   
View Full Code Here

       
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
       
        ExecutionResults results = ksession.execute( new FireAllRulesCommand( "fired" ) );
      
        assertEquals( 2, (int ) ( Integer) results.getValue( "fired" ) );
    }  
View Full Code Here

       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
       
        this.client.register( "ksession1", ksession );
       
        ExecutionResults results = this.client.lookup( "ksession1" ).execute( new FireAllRulesCommand( "fired" ) );
      
        assertEquals( 2, (int ) ( Integer) results.getValue( "fired" ) );
    }     
View Full Code Here

        }

        public void marshal(Object object,
                            HierarchicalStreamWriter writer,
                            MarshallingContext context) {
            ExecutionResults result = (ExecutionResults) object;
            writer.startNode( "results" );
            if ( !result.getIdentifiers().isEmpty() ) {
                for ( String identifier : result.getIdentifiers() ) {
                    writer.startNode( "result" );

                    writer.startNode( "identifier" );
                    writer.setValue( identifier );
                    writer.endNode();

                    writer.startNode( "value" );
                    Object value = result.getValue( identifier );
                    if ( value instanceof org.drools.runtime.rule.QueryResults ) {
                        String name = mapper().serializedClass(FlatQueryResults.class);
                        ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, FlatQueryResults.class);
                        context.convertAnother(value);
                        writer.endNode();
                    } else {
                        writeItem( value,
                                   context,
                                   writer );
                    }
                    writer.endNode();

                    writer.endNode();
                }
            }

            for ( String identifier : ((ExecutionResultImpl) result).getFactHandles().keySet() ) {
                Object handle = result.getFactHandle( identifier );
                if ( handle instanceof FactHandle ) {
                    writer.startNode( "fact-handle" );

                    writer.startNode( "identifier" );
                    writer.setValue( identifier );
View Full Code Here

            }
            if ( autoFireAllRules ) {
                ksession.fireAllRules( );
            }
            if ( command instanceof BatchExecutionCommandImpl) {
                ExecutionResults result = ((StatefulKnowledgeSessionImpl) ksession).session.getExecutionResult();
                return (T) result;
            } else {
                return (T) o;
            }
        } finally {
View Full Code Here

        }

        public void marshal(Object object,
                            HierarchicalStreamWriter writer,
                            MarshallingContext context) {
            ExecutionResults result = (ExecutionResults) object;
            for ( String identifier : result.getIdentifiers() ) {
                writer.startNode( "result" );
                writer.addAttribute( "identifier",
                                     identifier );
                Object value = result.getValue( identifier );
                writeItem( value,
                           context,
                           writer );
                writer.endNode();
            }

            for ( String identifier : ((ExecutionResultImpl) result).getFactHandles().keySet() ) {

                Object handle = result.getFactHandle( identifier );
                if ( handle instanceof FactHandle ) {
                    writer.startNode( "fact-handle" );
                    writer.addAttribute( "identifier",
                                         identifier );
                    writer.addAttribute( "externalForm",
View Full Code Here

        }
       
        try {
            session.startBatchExecution( results );
            ((GenericCommand)command).execute( new KnowledgeCommandContext( context, null, this.kbase, this, results) );
            ExecutionResults result = session.getExecutionResult();
            return result;
        } finally {
            session.endBatchExecution();
        }       
    }
View Full Code Here

                }
            }
            if ( autoFireAllRules ) {
                ksession.fireAllRules( );
            }
            ExecutionResults result = ((StatefulKnowledgeSessionImpl) ksession).session.getExecutionResult();
            return result;
        } finally {
            ((StatefulKnowledgeSessionImpl) ksession).session.endBatchExecution();
        }
    }
View Full Code Here

        setExec( ksession );

        String outXml = template.requestBody( "direct:exec",
                                              inXml,
                                              String.class );
        ExecutionResults result = template.requestBody( "direct:unmarshal",
                                                        outXml,
                                                        ExecutionResults.class );

        inXml = "";
        inXml += "<batch-execution>";
View Full Code Here

TOP

Related Classes of org.drools.runtime.ExecutionResults

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.