|
@ -66,8 +66,7 @@ public class ProcessEditor {
|
|
|
JsonNode node = nodeMap.get(nodeName);
|
|
|
String nodeType = node.get("nodeType").asText();
|
|
|
String config = node.get("config").asText();
|
|
|
String value = node.get("value").asText();
|
|
|
String name = node.get("name").asText();
|
|
|
// String name = node.get("name").asText();
|
|
|
StringBuilder bodyBuilderTemp = new StringBuilder();
|
|
|
if (nodeType.equals("start")) {
|
|
|
bodyBuilder.append("from(\"");
|
|
@ -76,9 +75,10 @@ public class ProcessEditor {
|
|
|
bodyBuilder.append(".routeId(\""+code+"\")");
|
|
|
}
|
|
|
} else if (nodeType.equals("processor")) {
|
|
|
String className = config.substring(value.lastIndexOf(".") + 1, value.length());
|
|
|
String value = node.get("value").asText();
|
|
|
String className = value.substring(value.lastIndexOf(".") + 1, value.length());
|
|
|
|
|
|
addPackageList("import " + config + ";\n");
|
|
|
addPackageList("import " + value + ";\n");
|
|
|
if (config == null) {
|
|
|
bodyBuilderTemp.append("\n.process(new "+className+"(\"\"))");
|
|
|
} else {
|
|
@ -113,9 +113,9 @@ public class ProcessEditor {
|
|
|
return bodyBuilderTemp;
|
|
|
}
|
|
|
|
|
|
public void judgement(String value, String nodeName, StringBuilder builder) {
|
|
|
public void judgement(String config, String nodeName, StringBuilder builder) {
|
|
|
builder.append("\n.choice()");
|
|
|
builder.append("\n.when("+value+")");
|
|
|
builder.append("\n.when("+config+")");
|
|
|
String trueNodeName = "";
|
|
|
String falseNodeName = "";
|
|
|
for (Edge<String> edge : mDG.getEdgeList(nodeName)) {
|
|
@ -123,7 +123,7 @@ public class ProcessEditor {
|
|
|
String nextNodeName = edge.getDest();
|
|
|
String nextLineName = edge.getName();
|
|
|
JsonNode nextLine = lineMap.get(nextLineName);
|
|
|
if (nextLine.get("value") != null && nextLine.get("value").asText().equals("correct")) {
|
|
|
if (nextLine.get("config") != null && nextLine.get("config").asText().equals("true")) {
|
|
|
trueNodeName = nextNodeName;
|
|
|
} else {
|
|
|
falseNodeName = nextNodeName;
|
|
@ -142,17 +142,17 @@ public class ProcessEditor {
|
|
|
|
|
|
}
|
|
|
|
|
|
public void split(String value, StringBuilder builder) {
|
|
|
public void split(String config, StringBuilder builder) {
|
|
|
addPackageList("import com.yihu.hos.broker.util.Split;\n");
|
|
|
builder.append("\n.split().method(Split.class, \""+value+"\")");
|
|
|
builder.append("\n.split().method(Split.class, \""+config+"\")");
|
|
|
}
|
|
|
|
|
|
public void aggregate(String value, StringBuilder builder) {
|
|
|
public void aggregate(String config, StringBuilder builder) {
|
|
|
addPackageList("import com.yihu.hos.broker.util.Aggregate;\n");
|
|
|
builder.append("\n.aggregate(header(\""+value+"\"), new Aggregate()).completionSize(3)");
|
|
|
builder.append("\n.aggregate(header(\""+config+"\"), new Aggregate()).completionSize(3)");
|
|
|
}
|
|
|
|
|
|
public void multicast(String value, String nodeName, StringBuilder builder) {
|
|
|
public void multicast(String config, String nodeName, StringBuilder builder) {
|
|
|
|
|
|
String directs = "";
|
|
|
int i = 'a';
|
|
@ -175,11 +175,11 @@ public class ProcessEditor {
|
|
|
builder.append("\n.multicast().stopOnException().to("+directs+").end()");
|
|
|
}
|
|
|
|
|
|
public void format(String value, String nodeName, StringBuilder builder) {
|
|
|
public void format(String config, String nodeName, StringBuilder builder) {
|
|
|
|
|
|
addPackageList("import org.apache.camel.model.dataformat.XmlJsonDataFormat;\n");
|
|
|
preferBuilder.append("XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();\n");
|
|
|
builder.append("\n."+value + "(xmlJsonFormat)");
|
|
|
builder.append("\n."+config + "(xmlJsonFormat)");
|
|
|
}
|
|
|
|
|
|
public void addPackageList(String pack) {
|