Package org.drools.command

Examples of org.drools.command.Command


        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
       
        Command insertCmd = CommandFactory.newInsert( stilton, "outStilton" );
        Command fireCmd = CommandFactory.newFireAllRules();
       
        Command cmds = CommandFactory.newBatchExecution( Arrays.asList( new Command[] { insertCmd,fireCmd} ) );
       
        ExecutionResults result = (ExecutionResults) ksession.execute( cmds );
        stilton = ( Cheese ) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );
View Full Code Here


      Object event = readItem( reader,
                               context,
                               null );
      reader.moveUp();

      Command cmd;
      if ( processInstanceId != null ) {
          cmd = CommandFactory.newSignalEvent( Long.parseLong( processInstanceId ),
                                               eventType,
                                               event );
      } else {
View Full Code Here

          results.put( identifier,
                       value );
          reader.moveUp();
      }

      Command cmd = CommandFactory.newCompleteWorkItem( Long.parseLong( id ),
                                                        results );

      return cmd;
  }
View Full Code Here

  }

  public Object unmarshal(HierarchicalStreamReader reader,
                          UnmarshallingContext context) {
      String id = reader.getAttribute( "id" );
      Command cmd = CommandFactory.newAbortWorkItem( Long.parseLong( id ) );

      return cmd;
  }
View Full Code Here

        // Add the EventListener just before the last FireAllRules in this step
        int lastFireAllRulesIndex = -1;
        List<Command> commands = activeStep.getCommands();
        for (ListIterator<Command> it = commands.listIterator(); it.hasNext();) {
            int i = it.nextIndex();
            Command command = it.next();
            if (command instanceof FireAllRulesCommand) {
                lastFireAllRulesIndex = i;
            }
        }
        if (lastFireAllRulesIndex < 0) {
View Full Code Here

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();       
       
        Command insertCmd = CommandFactory.newInsert( stilton, "outStilton" );
        Command fireCmd = CommandFactory.newFireAllRules();
       
        Command cmds = CommandFactory.newBatchExecution( Arrays.asList( new Command[] { insertCmd,fireCmd} ) );
       
        ExecutionResults result = (ExecutionResults) ksession.execute( cmds );
        stilton = ( Cheese ) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );     
View Full Code Here

        List list1 = new ArrayList();
        List list2 = new ArrayList();
        List list3 = new ArrayList();
       
        StatelessKnowledgeSession ksession = getSession2( ResourceFactory.newByteArrayResource( str.getBytes() ) );
        Command setGlobal1 = CommandFactory.newSetGlobal( "list1", list1 );
        Command setGlobal2 = CommandFactory.newSetGlobal( "list2", list2, true );
        Command setGlobal3 = CommandFactory.newSetGlobal( "list3", list3, "outList3" );
        Command insert = CommandFactory.newInsert( stilton  );
       
        List cmds = new ArrayList();
        cmds.add( setGlobal1 );
        cmds.add( setGlobal2 );
        cmds.add( setGlobal3 );
View Full Code Here

        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();       
       
        Command insertCmd = CommandFactory.newInsert( stilton, "outStilton" );
        Command fireCmd = CommandFactory.newFireAllRules();
       
        Command cmds = CommandFactory.newBatchExecution( Arrays.asList( new Command[] { insertCmd,fireCmd} ) );
       
        ExecutionResults result = ksession.execute( cmds );
        stilton = ( Cheese ) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );     
View Full Code Here

                                                          reader.getAttribute( "value" ) );
                setters.add( setter );
                reader.moveUp();
            }

            Command cmd = CommandFactory.newModify( factHandle,
                                                    setters );
            return cmd;
        }
View Full Code Here

        public Object unmarshal(HierarchicalStreamReader reader,
                                UnmarshallingContext context) {
            FactHandle factHandle = new DisconnectedFactHandle( reader.getAttribute( "factHandle" ) );

            Command cmd = CommandFactory.newRetract( factHandle );

            return cmd;
        }
View Full Code Here

TOP

Related Classes of org.drools.command.Command

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.