Hi,
I have attached a file for translating rule flows from 4.0 to 5.0. I have
tested my flows with the XSL and it works fine. However, the XSLT may not be
quite slick or compact as I have touched upon XSLT after a long time. I have
covered all the nodes available (ruleSet, start, end, join, split, milestone,
action and subProcess).
There is one issue in the XSLT. I have not added the xmlns attribute to the
process element. Reason is that this attribute appears in child nodes too with
empty string, even though it is not mentioned for the child nodes. This
attribute is needed in the 'process' node because the Eclipse editor for 5.0
ignores the process node if there are more than 2 sub processes in that
ruleflow. Am not sure why this is happening but that has been my observation.
In case XSLT is not present as an attachment then let me know the location
where it can be uploaded.
Thanks.
Regards,
- Nimesh
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Proctor
Sent: Tuesday, September 30, 2008 7:26 PM
To: Rules Users List
Subject: Re: [rules-users] Compatibility of Rule Flows from 4.0.7 to 5.0.0
No they are not compatible, 5.0 has a new ePDL XML language that is human
writable. I suggest that somone in the community starts looking into an XSLT to
translate them.
Mark
Vikrant Yagnick wrote:
Hi All,
I wanted to know if RuleFlows made using the Eclipse 4.0.7 RuleFlow Builder
will work with 5.0.0. When, I try to upload a 4.0.7 ruleflow into Guvnor, I
get a NullPointerException and before that the following:
Cannot find the declaration of element
'org.drools.ruleflow.core.impl.RuleFlowProcessImpl'.
I checked the 5.0.0M1 jars for drools-core, and this class seems to have been
removed from there. Also, after installing the 5.0.0 plug-in into Eclipse, my
rule-flow nodes have all gone.
Also, this may be a minor bug but it says(both in the docs and the BRMS Guvnor
M1 Release):
"Ruleflows allow flow control between rules. The eclipse plugin provides a
graphical editor. Upload ruleflow .rf files for inclusion in this package.":
Should the .rf say .rfm ?
Cheers,
Vikrant
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of
Mastek Limited, unless specifically indicated to that effect. Mastek Limited
does not accept any responsibility or liability for it. This e-mail and
attachments (if any) transmitted with it are confidential and/or privileged and
solely for the use of the intended person or entity to which it is addressed.
Any review, re-transmission, dissemination or other use of or taking of any
action in reliance upon this information by persons or entities other than the
intended recipient is prohibited. This e-mail and its attachments have been
scanned for the presence of computer viruses. It is the responsibility of the
recipient to run the virus check on e-mails and attachments before opening
them. If you have received this e-mail in error, kindly delete this e-mail from
desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
________________________________
_______________________________________________
rules-users mailing list
[email protected]<mailto:[email protected]>
https://lists.jboss.org/mailman/listinfo/rules-users
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of
Mastek Limited, unless specifically indicated to that effect. Mastek Limited
does not accept any responsibility or liability for it. This e-mail and
attachments (if any) transmitted with it are confidential and/or privileged and
solely for the use of the intended person or entity to which it is addressed.
Any review, re-transmission, dissemination or other use of or taking of any
action in reliance upon this information by persons or entities other than the
intended recipient is prohibited. This e-mail and its attachments have been
scanned for the presence of computer viruses. It is the responsibility of the
recipient to run the virus check on e-mails and attachments before opening
them. If you have received this e-mail in error, kindly delete this e-mail from
desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:output method="xml" indent="yes" />
<!-- How to get the first node so the the implementing class need not be mentioned here.-->
<xsl:variable name="type" select="/org.drools.ruleflow.core.impl.RuleFlowProcessImpl/type"></xsl:variable>
<xsl:variable name="name"><xsl:value-of select="./org.drools.ruleflow.core.impl.RuleFlowProcessImpl/name"/></xsl:variable>
<xsl:variable name="id"><xsl:value-of select="./org.drools.ruleflow.core.impl.RuleFlowProcessImpl/id"/></xsl:variable>
<xsl:variable name="packageName"><xsl:value-of select="./org.drools.ruleflow.core.impl.RuleFlowProcessImpl/packageName"/></xsl:variable>
<xsl:param name="generateTypes">false</xsl:param>
<xsl:param name="generateImports">false</xsl:param>
<xsl:param name="generateIncludes">false</xsl:param>
<xsl:param name="defaultIncludeFile">false</xsl:param>
<xsl:template match="/">
<!-- If we do not add the namespace then 5.0 Eclipse editor does not recognize the process
node if there are more than 2 sub processes defined in the ruleflow!
If we put the namespace then it gets reflected in child elements like ruleSet, join etc.-->
<xsl:element name="process">
<xsl:attribute name="type"><xsl:value-of select="$type"/></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
<xsl:attribute name="package-name"><xsl:value-of select="$packageName"/></xsl:attribute>
<!-- TODO Could not add other namespace related attributes on the element node especially for schema location. -->
<xsl:element name="nodes">
<xsl:call-template name="processNodes"/>
</xsl:element>
<xsl:element name="connections">
<xsl:call-template name="formConnections" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="processNodes">
<xsl:for-each select="//nodes/entry[1]/child::node()">
<xsl:choose>
<xsl:when test="(starts-with(name(.), 'org.drools.ruleflow'))">
<xsl:call-template name="printNodes"><xsl:with-param name="className"><xsl:value-of select = "name(.)"/></xsl:with-param></xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- Only those from or to nodes that have id. When there is reference it means that the node was already declared as id earlier or would come later.-->
<xsl:for-each select="//[EMAIL PROTECTED] != '']|//[EMAIL PROTECTED] != '']">
<xsl:call-template name="printNodes"><xsl:with-param name="className"><xsl:value-of select = "@class"/></xsl:with-param></xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="printNodes">
<xsl:param name="className"/>
<xsl:choose>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.RuleSetNodeImpl'">
<xsl:call-template name="RenderRuleSetNode"/>
</xsl:when>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.ActionNodeImpl'">
<xsl:call-template name="RenderActionNode"/>
</xsl:when>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.SplitImpl'">
<xsl:call-template name="RenderSplitNode"/>
</xsl:when>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.JoinImpl'">
<xsl:call-template name="RenderJoinNode"/>
</xsl:when>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.SubFlowNodeImpl'">
<xsl:call-template name="RenderSubflowNode"/>
</xsl:when>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.StartNodeImpl'">
<xsl:call-template name="RenderStartNode"/>
</xsl:when>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.EndNodeImpl'">
<xsl:call-template name="RenderEndNode"/>
</xsl:when>
<xsl:when test="$className = 'org.drools.ruleflow.core.impl.MilestoneNodeImpl'">
<xsl:call-template name="RenderMilestoneNode"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="RenderSplitNode">
<xsl:element name="split">
<xsl:call-template name="renderIdAndNameAttribute"/>
<xsl:attribute name="type"><xsl:value-of select = "./type"/></xsl:attribute>
<!-- Add constraints element if XOR or OR type of Split Node i.e. it is not AND node-->
<xsl:choose>
<xsl:when test="./type != '1'">
<xsl:element name="constraints">
<xsl:for-each select="constraints/entry/org.drools.ruleflow.core.impl.ConstraintImpl">
<xsl:call-template name="RenderConstraintNode"></xsl:call-template>
</xsl:for-each>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:element>
</xsl:template>
<xsl:template name="RenderConstraintNode">
<xsl:element name="constraint">
<xsl:attribute name="toNodeId">
<xsl:choose>
<xsl:when test="../[EMAIL PROTECTED] != '']">
<xsl:for-each select = "../org.drools.ruleflow.core.impl.ConnectionImpl/to">
<xsl:call-template name="printReferenceOrId"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="constraintReference"><xsl:value-of select="../org.drools.ruleflow.core.impl.ConnectionImpl/@reference"/></xsl:variable>
<xsl:for-each select = "//[EMAIL PROTECTED] = $constraintReference]/to">
<xsl:call-template name="printReferenceOrId"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:call-template name="renderIdAndNameAttribute"/>
<xsl:attribute name="toType"><xsl:value-of select = "'DROOLS_DEFAULT'"/></xsl:attribute>
<xsl:attribute name="priority"><xsl:value-of select = "./priority"/></xsl:attribute>
<xsl:attribute name="type"><xsl:value-of select = "'rule'"/></xsl:attribute>
<xsl:attribute name="dialect"><xsl:value-of select = "'mvel'"/></xsl:attribute>
<xsl:value-of select = "./constraint"/>
</xsl:element>
</xsl:template>
<xsl:template name="RenderSubflowNode">
<xsl:element name="subProcess">
<xsl:call-template name="renderIdAndNameAttribute"/>
<xsl:attribute name="processId"><xsl:value-of select = "./processId"/></xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template name="RenderJoinNode">
<xsl:element name="join">
<xsl:call-template name="renderIdAndNameAttribute"/>
<xsl:attribute name="type"><xsl:value-of select = "./type"/></xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template name="RenderRuleSetNode">
<xsl:element name="ruleSet">
<xsl:call-template name="renderIdAndNameAttribute"/>
<xsl:attribute name="ruleFlowGroup"><xsl:value-of select = "./ruleFlowGroup"/></xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template name="RenderActionNode">
<xsl:element name="actionNode">
<xsl:call-template name="renderIdAndNameAttribute"/>
<xsl:element name="action">
<!-- Hard coding type as expression and dialect as mvel. Not sure how this can be understood in the 4.0 format.
-->
<xsl:attribute name="type"><xsl:value-of select = "'expression'"/></xsl:attribute>
<xsl:attribute name="dialect"><xsl:value-of select = "'mvel'"/></xsl:attribute>
<xsl:value-of select = "./action/consequence"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="RenderStartNode">
<xsl:element name="start">
<xsl:call-template name="renderIdAndNameAttribute"/>
</xsl:element>
</xsl:template>
<xsl:template name="RenderEndNode">
<xsl:element name="end">
<xsl:call-template name="renderIdAndNameAttribute"/>
</xsl:element>
</xsl:template>
<xsl:template name="RenderMilestoneNode">
<xsl:element name="milestone">
<xsl:call-template name="renderIdAndNameAttribute"/>
<xsl:element name="constraint">
<!-- Hard coded the type and dialect as in 4.0 it was assumed to be mvel. -->
<xsl:attribute name="type"><xsl:value-of select="'rule'"/></xsl:attribute>
<xsl:attribute name="dialect"><xsl:value-of select="'mvel'"/></xsl:attribute>
<xsl:value-of select="./constraint"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="renderIdAndNameAttribute">
<xsl:attribute name="id"><xsl:value-of select = "./@id"/></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select = "./name"/></xsl:attribute>
</xsl:template>
<xsl:template name="formConnections">
<xsl:for-each select="//from">
<xsl:element name="connection">
<xsl:attribute name="from"><xsl:apply-templates select="current()"/></xsl:attribute>
<xsl:attribute name="to"><xsl:apply-templates select="../to"/></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="to">
<xsl:call-template name="printReferenceOrId"/>
</xsl:template>
<xsl:template match="from">
<xsl:call-template name="printReferenceOrId"/>
</xsl:template>
<xsl:template name="printReferenceOrId">
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="(name() eq 'reference') or (name() eq 'id')">
<xsl:value-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users