1
|
package eu.dnetlib.functionality.modular.ui.workflows.sarasvati.viewer;
|
2
|
|
3
|
import java.awt.image.BufferedImage;
|
4
|
import java.util.Set;
|
5
|
|
6
|
import javax.annotation.Resource;
|
7
|
|
8
|
import com.googlecode.sarasvati.Graph;
|
9
|
import com.googlecode.sarasvati.GraphProcess;
|
10
|
import com.googlecode.sarasvati.visual.GraphImageMapCreator;
|
11
|
import com.googlecode.sarasvati.visual.ProcessImageMapCreator;
|
12
|
|
13
|
import eu.dnetlib.functionality.modular.ui.workflows.util.ISLookupClient;
|
14
|
import eu.dnetlib.msro.workflows.sarasvati.loader.GraphLoader;
|
15
|
import eu.dnetlib.msro.workflows.sarasvati.registry.GraphProcessRegistry;
|
16
|
|
17
|
public class ProcessGraphGenerator {
|
18
|
|
19
|
@Resource
|
20
|
private GraphProcessRegistry graphProcessRegistry;
|
21
|
|
22
|
@Resource
|
23
|
private ISLookupClient isLookupClient;
|
24
|
|
25
|
@Resource
|
26
|
private GraphLoader graphLoader;
|
27
|
|
28
|
public BufferedImage getProcessImage(final String procId) throws Exception {
|
29
|
final GraphProcess proc = graphProcessRegistry.findProcess(procId);
|
30
|
final ProcessImageMapCreator imageMapCreator = new ProcessImageMapCreator(proc, new ProcessToImageMapHelper(procId));
|
31
|
return imageMapCreator.getImage();
|
32
|
}
|
33
|
|
34
|
public String getProcessImageMap(final String procId) throws Exception {
|
35
|
final GraphProcess proc = graphProcessRegistry.findProcess(procId);
|
36
|
final ProcessImageMapCreator imageMapCreator = new ProcessImageMapCreator(proc, new ProcessToImageMapHelper(procId));
|
37
|
return imageMapCreator.getMapContents();
|
38
|
}
|
39
|
|
40
|
public BufferedImage getWfDescImage(final String id, final String xml, final Set<String> notConfiguredNodes) throws Exception {
|
41
|
final Graph graph = graphLoader.loadGraph(xml);
|
42
|
final GraphImageMapCreator creator = new GraphImageMapCreator(graph, new GraphToImageMapHelper(id, notConfiguredNodes));
|
43
|
return creator.getImage();
|
44
|
}
|
45
|
|
46
|
public String getWfDescImageMap(String id, String xml) throws Exception {
|
47
|
final Graph graph = graphLoader.loadGraph(xml);
|
48
|
final GraphImageMapCreator creator = new GraphImageMapCreator(graph, new GraphToImageMapHelper(id, null));
|
49
|
return creator.getMapContents();
|
50
|
}
|
51
|
|
52
|
}
|