@@ -41,16 +41,19 @@ public class WorkflowService {
41
41
private final WorkflowRepository workflowRepository ;
42
42
private final ROBundleFactory ROBundleFactory ;
43
43
private final int cacheDays ;
44
+ private final String graphvizStorage ;
44
45
45
46
@ Autowired
46
47
public WorkflowService (GitHubService githubService ,
47
48
WorkflowRepository workflowRepository ,
48
49
ROBundleFactory ROBundleFactory ,
49
- @ Value ("${cacheDays}" ) int cacheDays ) {
50
+ @ Value ("${cacheDays}" ) int cacheDays ,
51
+ @ Value ("${graphvizStorage}" ) String graphvizStorage ) {
50
52
this .githubService = githubService ;
51
53
this .workflowRepository = workflowRepository ;
52
54
this .ROBundleFactory = ROBundleFactory ;
53
55
this .cacheDays = cacheDays ;
56
+ this .graphvizStorage = graphvizStorage ;
54
57
}
55
58
56
59
/**
@@ -105,7 +108,11 @@ public void removeWorkflow(Workflow workflow) {
105
108
logger .debug ("Failed to delete Research Object Bundle" );
106
109
}
107
110
108
- // TODO: Delete cached graphviz images when serverside graphviz is merged
111
+ // Delete cached graphviz images if they exist
112
+ File graphvizSvg = new File (graphvizStorage + "/" + workflow .getID () + ".svg" );
113
+ graphvizSvg .delete ();
114
+ File graphvizPng = new File (graphvizStorage + "/" + workflow .getID () + ".png" );
115
+ graphvizPng .delete ();
109
116
110
117
// Remove the workflow from the database
111
118
workflowRepository .delete (workflow );
0 commit comments