remaming classes
This commit is contained in:
parent
e40094a0b8
commit
27aaab75b7
|
@ -11,7 +11,7 @@ import java.util.stream.Collectors;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
public class WorkflowGraph implements Serializable {
|
||||
public class WorkflowTemplate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5919290887480115842L;
|
||||
|
|
@ -24,8 +24,8 @@ import eu.dnetlib.errors.WorkflowManagerException;
|
|||
import eu.dnetlib.is.model.resource.SimpleResource;
|
||||
import eu.dnetlib.is.resource.repository.SimpleResourceRepository;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowConfiguration;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowGraph;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowSubscription;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate;
|
||||
import eu.dnetlib.manager.wf.repository.WorkflowConfigurationRepository;
|
||||
import eu.dnetlib.manager.wf.repository.WorkflowSubscriptionRepository;
|
||||
import eu.dnetlib.manager.wf.workflows.procs.ExecutionStatus;
|
||||
|
@ -145,19 +145,19 @@ public class WorkflowManagerService implements Stoppable {
|
|||
.filter(r -> r.getType().equals("workflows"))
|
||||
.orElseThrow(() -> new WorkflowManagerException("WF not found: " + conf.getWorkflow()));
|
||||
|
||||
final WorkflowGraph wfGraph = simpleResourceRepository.findContentById(wfMetadata.getId())
|
||||
final WorkflowTemplate wfTmpl = simpleResourceRepository.findContentById(wfMetadata.getId())
|
||||
.map(s -> {
|
||||
try {
|
||||
return new ObjectMapper().readValue(s, WorkflowGraph.class);
|
||||
return new ObjectMapper().readValue(s, WorkflowTemplate.class);
|
||||
} catch (final Exception e) {
|
||||
return (WorkflowGraph) null;
|
||||
return (WorkflowTemplate) null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.orElseThrow(() -> new WorkflowManagerException("Invalid wf: " + wfMetadata.getId()));
|
||||
|
||||
final WorkflowProcess process =
|
||||
processFactory.newProcess(wfMetadata, wfGraph, conf, callback);
|
||||
processFactory.newProcess(wfMetadata, wfTmpl, conf, callback);
|
||||
|
||||
processRegistry.registerProcess(process, conf);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.google.common.base.Function;
|
|||
import com.google.common.collect.Sets;
|
||||
|
||||
import eu.dnetlib.errors.WorkflowManagerException;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowGraph;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate;
|
||||
import eu.dnetlib.manager.wf.workflows.procs.Env;
|
||||
import eu.dnetlib.manager.wf.workflows.util.NodeHelper;
|
||||
|
||||
|
@ -30,11 +30,11 @@ public class GraphLoader {
|
|||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
public Graph loadGraph(final WorkflowGraph workflowGraph, final Map<String, String> globalParams)
|
||||
public Graph loadGraph(final WorkflowTemplate wfTemplate, final Map<String, String> globalParams)
|
||||
throws WorkflowManagerException {
|
||||
final Graph graph = new Graph();
|
||||
|
||||
for (final WorkflowGraph.Node node : workflowGraph.getGraph()) {
|
||||
for (final WorkflowTemplate.Node node : wfTemplate.getGraph()) {
|
||||
final String nodeName = node.getName();
|
||||
final String nodeType = node.getType();
|
||||
final boolean isStart = node.isStart();
|
||||
|
@ -52,7 +52,7 @@ public class GraphLoader {
|
|||
}
|
||||
|
||||
if (node.getArcs() != null) {
|
||||
for (final WorkflowGraph.Arc a : node.getArcs()) {
|
||||
for (final WorkflowTemplate.Arc a : node.getArcs()) {
|
||||
final String to = a.getTo();
|
||||
final Function<Env, Boolean> condFunction = generateFunction(a.getCondition());
|
||||
graph.addArc(new Arc(nodeName, to, condFunction));
|
||||
|
|
|
@ -12,8 +12,8 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import eu.dnetlib.errors.WorkflowManagerException;
|
||||
import eu.dnetlib.is.model.resource.SimpleResource;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowGraph;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowConfiguration;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate;
|
||||
import eu.dnetlib.manager.wf.workflows.graph.Graph;
|
||||
import eu.dnetlib.manager.wf.workflows.graph.GraphLoader;
|
||||
import eu.dnetlib.manager.wf.workflows.util.ExecutionCallback;
|
||||
|
@ -31,7 +31,7 @@ public class ProcessFactory {
|
|||
private GraphLoader graphLoader;
|
||||
|
||||
public WorkflowProcess newProcess(final SimpleResource wfMetadata,
|
||||
final WorkflowGraph wfGraph,
|
||||
final WorkflowTemplate wfTemplate,
|
||||
final WorkflowConfiguration conf,
|
||||
final ExecutionCallback<WorkflowProcess> callback) throws WorkflowManagerException {
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class ProcessFactory {
|
|||
globalParams.putAll(conf.getSystemParams());
|
||||
globalParams.putAll(conf.getUserParams());
|
||||
|
||||
final Graph graph = graphLoader.loadGraph(wfGraph, globalParams);
|
||||
final Graph graph = graphLoader.loadGraph(wfTemplate, globalParams);
|
||||
|
||||
return new WorkflowProcess(generateProcessId(), wfMetadata, conf, graph, globalParams, callback);
|
||||
|
||||
|
|
Loading…
Reference in New Issue