Package org.drools.core.command.runtime.rule

Examples of org.drools.core.command.runtime.rule.InsertElementsCommand


        MyPerson jos =  new MyPerson("Jos", 30,
                                     Arrays.asList(new MyPerson("Jeff Jr 1st", 10, Collections.<MyPerson>emptyList()),
                                                   new MyPerson("Jeff Jr 2nd", 8, Collections.<MyPerson>emptyList())) );

        ksession.execute(new InsertElementsCommand(Arrays.asList(new Object[]{ josJr, jos })));

        ksession.fireAllRules();

        System.out.println( map );
View Full Code Here


        MyPerson jos =  new MyPerson("Jos", 30,
                                     Arrays.asList(new MyPerson("Jeff Jr 1st", 10, Collections.<MyPerson>emptyList()),
                                                   new MyPerson("Jeff Jr 2nd", 8, Collections.<MyPerson>emptyList())) );

        ksession.execute(new InsertElementsCommand(Arrays.asList(new Object[]{ josJr, jos })));

        ksession.fireAllRules();

        System.out.println( map );
View Full Code Here

        SimulationRepository repo = SimulationRunner.runSimulation(processId, processXML, Integer.parseInt(numInstances), intervalInt, true, "onevent.simulation.rules.drl");
        WorkingMemorySimulationRepository wmRepo = (WorkingMemorySimulationRepository) repo;
        // start evaluating all the simulation events generated
        // wmRepo.fireAllRules();
        List<SimulationEvent> allEvents = new ArrayList<SimulationEvent>(wmRepo.getEvents());
        wmRepo.getSession().execute(new InsertElementsCommand((Collection)wmRepo.getAggregatedEvents()));
            wmRepo.fireAllRules();
            List<AggregatedSimulationEvent> aggEvents = (List<AggregatedSimulationEvent>) wmRepo.getGlobal("summary");
                SimulationInfo simInfo = wmRepo.getSimulationInfo(); // TODO add siminfo to json
        wmRepo.close();
View Full Code Here

    @Test
    public void testInsertElements() throws Exception {

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );
        InsertElementsCommand elems = new InsertElementsCommand( "elems" );
        elems.getObjects().add( new Person( "lucaz",
                                            25 ) );
        elems.getObjects().add( new Person( "hadrian",
                                            25 ) );
        elems.getObjects().add( new Person( "baunax",
                                            21 ) );
        elems.getObjects().add( "xxx" );

        cmd.getCommands().add( elems );
        cmd.getCommands().add( new FireAllRulesCommand() );

        StringWriter xmlReq = new StringWriter();
View Full Code Here

    public void testMarshallInsertElementsCommand() {
        String xmlCommand = "<insert-elements>\n" +
                "  <string>test1</string>\n" +
                "  <string>test2</string>\n" +
                "</insert-elements>";
        InsertElementsCommand command = (InsertElementsCommand) marshaller.fromXML(xmlCommand);
        assertEquals(2, command.getObjects().size());

        assertEquals(xmlCommand, marshaller.toXML(command));
    }
View Full Code Here

        MyPerson jos =  new MyPerson("Jos", 30,
                                     Arrays.asList(new MyPerson("Jeff Jr 1st", 10, Collections.<MyPerson>emptyList()),
                                                   new MyPerson("Jeff Jr 2nd", 8, Collections.<MyPerson>emptyList())) );

        ksession.execute(new InsertElementsCommand(Arrays.asList(new Object[]{ josJr, jos })));

        ksession.fireAllRules();

        System.out.println( map );
View Full Code Here

        MyPerson jos =  new MyPerson("Jos", 30,
                                     Arrays.asList(new MyPerson("Jeff Jr 1st", 10, Collections.<MyPerson>emptyList()),
                                                   new MyPerson("Jeff Jr 2nd", 8, Collections.<MyPerson>emptyList())) );

        ksession.execute(new InsertElementsCommand(Arrays.asList(new Object[]{ josJr, jos })));

        ksession.fireAllRules();

        System.out.println( map );
View Full Code Here

    @Test
    public void testInsertElements() throws Exception {

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );
        InsertElementsCommand elems = new InsertElementsCommand( "elems" );
        elems.getObjects().add( new Person( "lucaz",
                                            25 ) );
        elems.getObjects().add( new Person( "hadrian",
                                            25 ) );
        elems.getObjects().add( new Person( "baunax",
                                            21 ) );
        elems.getObjects().add( "xxx" );

        cmd.getCommands().add( elems );
        cmd.getCommands().add( new FireAllRulesCommand() );

        StringWriter xmlReq = new StringWriter();
View Full Code Here

        MyPerson jos =  new MyPerson("Jos", 30,
                                      Arrays.asList(new MyPerson("Jeff Jr 1st", 10, Collections.<MyPerson>emptyList()),
                                                    new MyPerson("Jeff Jr 2nd", 8, Collections.<MyPerson>emptyList())) );

        ksession.execute(new InsertElementsCommand(Arrays.asList(new Object[]{ josJr, jos })));

        ksession.fireAllRules();

        System.out.println( map );
View Full Code Here

                assertTrue(((GenericSimulationEvent) event).getAggregatedEvent() instanceof AggregatedProcessSimulationEvent);
            } else if (event instanceof ProcessInstanceEndSimulationEvent) {
                assertNull(((GenericSimulationEvent) event).getAggregatedEvent());
            }
        }
        wmRepo.getSession().execute(new InsertElementsCommand((Collection)wmRepo.getAggregatedEvents()));
        wmRepo.fireAllRules();
        List<AggregatedSimulationEvent> summary = (List<AggregatedSimulationEvent>) wmRepo.getGlobal("summary");
        assertNotNull(summary);
        assertEquals(5, summary.size());
        for (AggregatedSimulationEvent event : summary) {
View Full Code Here

TOP

Related Classes of org.drools.core.command.runtime.rule.InsertElementsCommand

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.