[rules-users] How to handle generics in Drools?

Adrigan lillian.andres at lmco.com
Thu Nov 17 16:55:39 EST 2011


Hello Edson,

	If the generic *<T>* is not allowed, and drools appears to be written to
operate over collections of objects, how do you insert a List of items like
this:
*List<ProjectDataSet.Task> tasks*?  In my code I insert the tasks as facts
like this:
*commands.add(CommandFactory.newInsertElements(tasks));*
I use a decision table and have as one of the variables: (in the variable
row)
*List<ProjectDataSet.Task> tasks*.

	The error I receive is this:
/org.drools.template.parser.DecisionTableParseException: The format for
global variables is incorrect. It should be: [Class name, Class otherName].
But it was: [List<ProjectDataSet.Task> tasks]
	at
org.drools.decisiontable.parser.RuleSheetParserUtil.getVariableList(RuleSheetParserUtil.java:84)/

	I desire the rules in the table to iterate through all the tasks in that
list and identify tasks that are due soon (a part of my condition column
*TASKACTSTART< today* … etc.  The TASKACTSTART is a field named by Microsoft
in the ProjectDataSet.Task class.)

	Have I misunderstood the power of drools?  How do you address a collection
of a type like List<T> in a rule?

Thank you in advance for your help,
	Adrigan




--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-How-to-handle-generics-in-Drools-tp3427723p3517186.html
Sent from the Drools: User forum mailing list archive at Nabble.com.




More information about the rules-users mailing list