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

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


                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


        WorkingMemorySimulationRepository wmRepo = (WorkingMemorySimulationRepository) repo;

        assertEquals(30, wmRepo.getAggregatedEvents().size());
        assertEquals(45, wmRepo.getEvents().size());
       
        wmRepo.getSession().execute(new InsertElementsCommand((Collection)wmRepo.getAggregatedEvents()));
        wmRepo.fireAllRules();
       
        List<AggregatedSimulationEvent> summary = (List<AggregatedSimulationEvent>) wmRepo.getGlobal("summary");
        assertNotNull(summary);
        assertEquals(7, summary.size());
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

        cmd.setOutIdentifier(outIdentifier);
        return cmd;
    }

    public Command newInsertElements(Iterable objects) {
        return new InsertElementsCommand( i2c(objects) );
    }
View Full Code Here

    public Command newInsertElements(Iterable objects) {
        return new InsertElementsCommand( i2c(objects) );
    }

    public Command newInsertElements(Iterable objects, String outIdentifier) {
        InsertElementsCommand cmd = new InsertElementsCommand( i2c(objects) );
        cmd.setOutIdentifier(outIdentifier);
        return cmd;
    }
View Full Code Here

        cmd.setOutIdentifier(outIdentifier);
        return cmd;
    }

    public Command newInsertElements(Iterable objects, String outIdentifier, boolean returnObject, String entryPoint) {
        InsertElementsCommand cmd = new InsertElementsCommand( i2c(objects) );
        cmd.setEntryPoint( entryPoint );
        cmd.setOutIdentifier( outIdentifier );
        cmd.setReturnObject( returnObject );
        return cmd;
    }
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

        }

        public void marshal(Object object,
                            HierarchicalStreamWriter writer,
                            MarshallingContext context) {
            InsertElementsCommand cmd = (InsertElementsCommand) object;

            if ( cmd.getOutIdentifier() != null ) {
                writer.addAttribute( "out-identifier",
                                     cmd.getOutIdentifier() );

                writer.addAttribute( "return-objects",
                                     Boolean.toString( cmd.isReturnObject() ) );

                writer.addAttribute( "entry-point",
                                     cmd.getEntryPoint() );

            }

            for ( Object element : cmd.getObjects() ) {
                writeItem( element,
                           context,
                           writer );
            }
        }
View Full Code Here

                                          null );
                reader.moveUp();
                objects.add( object );
            }

            InsertElementsCommand cmd = new InsertElementsCommand( objects );
            if ( identifierOut != null ) {
                cmd.setOutIdentifier( identifierOut );
                if ( returnObject != null ) {
                    cmd.setReturnObject( Boolean.parseBoolean( returnObject ) );
                }
            }
            if ( entryPoint != null ) {
                cmd.setEntryPoint( entryPoint );
            }
            return cmd;
        }
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.