mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
enhancement: #I1X83D 提一个优化:flow.xml配置文件中,编排的节点找不到时,需要打印出日志,方便找出哪个节点,好定位问题
This commit is contained in:
@@ -7,8 +7,10 @@ import java.util.Map.Entry;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.yomahub.liteflow.entity.flow.*;
|
import com.yomahub.liteflow.entity.flow.*;
|
||||||
import com.yomahub.liteflow.exception.ExecutableItemNotFoundException;
|
import com.yomahub.liteflow.exception.ExecutableItemNotFoundException;
|
||||||
|
import com.yomahub.liteflow.util.SpringAware;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
@@ -44,13 +46,15 @@ public abstract class XmlFlowParser {
|
|||||||
String clazz = null;
|
String clazz = null;
|
||||||
Node node = null;
|
Node node = null;
|
||||||
NodeComponent component = null;
|
NodeComponent component = null;
|
||||||
|
Class<NodeComponent> nodeComponentClass;
|
||||||
for (Element e : nodeList) {
|
for (Element e : nodeList) {
|
||||||
node = new Node();
|
node = new Node();
|
||||||
id = e.attributeValue("id");
|
id = e.attributeValue("id");
|
||||||
clazz = e.attributeValue("class");
|
clazz = e.attributeValue("class");
|
||||||
node.setId(id);
|
node.setId(id);
|
||||||
node.setClazz(clazz);
|
node.setClazz(clazz);
|
||||||
component = (NodeComponent) Class.forName(clazz).newInstance();
|
nodeComponentClass = (Class<NodeComponent>)Class.forName(clazz);
|
||||||
|
component = SpringAware.registerOrGet(nodeComponentClass);
|
||||||
if (component == null) {
|
if (component == null) {
|
||||||
LOG.error("couldn't find component class [{}] ", clazz);
|
LOG.error("couldn't find component class [{}] ", clazz);
|
||||||
}
|
}
|
||||||
@@ -72,7 +76,7 @@ public abstract class XmlFlowParser {
|
|||||||
parseOneChain(e);
|
parseOneChain(e);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("FlowParser parser exception: {}", e);
|
LOG.error("FlowParser parser exception", e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,7 +122,8 @@ public abstract class XmlFlowParser {
|
|||||||
Chain chain = FlowBus.getChain(item);
|
Chain chain = FlowBus.getChain(item);
|
||||||
chainNodeList.add(chain);
|
chainNodeList.add(chain);
|
||||||
}else{
|
}else{
|
||||||
throw new ExecutableItemNotFoundException();
|
String errorMsg = StrUtil.format("executable node[{}] is not found!",regexEntity.getItem());
|
||||||
|
throw new ExecutableItemNotFoundException(errorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (condE.getName().equals("then")) {
|
if (condE.getName().equals("then")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user