package org.springblade.flow.engine.custom.handler;


import org.flowable.bpmn.model.ReceiveTask;
import org.flowable.engine.impl.bpmn.parser.BpmnParse;
import org.flowable.engine.impl.bpmn.parser.handler.ReceiveTaskParseHandler;
import org.springframework.stereotype.Component;

/**
 * @Author:LoveMyOrange
 * @Description: 将UserTask元素中 自定义的属性 加载到PVM中 方便在流程运转中直接获取到
 * @Date:Created in 2021/8/28 14:30
 */
@Component
public class CustomReceiveTaskParseHandler extends ReceiveTaskParseHandler {

    @Override
    protected void executeParse(BpmnParse bpmnParse, ReceiveTask receiveTask) {
        //1.委托父类进行元素进行解析工作
        super.executeParse(bpmnParse, receiveTask);
//        //2.父类解析完成之后, 直接获取到存储任务节点定义的ActivityImpl对象
//        ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(receiveTask.getId());
//        //3.自定义元素的解析
//        String attributeValue = receiveTask.getAttributeValue(exActivitiPrefixURL,extensionAttributeName);
//        //4.将解析到的扩展属性设置到 activity中 后续就可以直接通过 TaskEntity获取
//        if(StringUtils.isNotBlank(attributeValue)){
//            activity.setProperty(extensionAttributeName,attributeValue);
//        }
    }
}
