소스 검색

!35 支持在NodeComponent里自定义beforeProcess和afterProcess,没有覆盖方式时,默认读取aspect里的方法
Merge pull request !35 from Aaron/master

铂赛东 3 년 전
부모
커밋
59bcf5fa2e
1개의 변경된 파일21개의 추가작업 그리고 10개의 파일을 삭제
  1. 21 10
      liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java

+ 21 - 10
liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java

@@ -73,17 +73,9 @@ public abstract class NodeComponent {
 		StopWatch stopWatch = new StopWatch();
 		stopWatch.start();
 
-		// process前置处理
-		if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
-			ComponentScanner.cmpAroundAspect.beforeProcess(this.getNodeId(), slot);
-		}
-
+		self.beforeProcess(this.getNodeId(), slot);
 		self.process();
-
-		// process后置处理
-		if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
-			ComponentScanner.cmpAroundAspect.afterProcess(this.getNodeId(), slot);
-		}
+		self.afterProcess(this.getNodeId(), slot);
 
 		stopWatch.stop();
 		
@@ -109,6 +101,25 @@ public abstract class NodeComponent {
 
 	public abstract void process() throws Exception;
 
+	/**
+	 * process前置处理
+	 */
+	public void beforeProcess(String nodeId, Slot slot) {
+		if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
+			ComponentScanner.cmpAroundAspect.beforeProcess(nodeId, slot);
+		}
+	}
+
+	/**
+	 * process后置处理
+	 */
+	public void afterProcess(String nodeId, Slot slot) {
+		if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
+			ComponentScanner.cmpAroundAspect.afterProcess(nodeId, slot);
+		}
+	}
+
+
 	/**
 	 * 是否进入该节点
 	 * @return boolean