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

common-workflow-language / cwljava / #394

31 Oct 2025 04:10PM UTC coverage: 57.972% (-1.6%) from 59.538%
#394

push

github

mr-c
rename package to a namespace that we control

7575 of 12994 new or added lines in 261 files covered. (58.3%)

7752 of 13372 relevant lines covered (57.97%)

0.58 hits per line

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

48.15
/src/main/java/org/commonwl/cwlsdk/cwl1_1/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_1;
16

17
import org.commonwl.cwlsdk.cwl1_1.utils.LoaderInstances;
18
import org.commonwl.cwlsdk.cwl1_1.utils.LoadingOptions;
19
import org.commonwl.cwlsdk.cwl1_1.utils.LoadingOptionsBuilder;
20
import org.commonwl.cwlsdk.cwl1_1.utils.SaveableImpl;
21
import org.commonwl.cwlsdk.cwl1_1.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 "scatter" 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 is 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
 # Subworkflows
73
 
74
 To specify a nested workflow as part of a workflow step,
75
 [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be
76
 specified in the workflow or workflow step requirements.
77
 
78
 It is a fatal error if a workflow directly or indirectly invokes itself as
79
 a subworkflow (recursive workflows are not allowed).
80
  </BLOCKQUOTE>
81
 */
82
public class WorkflowStepImpl extends SaveableImpl implements WorkflowStep {
83
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
84
  private java.util.Map<String, Object> extensionFields_ =
1✔
85
      new java.util.HashMap<String, Object>();
86
  public LoadingOptions getLoadingOptions() {
NEW
87
    return this.loadingOptions_;
×
88
  }
89
  public java.util.Map<String, Object> getExtensionFields() {
NEW
90
    return this.extensionFields_;
×
91
  }
92

93
  private java.util.Optional<String> id;
94

95
  /**
96
   * Getter for property <I>https://w3id.org/cwl/cwl#Identified/id</I><BR>
97
   * <BLOCKQUOTE>
98
   * The unique identifier for this object.   * </BLOCKQUOTE>
99
   */
100

101
  public java.util.Optional<String> getId() {
NEW
102
    return this.id;
×
103
  }
104

105
  private java.util.Optional<String> label;
106

107
  /**
108
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
109
   * <BLOCKQUOTE>
110
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
111
   */
112

113
  public java.util.Optional<String> getLabel() {
NEW
114
    return this.label;
×
115
  }
116

117
  private Object doc;
118

119
  /**
120
   * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><BR>
121
   * <BLOCKQUOTE>
122
   * A documentation string for this object, or an array of strings which should be concatenated.   * </BLOCKQUOTE>
123
   */
124

125
  public Object getDoc() {
NEW
126
    return this.doc;
×
127
  }
128

129
  private java.util.List<Object> in;
130

131
  /**
132
   * Getter for property <I>https://w3id.org/cwl/cwl#in</I><BR>
133
   * <BLOCKQUOTE>
134
   * Defines the input parameters of the workflow step.  The process is ready to
135
   * run when all required input parameters are associated with concrete
136
   * values.  Input parameters include a schema for each parameter which is
137
   * used to validate the input object.  It may also be used build a user
138
   * interface for constructing the input object.
139
   *    * </BLOCKQUOTE>
140
   */
141

142
  public java.util.List<Object> getIn() {
143
    return this.in;
1✔
144
  }
145

146
  private java.util.List<Object> out;
147

148
  /**
149
   * Getter for property <I>https://w3id.org/cwl/cwl#out</I><BR>
150
   * <BLOCKQUOTE>
151
   * Defines the parameters representing the output of the process.  May be
152
   * used to generate and/or validate the output object.
153
   *    * </BLOCKQUOTE>
154
   */
155

156
  public java.util.List<Object> getOut() {
NEW
157
    return this.out;
×
158
  }
159

160
  private java.util.Optional<java.util.List<Object>> requirements;
161

162
  /**
163
   * Getter for property <I>https://w3id.org/cwl/cwl#requirements</I><BR>
164
   * <BLOCKQUOTE>
165
   * Declares requirements that apply to either the runtime environment or the
166
   * workflow engine that must be met in order to execute this workflow step.  If
167
   * an implementation cannot satisfy all requirements, or a requirement is
168
   * listed which is not recognized by the implementation, it is a fatal
169
   * error and the implementation must not attempt to run the process,
170
   * unless overridden at user option.
171
   *    * </BLOCKQUOTE>
172
   */
173

174
  public java.util.Optional<java.util.List<Object>> getRequirements() {
NEW
175
    return this.requirements;
×
176
  }
177

178
  private java.util.Optional<java.util.List<Object>> hints;
179

180
  /**
181
   * Getter for property <I>https://w3id.org/cwl/cwl#hints</I><BR>
182
   * <BLOCKQUOTE>
183
   * Declares hints applying to either the runtime environment or the
184
   * workflow engine that may be helpful in executing this workflow step.  It is
185
   * not an error if an implementation cannot satisfy all hints, however
186
   * the implementation may report a warning.
187
   *    * </BLOCKQUOTE>
188
   */
189

190
  public java.util.Optional<java.util.List<Object>> getHints() {
NEW
191
    return this.hints;
×
192
  }
193

194
  private Object run;
195

196
  /**
197
   * Getter for property <I>https://w3id.org/cwl/cwl#run</I><BR>
198
   * <BLOCKQUOTE>
199
   * Specifies the process to run.
200
   *    * </BLOCKQUOTE>
201
   */
202

203
  public Object getRun() {
NEW
204
    return this.run;
×
205
  }
206

207
  private Object scatter;
208

209
  /**
210
   * Getter for property <I>https://w3id.org/cwl/cwl#scatter</I><BR>
211

212
   */
213

214
  public Object getScatter() {
NEW
215
    return this.scatter;
×
216
  }
217

218
  private java.util.Optional<ScatterMethod> scatterMethod;
219

220
  /**
221
   * Getter for property <I>https://w3id.org/cwl/cwl#scatterMethod</I><BR>
222
   * <BLOCKQUOTE>
223
   * Required if `scatter` is an array of more than one element.
224
   *    * </BLOCKQUOTE>
225
   */
226

227
  public java.util.Optional<ScatterMethod> getScatterMethod() {
NEW
228
    return this.scatterMethod;
×
229
  }
230

231
  /**
232
   * Used by {@link org.commonwl.cwlsdk.cwl1_1.utils.RootLoader} to construct instances of WorkflowStepImpl.
233
   *
234
   * @param __doc_            Document fragment to load this record object from (presumably a
235
                              {@link java.util.Map}).
236
   * @param __baseUri_        Base URI to generate child document IDs against.
237
   * @param __loadingOptions  Context for loading URIs and populating objects.
238
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
239
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
240
   *                             or validation of fields fails.
241
   */
242
  public WorkflowStepImpl(
243
      final Object __doc_,
244
      final String __baseUri_,
245
      LoadingOptions __loadingOptions,
246
      final String __docRoot_) {
247
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
248
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
249
    // generated names.
250
    String __baseUri = __baseUri_;
1✔
251
    String __docRoot = __docRoot_;
1✔
252
    if (!(__doc_ instanceof java.util.Map)) {
1✔
NEW
253
      throw new ValidationException("WorkflowStepImpl called on non-map");
×
254
    }
255
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
256
    final java.util.List<ValidationException> __errors =
1✔
257
        new java.util.ArrayList<ValidationException>();
258
    if (__loadingOptions != null) {
1✔
259
      this.loadingOptions_ = __loadingOptions;
1✔
260
    }
261
    java.util.Optional<String> id;
262

263
    if (__doc.containsKey("id")) {
1✔
264
      try {
265
        id =
1✔
266
            LoaderInstances
267
                .uri_optional_StringInstance_True_False_None_None
268
                .loadField(__doc.get("id"), __baseUri, __loadingOptions);
1✔
NEW
269
      } catch (ValidationException e) {
×
NEW
270
        id = null; // won't be used but prevents compiler from complaining.
×
NEW
271
        final String __message = "the `id` field is not valid because:";
×
NEW
272
        __errors.add(new ValidationException(__message, e));
×
273
      }
1✔
274

275
    } else {
NEW
276
      id = null;
×
277
    }
278

279
    Boolean __original_is_null = id == null;
1✔
280
    if (id == null) {
1✔
NEW
281
      if (__docRoot != null) {
×
NEW
282
        id = java.util.Optional.of(__docRoot);
×
283
      } else {
NEW
284
        id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString());
×
285
      }
286
    }
287
    if (__original_is_null) {
1✔
NEW
288
        __baseUri = __baseUri_;
×
289
    } else {
290
        __baseUri = (String) id.orElse(null);
1✔
291
    }
292
    java.util.Optional<String> label;
293

294
    if (__doc.containsKey("label")) {
1✔
295
      try {
NEW
296
        label =
×
297
            LoaderInstances
298
                .optional_StringInstance
NEW
299
                .loadField(__doc.get("label"), __baseUri, __loadingOptions);
×
NEW
300
      } catch (ValidationException e) {
×
NEW
301
        label = null; // won't be used but prevents compiler from complaining.
×
NEW
302
        final String __message = "the `label` field is not valid because:";
×
NEW
303
        __errors.add(new ValidationException(__message, e));
×
NEW
304
      }
×
305

306
    } else {
307
      label = null;
1✔
308
    }
309
    Object doc;
310

311
    if (__doc.containsKey("doc")) {
1✔
312
      try {
NEW
313
        doc =
×
314
            LoaderInstances
315
                .union_of_NullInstance_or_StringInstance_or_array_of_StringInstance
NEW
316
                .loadField(__doc.get("doc"), __baseUri, __loadingOptions);
×
NEW
317
      } catch (ValidationException e) {
×
NEW
318
        doc = null; // won't be used but prevents compiler from complaining.
×
NEW
319
        final String __message = "the `doc` field is not valid because:";
×
NEW
320
        __errors.add(new ValidationException(__message, e));
×
NEW
321
      }
×
322

323
    } else {
324
      doc = null;
1✔
325
    }
326
    java.util.List<Object> in;
327
    try {
328
      in =
1✔
329
          LoaderInstances
330
              .idmap_in_array_of_WorkflowStepInput
331
              .loadField(__doc.get("in"), __baseUri, __loadingOptions);
1✔
NEW
332
    } catch (ValidationException e) {
×
NEW
333
      in = null; // won't be used but prevents compiler from complaining.
×
NEW
334
      final String __message = "the `in` field is not valid because:";
×
NEW
335
      __errors.add(new ValidationException(__message, e));
×
336
    }
1✔
337
    java.util.List<Object> out;
338
    try {
339
      out =
1✔
340
          LoaderInstances
341
              .uri_array_of_union_of_StringInstance_or_WorkflowStepOutput_True_False_None_None
342
              .loadField(__doc.get("out"), __baseUri, __loadingOptions);
1✔
NEW
343
    } catch (ValidationException e) {
×
NEW
344
      out = null; // won't be used but prevents compiler from complaining.
×
NEW
345
      final String __message = "the `out` field is not valid because:";
×
NEW
346
      __errors.add(new ValidationException(__message, e));
×
347
    }
1✔
348
    java.util.Optional<java.util.List<Object>> requirements;
349

350
    if (__doc.containsKey("requirements")) {
1✔
351
      try {
352
        requirements =
1✔
353
            LoaderInstances
354
                .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
355
                .loadField(__doc.get("requirements"), __baseUri, __loadingOptions);
1✔
NEW
356
      } catch (ValidationException e) {
×
NEW
357
        requirements = null; // won't be used but prevents compiler from complaining.
×
NEW
358
        final String __message = "the `requirements` field is not valid because:";
×
NEW
359
        __errors.add(new ValidationException(__message, e));
×
360
      }
1✔
361

362
    } else {
363
      requirements = null;
1✔
364
    }
365
    java.util.Optional<java.util.List<Object>> hints;
366

367
    if (__doc.containsKey("hints")) {
1✔
368
      try {
NEW
369
        hints =
×
370
            LoaderInstances
371
                .idmap_hints_optional_array_of_AnyInstance
NEW
372
                .loadField(__doc.get("hints"), __baseUri, __loadingOptions);
×
NEW
373
      } catch (ValidationException e) {
×
NEW
374
        hints = null; // won't be used but prevents compiler from complaining.
×
NEW
375
        final String __message = "the `hints` field is not valid because:";
×
NEW
376
        __errors.add(new ValidationException(__message, e));
×
NEW
377
      }
×
378

379
    } else {
380
      hints = null;
1✔
381
    }
382
    Object run;
383
    try {
384
      run =
1✔
385
          LoaderInstances
386
              .uri_union_of_StringInstance_or_CommandLineTool_or_ExpressionTool_or_Workflow_False_False_None_None
387
              .loadField(__doc.get("run"), __baseUri, __loadingOptions);
1✔
NEW
388
    } catch (ValidationException e) {
×
NEW
389
      run = null; // won't be used but prevents compiler from complaining.
×
NEW
390
      final String __message = "the `run` field is not valid because:";
×
NEW
391
      __errors.add(new ValidationException(__message, e));
×
392
    }
1✔
393
    Object scatter;
394

395
    if (__doc.containsKey("scatter")) {
1✔
396
      try {
397
        scatter =
1✔
398
            LoaderInstances
399
                .uri_union_of_NullInstance_or_StringInstance_or_array_of_StringInstance_False_False_0_None
400
                .loadField(__doc.get("scatter"), __baseUri, __loadingOptions);
1✔
NEW
401
      } catch (ValidationException e) {
×
NEW
402
        scatter = null; // won't be used but prevents compiler from complaining.
×
NEW
403
        final String __message = "the `scatter` field is not valid because:";
×
NEW
404
        __errors.add(new ValidationException(__message, e));
×
405
      }
1✔
406

407
    } else {
408
      scatter = null;
1✔
409
    }
410
    java.util.Optional<ScatterMethod> scatterMethod;
411

412
    if (__doc.containsKey("scatterMethod")) {
1✔
413
      try {
414
        scatterMethod =
1✔
415
            LoaderInstances
416
                .uri_optional_ScatterMethod_False_True_None_None
417
                .loadField(__doc.get("scatterMethod"), __baseUri, __loadingOptions);
1✔
NEW
418
      } catch (ValidationException e) {
×
NEW
419
        scatterMethod = null; // won't be used but prevents compiler from complaining.
×
NEW
420
        final String __message = "the `scatterMethod` field is not valid because:";
×
NEW
421
        __errors.add(new ValidationException(__message, e));
×
422
      }
1✔
423

424
    } else {
425
      scatterMethod = null;
1✔
426
    }
427
    if (!__errors.isEmpty()) {
1✔
NEW
428
      throw new ValidationException("Trying 'RecordField'", __errors);
×
429
    }
430
    this.id = (java.util.Optional<String>) id;
1✔
431
    this.label = (java.util.Optional<String>) label;
1✔
432
    this.doc = (Object) doc;
1✔
433
    this.in = (java.util.List<Object>) in;
1✔
434
    this.out = (java.util.List<Object>) out;
1✔
435
    this.requirements = (java.util.Optional<java.util.List<Object>>) requirements;
1✔
436
    this.hints = (java.util.Optional<java.util.List<Object>>) hints;
1✔
437
    this.run = (Object) run;
1✔
438
    this.scatter = (Object) scatter;
1✔
439
    this.scatterMethod = (java.util.Optional<ScatterMethod>) scatterMethod;
1✔
440
    for (String field:__doc.keySet()) {
1✔
441
      if (!attrs.contains(field)) {
1✔
NEW
442
        if (field.contains(":")) {
×
NEW
443
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
444
          extensionFields_.put(expanded_field, __doc.get(field));
×
445
        }
446
      }
447
    }
1✔
448
  }
1✔
449
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "label", "doc", "in", "out", "requirements", "hints", "run", "scatter", "scatterMethod");
1✔
450
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc