Package org.jbpm.compiler.xml.processes
Class RuleFlowMigrator
- java.lang.Object
-
- org.jbpm.compiler.xml.processes.RuleFlowMigrator
-
public class RuleFlowMigrator extends Object
Class the migrates drools version 4 .rfm and .rf ruleflow files to version 5 .rf and .rfm ruleflows.
-
-
Constructor Summary
Constructors Constructor Description RuleFlowMigrator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
convertReaderToString(Reader reader)
Converts the contents of the given Reader into a string.static void
main(String[] args)
Test application that reads a given source file containing a drools 4 .rf and writes it to another given file location as a drools 5 .rf file.static boolean
needToMigrateRF(String xml)
Returns true if the given .rf (graphical) ruleflow xml is a version 4 ruleflow that needs to be migrated to version 5, and returns false otherwise.static boolean
needToMigrateRFM(String xml)
Returns true if the given .rfm ruleflow xml is a version 4 ruleflow that needs to be migrated to version 5, and returns false otherwise.static String
portRFMToCurrentVersion(String xml)
Returns a drools 5 version of a given drools 4 .rfm ruleflow in string format.static String
portRFToCurrentVersion(String xml)
Returns a drools 5 version of a given drools 4 .rf (Graphical) ruleflow in string format.
-
-
-
Method Detail
-
portRFToCurrentVersion
public static String portRFToCurrentVersion(String xml) throws Exception
Returns a drools 5 version of a given drools 4 .rf (Graphical) ruleflow in string format. Note that this method assumes the given ruleflow is a valid version 4 .rf ruleflow - this can be checked using the needToMigrateRF method.- Parameters:
xml
- Drools 4 ruleflow (.rf) in xml format- Returns:
- drools 5 version of a given drools 4 .rf (Graphical) ruleflow in string format.
- Throws:
Exception
-
portRFMToCurrentVersion
public static String portRFMToCurrentVersion(String xml) throws Exception
Returns a drools 5 version of a given drools 4 .rfm ruleflow in string format. Note that this method assumes the given ruleflow is a valid version 4 .rfm ruleflow - this can be checked using the needToMigrateRFM method. The return version 5 xml can be used as a .rf (graphical) ruleflow, but its nodes do not contains positional data.- Parameters:
xml
- Drools 4 ruleflow (.rfm) in xml format- Returns:
- drools 5 version of a given drools 4 .rfm ruleflow in string format.
- Throws:
Exception
-
needToMigrateRF
public static boolean needToMigrateRF(String xml) throws Exception
Returns true if the given .rf (graphical) ruleflow xml is a version 4 ruleflow that needs to be migrated to version 5, and returns false otherwise.- Parameters:
xml
- a .rf ruleflow in xml format- Returns:
- true if the given .rf (graphical) ruleflow xml is a version 4 ruleflow that needs to be migrated to version 5, and returns false otherwise.
- Throws:
Exception
-
needToMigrateRFM
public static boolean needToMigrateRFM(String xml) throws Exception
Returns true if the given .rfm ruleflow xml is a version 4 ruleflow that needs to be migrated to version 5, and returns false otherwise.- Parameters:
xml
- a .rfm ruleflow in xml format- Returns:
- true if the given .rfm graphical ruleflow xml is a version 4 ruleflow that needs to be migrated to version 5, and returns false otherwise.
- Throws:
Exception
-
convertReaderToString
public static String convertReaderToString(Reader reader) throws IOException
Converts the contents of the given Reader into a string. WARNING: the given string is not reset (as not all readers support reset). Consequently, anny further attempt to read from the given reader will return nothing, unless you reset the reader.- Parameters:
reader
-- Returns:
- he contents of the given Reader into a string.
- Throws:
IOException
-
main
public static final void main(String[] args)
Test application that reads a given source file containing a drools 4 .rf and writes it to another given file location as a drools 5 .rf file.- Parameters:
args
- an array whose first element is the source filename and the second element is the the destination filename to which the transformed ruleflow is written
-
-