I have a feeling you're not going to be pleased.<br><br><div class="gmail_quote">On 31 May 2012 14:43, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The result of XmlDumper in its current state may not accurately reflect all<br>
that can now (5.4.0) be written in DRL. At least I got that impression when<br>
I was looking at XmlDumper earlier (IIRC ~5.2.0) and found some glitches<br>
even then.<br>
<br>
Mark, Michael: I'd be pleased to learn that this has been fixed. :)<br>
<br>
-W<br>
<div class="im"><br>
<br>
On 31/05/2012, Michael Anstis <<a href="mailto:michael.anstis@gmail.com">michael.anstis@gmail.com</a>> wrote:<br>
> The XML format produced by XmlDumper is an XML representation of various<br>
> internal Descriptors used by Drools Expert and only supports features up to<br>
> 4.0<br>
><br>
> It is unfortunately not the same as that stored internally in Guvnor (which<br>
> is simply a XStream representation of Guvnor's internal model).<br>
><br>
> Furthermore Guvnor's internal representation is private and subject to<br>
> change from release to release.<br>
><br>
> There is no easy way to convert from one to the other, other than writing<br>
> your own XSLT.<br>
><br>
> With kind regards,<br>
><br>
> Mike<br>
><br>
> On 29 May 2012 13:36, Anirban Bandyopadhyay <<br>
> <a href="mailto:Anirban.Bandyopadhyay@monitisegroup.com">Anirban.Bandyopadhyay@monitisegroup.com</a>> wrote:<br>
><br>
</div>>> Hi,****<br>
>><br>
>> ** **<br>
<div class="im">>><br>
>> We have a set of rule files in DRL format. We couldn’t find a way (tool)<br>
>> of importing them into Guvnor as BRL file so that we can edit using the<br>
</div>>> designer.****<br>
>><br>
>> ** **<br>
<div class="im">>><br>
>> We ended up using the DrlParser and XmlDumper to transform them from DRL<br>
>> to BRL. It produces the XML and when we add it to the repository using<br>
>> WebDav, Guvnor lists the files under Business Rule which is perfect. BUT<br>
</div>>> when I try to open it, it throws the following error:****<br>
>><br>
>> ** **<br>
>><br>
>><br>
>> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$Unkno<br>
>> ****<br>
>><br>
>> wnFieldException: No such field<br>
>> org.drools.ide.common.client.modeldriven.brl.Rul****<br>
>><br>
>> eModel.rule-attribute****<br>
>><br>
>> ---- Debugging information ----****<br>
>><br>
>> field : rule-attribute****<br>
>><br>
>> class :<br>
>> org.drools.ide.common.client.modeldriven.brl.RuleModel****<br>
>><br>
>> required-type :<br>
>> org.drools.ide.common.client.modeldriven.brl.RuleModel****<br>
>><br>
>> converter-type :<br>
>> com.thoughtworks.xstream.converters.reflection.ReflectionC****<br>
>><br>
>> onverter****<br>
>><br>
>> path : /rule/rule-attribute****<br>
>><br>
>> version : null****<br>
>><br>
>> -------------------------------****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv****<br>
>><br>
>> erter.determineType(AbstractReflectionConverter.java:449)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv****<br>
>><br>
>> erter.doUnmarshal(AbstractReflectionConverter.java:290)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv****<br>
>><br>
>> erter.unmarshal(AbstractReflectionConverter.java:230)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall****<br>
>><br>
>> er.java:72)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(A****<br>
>><br>
>> bstractReferenceUnmarshaller.java:65)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm****<br>
>><br>
>> arshaller.java:66)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm****<br>
>><br>
>> arshaller.java:50)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller****<br>
>><br>
>> .java:134)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarsh****<br>
>><br>
>> al(AbstractTreeMarshallingStrategy.java:32)****<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1035)**<br>
>> **<br>
>><br>
>> at<br>
>> com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1019)**<br>
>> **<br>
>><br>
>> at com.thoughtworks.xstream.XStream.fromXML(XStream.java:895)****<br>
>><br>
>> at com.thoughtworks.xstream.XStream.fromXML(XStream.java:886)****<br>
>><br>
>> at<br>
>> org.drools.ide.common.server.util.BRXMLPersistence.unmarshal(BRXMLPer****<br>
>><br>
>> sistence.java:191)****<br>
>><br>
>> at<br>
>> org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.retr****<br>
>><br>
>> ieveAssetContent(BRLContentHandler.java:41)****<br>
>><br>
>> at<br>
>> org.drools.guvnor.server.RepositoryAssetService.handlePackageItem(Rep****<br>
>><br>
>> ositoryAssetService.java:132)****<br>
>><br>
>> at<br>
>> org.drools.guvnor.server.RepositoryAssetService.loadRuleAsset(Reposit****<br>
>><br>
>> oryAssetService.java:118)****<br>
>><br>
>> at<br>
>> org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientP****<br>
>><br>
>> roxy.loadRuleAsset(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java)*<br>
>> ***<br>
>><br>
>> at<br>
>> org.drools.guvnor.server.RepositoryServiceServlet.loadRuleAsset(Repos****<br>
>><br>
>> itoryServiceServlet.java:403)****<br>
>><br>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native<br>
>> Method)****<br>
>><br>
>> at<br>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.****<br>
>><br>
>> java:39)****<br>
>><br>
>> at<br>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces****<br>
>><br>
>> sorImpl.java:25)****<br>
>><br>
>> at java.lang.reflect.Method.invoke(Method.java:597)****<br>
>><br>
>> at<br>
>> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:5****<br>
>><br>
>> 69)****<br>
>><br>
>> at<br>
>> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(Remot****<br>
>><br>
>> eServiceServlet.java:208)****<br>
>><br>
>> at<br>
>> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(Remot****<br>
>><br>
>> eServiceServlet.java:248)****<br>
>><br>
>> at<br>
>> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(Ab****<br>
>><br>
>> stractRemoteServiceServlet.java:62)****<br>
>><br>
>> at<br>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:637)***<br>
>> *<br>
>><br>
>> at<br>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)***<br>
>> *<br>
>><br>
>> at<br>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl****<br>
>><br>
>> icationFilterChain.java:290)****<br>
>><br>
>> at<br>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF****<br>
>><br>
>> ilterChain.java:206)****<br>
>><br>
>> at<br>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV****<br>
>><br>
>> alve.java:233)****<br>
>><br>
>> at<br>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV****<br>
>><br>
>> alve.java:191)****<br>
>><br>
>> at<br>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j****<br>
>><br>
>> ava:127)****<br>
>><br>
>> at<br>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j****<br>
>><br>
>> ava:102)****<br>
>><br>
>> at<br>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal****<br>
>><br>
>> ve.java:109)****<br>
>><br>
>> at<br>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav****<br>
>><br>
>> a:293)****<br>
>><br>
>> at<br>
>> org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcesso****<br>
>><br>
>> r.java:877)****<br>
>><br>
>> at<br>
>> org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pr****<br>
>><br>
>> ocess(Http11AprProtocol.java:594)****<br>
>><br>
>> at<br>
>> org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:16****<br>
>><br>
>> 75)****<br>
>><br>
>> at java.lang.Thread.run(Thread.java:662)****<br>
>><br>
>> ** **<br>
>><br>
>> ** **<br>
<div class="im">>><br>
>> I am able to re-produce the same error when I try to convert the BRL to<br>
>> DRL using BRDRLPersistence and BRXMLPersistence marshalling and<br>
>> unmarshalling. I checked that the field ‘rule-attribute’ is indeed not<br>
>> present in org.drools.brms.client.modeldriven.brl.RuleModel. when I look<br>
>> at the example brl file from the sample mortgage, they don’t have<br>
>> ‘rule-attribute’, and it’s not only that specific node, the whole set of<br>
</div>>> node names are different. ****<br>
>><br>
>> ** **<br>
>><br>
>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>** **<br>
>><br>
>> ** **<br>
<div class="im">>><br>
>> public void convertDrlToBrl() throws IOException, DroolsParserException<br>
</div>>> {*<br>
>> ***<br>
>><br>
>> ** **<br>
>><br>
>> Resource fileResource = new<br>
>> ClassPathResource("Beneficiary_User_KYC_Level_3_Daily_Limit.drl");****<br>
>><br>
>> ** **<br>
>><br>
>> DrlParser parser = new DrlParser();****<br>
>><br>
>> XmlDumper dumper = new XmlDumper();****<br>
>><br>
>> ** **<br>
<div class="im">>><br>
>> Reader source = new InputStreamReader(new<br>
</div>>> FileInputStream(fileResource.getFile()));****<br>
>><br>
>> PackageDescr pkg = parser.parse(source);****<br>
>><br>
>> ** **<br>
>><br>
>> String xmlString = dumper.dump(pkg);****<br>
>><br>
>> ** **<br>
>><br>
>> System.out.println(xmlString);****<br>
>><br>
>> }****<br>
>><br>
>> ** **<br>
>><br>
>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<** **<br>
>><br>
>> ** **<br>
>><br>
>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>** **<br>
>><br>
>> ** **<br>
>><br>
>> public void convertBrlToDrl() throws IOException {****<br>
>><br>
>> ** **<br>
>><br>
>> Resource fileResource = new<br>
>> ClassPathResource("Beneficiary_User_KYC_Level_3_Daily_Limit_BRL.brl");****<br>
>><br>
>> ** **<br>
>><br>
>> String fileAsString =<br>
>> FileUtils.readFileToString(fileResource.getFile());****<br>
>><br>
>> ** **<br>
>><br>
>> BRDRLPersistence write = (BRDRLPersistence)<br>
>> BRDRLPersistence.getInstance();****<br>
>><br>
>> BRXMLPersistence read = (BRXMLPersistence)<br>
>> BRXMLPersistence.getInstance();****<br>
>><br>
>> ** **<br>
>><br>
>> RuleModel ruleModel = read.unmarshal(fileAsString);****<br>
>><br>
>> String outputDRL = write.marshal(ruleModel);****<br>
>><br>
>> ** **<br>
>><br>
>> System.out.println(outputDRL);****<br>
>><br>
>> ** **<br>
>><br>
>> }****<br>
>><br>
>> ** **<br>
>><br>
>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<** **<br>
>><br>
>> ** **<br>
>><br>
>> Generated xml file:****<br>
>><br>
>> ** **<br>
>><br>
>> ===============================================****<br>
>><br>
>> ** **<br>
>><br>
>> <rule name="Beneficiary_User_KYC_Level_3_Daily_Limit_BRL">****<br>
>><br>
>> <rule-attribute name="dialect" value="mvel" />****<br>
>><br>
>> ** **<br>
>><br>
>> <lhs><pattern object-type="UserBean" >****<br>
>><br>
>> <field-constraint field-name="kycLevel"> ****<br>
>><br>
>> <literal-restriction evaluator="==" value="KYC_LEVEL_3" />****<br>
>><br>
>> ** **<br>
>><br>
>> </field-constraint>****<br>
>><br>
>> <field-constraint field-name="userType"> ****<br>
>><br>
>> <literal-restriction evaluator="==" value="BENEFICIARY" />****<br>
>><br>
>> ** **<br>
>><br>
>> </field-constraint>****<br>
>><br>
>> ** **<br>
>><br>
>> ** **<br>
>><br>
>> </pattern>****<br>
>><br>
>> ** **<br>
>><br>
>> <pattern object-type="Activity" >****<br>
>><br>
>> <field-constraint field-name="type"> ****<br>
>><br>
>> <literal-restriction evaluator="!=" value="TRANSACTION.SEND" />****<br>
>><br>
>> ** **<br>
>><br>
>> </field-constraint>****<br>
>><br>
>> ** **<br>
>><br>
>> ** **<br>
>><br>
>> </pattern>****<br>
>><br>
>> ** **<br>
>><br>
>> ** **<br>
>><br>
>> </lhs><rhs> Limit fact0 = new Limit();****<br>
>><br>
>> fact0.setType( "DAILY_TRANSACTION_LIMIT"<br>
>> );<br>
>> ****<br>
>><br>
>> fact0.setValue( 10000 );****<br>
>><br>
>> fact0.setErrorMessage( "Maximum daily<br>
>> total amount of N10,000 exceeded for {0}." );****<br>
>><br>
>> insert(fact0 );****<br>
>><br>
>> </rhs>****<br>
>><br>
>> </rule>****<br>
>><br>
>> ** **<br>
>><br>
>> ================================================****<br>
>><br>
>> ** **<br>
>><br>
>> ** **<br>
<div class="im">>><br>
>> Am I doing something wrong? Is there a better way of converting the DRLs<br>
</div>>> to BRLs?****<br>
>><br>
>> ** **<br>
>><br>
>> Thanks in advance!****<br>
>><br>
>> *Anirban Bandyopadhyay*<br>
>><br>
>> ------------------------------<br>
<div class="im HOEnZb">>> This message contains confidential and proprietary information of the<br>
>> sender, and is intended only for the person(s) to whom it is addressed.<br>
>> Any<br>
>> use, distribution, copying, disclosure or taking of any action in<br>
>> reliance<br>
>> upon it by any other person is strictly prohibited. If you have received<br>
>> this message in error, please notify the e-mail sender immediately, and<br>
>> delete the original message without making a copy.<br>
>><br>
>> The Monitise group comprises: Monitise plc (Reg. No. 6011822), Monitise<br>
>> Group Limited (Reg. No. 5590897), Monitise International Limited (Reg.<br>
>> No.<br>
>> 5556711) and Monitise Europe Limited (Reg. No. 4831976). These companies<br>
>> are registered in England and Wales and their registered office address<br>
>> is:<br>
>> Warnford Court, 29 Throgmorton Street, London, EC2N 2AT United Kingdom.<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 class="HOEnZb"><div class="h5">_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
</div></div></blockquote></div><br>