@@ -236,12 +236,13 @@ private Map<String, CWLStep> getSteps(JsonNode cwlDoc) {
236
236
*/
237
237
private Map <String , CWLElement > getInputs (JsonNode cwlDoc ) {
238
238
if (cwlDoc != null ) {
239
+ Map <String , CWLElement > inputsOutputs = null ;
239
240
if (cwlDoc .has (INPUTS )) {
240
- // For workflow
241
+ // For workflow/draft steps
241
242
return getInputsOutputs (cwlDoc .get (INPUTS ));
242
243
} else if (cwlDoc .has (IN )) {
243
- // For steps
244
- return getInputsOutputs (cwlDoc .get (IN ));
244
+ // For V1.0 steps
245
+ return getStepInputsOutputs (cwlDoc .get (IN ));
245
246
}
246
247
}
247
248
return null ;
@@ -255,16 +256,40 @@ private Map<String, CWLElement> getInputs(JsonNode cwlDoc) {
255
256
private Map <String , CWLElement > getOutputs (JsonNode cwlDoc ) {
256
257
if (cwlDoc != null ) {
257
258
if (cwlDoc .has (OUTPUTS )) {
258
- // For workflow
259
+ // For workflow/draft steps
259
260
return getInputsOutputs (cwlDoc .get (OUTPUTS ));
260
261
} else if (cwlDoc .has (OUT )) {
261
- // For steps
262
- return getInputsOutputs (cwlDoc .get (OUT ));
262
+ // For V1.0 steps
263
+ return getStepInputsOutputs (cwlDoc .get (OUT ));
263
264
}
264
265
}
265
266
return null ;
266
267
}
267
268
269
+ /**
270
+ * Get inputs or outputs from an in or out node
271
+ * @param inOut The in or out node
272
+ * @return A map of input IDs and details related to them
273
+ */
274
+ private Map <String , CWLElement > getStepInputsOutputs (JsonNode inOut ) {
275
+ Map <String , CWLElement > returnMap = new HashMap <>();
276
+
277
+ if (inOut .getClass () == ArrayNode .class ) {
278
+ // array<WorkflowStepInput>
279
+ } else if (inOut .getClass () == ObjectNode .class ) {
280
+ // map<WorkflowStepInput.id, WorkflowStepInput.source>
281
+ Iterator <Map .Entry <String , JsonNode >> iterator = inOut .fields ();
282
+ while (iterator .hasNext ()) {
283
+ Map .Entry <String , JsonNode > inOutNode = iterator .next ();
284
+ CWLElement input = new CWLElement ();
285
+ input .addSourceID (stepIDFromSource (inOutNode .getValue ().asText ()));
286
+ returnMap .put (inOutNode .getKey (), input );
287
+ }
288
+ }
289
+
290
+ return returnMap ;
291
+ }
292
+
268
293
/**
269
294
* Get inputs or outputs from an inputs or outputs node
270
295
* @param inputsOutputs The inputs or outputs node
0 commit comments