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

common-workflow-language / cwljava / #389

30 Oct 2025 05:13PM UTC coverage: 58.693% (-0.8%) from 59.538%
#389

Pull #218

github

web-flow
Merge 98b159202 into befd7e4b9
Pull Request #218: Populate the extensionFields; add public accessors for LoadingOptions

230 of 569 new or added lines in 67 files covered. (40.42%)

28 existing lines in 27 files now uncovered.

7535 of 12838 relevant lines covered (58.69%)

0.59 hits per line

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

61.81
/src/main/java/org/w3id/cwl/cwl1_2/WorkflowImpl.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.w3id.cwl.cwl1_2;
16

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

23
/**
24
* Auto-generated class implementation for <I>https://w3id.org/cwl/cwl#Workflow</I><BR> <BLOCKQUOTE>
25
 A workflow describes a set of **steps** and the **dependencies** between
26
 those steps.  When a step produces output that will be consumed by a
27
 second step, the first step is a dependency of the second step.
28
 
29
 When there is a dependency, the workflow engine must execute the preceding
30
 step and wait for it to successfully produce output before executing the
31
 dependent step.  If two steps are defined in the workflow graph that
32
 are not directly or indirectly dependent, these steps are **independent**,
33
 and may execute in any order or execute concurrently.  A workflow is
34
 complete when all steps have been executed.
35
 
36
 Dependencies between parameters are expressed using the `source`
37
 field on [workflow step input parameters](#WorkflowStepInput) and
38
 `outputSource` field on [workflow output
39
 parameters](#WorkflowOutputParameter).
40
 
41
 The `source` field on each workflow step input parameter expresses
42
 the data links that contribute to the value of the step input
43
 parameter (the "sink").  A workflow step can only begin execution
44
 when every data link connected to a step has been fulfilled.
45
 
46
 The `outputSource` field on each workflow step input parameter
47
 expresses the data links that contribute to the value of the
48
 workflow output parameter (the "sink").  Workflow execution cannot
49
 complete successfully until every data link connected to an output
50
 parameter has been fulfilled.
51
 
52
 ## Workflow success and failure
53
 
54
 A completed step must result in one of `success`, `temporaryFailure` or
55
 `permanentFailure` states.  An implementation may choose to retry a step
56
 execution which resulted in `temporaryFailure`.  An implementation may
57
 choose to either continue running other steps of a workflow, or terminate
58
 immediately upon `permanentFailure`.
59
 
60
 * If any step of a workflow execution results in `permanentFailure`, then
61
 the workflow status is `permanentFailure`.
62
 
63
 * If one or more steps result in `temporaryFailure` and all other steps
64
 complete `success` or are not executed, then the workflow status is
65
 `temporaryFailure`.
66
 
67
 * If all workflow steps are executed and complete with `success`, then the
68
 workflow status is `success`.
69
 
70
 # Extensions
71
 
72
 [ScatterFeatureRequirement](#ScatterFeatureRequirement) and
73
 [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) are
74
 available as standard [extensions](#Extensions_and_Metadata) to core
75
 workflow semantics.
76
  </BLOCKQUOTE>
77
 */
78
public class WorkflowImpl extends SaveableImpl implements Workflow {
79
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
80
  private java.util.Map<String, Object> extensionFields_ =
1✔
81
      new java.util.HashMap<String, Object>();
82
  public LoadingOptions getLoadingOptions() {
NEW
83
    return this.loadingOptions_;
×
84
  }
85
  public java.util.Map<String, Object> getExtensionFields() {
86
    return this.extensionFields_;
×
87
  }
88

89
  private java.util.Optional<String> id;
90

91
  /**
92
   * Getter for property <I>https://w3id.org/cwl/cwl#Process/id</I><BR>
93
   * <BLOCKQUOTE>
94
   * The unique identifier for this object.
95
   * 
96
   * Only useful for `$graph` at `Process` level. Should not be exposed
97
   * to users in graphical or terminal user interfaces.
98
   *    * </BLOCKQUOTE>
99
   */
100

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

105
  private Workflow_class class_;
106

107
  /**
108
   * Getter for property <I>https://w3id.org/cwl/cwl#Workflow/class</I><BR>
109

110
   */
111

112
  public Workflow_class getClass_() {
113
    return this.class_;
×
114
  }
115

116
  private java.util.Optional<String> label;
117

118
  /**
119
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
120
   * <BLOCKQUOTE>
121
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
122
   */
123

124
  public java.util.Optional<String> getLabel() {
125
    return this.label;
×
126
  }
127

128
  private Object doc;
129

130
  /**
131
   * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><BR>
132
   * <BLOCKQUOTE>
133
   * A documentation string for this object, or an array of strings which should be concatenated.   * </BLOCKQUOTE>
134
   */
135

136
  public Object getDoc() {
137
    return this.doc;
×
138
  }
139

140
  private java.util.List<Object> inputs;
141

142
  /**
143
   * Getter for property <I>https://w3id.org/cwl/cwl#inputs</I><BR>
144
   * <BLOCKQUOTE>
145
   * Defines the input parameters of the process.  The process is ready to
146
   * run when all required input parameters are associated with concrete
147
   * values.  Input parameters include a schema for each parameter which is
148
   * used to validate the input object.  It may also be used to build a user
149
   * interface for constructing the input object.
150
   * 
151
   * When accepting an input object, all input parameters must have a value.
152
   * If an input parameter is missing from the input object, it must be
153
   * assigned a value of `null` (or the value of `default` for that
154
   * parameter, if provided) for the purposes of validation and evaluation
155
   * of expressions.
156
   *    * </BLOCKQUOTE>
157
   */
158

159
  public java.util.List<Object> getInputs() {
160
    return this.inputs;
1✔
161
  }
162

163
  private java.util.List<Object> outputs;
164

165
  /**
166
   * Getter for property <I>https://w3id.org/cwl/cwl#outputs</I><BR>
167
   * <BLOCKQUOTE>
168
   * Defines the parameters representing the output of the process.  May be
169
   * used to generate and/or validate the output object.
170
   *    * </BLOCKQUOTE>
171
   */
172

173
  public java.util.List<Object> getOutputs() {
174
    return this.outputs;
×
175
  }
176

177
  private java.util.Optional<java.util.List<Object>> requirements;
178

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

191
  public java.util.Optional<java.util.List<Object>> getRequirements() {
192
    return this.requirements;
×
193
  }
194

195
  private java.util.Optional<java.util.List<Object>> hints;
196

197
  /**
198
   * Getter for property <I>https://w3id.org/cwl/cwl#hints</I><BR>
199
   * <BLOCKQUOTE>
200
   * Declares hints applying to either the runtime environment or the
201
   * workflow engine that may be helpful in executing this process.  It is
202
   * not an error if an implementation cannot satisfy all hints, however
203
   * the implementation may report a warning.
204
   *    * </BLOCKQUOTE>
205
   */
206

207
  public java.util.Optional<java.util.List<Object>> getHints() {
208
    return this.hints;
×
209
  }
210

211
  private java.util.Optional<CWLVersion> cwlVersion;
212

213
  /**
214
   * Getter for property <I>https://w3id.org/cwl/cwl#cwlVersion</I><BR>
215
   * <BLOCKQUOTE>
216
   * CWL document version. Always required at the document root. Not
217
   * required for a Process embedded inside another Process.
218
   *    * </BLOCKQUOTE>
219
   */
220

221
  public java.util.Optional<CWLVersion> getCwlVersion() {
222
    return this.cwlVersion;
1✔
223
  }
224

225
  private java.util.Optional<java.util.List<String>> intent;
226

227
  /**
228
   * Getter for property <I>https://w3id.org/cwl/cwl#Process/intent</I><BR>
229
   * <BLOCKQUOTE>
230
   * An identifier for the type of computational operation, of this Process.
231
   * Especially useful for [`Operation`](Workflow.html#Operation), but can also be used for
232
   * [`CommandLineTool`](CommandLineTool.html#CommandLineTool),
233
   * [`Workflow`](Workflow.html#Workflow), or [ExpressionTool](Workflow.html#ExpressionTool).
234
   * 
235
   * If provided, then this must be an IRI of a concept node that
236
   * represents the type of operation, preferably defined within an ontology.
237
   * 
238
   * For example, in the domain of bioinformatics, one can use an IRI from
239
   * the EDAM Ontology's [Operation concept nodes](http://edamontology.org/operation_0004),
240
   * like [Alignment](http://edamontology.org/operation_2928),
241
   * or [Clustering](http://edamontology.org/operation_3432); or a more
242
   * specific Operation concept like
243
   * [Split read mapping](http://edamontology.org/operation_3199).
244
   *    * </BLOCKQUOTE>
245
   */
246

247
  public java.util.Optional<java.util.List<String>> getIntent() {
248
    return this.intent;
×
249
  }
250

251
  private java.util.List<Object> steps;
252

253
  /**
254
   * Getter for property <I>https://w3id.org/cwl/cwl#Workflow/steps</I><BR>
255
   * <BLOCKQUOTE>
256
   * The individual steps that make up the workflow.  Each step is executed when all of its
257
   * input data links are fulfilled.  An implementation may choose to execute
258
   * the steps in a different order than listed and/or execute steps
259
   * concurrently, provided that dependencies between steps are met.
260
   *    * </BLOCKQUOTE>
261
   */
262

263
  public java.util.List<Object> getSteps() {
264
    return this.steps;
1✔
265
  }
266

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

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

311
    } else {
312
      id = null;
1✔
313
    }
314

315
    Boolean __original_is_null = id == null;
1✔
316
    if (id == null) {
1✔
317
      if (__docRoot != null) {
1✔
318
        id = java.util.Optional.of(__docRoot);
1✔
319
      } else {
320
        id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString());
1✔
321
      }
322
    }
323
    if (__original_is_null) {
1✔
324
        __baseUri = __baseUri_;
1✔
325
    } else {
326
        __baseUri = (String) id.orElse(null);
1✔
327
    }
328
    Workflow_class class_;
329
    try {
330
      class_ =
1✔
331
          LoaderInstances
332
              .uri_Workflow_class_False_True_None_None
333
              .loadField(__doc.get("class"), __baseUri, __loadingOptions);
1✔
334
    } catch (ValidationException e) {
1✔
335
      class_ = null; // won't be used but prevents compiler from complaining.
1✔
336
      final String __message = "the `class` field is not valid because:";
1✔
337
      __errors.add(new ValidationException(__message, e));
1✔
338
    }
1✔
339
    java.util.Optional<String> label;
340

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

353
    } else {
354
      label = null;
1✔
355
    }
356
    Object doc;
357

358
    if (__doc.containsKey("doc")) {
1✔
359
      try {
360
        doc =
1✔
361
            LoaderInstances
362
                .union_of_NullInstance_or_StringInstance_or_array_of_StringInstance
363
                .loadField(__doc.get("doc"), __baseUri, __loadingOptions);
1✔
364
      } catch (ValidationException e) {
×
365
        doc = null; // won't be used but prevents compiler from complaining.
×
366
        final String __message = "the `doc` field is not valid because:";
×
367
        __errors.add(new ValidationException(__message, e));
×
368
      }
1✔
369

370
    } else {
371
      doc = null;
1✔
372
    }
373
    java.util.List<Object> inputs;
374
    try {
375
      inputs =
1✔
376
          LoaderInstances
377
              .idmap_inputs_array_of_WorkflowInputParameter
378
              .loadField(__doc.get("inputs"), __baseUri, __loadingOptions);
1✔
379
    } catch (ValidationException e) {
×
380
      inputs = null; // won't be used but prevents compiler from complaining.
×
381
      final String __message = "the `inputs` field is not valid because:";
×
382
      __errors.add(new ValidationException(__message, e));
×
383
    }
1✔
384
    java.util.List<Object> outputs;
385
    try {
386
      outputs =
1✔
387
          LoaderInstances
388
              .idmap_outputs_array_of_WorkflowOutputParameter
389
              .loadField(__doc.get("outputs"), __baseUri, __loadingOptions);
1✔
390
    } catch (ValidationException e) {
×
391
      outputs = null; // won't be used but prevents compiler from complaining.
×
392
      final String __message = "the `outputs` field is not valid because:";
×
393
      __errors.add(new ValidationException(__message, e));
×
394
    }
1✔
395
    java.util.Optional<java.util.List<Object>> requirements;
396

397
    if (__doc.containsKey("requirements")) {
1✔
398
      try {
399
        requirements =
1✔
400
            LoaderInstances
401
                .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
402
                .loadField(__doc.get("requirements"), __baseUri, __loadingOptions);
1✔
403
      } catch (ValidationException e) {
×
404
        requirements = null; // won't be used but prevents compiler from complaining.
×
405
        final String __message = "the `requirements` field is not valid because:";
×
406
        __errors.add(new ValidationException(__message, e));
×
407
      }
1✔
408

409
    } else {
410
      requirements = null;
1✔
411
    }
412
    java.util.Optional<java.util.List<Object>> hints;
413

414
    if (__doc.containsKey("hints")) {
1✔
415
      try {
416
        hints =
1✔
417
            LoaderInstances
418
                .idmap_hints_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_or_AnyInstance
419
                .loadField(__doc.get("hints"), __baseUri, __loadingOptions);
1✔
420
      } catch (ValidationException e) {
×
421
        hints = null; // won't be used but prevents compiler from complaining.
×
422
        final String __message = "the `hints` field is not valid because:";
×
423
        __errors.add(new ValidationException(__message, e));
×
424
      }
1✔
425

426
    } else {
427
      hints = null;
1✔
428
    }
429
    java.util.Optional<CWLVersion> cwlVersion;
430

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

443
    } else {
444
      cwlVersion = null;
1✔
445
    }
446
    java.util.Optional<java.util.List<String>> intent;
447

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

460
    } else {
461
      intent = null;
1✔
462
    }
463
    java.util.List<Object> steps;
464
    try {
465
      steps =
1✔
466
          LoaderInstances
467
              .idmap_steps_array_of_WorkflowStep
468
              .loadField(__doc.get("steps"), __baseUri, __loadingOptions);
1✔
469
    } catch (ValidationException e) {
1✔
470
      steps = null; // won't be used but prevents compiler from complaining.
1✔
471
      final String __message = "the `steps` field is not valid because:";
1✔
472
      __errors.add(new ValidationException(__message, e));
1✔
473
    }
1✔
474
    if (!__errors.isEmpty()) {
1✔
475
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
476
    }
477
    this.id = (java.util.Optional<String>) id;
1✔
478
    this.label = (java.util.Optional<String>) label;
1✔
479
    this.doc = (Object) doc;
1✔
480
    this.inputs = (java.util.List<Object>) inputs;
1✔
481
    this.outputs = (java.util.List<Object>) outputs;
1✔
482
    this.requirements = (java.util.Optional<java.util.List<Object>>) requirements;
1✔
483
    this.hints = (java.util.Optional<java.util.List<Object>>) hints;
1✔
484
    this.cwlVersion = (java.util.Optional<CWLVersion>) cwlVersion;
1✔
485
    this.intent = (java.util.Optional<java.util.List<String>>) intent;
1✔
486
    this.class_ = (Workflow_class) class_;
1✔
487
    this.steps = (java.util.List<Object>) steps;
1✔
488
    for (String field:__doc.keySet()) {
1✔
489
      if (!attrs.contains(field)) {
1✔
NEW
490
        if (field.contains(":")) {
×
NEW
491
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
492
          extensionFields_.put(expanded_field, __doc.get(field));
×
493
        }
494
      }
495
    }
1✔
496
  }
1✔
497
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "label", "doc", "inputs", "outputs", "requirements", "hints", "cwlVersion", "intent", "class", "steps");
1✔
498
}
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

© 2026 Coveralls, Inc