@@ -231,7 +231,7 @@ private Map<String, CWLElement> getInputsOutputs(JsonNode inputsOutputs) {
231
231
Map <String , CWLElement > returnMap = new HashMap <>();
232
232
233
233
if (inputsOutputs .getClass () == ArrayNode .class ) {
234
- // Explicit ID and other fields within each input list
234
+ // Explicit ID and other fields within each ilist
235
235
for (JsonNode inputOutput : inputsOutputs ) {
236
236
String id = inputOutput .get ("id" ).asText ();
237
237
returnMap .put (id , getDetails (inputOutput ));
@@ -261,13 +261,11 @@ private CWLElement getDetails(JsonNode inputOutput) {
261
261
if (inputOutput .getClass () == TextNode .class ) {
262
262
details .setType (inputOutput .asText ());
263
263
} else {
264
- if (extractLabel (inputOutput ) != null ) {
265
- details .setLabel (extractLabel (inputOutput ));
266
- }
264
+ details .setLabel (extractLabel (inputOutput ));
265
+ details .setDoc (extractDoc (inputOutput ));
267
266
268
- if (extractDoc (inputOutput ) != null ) {
269
- details .setDoc (extractDoc (inputOutput ));
270
- }
267
+ // OutputSource is only for outputs of the overall workflow
268
+ details .setSourceID (extractOutputSource (inputOutput ));
271
269
272
270
// Type is only for inputs
273
271
if (inputOutput .has ("type" )) {
@@ -304,6 +302,39 @@ private String extractLabel(JsonNode node) {
304
302
return null ;
305
303
}
306
304
305
+ /**
306
+ * Extract the outputSource from a node
307
+ * @param node The node to have the label extracted from
308
+ * @return The string for the outputSource of the node
309
+ */
310
+ private String extractOutputSource (JsonNode node ) {
311
+ if (node != null ) {
312
+ String source = null ;
313
+ if (node .has ("outputSource" )) {
314
+ source = node .get ("outputSource" ).asText ();
315
+ } else if (node .has ("source" )) {
316
+ source = node .get ("source" ).asText ();
317
+ }
318
+
319
+ // Get step ID from a SALAD ID
320
+ if (source != null ) {
321
+ // Strip leading # if it exists
322
+ if (source .charAt (0 ) == '#' ) {
323
+ source = source .substring (1 );
324
+ }
325
+
326
+ // Get segment before / (step ID)
327
+ int slashSplit = source .indexOf ("/" );
328
+ if (slashSplit != -1 ) {
329
+ source = source .substring (0 , slashSplit );
330
+ }
331
+ }
332
+
333
+ return source ;
334
+ }
335
+ return null ;
336
+ }
337
+
307
338
/**
308
339
* Extract the doc or description from a node
309
340
* @param node The node to have the doc/description extracted from
0 commit comments