@ -84,6 +84,7 @@ import java.util.ArrayList;
import java.util.Arrays ;
import java.util.Arrays ;
import java.util.Calendar ;
import java.util.Calendar ;
import java.util.Date ;
import java.util.Date ;
import java.util.EnumMap ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.HashSet ;
import java.util.HashSet ;
import java.util.List ;
import java.util.List ;
@ -110,11 +111,11 @@ public class ProcessService {
private final Logger logger = LoggerFactory . getLogger ( getClass ( ) ) ;
private final Logger logger = LoggerFactory . getLogger ( getClass ( ) ) ;
private final int [ ] stateArray = new int [ ] { ExecutionStatus . SUBMITTED_SUCCESS . ordinal ( ) ,
private final int [ ] stateArray = new int [ ] { ExecutionStatus . SUBMITTED_SUCCESS . ordinal ( ) ,
ExecutionStatus . RUNNING_EXECUTION . ordinal ( ) ,
ExecutionStatus . RUNNING_EXECUTION . ordinal ( ) ,
ExecutionStatus . DELAY_EXECUTION . ordinal ( ) ,
ExecutionStatus . DELAY_EXECUTION . ordinal ( ) ,
ExecutionStatus . READY_PAUSE . ordinal ( ) ,
ExecutionStatus . READY_PAUSE . ordinal ( ) ,
ExecutionStatus . READY_STOP . ordinal ( ) } ;
ExecutionStatus . READY_STOP . ordinal ( ) } ;
@Autowired
@Autowired
private UserMapper userMapper ;
private UserMapper userMapper ;
@ -158,16 +159,16 @@ public class ProcessService {
/ * *
/ * *
* handle Command ( construct ProcessInstance from Command ) , wrapped in transaction
* handle Command ( construct ProcessInstance from Command ) , wrapped in transaction
*
*
* @param logger logger
* @param logger logger
* @param host host
* @param host host
* @param validThreadNum validThreadNum
* @param validThreadNum validThreadNum
* @param command found command
* @param command found command
* @return process instance
* @return process instance
* /
* /
@Transactional ( rollbackFor = Exception . class )
@Transactional ( rollbackFor = Exception . class )
public ProcessInstance handleCommand ( Logger logger , String host , int validThreadNum , Command command ) {
public ProcessInstance handleCommand ( Logger logger , String host , int validThreadNum , Command command ) {
ProcessInstance processInstance = constructProcessInstance ( command , host ) ;
ProcessInstance processInstance = constructProcessInstance ( command , host ) ;
//cannot construct process instance, return null;
// cannot construct process instance, return null
if ( processInstance = = null ) {
if ( processInstance = = null ) {
logger . error ( "scan command, command parameter is error: {}" , command ) ;
logger . error ( "scan command, command parameter is error: {}" , command ) ;
moveToErrorCommand ( command , "process instance is null" ) ;
moveToErrorCommand ( command , "process instance is null" ) ;
@ -201,7 +202,7 @@ public class ProcessService {
/ * *
/ * *
* set process waiting thread
* set process waiting thread
*
*
* @param command command
* @param command command
* @param processInstance processInstance
* @param processInstance processInstance
* @return process instance
* @return process instance
* /
* /
@ -219,7 +220,7 @@ public class ProcessService {
/ * *
/ * *
* check thread num
* check thread num
*
*
* @param command command
* @param command command
* @param validThreadNum validThreadNum
* @param validThreadNum validThreadNum
* @return if thread is enough
* @return if thread is enough
* /
* /
@ -259,7 +260,7 @@ public class ProcessService {
* /
* /
public Boolean verifyIsNeedCreateCommand ( Command command ) {
public Boolean verifyIsNeedCreateCommand ( Command command ) {
Boolean isNeedCreate = true ;
Boolean isNeedCreate = true ;
Map < CommandType , Integer > cmdTypeMap = new HashMap < CommandType , Integer > ( ) ;
Enum Map< CommandType , Integer > cmdTypeMap = new EnumMap < > ( CommandType . class ) ;
cmdTypeMap . put ( CommandType . REPEAT_RUNNING , 1 ) ;
cmdTypeMap . put ( CommandType . REPEAT_RUNNING , 1 ) ;
cmdTypeMap . put ( CommandType . RECOVER_SUSPENDED_PROCESS , 1 ) ;
cmdTypeMap . put ( CommandType . RECOVER_SUSPENDED_PROCESS , 1 ) ;
cmdTypeMap . put ( CommandType . START_FAILURE_TASK_PROCESS , 1 ) ;
cmdTypeMap . put ( CommandType . START_FAILURE_TASK_PROCESS , 1 ) ;
@ -296,9 +297,6 @@ public class ProcessService {
/ * *
/ * *
* get task node list by definitionId
* get task node list by definitionId
*
* @param defineId
* @return
* /
* /
public List < TaskNode > getTaskNodeListByDefinitionId ( Integer defineId ) {
public List < TaskNode > getTaskNodeListByDefinitionId ( Integer defineId ) {
ProcessDefinition processDefinition = processDefineMapper . selectById ( defineId ) ;
ProcessDefinition processDefinition = processDefineMapper . selectById ( defineId ) ;
@ -425,7 +423,7 @@ public class ProcessService {
* recursive query sub process definition id by parent id .
* recursive query sub process definition id by parent id .
*
*
* @param parentId parentId
* @param parentId parentId
* @param ids ids
* @param ids ids
* /
* /
public void recurseFindSubProcessId ( int parentId , List < Integer > ids ) {
public void recurseFindSubProcessId ( int parentId , List < Integer > ids ) {
ProcessDefinition processDefinition = processDefineMapper . selectById ( parentId ) ;
ProcessDefinition processDefinition = processDefineMapper . selectById ( parentId ) ;
@ -435,7 +433,7 @@ public class ProcessService {
List < TaskNode > taskNodeList = processData . getTasks ( ) ;
List < TaskNode > taskNodeList = processData . getTasks ( ) ;
if ( taskNodeList ! = null & & taskNodeList . size ( ) > 0 ) {
if ( taskNodeList ! = null & & ! taskNodeList . isEmpty ( ) ) {
for ( TaskNode taskNode : taskNodeList ) {
for ( TaskNode taskNode : taskNodeList ) {
String parameter = taskNode . getParams ( ) ;
String parameter = taskNode . getParams ( ) ;
@ -456,7 +454,7 @@ public class ProcessService {
* create recovery waiting thread command and delete origin command at the same time .
* create recovery waiting thread command and delete origin command at the same time .
* if the recovery command is exists , only update the field update_time
* if the recovery command is exists , only update the field update_time
*
*
* @param originCommand originCommand
* @param originCommand originCommand
* @param processInstance processInstance
* @param processInstance processInstance
* /
* /
public void createRecoveryWaitingThreadCommand ( Command originCommand , ProcessInstance processInstance ) {
public void createRecoveryWaitingThreadCommand ( Command originCommand , ProcessInstance processInstance ) {
@ -473,17 +471,17 @@ public class ProcessService {
// process instance quit by "waiting thread" state
// process instance quit by "waiting thread" state
if ( originCommand = = null ) {
if ( originCommand = = null ) {
Command command = new Command (
Command command = new Command (
CommandType . RECOVER_WAITTING_THREAD ,
CommandType . RECOVER_WAITTING_THREAD ,
processInstance . getTaskDependType ( ) ,
processInstance . getTaskDependType ( ) ,
processInstance . getFailureStrategy ( ) ,
processInstance . getFailureStrategy ( ) ,
processInstance . getExecutorId ( ) ,
processInstance . getExecutorId ( ) ,
processInstance . getProcessDefinitionId ( ) ,
processInstance . getProcessDefinitionId ( ) ,
JSONUtils . toJsonString ( cmdParam ) ,
JSONUtils . toJsonString ( cmdParam ) ,
processInstance . getWarningType ( ) ,
processInstance . getWarningType ( ) ,
processInstance . getWarningGroupId ( ) ,
processInstance . getWarningGroupId ( ) ,
processInstance . getScheduleTime ( ) ,
processInstance . getScheduleTime ( ) ,
processInstance . getWorkerGroup ( ) ,
processInstance . getWorkerGroup ( ) ,
processInstance . getProcessInstancePriority ( )
processInstance . getProcessInstancePriority ( )
) ;
) ;
saveCommand ( command ) ;
saveCommand ( command ) ;
return ;
return ;
@ -508,16 +506,14 @@ public class ProcessService {
/ * *
/ * *
* get schedule time from command
* get schedule time from command
*
*
* @param command command
* @param command command
* @param cmdParam cmdParam map
* @param cmdParam cmdParam map
* @return date
* @return date
* /
* /
private Date getScheduleTime ( Command command , Map < String , String > cmdParam ) {
private Date getScheduleTime ( Command command , Map < String , String > cmdParam ) {
Date scheduleTime = command . getScheduleTime ( ) ;
Date scheduleTime = command . getScheduleTime ( ) ;
if ( scheduleTime = = null ) {
if ( scheduleTime = = null & & cmdParam ! = null & & cmdParam . containsKey ( CMDPARAM_COMPLEMENT_DATA_START_DATE ) ) {
if ( cmdParam ! = null & & cmdParam . containsKey ( CMDPARAM_COMPLEMENT_DATA_START_DATE ) ) {
scheduleTime = DateUtils . stringToDate ( cmdParam . get ( CMDPARAM_COMPLEMENT_DATA_START_DATE ) ) ;
scheduleTime = DateUtils . stringToDate ( cmdParam . get ( CMDPARAM_COMPLEMENT_DATA_START_DATE ) ) ;
}
}
}
return scheduleTime ;
return scheduleTime ;
}
}
@ -526,8 +522,8 @@ public class ProcessService {
* generate a new work process instance from command .
* generate a new work process instance from command .
*
*
* @param processDefinition processDefinition
* @param processDefinition processDefinition
* @param command command
* @param command command
* @param cmdParam cmdParam map
* @param cmdParam cmdParam map
* @return process instance
* @return process instance
* /
* /
private ProcessInstance generateNewProcessInstance ( ProcessDefinition processDefinition ,
private ProcessInstance generateNewProcessInstance ( ProcessDefinition processDefinition ,
@ -580,10 +576,10 @@ public class ProcessService {
// curing global params
// curing global params
processInstance . setGlobalParams ( ParameterUtils . curingGlobalParams (
processInstance . setGlobalParams ( ParameterUtils . curingGlobalParams (
processDefinition . getGlobalParamMap ( ) ,
processDefinition . getGlobalParamMap ( ) ,
processDefinition . getGlobalParamList ( ) ,
processDefinition . getGlobalParamList ( ) ,
getCommandTypeIfComplement ( processInstance , command ) ,
getCommandTypeIfComplement ( processInstance , command ) ,
processInstance . getScheduleTime ( ) ) ) ;
processInstance . getScheduleTime ( ) ) ) ;
//copy process define json to process instance
//copy process define json to process instance
processInstance . setProcessInstanceJson ( processDefinition . getProcessDefinitionJson ( ) ) ;
processInstance . setProcessInstanceJson ( processDefinition . getProcessDefinitionJson ( ) ) ;
@ -603,7 +599,7 @@ public class ProcessService {
* use definition creator ' s tenant .
* use definition creator ' s tenant .
*
*
* @param tenantId tenantId
* @param tenantId tenantId
* @param userId userId
* @param userId userId
* @return tenant
* @return tenant
* /
* /
public Tenant getTenantForProcess ( int tenantId , int userId ) {
public Tenant getTenantForProcess ( int tenantId , int userId ) {
@ -626,15 +622,15 @@ public class ProcessService {
/ * *
/ * *
* check command parameters is valid
* check command parameters is valid
*
*
* @param command command
* @param command command
* @param cmdParam cmdParam map
* @param cmdParam cmdParam map
* @return whether command param is valid
* @return whether command param is valid
* /
* /
private Boolean checkCmdParam ( Command command , Map < String , String > cmdParam ) {
private Boolean checkCmdParam ( Command command , Map < String , String > cmdParam ) {
if ( command . getTaskDependType ( ) = = TaskDependType . TASK_ONLY | | command . getTaskDependType ( ) = = TaskDependType . TASK_PRE ) {
if ( command . getTaskDependType ( ) = = TaskDependType . TASK_ONLY | | command . getTaskDependType ( ) = = TaskDependType . TASK_PRE ) {
if ( cmdParam = = null
if ( cmdParam = = null
| | ! cmdParam . containsKey ( Constants . CMD_PARAM_START_NODE_NAMES )
| | ! cmdParam . containsKey ( Constants . CMD_PARAM_START_NODE_NAMES )
| | cmdParam . get ( Constants . CMD_PARAM_START_NODE_NAMES ) . isEmpty ( ) ) {
| | cmdParam . get ( Constants . CMD_PARAM_START_NODE_NAMES ) . isEmpty ( ) ) {
logger . error ( "command node depend type is {}, but start nodes is null " , command . getTaskDependType ( ) ) ;
logger . error ( "command node depend type is {}, but start nodes is null " , command . getTaskDependType ( ) ) ;
return false ;
return false ;
}
}
@ -646,7 +642,7 @@ public class ProcessService {
* construct process instance according to one command .
* construct process instance according to one command .
*
*
* @param command command
* @param command command
* @param host host
* @param host host
* @return process instance
* @return process instance
* /
* /
private ProcessInstance constructProcessInstance ( Command command , String host ) {
private ProcessInstance constructProcessInstance ( Command command , String host ) {
@ -714,7 +710,7 @@ public class ProcessService {
// generate one new process instance
// generate one new process instance
processInstance = generateNewProcessInstance ( processDefinition , command , cmdParam ) ;
processInstance = generateNewProcessInstance ( processDefinition , command , cmdParam ) ;
}
}
if ( ! checkCmdParam ( command , cmdParam ) ) {
if ( Boolean . FALSE . equals ( checkCmdParam ( command , cmdParam ) ) ) {
logger . error ( "command parameter check failed!" ) ;
logger . error ( "command parameter check failed!" ) ;
return null ;
return null ;
}
}
@ -742,7 +738,7 @@ public class ProcessService {
initTaskInstance ( this . findTaskInstanceById ( taskId ) ) ;
initTaskInstance ( this . findTaskInstanceById ( taskId ) ) ;
}
}
cmdParam . put ( Constants . CMD_PARAM_RECOVERY_START_NODE_STRING ,
cmdParam . put ( Constants . CMD_PARAM_RECOVERY_START_NODE_STRING ,
String . join ( Constants . COMMA , convertIntListToString ( failedList ) ) ) ;
String . join ( Constants . COMMA , convertIntListToString ( failedList ) ) ) ;
processInstance . setCommandParam ( JSONUtils . toJsonString ( cmdParam ) ) ;
processInstance . setCommandParam ( JSONUtils . toJsonString ( cmdParam ) ) ;
processInstance . setRunTimes ( runTime + 1 ) ;
processInstance . setRunTimes ( runTime + 1 ) ;
break ;
break ;
@ -755,7 +751,7 @@ public class ProcessService {
cmdParam . remove ( Constants . CMD_PARAM_RECOVERY_START_NODE_STRING ) ;
cmdParam . remove ( Constants . CMD_PARAM_RECOVERY_START_NODE_STRING ) ;
List < Integer > suspendedNodeList = this . findTaskIdByInstanceState ( processInstance . getId ( ) , ExecutionStatus . PAUSE ) ;
List < Integer > suspendedNodeList = this . findTaskIdByInstanceState ( processInstance . getId ( ) , ExecutionStatus . PAUSE ) ;
List < Integer > stopNodeList = findTaskIdByInstanceState ( processInstance . getId ( ) ,
List < Integer > stopNodeList = findTaskIdByInstanceState ( processInstance . getId ( ) ,
ExecutionStatus . KILL ) ;
ExecutionStatus . KILL ) ;
suspendedNodeList . addAll ( stopNodeList ) ;
suspendedNodeList . addAll ( stopNodeList ) ;
for ( Integer taskId : suspendedNodeList ) {
for ( Integer taskId : suspendedNodeList ) {
// initialize the pause state
// initialize the pause state
@ -809,7 +805,7 @@ public class ProcessService {
* return complement data if the process start with complement data
* return complement data if the process start with complement data
*
*
* @param processInstance processInstance
* @param processInstance processInstance
* @param command command
* @param command command
* @return command type
* @return command type
* /
* /
private CommandType getCommandTypeIfComplement ( ProcessInstance processInstance , Command command ) {
private CommandType getCommandTypeIfComplement ( ProcessInstance processInstance , Command command ) {
@ -824,8 +820,8 @@ public class ProcessService {
* initialize complement data parameters
* initialize complement data parameters
*
*
* @param processDefinition processDefinition
* @param processDefinition processDefinition
* @param processInstance processInstance
* @param processInstance processInstance
* @param cmdParam cmdParam
* @param cmdParam cmdParam
* /
* /
private void initComplementDataParam ( ProcessDefinition processDefinition ,
private void initComplementDataParam ( ProcessDefinition processDefinition ,
ProcessInstance processInstance ,
ProcessInstance processInstance ,
@ -835,14 +831,14 @@ public class ProcessService {
}
}
Date startComplementTime = DateUtils . parse ( cmdParam . get ( CMDPARAM_COMPLEMENT_DATA_START_DATE ) ,
Date startComplementTime = DateUtils . parse ( cmdParam . get ( CMDPARAM_COMPLEMENT_DATA_START_DATE ) ,
YYYY_MM_DD_HH_MM_SS ) ;
YYYY_MM_DD_HH_MM_SS ) ;
if ( Flag . NO = = processInstance . getIsSubProcess ( ) ) {
if ( Flag . NO = = processInstance . getIsSubProcess ( ) ) {
processInstance . setScheduleTime ( startComplementTime ) ;
processInstance . setScheduleTime ( startComplementTime ) ;
}
}
processInstance . setGlobalParams ( ParameterUtils . curingGlobalParams (
processInstance . setGlobalParams ( ParameterUtils . curingGlobalParams (
processDefinition . getGlobalParamMap ( ) ,
processDefinition . getGlobalParamMap ( ) ,
processDefinition . getGlobalParamList ( ) ,
processDefinition . getGlobalParamList ( ) ,
CommandType . COMPLEMENT_DATA , processInstance . getScheduleTime ( ) ) ) ;
CommandType . COMPLEMENT_DATA , processInstance . getScheduleTime ( ) ) ) ;
}
}
@ -862,7 +858,7 @@ public class ProcessService {
Map < String , String > paramMap = JSONUtils . toMap ( cmdParam ) ;
Map < String , String > paramMap = JSONUtils . toMap ( cmdParam ) ;
// write sub process id into cmd param.
// write sub process id into cmd param.
if ( paramMap . containsKey ( CMD_PARAM_SUB_PROCESS )
if ( paramMap . containsKey ( CMD_PARAM_SUB_PROCESS )
& & CMD_PARAM_EMPTY_SUB_PROCESS . equals ( paramMap . get ( CMD_PARAM_SUB_PROCESS ) ) ) {
& & CMD_PARAM_EMPTY_SUB_PROCESS . equals ( paramMap . get ( CMD_PARAM_SUB_PROCESS ) ) ) {
paramMap . remove ( CMD_PARAM_SUB_PROCESS ) ;
paramMap . remove ( CMD_PARAM_SUB_PROCESS ) ;
paramMap . put ( CMD_PARAM_SUB_PROCESS , String . valueOf ( subProcessInstance . getId ( ) ) ) ;
paramMap . put ( CMD_PARAM_SUB_PROCESS , String . valueOf ( subProcessInstance . getId ( ) ) ) ;
subProcessInstance . setCommandParam ( JSONUtils . toJsonString ( paramMap ) ) ;
subProcessInstance . setCommandParam ( JSONUtils . toJsonString ( paramMap ) ) ;
@ -875,7 +871,7 @@ public class ProcessService {
ProcessInstance parentInstance = findProcessInstanceDetailById ( Integer . parseInt ( parentInstanceId ) ) ;
ProcessInstance parentInstance = findProcessInstanceDetailById ( Integer . parseInt ( parentInstanceId ) ) ;
if ( parentInstance ! = null ) {
if ( parentInstance ! = null ) {
subProcessInstance . setGlobalParams (
subProcessInstance . setGlobalParams (
joinGlobalParams ( parentInstance . getGlobalParams ( ) , subProcessInstance . getGlobalParams ( ) ) ) ;
joinGlobalParams ( parentInstance . getGlobalParams ( ) , subProcessInstance . getGlobalParams ( ) ) ) ;
this . saveProcessInstance ( subProcessInstance ) ;
this . saveProcessInstance ( subProcessInstance ) ;
} else {
} else {
logger . error ( "sub process command params error, cannot find parent instance: {} " , cmdParam ) ;
logger . error ( "sub process command params error, cannot find parent instance: {} " , cmdParam ) ;
@ -897,7 +893,7 @@ public class ProcessService {
* only the keys doesn ' t in sub process global would be joined .
* only the keys doesn ' t in sub process global would be joined .
*
*
* @param parentGlobalParams parentGlobalParams
* @param parentGlobalParams parentGlobalParams
* @param subGlobalParams subGlobalParams
* @param subGlobalParams subGlobalParams
* @return global params join
* @return global params join
* /
* /
private String joinGlobalParams ( String parentGlobalParams , String subGlobalParams ) {
private String joinGlobalParams ( String parentGlobalParams , String subGlobalParams ) {
@ -922,12 +918,11 @@ public class ProcessService {
* /
* /
private void initTaskInstance ( TaskInstance taskInstance ) {
private void initTaskInstance ( TaskInstance taskInstance ) {
if ( ! taskInstance . isSubProcess ( ) ) {
if ( ! taskInstance . isSubProcess ( )
if ( taskInstance . getState ( ) . typeIsCancel ( ) | | taskInstance . getState ( ) . typeIsFailure ( ) ) {
& & ( taskInstance . getState ( ) . typeIsCancel ( ) | | taskInstance . getState ( ) . typeIsFailure ( ) ) ) {
taskInstance . setFlag ( Flag . NO ) ;
taskInstance . setFlag ( Flag . NO ) ;
updateTaskInstance ( taskInstance ) ;
updateTaskInstance ( taskInstance ) ;
return ;
return ;
}
}
}
taskInstance . setState ( ExecutionStatus . SUBMITTED_SUCCESS ) ;
taskInstance . setState ( ExecutionStatus . SUBMITTED_SUCCESS ) ;
updateTaskInstance ( taskInstance ) ;
updateTaskInstance ( taskInstance ) ;
@ -944,12 +939,12 @@ public class ProcessService {
public TaskInstance submitTask ( TaskInstance taskInstance ) {
public TaskInstance submitTask ( TaskInstance taskInstance ) {
ProcessInstance processInstance = this . findProcessInstanceDetailById ( taskInstance . getProcessInstanceId ( ) ) ;
ProcessInstance processInstance = this . findProcessInstanceDetailById ( taskInstance . getProcessInstanceId ( ) ) ;
logger . info ( "start submit task : {}, instance id:{}, state: {}" ,
logger . info ( "start submit task : {}, instance id:{}, state: {}" ,
taskInstance . getName ( ) , taskInstance . getProcessInstanceId ( ) , processInstance . getState ( ) ) ;
taskInstance . getName ( ) , taskInstance . getProcessInstanceId ( ) , processInstance . getState ( ) ) ;
//submit to db
//submit to db
TaskInstance task = submitTaskInstanceToDB ( taskInstance , processInstance ) ;
TaskInstance task = submitTaskInstanceToDB ( taskInstance , processInstance ) ;
if ( task = = null ) {
if ( task = = null ) {
logger . error ( "end submit task to db error, task name:{}, process id:{} state: {} " ,
logger . error ( "end submit task to db error, task name:{}, process id:{} state: {} " ,
taskInstance . getName ( ) , taskInstance . getProcessInstance ( ) , processInstance . getState ( ) ) ;
taskInstance . getName ( ) , taskInstance . getProcessInstance ( ) , processInstance . getState ( ) ) ;
return task ;
return task ;
}
}
if ( ! task . getState ( ) . typeIsFinished ( ) ) {
if ( ! task . getState ( ) . typeIsFinished ( ) ) {
@ -957,7 +952,7 @@ public class ProcessService {
}
}
logger . info ( "end submit task to db successfully:{} state:{} complete, instance id:{} state: {} " ,
logger . info ( "end submit task to db successfully:{} state:{} complete, instance id:{} state: {} " ,
taskInstance . getName ( ) , task . getState ( ) , processInstance . getId ( ) , processInstance . getState ( ) ) ;
taskInstance . getName ( ) , task . getState ( ) , processInstance . getId ( ) , processInstance . getState ( ) ) ;
return task ;
return task ;
}
}
@ -968,7 +963,7 @@ public class ProcessService {
* set map { parent instance id , task instance id , 0 ( child instance id ) }
* set map { parent instance id , task instance id , 0 ( child instance id ) }
*
*
* @param parentInstance parentInstance
* @param parentInstance parentInstance
* @param parentTask parentTask
* @param parentTask parentTask
* @return process instance map
* @return process instance map
* /
* /
private ProcessInstanceMap setProcessInstanceMap ( ProcessInstance parentInstance , TaskInstance parentTask ) {
private ProcessInstanceMap setProcessInstanceMap ( ProcessInstance parentInstance , TaskInstance parentTask ) {
@ -997,7 +992,7 @@ public class ProcessService {
* find previous task work process map .
* find previous task work process map .
*
*
* @param parentProcessInstance parentProcessInstance
* @param parentProcessInstance parentProcessInstance
* @param parentTask parentTask
* @param parentTask parentTask
* @return process instance map
* @return process instance map
* /
* /
private ProcessInstanceMap findPreviousTaskProcessMap ( ProcessInstance parentProcessInstance ,
private ProcessInstanceMap findPreviousTaskProcessMap ( ProcessInstance parentProcessInstance ,
@ -1015,7 +1010,7 @@ public class ProcessService {
}
}
}
}
logger . info ( "sub process instance is not found,parent task:{},parent instance:{}" ,
logger . info ( "sub process instance is not found,parent task:{},parent instance:{}" ,
parentTask . getId ( ) , parentProcessInstance . getId ( ) ) ;
parentTask . getId ( ) , parentProcessInstance . getId ( ) ) ;
return null ;
return null ;
}
}
@ -1049,10 +1044,6 @@ public class ProcessService {
/ * *
/ * *
* complement data needs transform parent parameter to child .
* complement data needs transform parent parameter to child .
*
* @param instanceMap
* @param parentProcessInstance
* @return
* /
* /
private String getSubWorkFlowParam ( ProcessInstanceMap instanceMap , ProcessInstance parentProcessInstance ) {
private String getSubWorkFlowParam ( ProcessInstanceMap instanceMap , ProcessInstance parentProcessInstance ) {
// set sub work process command
// set sub work process command
@ -1071,11 +1062,6 @@ public class ProcessService {
/ * *
/ * *
* create sub work process command
* create sub work process command
*
* @param parentProcessInstance
* @param childInstance
* @param instanceMap
* @param task
* /
* /
public Command createSubProcessCommand ( ProcessInstance parentProcessInstance ,
public Command createSubProcessCommand ( ProcessInstance parentProcessInstance ,
ProcessInstance childInstance ,
ProcessInstance childInstance ,
@ -1088,25 +1074,23 @@ public class ProcessService {
String processParam = getSubWorkFlowParam ( instanceMap , parentProcessInstance ) ;
String processParam = getSubWorkFlowParam ( instanceMap , parentProcessInstance ) ;
return new Command (
return new Command (
commandType ,
commandType ,
TaskDependType . TASK_POST ,
TaskDependType . TASK_POST ,
parentProcessInstance . getFailureStrategy ( ) ,
parentProcessInstance . getFailureStrategy ( ) ,
parentProcessInstance . getExecutorId ( ) ,
parentProcessInstance . getExecutorId ( ) ,
childDefineId ,
childDefineId ,
processParam ,
processParam ,
parentProcessInstance . getWarningType ( ) ,
parentProcessInstance . getWarningType ( ) ,
parentProcessInstance . getWarningGroupId ( ) ,
parentProcessInstance . getWarningGroupId ( ) ,
parentProcessInstance . getScheduleTime ( ) ,
parentProcessInstance . getScheduleTime ( ) ,
task . getWorkerGroup ( ) ,
task . getWorkerGroup ( ) ,
parentProcessInstance . getProcessInstancePriority ( )
parentProcessInstance . getProcessInstancePriority ( )
) ;
) ;
}
}
/ * *
/ * *
* initialize sub work flow state
* initialize sub work flow state
* child instance state would be initialized when ' recovery from pause / stop / failure '
* child instance state would be initialized when ' recovery from pause / stop / failure '
*
* @param childInstance
* /
* /
private void initSubInstanceState ( ProcessInstance childInstance ) {
private void initSubInstanceState ( ProcessInstance childInstance ) {
if ( childInstance ! = null ) {
if ( childInstance ! = null ) {
@ -1119,9 +1103,6 @@ public class ProcessService {
* get sub work flow command type
* get sub work flow command type
* child instance exist : child command = fatherCommand
* child instance exist : child command = fatherCommand
* child instance not exists : child command = fatherCommand [ 0 ]
* child instance not exists : child command = fatherCommand [ 0 ]
*
* @param parentProcessInstance
* @return
* /
* /
private CommandType getSubCommandType ( ProcessInstance parentProcessInstance , ProcessInstance childInstance ) {
private CommandType getSubCommandType ( ProcessInstance parentProcessInstance , ProcessInstance childInstance ) {
CommandType commandType = parentProcessInstance . getCommandType ( ) ;
CommandType commandType = parentProcessInstance . getCommandType ( ) ;
@ -1136,7 +1117,7 @@ public class ProcessService {
* update sub process definition
* update sub process definition
*
*
* @param parentProcessInstance parentProcessInstance
* @param parentProcessInstance parentProcessInstance
* @param childDefinitionId childDefinitionId
* @param childDefinitionId childDefinitionId
* /
* /
private void updateSubProcessDefinitionByParent ( ProcessInstance parentProcessInstance , int childDefinitionId ) {
private void updateSubProcessDefinitionByParent ( ProcessInstance parentProcessInstance , int childDefinitionId ) {
ProcessDefinition fatherDefinition = this . findProcessDefineById ( parentProcessInstance . getProcessDefinitionId ( ) ) ;
ProcessDefinition fatherDefinition = this . findProcessDefineById ( parentProcessInstance . getProcessDefinitionId ( ) ) ;
@ -1150,7 +1131,7 @@ public class ProcessService {
/ * *
/ * *
* submit task to mysql
* submit task to mysql
*
*
* @param taskInstance taskInstance
* @param taskInstance taskInstance
* @param processInstance processInstance
* @param processInstance processInstance
* @return task instance
* @return task instance
* /
* /
@ -1163,7 +1144,7 @@ public class ProcessService {
} else {
} else {
if ( processInstanceState ! = ExecutionStatus . READY_STOP
if ( processInstanceState ! = ExecutionStatus . READY_STOP
& & processInstanceState ! = ExecutionStatus . READY_PAUSE ) {
& & processInstanceState ! = ExecutionStatus . READY_PAUSE ) {
// failure task set invalid
// failure task set invalid
taskInstance . setFlag ( Flag . NO ) ;
taskInstance . setFlag ( Flag . NO ) ;
updateTaskInstance ( taskInstance ) ;
updateTaskInstance ( taskInstance ) ;
@ -1204,19 +1185,19 @@ public class ProcessService {
* return stop if work process state is ready stop
* return stop if work process state is ready stop
* if all of above are not satisfied , return submit success
* if all of above are not satisfied , return submit success
*
*
* @param taskInstance taskInstance
* @param taskInstance taskInstance
* @param processInstanceState processInstanceState
* @param processInstanceState processInstanceState
* @return process instance state
* @return process instance state
* /
* /
public ExecutionStatus getSubmitTaskState ( TaskInstance taskInstance , ExecutionStatus processInstanceState ) {
public ExecutionStatus getSubmitTaskState ( TaskInstance taskInstance , ExecutionStatus processInstanceState ) {
ExecutionStatus state = taskInstance . getState ( ) ;
ExecutionStatus state = taskInstance . getState ( ) ;
if (
if (
// running, delayed or killed
// running, delayed or killed
// the task already exists in task queue
// the task already exists in task queue
// return state
// return state
state = = ExecutionStatus . RUNNING_EXECUTION
state = = ExecutionStatus . RUNNING_EXECUTION
| | state = = ExecutionStatus . DELAY_EXECUTION
| | state = = ExecutionStatus . DELAY_EXECUTION
| | state = = ExecutionStatus . KILL
| | state = = ExecutionStatus . KILL
) {
) {
return state ;
return state ;
}
}
@ -1225,7 +1206,7 @@ public class ProcessService {
if ( processInstanceState = = ExecutionStatus . READY_PAUSE ) {
if ( processInstanceState = = ExecutionStatus . READY_PAUSE ) {
state = ExecutionStatus . PAUSE ;
state = ExecutionStatus . PAUSE ;
} else if ( processInstanceState = = ExecutionStatus . READY_STOP
} else if ( processInstanceState = = ExecutionStatus . READY_STOP
| | ! checkProcessStrategy ( taskInstance ) ) {
| | ! checkProcessStrategy ( taskInstance ) ) {
state = ExecutionStatus . KILL ;
state = ExecutionStatus . KILL ;
} else {
} else {
state = ExecutionStatus . SUBMITTED_SUCCESS ;
state = ExecutionStatus . SUBMITTED_SUCCESS ;
@ -1380,7 +1361,7 @@ public class ProcessService {
* get id list by task state
* get id list by task state
*
*
* @param instanceId instanceId
* @param instanceId instanceId
* @param state state
* @param state state
* @return task instance states
* @return task instance states
* /
* /
public List < Integer > findTaskIdByInstanceState ( int instanceId , ExecutionStatus state ) {
public List < Integer > findTaskIdByInstanceState ( int instanceId , ExecutionStatus state ) {
@ -1435,7 +1416,7 @@ public class ProcessService {
* find work process map by parent process id and parent task id .
* find work process map by parent process id and parent task id .
*
*
* @param parentWorkProcessId parentWorkProcessId
* @param parentWorkProcessId parentWorkProcessId
* @param parentTaskId parentTaskId
* @param parentTaskId parentTaskId
* @return process instance map
* @return process instance map
* /
* /
public ProcessInstanceMap findWorkProcessMapByParent ( Integer parentWorkProcessId , Integer parentTaskId ) {
public ProcessInstanceMap findWorkProcessMapByParent ( Integer parentWorkProcessId , Integer parentTaskId ) {
@ -1457,7 +1438,7 @@ public class ProcessService {
* find sub process instance
* find sub process instance
*
*
* @param parentProcessId parentProcessId
* @param parentProcessId parentProcessId
* @param parentTaskId parentTaskId
* @param parentTaskId parentTaskId
* @return process instance
* @return process instance
* /
* /
public ProcessInstance findSubProcessInstance ( Integer parentProcessId , Integer parentTaskId ) {
public ProcessInstance findSubProcessInstance ( Integer parentProcessId , Integer parentTaskId ) {
@ -1489,12 +1470,12 @@ public class ProcessService {
/ * *
/ * *
* change task state
* change task state
*
*
* @param state state
* @param state state
* @param startTime startTime
* @param startTime startTime
* @param host host
* @param host host
* @param executePath executePath
* @param executePath executePath
* @param logPath logPath
* @param logPath logPath
* @param taskInstId taskInstId
* @param taskInstId taskInstId
* /
* /
public void changeTaskState ( TaskInstance taskInstance , ExecutionStatus state , Date startTime , String host ,
public void changeTaskState ( TaskInstance taskInstance , ExecutionStatus state , Date startTime , String host ,
String executePath ,
String executePath ,
@ -1522,12 +1503,12 @@ public class ProcessService {
* update the process instance
* update the process instance
*
*
* @param processInstanceId processInstanceId
* @param processInstanceId processInstanceId
* @param processJson processJson
* @param processJson processJson
* @param globalParams globalParams
* @param globalParams globalParams
* @param scheduleTime scheduleTime
* @param scheduleTime scheduleTime
* @param flag flag
* @param flag flag
* @param locations locations
* @param locations locations
* @param connects connects
* @param connects connects
* @return update process instance result
* @return update process instance result
* /
* /
public int updateProcessInstance ( Integer processInstanceId , String processJson ,
public int updateProcessInstance ( Integer processInstanceId , String processJson ,
@ -1548,10 +1529,10 @@ public class ProcessService {
/ * *
/ * *
* change task state
* change task state
*
*
* @param state state
* @param state state
* @param endTime endTime
* @param endTime endTime
* @param taskInstId taskInstId
* @param taskInstId taskInstId
* @param varPool varPool
* @param varPool varPool
* /
* /
public void changeTaskState ( TaskInstance taskInstance , ExecutionStatus state ,
public void changeTaskState ( TaskInstance taskInstance , ExecutionStatus state ,
Date endTime ,
Date endTime ,
@ -1577,7 +1558,7 @@ public class ProcessService {
if ( intList = = null ) {
if ( intList = = null ) {
return new ArrayList < > ( ) ;
return new ArrayList < > ( ) ;
}
}
List < String > result = new ArrayList < String > ( intList . size ( ) ) ;
List < String > result = new ArrayList < > ( intList . size ( ) ) ;
for ( Integer intVar : intList ) {
for ( Integer intVar : intList ) {
result . add ( String . valueOf ( intVar ) ) ;
result . add ( String . valueOf ( intVar ) ) ;
}
}
@ -1642,7 +1623,7 @@ public class ProcessService {
* /
* /
public List < TaskInstance > queryNeedFailoverTaskInstances ( String host ) {
public List < TaskInstance > queryNeedFailoverTaskInstances ( String host ) {
return taskInstanceMapper . queryByHostAndStatus ( host ,
return taskInstanceMapper . queryByHostAndStatus ( host ,
stateArray ) ;
stateArray ) ;
}
}
/ * *
/ * *
@ -1659,7 +1640,7 @@ public class ProcessService {
* update process instance state by id
* update process instance state by id
*
*
* @param processInstanceId processInstanceId
* @param processInstanceId processInstanceId
* @param executionStatus executionStatus
* @param executionStatus executionStatus
* @return update process result
* @return update process result
* /
* /
public int updateProcessInstanceState ( Integer processInstanceId , ExecutionStatus executionStatus ) {
public int updateProcessInstanceState ( Integer processInstanceId , ExecutionStatus executionStatus ) {
@ -1696,7 +1677,7 @@ public class ProcessService {
/ * *
/ * *
* find tenant code by resource name
* find tenant code by resource name
*
*
* @param resName resource name
* @param resName resource name
* @param resourceType resource type
* @param resourceType resource type
* @return tenant code
* @return tenant code
* /
* /
@ -1714,35 +1695,35 @@ public class ProcessService {
* /
* /
public List < Schedule > selectAllByProcessDefineId ( int [ ] ids ) {
public List < Schedule > selectAllByProcessDefineId ( int [ ] ids ) {
return scheduleMapper . selectAllByProcessDefineArray (
return scheduleMapper . selectAllByProcessDefineArray (
ids ) ;
ids ) ;
}
}
/ * *
/ * *
* get dependency cycle by work process define id and scheduler fire time
* get dependency cycle by work process define id and scheduler fire time
*
*
* @param masterId masterId
* @param masterId masterId
* @param processDefinitionId processDefinitionId
* @param processDefinitionId processDefinitionId
* @param scheduledFireTime the time the task schedule is expected to trigger
* @param scheduledFireTime the time the task schedule is expected to trigger
* @return CycleDependency
* @return CycleDependency
* @throws Exception if error throws Exception
* @throws Exception if error throws Exception
* /
* /
public CycleDependency getCycleDependency ( int masterId , int processDefinitionId , Date scheduledFireTime ) throws Exception {
public CycleDependency getCycleDependency ( int masterId , int processDefinitionId , Date scheduledFireTime ) throws Exception {
List < CycleDependency > list = getCycleDependencies ( masterId , new int [ ] { processDefinitionId } , scheduledFireTime ) ;
List < CycleDependency > list = getCycleDependencies ( masterId , new int [ ] { processDefinitionId } , scheduledFireTime ) ;
return list . size ( ) > 0 ? list . get ( 0 ) : null ;
return ! list . isEmpty ( ) ? list . get ( 0 ) : null ;
}
}
/ * *
/ * *
* get dependency cycle list by work process define id list and scheduler fire time
* get dependency cycle list by work process define id list and scheduler fire time
*
*
* @param masterId masterId
* @param masterId masterId
* @param ids ids
* @param ids ids
* @param scheduledFireTime the time the task schedule is expected to trigger
* @param scheduledFireTime the time the task schedule is expected to trigger
* @return CycleDependency list
* @return CycleDependency list
* @throws Exception if error throws Exception
* @throws Exception if error throws Exception
* /
* /
public List < CycleDependency > getCycleDependencies ( int masterId , int [ ] ids , Date scheduledFireTime ) throws Exception {
public List < CycleDependency > getCycleDependencies ( int masterId , int [ ] ids , Date scheduledFireTime ) throws Exception {
List < CycleDependency > cycleDependencyList = new ArrayList < CycleDependency > ( ) ;
List < CycleDependency > cycleDependencyList = new ArrayList < > ( ) ;
if ( null = = ids | | ids . length = = 0 ) {
if ( null = = ids | | ids . length = = 0 ) {
logger . warn ( "ids[] is empty!is invalid!" ) ;
logger . warn ( "ids[] is empty!is invalid!" ) ;
return cycleDependencyList ;
return cycleDependencyList ;
@ -1769,14 +1750,10 @@ public class ProcessService {
}
}
Calendar calendar = Calendar . getInstance ( ) ;
Calendar calendar = Calendar . getInstance ( ) ;
switch ( cycleEnum ) {
switch ( cycleEnum ) {
/ * case MINUTE :
calendar . add ( Calendar . MINUTE , - 61 ) ; * /
case HOUR :
case HOUR :
calendar . add ( Calendar . HOUR , - 25 ) ;
calendar . add ( Calendar . HOUR , - 25 ) ;
break ;
break ;
case DAY :
case DAY :
calendar . add ( Calendar . DATE , - 32 ) ;
break ;
case WEEK :
case WEEK :
calendar . add ( Calendar . DATE , - 32 ) ;
calendar . add ( Calendar . DATE , - 32 ) ;
break ;
break ;
@ -1784,7 +1761,8 @@ public class ProcessService {
calendar . add ( Calendar . MONTH , - 13 ) ;
calendar . add ( Calendar . MONTH , - 13 ) ;
break ;
break ;
default :
default :
logger . warn ( "Dependent process definition's cycleEnum is {},not support!!" , cycleEnum . name ( ) ) ;
String cycleName = cycleEnum . name ( ) ;
logger . warn ( "Dependent process definition's cycleEnum is {},not support!!" , cycleName ) ;
continue ;
continue ;
}
}
Date start = calendar . getTime ( ) ;
Date start = calendar . getTime ( ) ;
@ -1794,7 +1772,7 @@ public class ProcessService {
} else {
} else {
list = CronUtils . getFireDateList ( start , scheduledFireTime , depCronExpression ) ;
list = CronUtils . getFireDateList ( start , scheduledFireTime , depCronExpression ) ;
}
}
if ( list . size ( ) > = 1 ) {
if ( ! list . isEmpty ( ) ) {
start = list . get ( list . size ( ) - 1 ) ;
start = list . get ( list . size ( ) - 1 ) ;
CycleDependency dependency = new CycleDependency ( depSchedule . getProcessDefinitionId ( ) , start , CronUtils . getExpirationTime ( start , cycleEnum ) , cycleEnum ) ;
CycleDependency dependency = new CycleDependency ( depSchedule . getProcessDefinitionId ( ) , start , CronUtils . getExpirationTime ( start , cycleEnum ) , cycleEnum ) ;
cycleDependencyList . add ( dependency ) ;
cycleDependencyList . add ( dependency ) ;
@ -1813,8 +1791,8 @@ public class ProcessService {
* /
* /
public ProcessInstance findLastSchedulerProcessInterval ( int definitionId , DateInterval dateInterval ) {
public ProcessInstance findLastSchedulerProcessInterval ( int definitionId , DateInterval dateInterval ) {
return processInstanceMapper . queryLastSchedulerProcess ( definitionId ,
return processInstanceMapper . queryLastSchedulerProcess ( definitionId ,
dateInterval . getStartTime ( ) ,
dateInterval . getStartTime ( ) ,
dateInterval . getEndTime ( ) ) ;
dateInterval . getEndTime ( ) ) ;
}
}
/ * *
/ * *
@ -1826,23 +1804,23 @@ public class ProcessService {
* /
* /
public ProcessInstance findLastManualProcessInterval ( int definitionId , DateInterval dateInterval ) {
public ProcessInstance findLastManualProcessInterval ( int definitionId , DateInterval dateInterval ) {
return processInstanceMapper . queryLastManualProcess ( definitionId ,
return processInstanceMapper . queryLastManualProcess ( definitionId ,
dateInterval . getStartTime ( ) ,
dateInterval . getStartTime ( ) ,
dateInterval . getEndTime ( ) ) ;
dateInterval . getEndTime ( ) ) ;
}
}
/ * *
/ * *
* find last running process instance
* find last running process instance
*
*
* @param definitionId process definition id
* @param definitionId process definition id
* @param startTime start time
* @param startTime start time
* @param endTime end time
* @param endTime end time
* @return process instance
* @return process instance
* /
* /
public ProcessInstance findLastRunningProcess ( int definitionId , Date startTime , Date endTime ) {
public ProcessInstance findLastRunningProcess ( int definitionId , Date startTime , Date endTime ) {
return processInstanceMapper . queryLastRunningProcess ( definitionId ,
return processInstanceMapper . queryLastRunningProcess ( definitionId ,
startTime ,
startTime ,
endTime ,
endTime ,
stateArray ) ;
stateArray ) ;
}
}
/ * *
/ * *
@ -1867,6 +1845,7 @@ public class ProcessService {
/ * *
/ * *
* query project name and user name by processInstanceId .
* query project name and user name by processInstanceId .
*
* @param processInstanceId processInstanceId
* @param processInstanceId processInstanceId
* @return projectName and userName
* @return projectName and userName
* /
* /
@ -1934,35 +1913,32 @@ public class ProcessService {
/ * *
/ * *
* list unauthorized udf function
* list unauthorized udf function
*
*
* @param userId user id
* @param userId user id
* @param needChecks data source id array
* @param needChecks data source id array
* @return unauthorized udf function list
* @return unauthorized udf function list
* /
* /
public < T > List < T > listUnauthorized ( int userId , T [ ] needChecks , AuthorizationType authorizationType ) {
public < T > List < T > listUnauthorized ( int userId , T [ ] needChecks , AuthorizationType authorizationType ) {
List < T > resultList = new ArrayList < T > ( ) ;
List < T > resultList = new ArrayList < > ( ) ;
if ( Objects . nonNull ( needChecks ) & & needChecks . length > 0 ) {
if ( Objects . nonNull ( needChecks ) & & needChecks . length > 0 ) {
Set < T > originResSet = new HashSet < T > ( Arrays . asList ( needChecks ) ) ;
Set < T > originResSet = new HashSet < > ( Arrays . asList ( needChecks ) ) ;
switch ( authorizationType ) {
switch ( authorizationType ) {
case RESOURCE_FILE_ID :
case RESOURCE_FILE_ID :
Set < Integer > authorizedResourceFiles = resourceMapper . listAuthorizedResourceById ( userId , needChecks ) . stream ( ) . map ( t - > t . getId ( ) ) . collect ( toSet ( ) ) ;
case UDF_FILE :
Set < Integer > authorizedResourceFiles = resourceMapper . listAuthorizedResourceById ( userId , needChecks ) . stream ( ) . map ( Resource : : getId ) . collect ( toSet ( ) ) ;
originResSet . removeAll ( authorizedResourceFiles ) ;
originResSet . removeAll ( authorizedResourceFiles ) ;
break ;
break ;
case RESOURCE_FILE_NAME :
case RESOURCE_FILE_NAME :
Set < String > authorizedResources = resourceMapper . listAuthorizedResource ( userId , needChecks ) . stream ( ) . map ( t - > t . getFullName ( ) ) . collect ( toSet ( ) ) ;
Set < String > authorizedResources = resourceMapper . listAuthorizedResource ( userId , needChecks ) . stream ( ) . map ( Resource : : getFullName ) . collect ( toSet ( ) ) ;
originResSet . removeAll ( authorizedResources ) ;
originResSet . removeAll ( authorizedResources ) ;
break ;
break ;
case UDF_FILE :
Set < Integer > authorizedUdfFiles = resourceMapper . listAuthorizedResourceById ( userId , needChecks ) . stream ( ) . map ( t - > t . getId ( ) ) . collect ( toSet ( ) ) ;
originResSet . removeAll ( authorizedUdfFiles ) ;
break ;
case DATASOURCE :
case DATASOURCE :
Set < Integer > authorizedDatasources = dataSourceMapper . listAuthorizedDataSource ( userId , needChecks ) . stream ( ) . map ( t - > t . getId ( ) ) . collect ( toSet ( ) ) ;
Set < Integer > authorizedDatasources = dataSourceMapper . listAuthorizedDataSource ( userId , needChecks ) . stream ( ) . map ( DataSource : : getId ) . collect ( toSet ( ) ) ;
originResSet . removeAll ( authorizedDatasources ) ;
originResSet . removeAll ( authorizedDatasources ) ;
break ;
break ;
case UDF :
case UDF :
Set < Integer > authorizedUdfs = udfFuncMapper . listAuthorizedUdfFunc ( userId , needChecks ) . stream ( ) . map ( t - > t . getId ( ) ) . collect ( toSet ( ) ) ;
Set < Integer > authorizedUdfs = udfFuncMapper . listAuthorizedUdfFunc ( userId , needChecks ) . stream ( ) . map ( UdfFunc : : getId ) . collect ( toSet ( ) ) ;
originResSet . removeAll ( authorizedUdfs ) ;
originResSet . removeAll ( authorizedUdfs ) ;
break ;
break ;
default :
default :
@ -2007,9 +1983,6 @@ public class ProcessService {
/ * *
/ * *
* format task app id in task instance
* format task app id in task instance
*
* @param taskInstance
* @return
* /
* /
public String formatTaskAppId ( TaskInstance taskInstance ) {
public String formatTaskAppId ( TaskInstance taskInstance ) {
ProcessDefinition definition = this . findProcessDefineById ( taskInstance . getProcessDefinitionId ( ) ) ;
ProcessDefinition definition = this . findProcessDefineById ( taskInstance . getProcessDefinitionId ( ) ) ;
@ -2019,9 +1992,9 @@ public class ProcessService {
return "" ;
return "" ;
}
}
return String . format ( "%s_%s_%s" ,
return String . format ( "%s_%s_%s" ,
definition . getId ( ) ,
definition . getId ( ) ,
processInstanceById . getId ( ) ,
processInstanceById . getId ( ) ,
taskInstance . getId ( ) ) ;
taskInstance . getId ( ) ) ;
}
}
}
}