[rules-users] Dynamic rule creation

Wolfgang Laun wolfgang.laun at gmail.com
Thu Sep 13 04:37:37 EDT 2012


On 13/09/2012, kavitha86 <kavithaparameswaran at gmail.com> wrote:
> Hi david,
>
> Yes. Please find below the rule file details. It has one rule added in the
> file. What I am trying, is to add a new rule dynamically to this file.


To "add a rule to a file", edit the file :)

To add a rule to the knowledge base, create a text complete with
"package", "import" statements (as required) and compile and add the
resulting KnowledgePackage resulting from the builder.


>
> package datanet.minhours
> import com.emlogis.policy.util.RuleAttribute;
> import com.emlogis.egs.domain.employee.Employee;
> dialect "mvel";
>
>
>
>
> rule 'Minhours_2'
> dialect 'mvel'
> salience 80
>     when
>         $p: RuleAttribute()
>         $g: Employee(employeeType.employeeTypeName == "PartTime")
>         //eval($p.attribute["StructureLevel"] >=
> $p.inParam["structure_1#PolicyStructure"])
>     then
>     	$p.outParam["MinimumHours"] = $p.inParam["minhours_2"];
>         $p.outParam["message"] = "Successfully read and match the age
> value["+$g.value("age")+"] from the Bussiness Object Employee";
> 	$p.outParam["name"] = $g.value("name");
>
>
>
> end
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Dynamic-rule-creation-tp4019723p4019730.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list