}
private String generateRules(final Process process) {
String result = "";
if (process instanceof RuleFlowProcessImpl) {
RuleFlowProcessImpl ruleFlow = (RuleFlowProcessImpl) process;
result = "package " + ruleFlow.getPackageName() + "\n" + result;
List imports = ruleFlow.getImports();
if (imports != null) {
for (Iterator iterator = imports.iterator(); iterator.hasNext(); ) {
result += "import " + iterator.next() + ";\n";
}
}
Map globals = ruleFlow.getGlobals();
if (globals != null) {
for (Iterator iterator = globals.entrySet().iterator(); iterator.hasNext(); ) {
Map.Entry entry = (Map.Entry) iterator.next();
result += "global " + entry.getValue() + " " + entry.getKey() + ";\n";
}
}
Node[] nodes = ruleFlow.getNodes();
for (int i = 0; i < nodes.length; i++) {
if (nodes[i] instanceof Split) {
Split split = (Split) nodes[i];
if (split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR) {
for (Iterator iterator = split.getOutgoingConnections().iterator(); iterator.hasNext(); ) {