[rules-users] Problems modifying objects in flow

raic agomezcom at gmail.com
Thu Nov 18 03:59:17 EST 2010


Hi,

I'm using Drools commands API
(http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-integration/html_single/index.html#d0e614)
for interacting via REST to my Drools server for executing flows.

I want to execute a simple flow with some human tasks. In this flow, I'm
passing a client object which will be modified inside the flow in script
nodes (client.setParameter("parameterChanged");)

The code i'm using for executing this flow is below:

Command insertObjectCommand = CommandFactory.newInsert(client,
				"client", true, null);
		
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("client", client);

		WorkItemHandler htHandler = new WSHumanTaskHandler();

		List<Command> cmds = new ArrayList<Command>();
		RegisterWorkItemHandlerCommand workItemHandlerCommand = new
RegisterWorkItemHandlerCommand(
				"Human Task", htHandler);
		StartProcessCommand startProcessCommand = new StartProcessCommand();
		cmds.add(insertObjectCommand);
		startProcessCommand.setProcessId("harrods.HumanFlow");
		startProcessCommand.setParameters(params);
		cmds.add(workItemHandlerCommand);
		cmds.add(startProcessCommand);

		result = execute(cmds); //Execute is a function which takes care of
marshalling commands and sending them to the execution server.


This starts the process correctly, i can complete the user tasks correctly
(i see in traces that the object is modifyed), but the problem is that i
can't retrieve the modified object from my application.

I try to do this from my application:


	        FactHandle fact = (FactHandle) result.getFactHandle("client");

		cmds.clear();

		GetObjectCommand getObjectCommand = new GetObjectCommand(fact);
		getObjectCommand.setOutIdentifier("client");
		cmds.add(getObjectCommand);

		result = execute(cmds);


But i'm obtaining the same object i sent to the flow (without the flow
modifications).


So, the question is, how can i modify objects inside my flow and retrieve
them in my application using drools commands api?? is it possible? i'm doing
something wrong?

I have the same example without execution server using normal API, and it
works fine...


Some ideas?


Thanks

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Problems-modifying-objects-in-flow-tp1922704p1922704.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list