Package org.kie.api.command

Examples of org.kie.api.command.Command


        ksession.fireAllRules();
        ksession.setGlobal("globalCheeseCountry", "France");
       
        List<Command<?>> commands = new ArrayList<Command<?>>();
        commands.add(CommandFactory.newGetGlobal( "globalCheeseCountry", "cheeseCountry" ));
        Command cmds = CommandFactory.newBatchExecution( commands );

        ExecutionResults result = (ExecutionResults) ksession.execute( cmds );
        assertNotNull("GetGlobalCommand result is null!", result);
        Object global = result.getValue("cheeseCountry");
        assertNotNull("Retrieved global fact is null!", global);
View Full Code Here


        assertEquals(expected_1, fact);
       
        List<Command<?>> commands = new ArrayList<Command<?>>();
        commands.add(CommandFactory.newGetObject(handle_1, "out_1"));
        commands.add(CommandFactory.newGetObject(handle_2, "out_2"));
        Command cmds = CommandFactory.newBatchExecution( commands );
       
        ExecutionResults result = (ExecutionResults) ksession.execute( cmds );
        assertNotNull("GetObjectCommand result is null!", result);
       
        assertEquals( expected_1, result.getValue("out_1") );
View Full Code Here

        assertNotNull(object);
        assertEquals(expected_2, object);
       
        List<Command<?>> commands = new ArrayList<Command<?>>();
        commands.add(CommandFactory.newGetObjects("out_list"));
        Command cmds = CommandFactory.newBatchExecution( commands );
       
        ExecutionResults result = (ExecutionResults) ksession.execute( cmds );
        assertNotNull("GetObjectsCommand result is null!", result);
       
        List<Object> objectList = (List) result.getValue("out_list");
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

        KieSession ksession = runtimeEngine.getKieSession();
   
        Map<String, Object> params = new HashMap<String, Object>();
        String val = "initial-val";
        params.put("test", val);
        Command cmd = new StartProcessCommand("StructureRef");
        ((StartProcessCommand) cmd).setParameters(params);
        ProcessInstance processInstance = ksession.execute((StartProcessCommand) cmd);
        assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
   
        JaxbCommandsResponse resp = new JaxbCommandsResponse();
View Full Code Here

   
    /**
     * build json query command and send it to drools
     */
    private QueryResults query(String queryName, Object[] args) {
        Command command = CommandFactory.newQuery("persons", queryName, args);
        String queryStr = template.requestBody("direct:marshall", command, String.class);

        String json = template.requestBody("direct:test-session", queryStr, String.class);
        ExecutionResults res = (ExecutionResults) template.requestBody("direct:unmarshall", json);
        return (QueryResults) res.getValue("persons");
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

        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

                    reader.moveUp();
                }
                reader.moveUp();
            }

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

                                UnmarshallingContext context) {
            reader.moveDown();
            String id = reader.getValue();
            reader.moveUp();

            Command cmd = CommandFactory.newAbortWorkItem( Long.parseLong( id ) );

            return cmd;
        }
View Full Code Here

TOP

Related Classes of org.kie.api.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.