package org.springblade.flow.engine.custom.behavior.impl;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.impl.bpmn.behavior.SubProcessActivityBehavior;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;

/**
 * @author LoveMyOrange
 * @create 2022-02-02 12:08
 * @desc 子流程的bug  为以后接入子流程做准备
 */
@Slf4j
public class CustomSubProcessActivityBehavior extends SubProcessActivityBehavior {


    @Override
    public void execute(DelegateExecution execution) {
        DelegateExecution parent = execution.getParent();
        ExecutionEntity executionEntity=null;
        if (null!=parent){
            String processInstanceBusinessKey = parent.getProcessInstanceBusinessKey();
            executionEntity=(ExecutionEntity)execution;
            executionEntity.setBusinessKey(processInstanceBusinessKey);
        }
        super.execute(execution);
    }
}
