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

common-workflow-language / cwljava / #365

15 Jul 2025 10:44AM UTC coverage: 59.538% (-0.6%) from 60.167%
#365

Pull #193

github

web-flow
Merge dddcd65fe into f35b0bad8
Pull Request #193: Add accessor for the extension field.

0 of 129 new or added lines in 129 files covered. (0.0%)

7347 of 12340 relevant lines covered (59.54%)

0.6 hits per line

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

50.82
/src/main/java/org/w3id/cwl/cwl1_2/WorkflowStepInputImpl.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#WorkflowStepInput</I><BR> <BLOCKQUOTE>
25
 The input of a workflow step connects an upstream parameter (from the
26
 workflow inputs, or the outputs of other workflows steps) with the input
27
 parameters of the process specified by the `run` field. Only input parameters
28
 declared by the target process will be passed through at runtime to the process
29
 though additional parameters may be specified (for use within `valueFrom`
30
 expressions for instance) - unconnected or unused parameters do not represent an
31
 error condition.
32
 
33
 # Input object
34
 
35
 A WorkflowStepInput object must contain an `id` field in the form
36
 `#fieldname` or `#prefix/fieldname`.  When the `id` field contains a slash
37
 `/` the field name consists of the characters following the final slash
38
 (the prefix portion may contain one or more slashes to indicate scope).
39
 This defines a field of the workflow step input object with the value of
40
 the `source` parameter(s).
41
 
42
 # Merging multiple inbound data links
43
 
44
 To merge multiple inbound data links,
45
 [MultipleInputFeatureRequirement](#MultipleInputFeatureRequirement) must be specified
46
 in the workflow or workflow step requirements.
47
 
48
 If the sink parameter is an array, or named in a [workflow
49
 scatter](#WorkflowStep) operation, there may be multiple inbound
50
 data links listed in the `source` field.  The values from the
51
 input links are merged depending on the method specified in the
52
 `linkMerge` field.  If both `linkMerge` and `pickValue` are null
53
 or not specified, and there is more than one element in the
54
 `source` array, the default method is "merge_nested".
55
 
56
 If both `linkMerge` and `pickValue` are null or not specified, and
57
 there is only a single element in the `source`, then the input
58
 parameter takes the scalar value from the single input link (it is
59
 *not* wrapped in a single-list).
60
 
61
 * **merge_nested**
62
 
63
   The input must be an array consisting of exactly one entry for each
64
   input link.  If "merge_nested" is specified with a single link, the value
65
   from the link must be wrapped in a single-item list.
66
 
67
 * **merge_flattened**
68
 
69
   1. The source and sink parameters must be compatible types, or the source
70
      type must be compatible with single element from the "items" type of
71
      the destination array parameter.
72
   2. Source parameters which are arrays are concatenated.
73
      Source parameters which are single element types are appended as
74
      single elements.
75
 
76
 # Picking non-null values among inbound data links
77
 
78
 If present, `pickValue` specifies how to pick non-null values among inbound data links.
79
 
80
 `pickValue` is evaluated
81
   1. Once all source values from upstream step or parameters are available.
82
   2. After `linkMerge`.
83
   3. Before `scatter` or `valueFrom`.
84
 
85
 This is specifically intended to be useful in combination with
86
 [conditional execution](#WorkflowStep), where several upstream
87
 steps may be connected to a single input (`source` is a list), and
88
 skipped steps produce null values.
89
 
90
 Static type checkers should check for type consistency after inferring what the type
91
 will be after `pickValue` is applied, just as they do currently for `linkMerge`.
92
 
93
 * **first_non_null**
94
 
95
   For the first level of a list input, pick the first non-null element.  The result is a scalar.
96
   It is an error if there is no non-null element.  Examples:
97
   * `[null, x, null, y] -> x`
98
   * `[null, [null], null, y] -> [null]`
99
   * `[null, null, null] -> Runtime Error`
100
 
101
   *Intended use case*: If-else pattern where the
102
   value comes either from a conditional step or from a default or
103
   fallback value. The conditional step(s) should be placed first in
104
   the list.
105
 
106
 * **the_only_non_null**
107
 
108
   For the first level of a list input, pick the single non-null element.  The result is a scalar.
109
   It is an error if there is more than one non-null element.  Examples:
110
 
111
   * `[null, x, null] -> x`
112
   * `[null, x, null, y] -> Runtime Error`
113
   * `[null, [null], null] -> [null]`
114
   * `[null, null, null] -> Runtime Error`
115
 
116
   *Intended use case*: Switch type patterns where developer considers
117
   more than one active code path as a workflow error
118
   (possibly indicating an error in writing `when` condition expressions).
119
 
120
 * **all_non_null**
121
 
122
   For the first level of a list input, pick all non-null values.
123
   The result is a list, which may be empty.  Examples:
124
 
125
   * `[null, x, null] -> [x]`
126
   * `[x, null, y] -> [x, y]`
127
   * `[null, [x], [null]] -> [[x], [null]]`
128
   * `[null, null, null] -> []`
129
 
130
   *Intended use case*: It is valid to have more than one source, but
131
    sources are conditional, so null sources (from skipped steps)
132
    should be filtered out.
133
  </BLOCKQUOTE>
134
 */
135
public class WorkflowStepInputImpl extends SaveableImpl implements WorkflowStepInput {
136
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
137
  private java.util.Map<String, Object> extensionFields_ =
1✔
138
      new java.util.HashMap<String, Object>();
139
  public java.util.Map<String, Object> getExtensionFields() {
NEW
140
    return this.extensionFields_;
×
141
  }
142

143
  private java.util.Optional<String> id;
144

145
  /**
146
   * Getter for property <I>https://w3id.org/cwl/cwl#Identified/id</I><BR>
147
   * <BLOCKQUOTE>
148
   * The unique identifier for this object.   * </BLOCKQUOTE>
149
   */
150

151
  public java.util.Optional<String> getId() {
152
    return this.id;
1✔
153
  }
154

155
  private Object source;
156

157
  /**
158
   * Getter for property <I>https://w3id.org/cwl/cwl#source</I><BR>
159
   * <BLOCKQUOTE>
160
   * Specifies one or more workflow parameters that will provide input to
161
   * the underlying step parameter.
162
   *    * </BLOCKQUOTE>
163
   */
164

165
  public Object getSource() {
166
    return this.source;
1✔
167
  }
168

169
  private java.util.Optional<LinkMergeMethod> linkMerge;
170

171
  /**
172
   * Getter for property <I>https://w3id.org/cwl/cwl#Sink/linkMerge</I><BR>
173
   * <BLOCKQUOTE>
174
   * The method to use to merge multiple inbound links into a single array.
175
   * If not specified, the default method is "merge_nested".
176
   *    * </BLOCKQUOTE>
177
   */
178

179
  public java.util.Optional<LinkMergeMethod> getLinkMerge() {
180
    return this.linkMerge;
×
181
  }
182

183
  private java.util.Optional<PickValueMethod> pickValue;
184

185
  /**
186
   * Getter for property <I>https://w3id.org/cwl/cwl#Sink/pickValue</I><BR>
187
   * <BLOCKQUOTE>
188
   * The method to use to choose non-null elements among multiple sources.
189
   *    * </BLOCKQUOTE>
190
   */
191

192
  public java.util.Optional<PickValueMethod> getPickValue() {
193
    return this.pickValue;
×
194
  }
195

196
  private java.util.Optional<Boolean> loadContents;
197

198
  /**
199
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadContents</I><BR>
200
   * <BLOCKQUOTE>
201
   * Only valid when `type: File` or is an array of `items: File`.
202
   * 
203
   * If true, the file (or each file in the array) must be a UTF-8
204
   * text file 64 KiB or smaller, and the implementation must read
205
   * the entire contents of the file (or file array) and place it
206
   * in the `contents` field of the File object for use by
207
   * expressions.  If the size of the file is greater than 64 KiB,
208
   * the implementation must raise a fatal error.
209
   *    * </BLOCKQUOTE>
210
   */
211

212
  public java.util.Optional<Boolean> getLoadContents() {
213
    return this.loadContents;
×
214
  }
215

216
  private java.util.Optional<LoadListingEnum> loadListing;
217

218
  /**
219
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadListing</I><BR>
220
   * <BLOCKQUOTE>
221
   * Only valid when `type: Directory` or is an array of `items: Directory`.
222
   * 
223
   * Specify the desired behavior for loading the `listing` field of
224
   * a Directory object for use by expressions.
225
   * 
226
   * The order of precedence for loadListing is:
227
   * 
228
   *   1. `loadListing` on an individual parameter
229
   *   2. Inherited from `LoadListingRequirement`
230
   *   3. By default: `no_listing`
231
   *    * </BLOCKQUOTE>
232
   */
233

234
  public java.util.Optional<LoadListingEnum> getLoadListing() {
235
    return this.loadListing;
×
236
  }
237

238
  private java.util.Optional<String> label;
239

240
  /**
241
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
242
   * <BLOCKQUOTE>
243
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
244
   */
245

246
  public java.util.Optional<String> getLabel() {
247
    return this.label;
×
248
  }
249

250
  private java.util.Optional<Object> default_;
251

252
  /**
253
   * Getter for property <I>https://w3id.org/cwl/salad#default</I><BR>
254
   * <BLOCKQUOTE>
255
   * The default value for this parameter to use if either there is no
256
   * `source` field, or the value produced by the `source` is `null`.  The
257
   * default must be applied prior to scattering or evaluating `valueFrom`.
258
   *    * </BLOCKQUOTE>
259
   */
260

261
  public java.util.Optional<Object> getDefault() {
262
    return this.default_;
×
263
  }
264

265
  private Object valueFrom;
266

267
  /**
268
   * Getter for property <I>https://w3id.org/cwl/cwl#WorkflowStepInput/valueFrom</I><BR>
269
   * <BLOCKQUOTE>
270
   * To use valueFrom, [StepInputExpressionRequirement](#StepInputExpressionRequirement) must
271
   * be specified in the workflow or workflow step requirements.
272
   * 
273
   * If `valueFrom` is a constant string value, use this as the value for
274
   * this input parameter.
275
   * 
276
   * If `valueFrom` is a parameter reference or expression, it must be
277
   * evaluated to yield the actual value to be assigned to the input field.
278
   * 
279
   * The `self` value in the parameter reference or expression must be
280
   * 1. `null` if there is no `source` field
281
   * 2. the value of the parameter(s) specified in the `source` field when this
282
   * workflow input parameter **is not** specified in this workflow step's `scatter` field.
283
   * 3. an element of the parameter specified in the `source` field when this workflow input
284
   * parameter **is** specified in this workflow step's `scatter` field.
285
   * 
286
   * The value of `inputs` in the parameter reference or expression must be
287
   * the input object to the workflow step after assigning the `source`
288
   * values, applying `default`, and then scattering.  The order of
289
   * evaluating `valueFrom` among step input parameters is undefined and the
290
   * result of evaluating `valueFrom` on a parameter must not be visible to
291
   * evaluation of `valueFrom` on other parameters.
292
   *    * </BLOCKQUOTE>
293
   */
294

295
  public Object getValueFrom() {
296
    return this.valueFrom;
×
297
  }
298

299
  /**
300
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of WorkflowStepInputImpl.
301
   *
302
   * @param __doc_            Document fragment to load this record object from (presumably a
303
                              {@link java.util.Map}).
304
   * @param __baseUri_        Base URI to generate child document IDs against.
305
   * @param __loadingOptions  Context for loading URIs and populating objects.
306
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
307
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
308
   *                             or validation of fields fails.
309
   */
310
  public WorkflowStepInputImpl(
311
      final Object __doc_,
312
      final String __baseUri_,
313
      LoadingOptions __loadingOptions,
314
      final String __docRoot_) {
315
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
316
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
317
    // generated names.
318
    String __baseUri = __baseUri_;
1✔
319
    String __docRoot = __docRoot_;
1✔
320
    if (!(__doc_ instanceof java.util.Map)) {
1✔
321
      throw new ValidationException("WorkflowStepInputImpl called on non-map");
×
322
    }
323
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
324
    final java.util.List<ValidationException> __errors =
1✔
325
        new java.util.ArrayList<ValidationException>();
326
    if (__loadingOptions != null) {
1✔
327
      this.loadingOptions_ = __loadingOptions;
1✔
328
    }
329
    java.util.Optional<String> id;
330

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

343
    } else {
344
      id = null;
×
345
    }
346

347
    Boolean __original_is_null = id == null;
1✔
348
    if (id == null) {
1✔
349
      if (__docRoot != null) {
×
350
        id = java.util.Optional.of(__docRoot);
×
351
      } else {
352
        id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString());
×
353
      }
354
    }
355
    if (__original_is_null) {
1✔
356
        __baseUri = __baseUri_;
×
357
    } else {
358
        __baseUri = (String) id.orElse(null);
1✔
359
    }
360
    Object source;
361

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

374
    } else {
375
      source = null;
1✔
376
    }
377
    java.util.Optional<LinkMergeMethod> linkMerge;
378

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

391
    } else {
392
      linkMerge = null;
1✔
393
    }
394
    java.util.Optional<PickValueMethod> pickValue;
395

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

408
    } else {
409
      pickValue = null;
1✔
410
    }
411
    java.util.Optional<Boolean> loadContents;
412

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

425
    } else {
426
      loadContents = null;
1✔
427
    }
428
    java.util.Optional<LoadListingEnum> loadListing;
429

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

442
    } else {
443
      loadListing = null;
1✔
444
    }
445
    java.util.Optional<String> label;
446

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

459
    } else {
460
      label = null;
1✔
461
    }
462
    java.util.Optional<Object> default_;
463

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

476
    } else {
477
      default_ = null;
1✔
478
    }
479
    Object valueFrom;
480

481
    if (__doc.containsKey("valueFrom")) {
1✔
482
      try {
483
        valueFrom =
1✔
484
            LoaderInstances
485
                .union_of_NullInstance_or_StringInstance_or_ExpressionLoader
486
                .loadField(__doc.get("valueFrom"), __baseUri, __loadingOptions);
1✔
487
      } catch (ValidationException e) {
×
488
        valueFrom = null; // won't be used but prevents compiler from complaining.
×
489
        final String __message = "the `valueFrom` field is not valid because:";
×
490
        __errors.add(new ValidationException(__message, e));
×
491
      }
1✔
492

493
    } else {
494
      valueFrom = null;
1✔
495
    }
496
    if (!__errors.isEmpty()) {
1✔
497
      throw new ValidationException("Trying 'RecordField'", __errors);
×
498
    }
499
    this.id = (java.util.Optional<String>) id;
1✔
500
    this.source = (Object) source;
1✔
501
    this.linkMerge = (java.util.Optional<LinkMergeMethod>) linkMerge;
1✔
502
    this.pickValue = (java.util.Optional<PickValueMethod>) pickValue;
1✔
503
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
504
    this.loadListing = (java.util.Optional<LoadListingEnum>) loadListing;
1✔
505
    this.label = (java.util.Optional<String>) label;
1✔
506
    this.default_ = (java.util.Optional<Object>) default_;
1✔
507
    this.valueFrom = (Object) valueFrom;
1✔
508
  }
1✔
509
}
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