package jnpf.flowable.service;
|
|
import jnpf.exception.DataException;
|
import jnpf.flowable.model.filepermission.WorkflowFileCheckpoint;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.beans.factory.ObjectProvider;
|
import org.springframework.stereotype.Service;
|
import java.util.Map;
|
import java.util.function.Consumer;
|
|
@Service
|
@RequiredArgsConstructor
|
public class WorkflowFileCheckpointSupport {
|
private final FilePermissionSnapshotService snapshots;
|
private final ObjectProvider<WorkflowFileCheckpoint> checkpoint;
|
|
public boolean enabled(String taskId) { return snapshots.find(taskId) != null; }
|
|
public void save(String taskId, String formId, Map<String, Object> data, Consumer<Map<String, Object>> continuation) {
|
save(taskId, formId, null, data, continuation);
|
}
|
|
public void save(String taskId, String formId, String operatorId, Map<String, Object> data,
|
Consumer<Map<String, Object>> continuation) {
|
if (snapshots.find(taskId) == null) { continuation.accept(data); return; }
|
WorkflowFileCheckpoint service = checkpoint.getIfAvailable();
|
if (service == null) throw new DataException("当前部署尚未接入流程共享附件保存,不能继续节点操作");
|
service.save(taskId, formId, operatorId, data, continuation);
|
}
|
}
|