Flowable源码地址:https://github.com/flowable/flowable-engine
Flowable-6.7.2 源码注释地址:https://github.com/solojin/flowable-6.7.2-annotated
包路径:org.flowable.engine.impl.jobexecutor
ProcessInstanceMigrationStatusJobHandler 流程实例迁移状态作业处理器
/**
* 流程实例迁移状态作业处理器
*/
public class ProcessInstanceMigrationStatusJobHandler extends AbstractProcessInstanceMigrationJobHandler {
// 类型: 流程迁移状态
public static final String TYPE = "process-migration-status";
@Override
public String getType() {
return TYPE;
}
@Override
public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
BatchService batchService = processEngineConfiguration.getBatchServiceConfiguration().getBatchService();
String batchId = getBatchIdFromHandlerCfg(configuration);
Batch batch = batchService.getBatch(batchId);
List<BatchPart> batchParts = batchService.findBatchPartsByBatchId(batchId);
int completedBatchParts = 0;
int failedBatchParts = 0;
for (BatchPart batchPart : batchParts) {
if (batchPart.getCompleteTime() != null) {
completedBatchParts++;
if (ProcessInstanceBatchMigrationResult.RESULT_FAIL.equals(batchPart.getStatus())) {
failedBatchParts++;
}
}
}
if (completedBatchParts == batchParts.size()) {
batchService.completeBatch(batch.