@@ -129,10 +129,11 @@ private Optional<String> findRaw(String commitId, HttpServletRequest request) {
129
129
@ GetMapping (value = "/git/{commitid}/**" ,
130
130
produces = "text/turtle" )
131
131
public byte [] getRdfAsTurtle (@ PathVariable ("commitid" ) String commitId ,
132
+ @ RequestParam (name = "part" ) Optional <String > part ,
132
133
HttpServletRequest request ,
133
134
HttpServletResponse response ) {
134
- Workflow workflow = getWorkflow (commitId , request );
135
- String rdfUrl = workflow .getPermalink ();
135
+ Workflow workflow = getWorkflow (commitId , request , part );
136
+ String rdfUrl = workflow .getIdentifier ();
136
137
if (rdfService .graphExists (rdfUrl )) {
137
138
response .setHeader ("Content-Disposition" , "inline; filename=\" workflow.ttl\" " );
138
139
return rdfService .getModel (rdfUrl , "TURTLE" );
@@ -149,10 +150,11 @@ public byte[] getRdfAsTurtle(@PathVariable("commitid") String commitId,
149
150
@ GetMapping (value = "/git/{commitid}/**" ,
150
151
produces = "application/ld+json" )
151
152
public byte [] getRdfAsJsonLd (@ PathVariable ("commitid" ) String commitId ,
153
+ @ RequestParam (name = "part" ) Optional <String > part ,
152
154
HttpServletRequest request ,
153
155
HttpServletResponse response ) {
154
- Workflow workflow = getWorkflow (commitId , request );
155
- String rdfUrl = workflow .getPermalink ();
156
+ Workflow workflow = getWorkflow (commitId , request , part );
157
+ String rdfUrl = workflow .getIdentifier ();
156
158
if (rdfService .graphExists (rdfUrl )) {
157
159
response .setHeader ("Content-Disposition" , "inline; filename=\" workflow.jsonld\" " );
158
160
return rdfService .getModel (rdfUrl , "JSON-LD" );
@@ -169,10 +171,11 @@ public byte[] getRdfAsJsonLd(@PathVariable("commitid") String commitId,
169
171
@ GetMapping (value = "/git/{commitid}/**" ,
170
172
produces = "application/rdf+xml" )
171
173
public byte [] getRdfAsRdfXml (@ PathVariable ("commitid" ) String commitId ,
174
+ @ RequestParam (name = "part" ) Optional <String > part ,
172
175
HttpServletRequest request ,
173
176
HttpServletResponse response ) {
174
- Workflow workflow = getWorkflow (commitId , request );
175
- String rdfUrl = workflow .getPermalink ();
177
+ Workflow workflow = getWorkflow (commitId , request , part );
178
+ String rdfUrl = workflow .getIdentifier ();
176
179
if (rdfService .graphExists (rdfUrl )) {
177
180
response .setHeader ("Content-Disposition" , "inline; filename=\" workflow.rdf\" " );
178
181
return rdfService .getModel (rdfUrl , "RDFXML" );
@@ -189,9 +192,10 @@ public byte[] getRdfAsRdfXml(@PathVariable("commitid") String commitId,
189
192
@ GetMapping (value = "/git/{commitid}/**" ,
190
193
produces = "image/svg+xml" )
191
194
public FileSystemResource getGraphAsSvg (@ PathVariable ("commitid" ) String commitId ,
195
+ @ RequestParam (name = "part" ) Optional <String > part ,
192
196
HttpServletRequest request ,
193
197
HttpServletResponse response ) {
194
- Workflow workflow = getWorkflow (commitId , request );
198
+ Workflow workflow = getWorkflow (commitId , request , part );
195
199
response .setHeader ("Content-Disposition" , "inline; filename=\" graph.svg\" " );
196
200
return workflowService .getWorkflowGraph ("svg" , workflow .getRetrievedFrom ());
197
201
}
@@ -204,9 +208,10 @@ public FileSystemResource getGraphAsSvg(@PathVariable("commitid") String commitI
204
208
@ GetMapping (value = "/git/{commitid}/**" ,
205
209
produces = "image/png" )
206
210
public FileSystemResource getGraphAsPng (@ PathVariable ("commitid" ) String commitId ,
211
+ @ RequestParam (name = "part" ) Optional <String > part ,
207
212
HttpServletRequest request ,
208
213
HttpServletResponse response ) {
209
- Workflow workflow = getWorkflow (commitId , request );
214
+ Workflow workflow = getWorkflow (commitId , request , part );
210
215
response .setHeader ("Content-Disposition" , "inline; filename=\" graph.png\" " );
211
216
return workflowService .getWorkflowGraph ("png" , workflow .getRetrievedFrom ());
212
217
}
@@ -219,9 +224,10 @@ public FileSystemResource getGraphAsPng(@PathVariable("commitid") String commitI
219
224
@ GetMapping (value = "/git/{commitid}/**" ,
220
225
produces = "text/vnd+graphviz" )
221
226
public FileSystemResource getGraphAsXDot (@ PathVariable ("commitid" ) String commitId ,
227
+ @ RequestParam (name = "part" ) Optional <String > part ,
222
228
HttpServletRequest request ,
223
229
HttpServletResponse response ) {
224
- Workflow workflow = getWorkflow (commitId , request );
230
+ Workflow workflow = getWorkflow (commitId , request , part );
225
231
response .setHeader ("Content-Disposition" , "inline; filename=\" graph.dot\" " );
226
232
return workflowService .getWorkflowGraph ("xdot" , workflow .getRetrievedFrom ());
227
233
}
@@ -235,24 +241,33 @@ public FileSystemResource getGraphAsXDot(@PathVariable("commitid") String commit
235
241
@ GetMapping (value = "/git/{commitid}/**" ,
236
242
produces = {"application/vnd.wf4ever.robundle+zip" , "application/zip" })
237
243
public FileSystemResource getROBundle (@ PathVariable ("commitid" ) String commitId ,
244
+ @ RequestParam (name = "part" ) Optional <String > part ,
238
245
HttpServletRequest request ,
239
246
HttpServletResponse response ) {
240
- Workflow workflow = getWorkflow (commitId , request );
247
+ Workflow workflow = getWorkflow (commitId , request , part );
241
248
File bundleDownload = workflowService .getROBundle (workflow .getRetrievedFrom ());
242
249
response .setHeader ("Content-Disposition" , "attachment; filename=bundle.zip;" );
243
250
return new FileSystemResource (bundleDownload );
244
251
}
245
252
246
253
/**
247
254
* Get a workflow based on commit ID and extracting path from request
248
- * @param commitId The commit ID of the repository
249
- * @param request The HttpServletRequest from the controller to extract path
250
- * @throws WorkflowNotFoundException If workflow could not be found (404)
255
+ *
256
+ * @param commitId
257
+ * The commit ID of the repository
258
+ * @param request
259
+ * The HttpServletRequest from the controller to extract path
260
+ * @param part2
261
+ * @throws WorkflowNotFoundException
262
+ * If workflow could not be found (404)
263
+ * @throws MultipleWorkflowsException
264
+ * If multiple workflow (parts) were found (300)
251
265
*/
252
- private Workflow getWorkflow (String commitId , HttpServletRequest request ) throws WorkflowNotFoundException {
266
+ private Workflow getWorkflow (String commitId , HttpServletRequest request , Optional <String > part )
267
+ throws WorkflowNotFoundException {
253
268
String path = (String ) request .getAttribute (HandlerMapping .PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE );
254
269
path = WorkflowController .extractPath (path , 3 );
255
- return workflowService .findByCommitAndPath (commitId , path );
270
+ return workflowService .findByCommitAndPath (commitId , path , part );
256
271
}
257
272
258
273
}
0 commit comments