ProcessFlowUtils.java
package com.mycim.valueobject.prp;
import com.mycim.framework.utils.lang.StringUtils;
/**
* @author Qiansheng.Wang
* @since 2020-08-18
*/
public class ProcessFlowUtils {
public static Boolean isRouteNode(String nodeType) {
return "0".equals(nodeType);
}
/**
* <p>
* Parse workflow step path string.
* <p>
* The string format example: <br> NORMAL: 5150602.8.5185744|5147265.3.5153854 <br>
* (workflowRrn.workflowVersion.stepRrn|workflowOrTaskRrn.workflowVersion.stepRrn) ==
* (processRrn.processVersion.routeStepRrn|routeRrn.routeVersion.operationStepRrn) <br> REWORK:
* 5149828.1.5149836 <br> (workflowRrn.workflowVersion.stepRrn) == (routeRrn.routeVersion
* .operationStepRrn)
*
* @param wflStepPath Special format string
* @return {@code String[6]}. if {@code wflStepPath} is null or an error string, an empty string array
* will be returned <br> 0=processRrn,1=processVersion,2=routeStepRrn,3=routeRrn,4=routeVersion,
* 5=operationStepRrn
* <br>
* <p>
* Here is an example of how to use this string array:
*
* <pre>
* long processRrn = NumberUtils.toLong(stepPath[0])
* int processVersion = NumberUtils.toInt(stepPath[1])
* long routeStepRrn = NumberUtils.toLong(stepPath[2])
* long routeRrn = NumberUtils.toLong(stepPath[3])
* int routeVersion = NumberUtils.toInt(stepPath[4])
* long operationStepRrn = NumberUtils.toLong(stepPath[5])
* </pre>
* @author Qiansheng.Wang
*/
public static String[] parseWflStepPath(String wflStepPath) {
String[] result = new String[6];
String[] wflInfo = StringUtils.split(wflStepPath, '|');
if (wflInfo.length == 2) {
String[] processInfo = StringUtils.split(wflInfo[0], '.');
String[] routeInfo = StringUtils.split(wflInfo[1], '.');
result = StringUtils.mergeStringArraysForNotCheckContains(processInfo, routeInfo);
} else if (wflInfo.length == 1) {
String[] reworkWflInfo = StringUtils.split(wflInfo[0], '.');
if (reworkWflInfo.length == 3) {
result[3] = reworkWflInfo[0];
result[4] = reworkWflInfo[1];
result[5] = reworkWflInfo[2];
}
}
return result;
}
}