<div dir="ltr">Hi, <br>The example I used is very simple.<br>I don&#39;t have a concrete idea on how the rules should look.<br>For example the return value can be map or insert new bean to working memory.<br>Probably I will have to build a generic component for processing and building packages.<br>
Are you familiar with an API that I can use?<br>Probably the BRMS component is doing the same - reading data base tables and building the DRL files.<br>Should I use it?<br><br>Thanks,<br>Meny<br><br><br><br><div class="gmail_quote">
On Tue, Mar 31, 2009 at 4:33 PM, Marcus Ilgner <span dir="ltr">&lt;<a href="mailto:marcus.ilgner@gmail.com">marcus.ilgner@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2009/3/31 Meny Kobel &lt;<a href="mailto:meny.kobel@gmail.com">meny.kobel@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Hi,<br>
&gt; First - Thanks for your quick response.<br>
&gt; Second - As I wrote rules conditions are saved in DB.<br>
&gt;<br>
&gt; Conditions table example :<br>
&gt;<br>
&gt;<br>
&gt; TypeName    Operation       Value                Return Value<br>
&gt; Var1                 &gt;=                5                        “Segment<br>
&gt; 1”<br>
&gt; Var2                 matches      “someString”        “Segment 1”<br>
&gt; Var3                 &lt;                  6                        “Segment<br>
&gt; 1”<br>
&gt; Var4                  ==               1                        “Segment<br>
&gt; 2”<br>
&gt; Var5                  ==                5                       “Segment<br>
&gt; 2”<br>
&gt;<br>
&gt; The table above should trasform to the following DRL rule -<br>
&gt;<br>
&gt; rule &quot;example 1&quot;<br>
&gt;     when<br>
&gt;<br>
&gt;         Bean(var1 &gt;= 5 ,var2 matches &quot;someString&quot;,var3 &lt; 6)<br>
&gt;<br>
&gt;     then<br>
&gt;         list.add(&quot;Segment 1&quot;);<br>
&gt; End<br>
&gt;<br>
&gt; rule &quot;example 2&quot;<br>
&gt;     when<br>
&gt;         Bean(var4 == 1 ,var5 == 5)<br>
&gt;     then<br>
&gt;         list.add(&quot;Segment 2&quot;);<br>
&gt; End<br>
&gt;<br>
&gt; The conditions are dynamically build on Site by customer and I don’t know<br>
&gt; the number of conditions And the conditions values(the values of columns<br>
&gt; TypeName,Operation, Value and Return Value ).<br>
&gt;<br>
&gt; On Tue, Mar 31, 2009 at 2:35 PM, Meny Kobel &lt;<a href="mailto:meny.kobel@gmail.com">meny.kobel@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt; Any updates regarding this subject?<br>
&gt;&gt; I have the same problem and can&#39;t find a solution.<br>
&gt;&gt; Like newbie I need to read varying rules from DB and transform them to<br>
&gt;&gt; drools language.<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt; Meny<br>
&gt;<br>
<br>
</div></div>Hi,<br>
<br>
since you seem to have a concrete idea on how your rules should look,<br>
you can simply render them into a String according to your<br>
specification and then pass a StringReader to<br>
PackageBuilder.addPackageFromDrl(). The resultig package can then be<br>
added to your rulebase.<br>
Of course you could also use rules to generate the rules from the<br>
conditions in the DB, which would be more complex but more extensible,<br>
too.<br>
<br>
HTH<br>
<font color="#888888">Marcus<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div>