[rules-users] Use of StatelessKnowledgeSession

aminmc aminmc at gmail.com
Sat Apr 16 14:31:14 EDT 2011


Hi there

I was wondering if someone might be able to help with what I am trying to
do.  I have the following rule definition:

rule "open work item"
    when
        Task ( status == "OPEN")
    then
      insert(new Action("Take","take_task"));
      insert(new Action("Complete","complete_task"));
      insert(new Action("Close","close_task"));

end

Basically I want to insert a Task and then get back a list of Actions that
are available for the Task (based on the status.  I have this working with a
statefulknowledgesession with the code:

 List<Command> commands = new ArrayList<Command>();
        for (Task task : tasks) {
            commands.add(CommandFactory.newInsert(task));
        }
        session.execute(CommandFactory.newBatchExecution(commands));
        session.fireAllRules();
        session.dispose();
       
       //this returns the actions
       Collection objects = session.getObjects(new
ClassObjectFilter(Action.class));

I was wondering whether it is possible to do this with a
statelessknowledgesession instead?  I could'nt see how to achieve this
without updating the task to include the actions.

Any help would be appreciated.

Cheers

--
View this message in context: http://drools.46999.n3.nabble.com/Use-of-StatelessKnowledgeSession-tp2828548p2828548.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list