Package org.drools.command.runtime.rule

Examples of org.drools.command.runtime.rule.InsertObjectCommand


    public Command newInsert(Object object) {
        return new InsertObjectCommand(object);
    }

    public Command newInsert(Object object, String outIdentifier, boolean returnObject, String entryPoint) {
        InsertObjectCommand cmd = new InsertObjectCommand(object);
        cmd.setOutIdentifier(outIdentifier);
        cmd.setEntryPoint( entryPoint );
        cmd.setReturnObject( returnObject );
        return cmd;
    }
View Full Code Here


        List<String> list = new ArrayList<String>();
        ksession.setGlobal( "list",
                            list );

        ksession.execute( new InsertObjectCommand( "hello" ) );

        assertEquals( 2,
                      list.size() );
        assertTrue( list.contains( "rule1" ) );
        assertTrue( list.contains( "rule2" ) );
View Full Code Here

        List<String> list = new ArrayList<String>();
        ksession.setGlobal( "list",
                            list );

        ksession.execute( new InsertObjectCommand( "hello" ) );

        assertEquals( 2,
                      list.size() );
        assertTrue( list.contains( "rule1" ) );
        assertTrue( list.contains( "rule2" ) );
View Full Code Here

        addCommand(new SetGlobalCommand(identifier, object));
        return this;
    }   
   
    public StatefulKnowledgeSessionSimFluent insert(Object object) {
        addCommand(new InsertObjectCommand(object));
       
        return this;
    }
View Full Code Here

    public FluentBatchExecution newBatchExecution() {
        return this;
    }

    public FluentBatchExecution insert(Object object) {
        lastAddedCommand = new InsertObjectCommand(object);
        addCommand(lastAddedCommand);
        return this;
    }
View Full Code Here

        addCommand(lastAddedCommand);
        return this;
    }

    public FluentBatchExecution update(FactHandle handle, Object object) {
        lastAddedCommand = new InsertObjectCommand(object);
        addCommand(lastAddedCommand);
        return this;
    }
View Full Code Here

/**
* Class for transforming a InsertObject command.
*/
class InsertObjectTransformer extends CommandTransformer {
  public GenericCommand<?> transform(CommandTranslator ct, Object o, Unmarshaller unmarshaller) {
    InsertObjectCommand io = (InsertObjectCommand)o;
    Object object = io.getObject();
    if (object instanceof Element) {
      Element el = (Element)object;
      Object obj = ct.makeObject(el , unmarshaller);
      io.setObject(obj);
    }
    return io;
  }
View Full Code Here

    @Test
    public void test1() throws Exception {
        JAXBContext jaxbContext = getJaxbContext();

        List<GenericCommand< ? >> cmds = new ArrayList<GenericCommand< ? >>();
        cmds.add( new InsertObjectCommand( new Person( "darth",
                                                       21 ),
                                           "p" ) );
        cmds.add( new GetGlobalCommand( "xxx" ) );
        cmds.add( new SetGlobalCommand( "yyy",
                                        new Person( "yoda",
View Full Code Here

    @Test
    public void testSessionInsert() throws Exception {
        Person person = new Person();
        person.setName( "Mauricio" );

        InsertObjectCommand cmd = (InsertObjectCommand) CommandFactory.newInsert( person,
                                                                                  "salaboy" );

        ExecutionResults response = (ExecutionResults) template.requestBody( "direct:test-with-session",
                                                                             cmd );
        assertTrue( "Expected valid ExecutionResults object",
View Full Code Here

    @Test
    public void testNoSessionInsert() throws Exception {
        Person person = new Person();
        person.setName( "Mauricio" );

        InsertObjectCommand cmd = (InsertObjectCommand) CommandFactory.newInsert( person,
                                                                                  "salaboy" );

        ExecutionResults response = (ExecutionResults) template.requestBodyAndHeader("direct:test-no-session",
                cmd,
                DroolsComponent.DROOLS_LOOKUP,
View Full Code Here

TOP

Related Classes of org.drools.command.runtime.rule.InsertObjectCommand

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.