remaming classes

This commit is contained in:
Michele Artini 2023-03-22 11:38:31 +01:00
parent e40094a0b8
commit 27aaab75b7
4 changed files with 13 additions and 13 deletions

View File

@ -11,7 +11,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
public class WorkflowGraph implements Serializable { public class WorkflowTemplate implements Serializable {
private static final long serialVersionUID = 5919290887480115842L; private static final long serialVersionUID = 5919290887480115842L;

View File

@ -24,8 +24,8 @@ import eu.dnetlib.errors.WorkflowManagerException;
import eu.dnetlib.is.model.resource.SimpleResource; import eu.dnetlib.is.model.resource.SimpleResource;
import eu.dnetlib.is.resource.repository.SimpleResourceRepository; import eu.dnetlib.is.resource.repository.SimpleResourceRepository;
import eu.dnetlib.manager.wf.model.WorkflowConfiguration; 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.WorkflowSubscription;
import eu.dnetlib.manager.wf.model.WorkflowTemplate;
import eu.dnetlib.manager.wf.repository.WorkflowConfigurationRepository; import eu.dnetlib.manager.wf.repository.WorkflowConfigurationRepository;
import eu.dnetlib.manager.wf.repository.WorkflowSubscriptionRepository; import eu.dnetlib.manager.wf.repository.WorkflowSubscriptionRepository;
import eu.dnetlib.manager.wf.workflows.procs.ExecutionStatus; import eu.dnetlib.manager.wf.workflows.procs.ExecutionStatus;
@ -145,19 +145,19 @@ public class WorkflowManagerService implements Stoppable {
.filter(r -> r.getType().equals("workflows")) .filter(r -> r.getType().equals("workflows"))
.orElseThrow(() -> new WorkflowManagerException("WF not found: " + conf.getWorkflow())); .orElseThrow(() -> new WorkflowManagerException("WF not found: " + conf.getWorkflow()));
final WorkflowGraph wfGraph = simpleResourceRepository.findContentById(wfMetadata.getId()) final WorkflowTemplate wfTmpl = simpleResourceRepository.findContentById(wfMetadata.getId())
.map(s -> { .map(s -> {
try { try {
return new ObjectMapper().readValue(s, WorkflowGraph.class); return new ObjectMapper().readValue(s, WorkflowTemplate.class);
} catch (final Exception e) { } catch (final Exception e) {
return (WorkflowGraph) null; return (WorkflowTemplate) null;
} }
}) })
.filter(Objects::nonNull) .filter(Objects::nonNull)
.orElseThrow(() -> new WorkflowManagerException("Invalid wf: " + wfMetadata.getId())); .orElseThrow(() -> new WorkflowManagerException("Invalid wf: " + wfMetadata.getId()));
final WorkflowProcess process = final WorkflowProcess process =
processFactory.newProcess(wfMetadata, wfGraph, conf, callback); processFactory.newProcess(wfMetadata, wfTmpl, conf, callback);
processRegistry.registerProcess(process, conf); processRegistry.registerProcess(process, conf);

View File

@ -17,7 +17,7 @@ import com.google.common.base.Function;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import eu.dnetlib.errors.WorkflowManagerException; 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.procs.Env;
import eu.dnetlib.manager.wf.workflows.util.NodeHelper; import eu.dnetlib.manager.wf.workflows.util.NodeHelper;
@ -30,11 +30,11 @@ public class GraphLoader {
@Autowired @Autowired
private Environment environment; 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 { throws WorkflowManagerException {
final Graph graph = new Graph(); 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 nodeName = node.getName();
final String nodeType = node.getType(); final String nodeType = node.getType();
final boolean isStart = node.isStart(); final boolean isStart = node.isStart();
@ -52,7 +52,7 @@ public class GraphLoader {
} }
if (node.getArcs() != null) { if (node.getArcs() != null) {
for (final WorkflowGraph.Arc a : node.getArcs()) { for (final WorkflowTemplate.Arc a : node.getArcs()) {
final String to = a.getTo(); final String to = a.getTo();
final Function<Env, Boolean> condFunction = generateFunction(a.getCondition()); final Function<Env, Boolean> condFunction = generateFunction(a.getCondition());
graph.addArc(new Arc(nodeName, to, condFunction)); graph.addArc(new Arc(nodeName, to, condFunction));

View File

@ -12,8 +12,8 @@ import org.springframework.stereotype.Component;
import eu.dnetlib.errors.WorkflowManagerException; import eu.dnetlib.errors.WorkflowManagerException;
import eu.dnetlib.is.model.resource.SimpleResource; 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.WorkflowConfiguration;
import eu.dnetlib.manager.wf.model.WorkflowTemplate;
import eu.dnetlib.manager.wf.workflows.graph.Graph; import eu.dnetlib.manager.wf.workflows.graph.Graph;
import eu.dnetlib.manager.wf.workflows.graph.GraphLoader; import eu.dnetlib.manager.wf.workflows.graph.GraphLoader;
import eu.dnetlib.manager.wf.workflows.util.ExecutionCallback; import eu.dnetlib.manager.wf.workflows.util.ExecutionCallback;
@ -31,7 +31,7 @@ public class ProcessFactory {
private GraphLoader graphLoader; private GraphLoader graphLoader;
public WorkflowProcess newProcess(final SimpleResource wfMetadata, public WorkflowProcess newProcess(final SimpleResource wfMetadata,
final WorkflowGraph wfGraph, final WorkflowTemplate wfTemplate,
final WorkflowConfiguration conf, final WorkflowConfiguration conf,
final ExecutionCallback<WorkflowProcess> callback) throws WorkflowManagerException { final ExecutionCallback<WorkflowProcess> callback) throws WorkflowManagerException {
@ -39,7 +39,7 @@ public class ProcessFactory {
globalParams.putAll(conf.getSystemParams()); globalParams.putAll(conf.getSystemParams());
globalParams.putAll(conf.getUserParams()); 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); return new WorkflowProcess(generateProcessId(), wfMetadata, conf, graph, globalParams, callback);