package cn.axzo.workflow.core.common.context;

import cn.axzo.workflow.core.repository.entity.ExtAxHiTaskInst;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

/**
 * 任务相关操作上下文
 *
 * @author wangli
 * @since 2024/4/9 20:59
 */
public class TaskOperationContext extends CommonContext<TaskOperationContext> {

    private List<ExtAxHiTaskInst> extAxHiTaskInsts = new ArrayList<>();

    public List<ExtAxHiTaskInst> getExtAxHiTaskInsts(Supplier<List<ExtAxHiTaskInst>> supplier) {
        if (CollectionUtils.isEmpty(extAxHiTaskInsts)) {
            extAxHiTaskInsts.addAll(supplier.get());
        }
        return extAxHiTaskInsts;
    }

}
