<div>Esteban,</div><div><br></div>That worked just as we wanted. Thank you very much!<div><br></div><div>Regards,</div><div>Luiz Eduardo<br><br><div class="gmail_quote">2010/4/14 Esteban Aliverti <span dir="ltr">&lt;<a href="mailto:esteban.aliverti@gmail.com">esteban.aliverti@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The runtime type of the objects returned by KnowledgePackageImp.getRules() is org.drools.definitions.rule.impl.RuleImpl. RuleImpl implements org.drools.definition.rule.Rule and contains a org.drools.rule.Rule as attribute. The thing is that it is not exposing all the org.drools.rule.Rule&#39;s attributes. I really don&#39;t know why these two different Rule classes exists. It would be nice if someone could clarify this. <div>



As a workaround you can cast <span style="font-family:&#39;courier new&#39;, monospace;font-size:13px;border-collapse:collapse">agent.getKnowledgeBase().getKnowledgePackage( /* ... */ ) </span>to <span style="font-family:&#39;courier new&#39;, monospace;font-size:13px;border-collapse:collapse">KnowledgePackageImpl </span>and use its public attribute pkg to get the rules you want. Remember that this is just a workaround. It would be better to use the standard APIs. <br>



<br><div class="gmail_quote">2010/4/13 Luiz Eduardo Guida Valmont <span dir="ltr">&lt;<a href="mailto:legvalmont@gmail.com" target="_blank">legvalmont@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div></div><div class="h5">

<div><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex" class="gmail_quote">a less critical part of that code<br></blockquote><br></div>I meant a part of the application I&#39;m working on, not the one that&#39;ll generate the DRL files.<br>





<br>Mea culpa<div><div></div><div><br><br><div class="gmail_quote">On 13 April 2010 17:30, Luiz Eduardo Guida Valmont <span dir="ltr">&lt;<a href="mailto:legvalmont@gmail.com" target="_blank">legvalmont@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">

Hi all,<br><br>Recently I had to update part of the application I&#39;m working so it would use KnowledgeAgent instead of RuleAgent. The later restricts scanned DRL files so that all rules from any given package must be written into only one file), whereas the former does not. Long story made short: an external application will feed my application with generated DRL&#39;s and it cannot (aka will not) managed a single monolithic DRL or even regenerate it every now and then.<br>







<br>What happens is that I have to update (re-write?) a less critical part of that code which generates a list of all rules contained within a certain package. It has to print rules&#39; attibutes like name, salience, date-effective and date-expires. On the one hand, the old code imports <i>org.drools.rule.Rule</i> (1), which provides getters for such properties; that Rule class is accessed through a chain of method calls starting at RuleAgent, for example: <br>







<br><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex;font-family:courier new,monospace" class="gmail_quote">agent.getRuleBase().getPackage( /* ... */ ).getRules()[ /* ... */ ].getDateEffective()<br>






</blockquote><br>On the other hand, when using KnowledgeAgent&#39;s, I can fetch instances of <i>org.drools.definition.rule.Rule</i> through a similar-but-effectivelly-different chain of method calls, like so:<br><br><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex;font-family:courier new,monospace" class="gmail_quote">






agent.getKnowledgeBase().getKnowledgePackage( /* ... */ ).getRules()<br></blockquote><div><br>This one getRules returns a <i>Collection</i> of <i>org.drools.definition.rule.Rule</i> (2). Finally, this class does not provide similar methods:<br>






<br><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex" class="gmail_quote">String getPackageName</blockquote><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex" class="gmail_quote">






String getName</blockquote><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex" class="gmail_quote">Collection listMetaAttributes </blockquote><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex" class="gmail_quote">






String getMetaAttribute<br></blockquote><div> <br>Hoping I&#39;ve made myself clear up to this point, I ask: is it posible to convert an instance of (1) into an instance of (2) or is it possible to get instances of (1) through getters starting at KnowledgeAgent?<br>






<br>Thanks in advance,<br>Luiz Valmont<br></div></div>
</blockquote></div><br>
</div></div><br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br><br clear="all"><br>-- <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>
</div>
<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>
<br></blockquote></div><br></div>