• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

common-workflow-language / cwljava / #421

16 Dec 2025 08:00PM UTC coverage: 57.962% (-0.01%) from 57.972%
#421

Pull #218

github

web-flow
Merge 0d5009150 into 4d3285bc2
Pull Request #218: "id" is a required field in for `Parameter`s and `WorkflowStep`s

23 of 43 new or added lines in 12 files covered. (53.49%)

10 existing lines in 10 files now uncovered.

7735 of 13345 relevant lines covered (57.96%)

0.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.25
/src/main/java/org/commonwl/cwlsdk/cwl1_2/WorkflowStepImpl.java
1
// Copyright Common Workflow Language project contributors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
package org.commonwl.cwlsdk.cwl1_2;
16

17
import org.commonwl.cwlsdk.cwl1_2.utils.LoaderInstances;
18
import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptions;
19
import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptionsBuilder;
20
import org.commonwl.cwlsdk.cwl1_2.utils.SaveableImpl;
21
import org.commonwl.cwlsdk.cwl1_2.utils.ValidationException;
22

23
/**
24
* Auto-generated class implementation for <I>https://w3id.org/cwl/cwl#WorkflowStep</I><BR> <BLOCKQUOTE>
25
 A workflow step is an executable element of a workflow.  It specifies the
26
 underlying process implementation (such as `CommandLineTool` or another
27
 `Workflow`) in the `run` field and connects the input and output parameters
28
 of the underlying process to workflow parameters.
29
 
30
 # Scatter/gather
31
 
32
 To use scatter/gather,
33
 [ScatterFeatureRequirement](#ScatterFeatureRequirement) must be specified
34
 in the workflow or workflow step requirements.
35
 
36
 A &quot;scatter&quot; operation specifies that the associated workflow step or
37
 subworkflow should execute separately over a list of input elements.  Each
38
 job making up a scatter operation is independent and may be executed
39
 concurrently.
40
 
41
 The `scatter` field specifies one or more input parameters which will be
42
 scattered.  An input parameter may be listed more than once.  The declared
43
 type of each input parameter implicitly becomes an array of items of the
44
 input parameter type.  If a parameter is listed more than once, it becomes
45
 a nested array.  As a result, upstream parameters which are connected to
46
 scattered parameters must be arrays.
47
 
48
 All output parameter types are also implicitly wrapped in arrays.  Each job
49
 in the scatter results in an entry in the output array.
50
 
51
 If any scattered parameter runtime value is an empty array, all outputs are
52
 set to empty arrays and no work is done for the step, according to
53
 applicable scattering rules.
54
 
55
 If `scatter` declares more than one input parameter, `scatterMethod`
56
 describes how to decompose the input into a discrete set of jobs.
57
 
58
   * **dotproduct** specifies that each of the input arrays are aligned and one
59
       element taken from each array to construct each job.  It is an error
60
       if all input arrays are not the same length.
61
 
62
   * **nested_crossproduct** specifies the Cartesian product of the inputs,
63
       producing a job for every combination of the scattered inputs.  The
64
       output must be nested arrays for each level of scattering, in the
65
       order that the input arrays are listed in the `scatter` field.
66
 
67
   * **flat_crossproduct** specifies the Cartesian product of the inputs,
68
       producing a job for every combination of the scattered inputs.  The
69
       output arrays must be flattened to a single level, but otherwise listed in the
70
       order that the input arrays are listed in the `scatter` field.
71
 
72
 # Conditional execution (Optional)
73
 
74
 Conditional execution makes execution of a step conditional on an
75
 expression.  A step that is not executed is &quot;skipped&quot;.  A skipped
76
 step produces `null` for all output parameters.
77
 
78
 The condition is evaluated after `scatter`, using the input object
79
 of each individual scatter job.  This means over a set of scatter
80
 jobs, some may be executed and some may be skipped.  When the
81
 results are gathered, skipped steps must be `null` in the output
82
 arrays.
83
 
84
 The `when` field controls conditional execution.  This is an
85
 expression that must be evaluated with `inputs` bound to the step
86
 input object (or individual scatter job), and returns a boolean
87
 value.  It is an error if this expression returns a value other
88
 than `true` or `false`.
89
 
90
 Conditionals in CWL are an optional feature and are not required
91
 to be implemented by all consumers of CWL documents.  An
92
 implementation that does not support conditionals must return a
93
 fatal error when attempting to execute a workflow that uses
94
 conditional constructs the implementation does not support.
95
 
96
 # Subworkflows
97
 
98
 To specify a nested workflow as part of a workflow step,
99
 [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be
100
 specified in the workflow or workflow step requirements.
101
 
102
 It is a fatal error if a workflow directly or indirectly invokes itself as
103
 a subworkflow (recursive workflows are not allowed).
104
  </BLOCKQUOTE>
105
 */
106
public class WorkflowStepImpl extends SaveableImpl implements WorkflowStep {
107
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
108
  private java.util.Map<String, Object> extensionFields_ =
1✔
109
      new java.util.HashMap<String, Object>();
110
  public LoadingOptions getLoadingOptions() {
111
    return this.loadingOptions_;
×
112
  }
113
  public java.util.Map<String, Object> getExtensionFields() {
114
    return this.extensionFields_;
×
115
  }
116

117
  private String id;
118

119
  /**
120
   * Getter for property <I>https://w3id.org/cwl/cwl#WorkflowStep/id</I><BR>
121
   * <BLOCKQUOTE>
122
   * The unique identifier for this WorkflowStep.   * </BLOCKQUOTE>
123
   */
124

125
  public String getId() {
126
    return this.id;
×
127
  }
128

129
  private java.util.Optional<String> label;
130

131
  /**
132
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
133
   * <BLOCKQUOTE>
134
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
135
   */
136

137
  public java.util.Optional<String> getLabel() {
138
    return this.label;
×
139
  }
140

141
  private Object doc;
142

143
  /**
144
   * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><BR>
145
   * <BLOCKQUOTE>
146
   * A documentation string for this object, or an array of strings which should be concatenated.   * </BLOCKQUOTE>
147
   */
148

149
  public Object getDoc() {
150
    return this.doc;
×
151
  }
152

153
  private java.util.List<Object> in;
154

155
  /**
156
   * Getter for property <I>https://w3id.org/cwl/cwl#in</I><BR>
157
   * <BLOCKQUOTE>
158
   * Defines the input parameters of the workflow step.  The process is ready to
159
   * run when all required input parameters are associated with concrete
160
   * values.  Input parameters include a schema for each parameter which is
161
   * used to validate the input object.  It may also be used build a user
162
   * interface for constructing the input object.
163
   *    * </BLOCKQUOTE>
164
   */
165

166
  public java.util.List<Object> getIn() {
167
    return this.in;
1✔
168
  }
169

170
  private java.util.List<Object> out;
171

172
  /**
173
   * Getter for property <I>https://w3id.org/cwl/cwl#out</I><BR>
174
   * <BLOCKQUOTE>
175
   * Defines the parameters representing the output of the process.  May be
176
   * used to generate and/or validate the output object.
177
   *    * </BLOCKQUOTE>
178
   */
179

180
  public java.util.List<Object> getOut() {
181
    return this.out;
×
182
  }
183

184
  private java.util.Optional<java.util.List<Object>> requirements;
185

186
  /**
187
   * Getter for property <I>https://w3id.org/cwl/cwl#requirements</I><BR>
188
   * <BLOCKQUOTE>
189
   * Declares requirements that apply to either the runtime environment or the
190
   * workflow engine that must be met in order to execute this workflow step.  If
191
   * an implementation cannot satisfy all requirements, or a requirement is
192
   * listed which is not recognized by the implementation, it is a fatal
193
   * error and the implementation must not attempt to run the process,
194
   * unless overridden at user option.
195
   *    * </BLOCKQUOTE>
196
   */
197

198
  public java.util.Optional<java.util.List<Object>> getRequirements() {
199
    return this.requirements;
×
200
  }
201

202
  private java.util.Optional<java.util.List<Object>> hints;
203

204
  /**
205
   * Getter for property <I>https://w3id.org/cwl/cwl#hints</I><BR>
206
   * <BLOCKQUOTE>
207
   * Declares hints applying to either the runtime environment or the
208
   * workflow engine that may be helpful in executing this workflow step.  It is
209
   * not an error if an implementation cannot satisfy all hints, however
210
   * the implementation may report a warning.
211
   *    * </BLOCKQUOTE>
212
   */
213

214
  public java.util.Optional<java.util.List<Object>> getHints() {
215
    return this.hints;
×
216
  }
217

218
  private Object run;
219

220
  /**
221
   * Getter for property <I>https://w3id.org/cwl/cwl#run</I><BR>
222
   * <BLOCKQUOTE>
223
   * Specifies the process to run.  If `run` is a string, it must be an absolute IRI
224
   * or a relative path from the primary document.
225
   *    * </BLOCKQUOTE>
226
   */
227

228
  public Object getRun() {
229
    return this.run;
×
230
  }
231

232
  private java.util.Optional<String> when;
233

234
  /**
235
   * Getter for property <I>https://w3id.org/cwl/cwl#WorkflowStep/when</I><BR>
236
   * <BLOCKQUOTE>
237
   * If defined, only run the step when the expression evaluates to
238
   * `true`.  If `false` the step is skipped.  A skipped step
239
   * produces a `null` on each output.
240
   *    * </BLOCKQUOTE>
241
   */
242

243
  public java.util.Optional<String> getWhen() {
244
    return this.when;
×
245
  }
246

247
  private Object scatter;
248

249
  /**
250
   * Getter for property <I>https://w3id.org/cwl/cwl#scatter</I><BR>
251

252
   */
253

254
  public Object getScatter() {
255
    return this.scatter;
×
256
  }
257

258
  private java.util.Optional<ScatterMethod> scatterMethod;
259

260
  /**
261
   * Getter for property <I>https://w3id.org/cwl/cwl#scatterMethod</I><BR>
262
   * <BLOCKQUOTE>
263
   * Required if `scatter` is an array of more than one element.
264
   *    * </BLOCKQUOTE>
265
   */
266

267
  public java.util.Optional<ScatterMethod> getScatterMethod() {
268
    return this.scatterMethod;
×
269
  }
270

271
  /**
272
   * Used by {@link org.commonwl.cwlsdk.cwl1_2.utils.RootLoader} to construct instances of WorkflowStepImpl.
273
   *
274
   * @param __doc_            Document fragment to load this record object from (presumably a
275
                              {@link java.util.Map}).
276
   * @param __baseUri_        Base URI to generate child document IDs against.
277
   * @param __loadingOptions  Context for loading URIs and populating objects.
278
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
279
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
280
   *                             or validation of fields fails.
281
   */
282
  public WorkflowStepImpl(
283
      final Object __doc_,
284
      final String __baseUri_,
285
      LoadingOptions __loadingOptions,
286
      final String __docRoot_) {
287
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
288
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
289
    // generated names.
290
    String __baseUri = __baseUri_;
1✔
291
    String __docRoot = __docRoot_;
1✔
292
    if (!(__doc_ instanceof java.util.Map)) {
1✔
293
      throw new ValidationException("WorkflowStepImpl called on non-map");
×
294
    }
295
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
296
    final java.util.List<ValidationException> __errors =
1✔
297
        new java.util.ArrayList<ValidationException>();
298
    if (__loadingOptions != null) {
1✔
299
      this.loadingOptions_ = __loadingOptions;
1✔
300
    }
301
    String id;
302

303
    if (__doc.containsKey("id")) {
1✔
304
      try {
305
        id =
1✔
306
            LoaderInstances
307
                .uri_StringInstance_True_False_None_None
308
                .loadField(__doc.get("id"), __baseUri, __loadingOptions);
1✔
309
      } catch (ValidationException e) {
×
310
        id = null; // won't be used but prevents compiler from complaining.
×
311
        final String __message = "the `id` field is not valid because:";
×
312
        __errors.add(new ValidationException(__message, e));
×
313
      }
1✔
314

315
    } else {
316
      id = null;
×
317
    }
318

319
    if (id == null) {
1✔
UNCOV
320
      if (__docRoot != null) {
×
NEW
321
        id = __docRoot;
×
322
      } else {
NEW
323
        throw new ValidationException("Missing id");
×
324
      }
325
    }
326
    __baseUri = (String) id;
1✔
327
    java.util.Optional<String> label;
328

329
    if (__doc.containsKey("label")) {
1✔
330
      try {
331
        label =
×
332
            LoaderInstances
333
                .optional_StringInstance
334
                .loadField(__doc.get("label"), __baseUri, __loadingOptions);
×
335
      } catch (ValidationException e) {
×
336
        label = null; // won't be used but prevents compiler from complaining.
×
337
        final String __message = "the `label` field is not valid because:";
×
338
        __errors.add(new ValidationException(__message, e));
×
339
      }
×
340

341
    } else {
342
      label = null;
1✔
343
    }
344
    Object doc;
345

346
    if (__doc.containsKey("doc")) {
1✔
347
      try {
348
        doc =
×
349
            LoaderInstances
350
                .union_of_NullInstance_or_StringInstance_or_array_of_StringInstance
351
                .loadField(__doc.get("doc"), __baseUri, __loadingOptions);
×
352
      } catch (ValidationException e) {
×
353
        doc = null; // won't be used but prevents compiler from complaining.
×
354
        final String __message = "the `doc` field is not valid because:";
×
355
        __errors.add(new ValidationException(__message, e));
×
356
      }
×
357

358
    } else {
359
      doc = null;
1✔
360
    }
361
    java.util.List<Object> in;
362
    try {
363
      in =
1✔
364
          LoaderInstances
365
              .idmap_in_array_of_WorkflowStepInput
366
              .loadField(__doc.get("in"), __baseUri, __loadingOptions);
1✔
367
    } catch (ValidationException e) {
×
368
      in = null; // won't be used but prevents compiler from complaining.
×
369
      final String __message = "the `in` field is not valid because:";
×
370
      __errors.add(new ValidationException(__message, e));
×
371
    }
1✔
372
    java.util.List<Object> out;
373
    try {
374
      out =
1✔
375
          LoaderInstances
376
              .uri_array_of_union_of_StringInstance_or_WorkflowStepOutput_True_False_None_None
377
              .loadField(__doc.get("out"), __baseUri, __loadingOptions);
1✔
378
    } catch (ValidationException e) {
×
379
      out = null; // won't be used but prevents compiler from complaining.
×
380
      final String __message = "the `out` field is not valid because:";
×
381
      __errors.add(new ValidationException(__message, e));
×
382
    }
1✔
383
    java.util.Optional<java.util.List<Object>> requirements;
384

385
    if (__doc.containsKey("requirements")) {
1✔
386
      try {
387
        requirements =
1✔
388
            LoaderInstances
389
                .idmap_requirements_optional_array_of_union_of_InlineJavascriptRequirement_or_SchemaDefRequirement_or_LoadListingRequirement_or_DockerRequirement_or_SoftwareRequirement_or_InitialWorkDirRequirement_or_EnvVarRequirement_or_ShellCommandRequirement_or_ResourceRequirement_or_WorkReuse_or_NetworkAccess_or_InplaceUpdateRequirement_or_ToolTimeLimit_or_SubworkflowFeatureRequirement_or_ScatterFeatureRequirement_or_MultipleInputFeatureRequirement_or_StepInputExpressionRequirement
390
                .loadField(__doc.get("requirements"), __baseUri, __loadingOptions);
1✔
391
      } catch (ValidationException e) {
×
392
        requirements = null; // won't be used but prevents compiler from complaining.
×
393
        final String __message = "the `requirements` field is not valid because:";
×
394
        __errors.add(new ValidationException(__message, e));
×
395
      }
1✔
396

397
    } else {
398
      requirements = null;
1✔
399
    }
400
    java.util.Optional<java.util.List<Object>> hints;
401

402
    if (__doc.containsKey("hints")) {
1✔
403
      try {
404
        hints =
×
405
            LoaderInstances
406
                .idmap_hints_optional_array_of_AnyInstance
407
                .loadField(__doc.get("hints"), __baseUri, __loadingOptions);
×
408
      } catch (ValidationException e) {
×
409
        hints = null; // won't be used but prevents compiler from complaining.
×
410
        final String __message = "the `hints` field is not valid because:";
×
411
        __errors.add(new ValidationException(__message, e));
×
412
      }
×
413

414
    } else {
415
      hints = null;
1✔
416
    }
417
    Object run;
418
    try {
419
      run =
1✔
420
          LoaderInstances
421
              .uri_union_of_StringInstance_or_CommandLineTool_or_ExpressionTool_or_Workflow_or_Operation_False_False_None_None
422
              .loadField(__doc.get("run"), __baseUri, __loadingOptions);
1✔
423
    } catch (ValidationException e) {
×
424
      run = null; // won't be used but prevents compiler from complaining.
×
425
      final String __message = "the `run` field is not valid because:";
×
426
      __errors.add(new ValidationException(__message, e));
×
427
    }
1✔
428
    java.util.Optional<String> when;
429

430
    if (__doc.containsKey("when")) {
1✔
431
      try {
432
        when =
1✔
433
            LoaderInstances
434
                .optional_ExpressionLoader
435
                .loadField(__doc.get("when"), __baseUri, __loadingOptions);
1✔
436
      } catch (ValidationException e) {
×
437
        when = null; // won't be used but prevents compiler from complaining.
×
438
        final String __message = "the `when` field is not valid because:";
×
439
        __errors.add(new ValidationException(__message, e));
×
440
      }
1✔
441

442
    } else {
443
      when = null;
1✔
444
    }
445
    Object scatter;
446

447
    if (__doc.containsKey("scatter")) {
1✔
448
      try {
449
        scatter =
1✔
450
            LoaderInstances
451
                .uri_union_of_NullInstance_or_StringInstance_or_array_of_StringInstance_False_False_0_None
452
                .loadField(__doc.get("scatter"), __baseUri, __loadingOptions);
1✔
453
      } catch (ValidationException e) {
×
454
        scatter = null; // won't be used but prevents compiler from complaining.
×
455
        final String __message = "the `scatter` field is not valid because:";
×
456
        __errors.add(new ValidationException(__message, e));
×
457
      }
1✔
458

459
    } else {
460
      scatter = null;
1✔
461
    }
462
    java.util.Optional<ScatterMethod> scatterMethod;
463

464
    if (__doc.containsKey("scatterMethod")) {
1✔
465
      try {
466
        scatterMethod =
1✔
467
            LoaderInstances
468
                .uri_optional_ScatterMethod_False_True_None_None
469
                .loadField(__doc.get("scatterMethod"), __baseUri, __loadingOptions);
1✔
470
      } catch (ValidationException e) {
×
471
        scatterMethod = null; // won't be used but prevents compiler from complaining.
×
472
        final String __message = "the `scatterMethod` field is not valid because:";
×
473
        __errors.add(new ValidationException(__message, e));
×
474
      }
1✔
475

476
    } else {
477
      scatterMethod = null;
1✔
478
    }
479
    if (!__errors.isEmpty()) {
1✔
480
      throw new ValidationException("Trying 'RecordField'", __errors);
×
481
    }
482
    this.id = (String) id;
1✔
483
    this.label = (java.util.Optional<String>) label;
1✔
484
    this.doc = (Object) doc;
1✔
485
    this.in = (java.util.List<Object>) in;
1✔
486
    this.out = (java.util.List<Object>) out;
1✔
487
    this.requirements = (java.util.Optional<java.util.List<Object>>) requirements;
1✔
488
    this.hints = (java.util.Optional<java.util.List<Object>>) hints;
1✔
489
    this.run = (Object) run;
1✔
490
    this.when = (java.util.Optional<String>) when;
1✔
491
    this.scatter = (Object) scatter;
1✔
492
    this.scatterMethod = (java.util.Optional<ScatterMethod>) scatterMethod;
1✔
493
    for (String field:__doc.keySet()) {
1✔
494
      if (!attrs.contains(field)) {
1✔
495
        if (field.contains(":")) {
×
496
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
497
          extensionFields_.put(expanded_field, __doc.get(field));
×
498
        }
499
      }
500
    }
1✔
501
  }
1✔
502
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "label", "doc", "in", "out", "requirements", "hints", "run", "when", "scatter", "scatterMethod");
1✔
503
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc