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

import org.flowable.engine.ProcessEngineConfiguration;
import org.springframework.util.CollectionUtils;

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

/**
 * 流程相关操作上下文
 *
 * @author wangli
 * @since 2024/4/9 22:52
 */
public class ProcessOperationContext extends CommonContext<ProcessOperationContext> {

    private List<String> processFileTags;
    private ProcessEngineConfiguration processEngineConfiguration;

    public List<String> getProcessFileTags(Supplier<List<String>> supplier) {
        if (CollectionUtils.isEmpty(processFileTags)) {
            processFileTags = supplier.get();
        }
        return processFileTags;
    }

    public ProcessEngineConfiguration getProcessEngineConfiguration(Supplier<ProcessEngineConfiguration> supplier) {
        if (Objects.isNull(processEngineConfiguration)) {
            return supplier.get();
        }
        return processEngineConfiguration;
    }
}
