[rules-users] How to generate rule statements using MVEL 2.0 template?

neal swapnilaute at gmail.com
Mon Jan 20 05:46:15 EST 2014


Hi Mark,

This is the rough template i have created to produce rules. I am able to
generate basic rules and able to write them .drl. 

package @{package};

@foreach{importEntry : imports}
import @{importEntry};
@end{}

@foreach{importEntry : staticImports}
import static @{importEntry};
@end{}

rule "@{ruleName}"

dialect "@{dialectName}"
salience @{salienceValue}
enabled @{enableValue}

when
@foreach{modelObject : modelObjects} @{modelObject.referenceName} :
@{modelObject.referenceType} ( @foreach{ attribute : modelObject.attributes}
@{attribute.name} @{attribute.operator} "@{attribute.value}" @end{} ) @end{}
then
@foreach{modelObject : modelObjects} @{modelObject.referenceName} :
@{modelObject.referenceType} ( @foreach{ attribute :
modelObject.thenAttributes} @{attribute.name} @{attribute.operator}
"@{attribute.value}" @end{} ) @end{}
end

I am reading the generated rule through .drl into String. How can i able to
parse it so that it will give me object model which i passed to this
template?




--
View this message in context: http://drools.46999.n3.nabble.com/How-to-generate-rule-statements-using-MVEL-2-0-template-tp4027692p4027765.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list