package com.codvision.workflow.listener.task;

import lombok.RequiredArgsConstructor;
import org.flowable.engine.TaskService;
import org.flowable.task.service.delegate.DelegateTask;
import org.flowable.task.service.delegate.TaskListener;
import org.springframework.stereotype.Component;

import static com.codvision.workflow.constant.WorkFlowConstant.SUB_DATA;


/**
 * 数据隔离配置（事件类型 -> create）
 * @author hxl
 */
@RequiredArgsConstructor
@Component(value = "workFlowSubDataListener")
public class WorkFlowSubDataListener implements TaskListener {

    private final TaskService taskService;

    @Override
    public void notify(DelegateTask delegateTask) {
        taskService.setVariableLocal(delegateTask.getId(), SUB_DATA, true);
    }
}
