<br>   Not sure what the problem is, in this case. Can you create a JIRA and attach a test case, plz?<br><br><div class="gmail_quote">2009/3/10 nestabur <span dir="ltr">&lt;<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Thanks for the quick reply ;)<br>
<br>
I saw that sample before, but I&#39;m getting the drl info throw the package<br>
generated in guvnor, so I load the package like this:<br>
                Properties props = new Properties();<br>
                props.put(&quot;url&quot;, rulePackagePath);<br>
                props.put(&quot;name&quot;,packageId);<br>
                agent = RuleAgent.newRuleAgent(props);<br>
                session = agent.getRuleBase().newStatefulSession();<br>
<br>
And I&#39;m trying to get the factType like:<br>
agent.getRuleBase().getPackage(packageId).getFactType(modelFullName);<br>
<div><div></div><div class="h5"><br>
NEStor<br>
<br>
<br>
Edson Tirelli-3 wrote:<br>
&gt;<br>
&gt;    Nestor<br>
&gt;<br>
&gt;    Look at this integration test, method testGeneratedBeans1():<br>
&gt;<br>
&gt; <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java</a><br>

&gt;<br>
&gt;    Hopefully it will be clear.<br>
&gt;<br>
&gt;    []s<br>
&gt;    Edson<br>
&gt;<br>
&gt; 2009/3/10 nestabur &lt;<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Sorry, I don&#39;t understand your suggestion ...<br>
&gt;&gt;<br>
&gt;&gt; As I know, the factTypes are included in the package and referenced in<br>
&gt;&gt; the<br>
&gt;&gt; DRL files, so for getting the factType I&#39;d have to access via the<br>
&gt;&gt; package,<br>
&gt;&gt; isn&#39;t it? And your proposal is getting the factType throw the DRL file<br>
&gt;&gt; name?ż<br>
&gt;&gt;<br>
&gt;&gt; NEStor<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Edson Tirelli-3 wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     Nestor,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     As it is now, DRL files must have a package name or you will be in<br>
&gt;&gt; &gt; trouble. So, use a package name for your DRL file and use that package<br>
&gt;&gt; &gt; name<br>
&gt;&gt; &gt; to retrieve the fact type. It will work.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     Meanwhile, I will fix the bug. If you can open a JIRA, even better<br>
&gt;&gt; to<br>
&gt;&gt; &gt; keep track of progress.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     []s<br>
&gt;&gt; &gt;     Edson<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2009/3/10 nestabur &lt;<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Any suggestions?ż<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; nestabur wrote:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Yes,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; If I put a non existent package and type, the method getFactType<br>
&gt;&gt; &gt;&gt; returns<br>
&gt;&gt; &gt;&gt; &gt; me<br>
&gt;&gt; &gt;&gt; &gt; null value, but if I put the correct package and type it throws that<br>
&gt;&gt; &gt;&gt; &gt; error.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; NEStor<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; 2009/3/8 Michal Bali &lt;<a href="mailto:michalbali@gmail.com">michalbali@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; your factTypeName should consist of package name + type name, for<br>
&gt;&gt; &gt;&gt; &gt;&gt; example:<br>
&gt;&gt; &gt;&gt; &gt;&gt; com.mycompany.Account<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; On Sun, Mar 8, 2009 at 7:02 PM, nestabur &lt;<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; Hi all,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; I&#39;m trying to create a fact programatically like this:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; FactType myfact =package.getFactType(factTypeName);<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; Object myPojo = myfact.newInstance();<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; An error occurs when calling the method getFactType, here my<br>
&gt;&gt; &gt;&gt; stackTrace:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; 36267-1236185246849-0:0:1:1 Exception while processing message:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; java.lang.StringIndexOutOfBoundsException: String index out of<br>
&gt;&gt; range:<br>
&gt;&gt; &gt;&gt; -1<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; java.lang.StringIndexOutOfBoundsException: String index out of<br>
&gt;&gt; range:<br>
&gt;&gt; &gt;&gt; -1<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;        at java.lang.String.substring(String.java:1938)<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;        at java.lang.String.substring(String.java:1905)<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;        at org.drools.rule.Package.getFactType(Package.java:552)<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; My drools version is 5.0.0.M5<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; Any suggestion?<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; View this message in context:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; <a href="http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22334399.html" target="_blank">http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22334399.html</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt;&gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; &gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; View this message in context:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; <a href="http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22431776.html" target="_blank">http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22431776.html</a><br>
&gt;&gt; &gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; rules-users mailing list<br>
&gt;&gt; &gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt;  Edson Tirelli<br>
&gt;&gt; &gt;  JBoss Drools Core Development<br>
&gt;&gt; &gt;  JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22435233.html" target="_blank">http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22435233.html</a><br>
&gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;  Edson Tirelli<br>
&gt;  JBoss Drools Core Development<br>
&gt;  JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
<br>
--<br>
</div></div>View this message in context: <a href="http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22437604.html" target="_blank">http://www.nabble.com/Creating-fact-instance-programatically-tp22334399p22437604.html</a><br>

<div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
<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><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>