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