• 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

50.77
/src/main/java/org/commonwl/cwlsdk/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.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#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 LoadingOptions getLoadingOptions() {
NEW
140
    return this.loadingOptions_;
×
141
  }
142
  public java.util.Map<String, Object> getExtensionFields() {
NEW
143
    return this.extensionFields_;
×
144
  }
145

146
  private java.util.Optional<String> id;
147

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

154
  public java.util.Optional<String> getId() {
155
    return this.id;
1✔
156
  }
157

158
  private Object source;
159

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

168
  public Object getSource() {
169
    return this.source;
1✔
170
  }
171

172
  private java.util.Optional<LinkMergeMethod> linkMerge;
173

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

182
  public java.util.Optional<LinkMergeMethod> getLinkMerge() {
NEW
183
    return this.linkMerge;
×
184
  }
185

186
  private java.util.Optional<PickValueMethod> pickValue;
187

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

195
  public java.util.Optional<PickValueMethod> getPickValue() {
NEW
196
    return this.pickValue;
×
197
  }
198

199
  private java.util.Optional<Boolean> loadContents;
200

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

215
  public java.util.Optional<Boolean> getLoadContents() {
NEW
216
    return this.loadContents;
×
217
  }
218

219
  private java.util.Optional<LoadListingEnum> loadListing;
220

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

237
  public java.util.Optional<LoadListingEnum> getLoadListing() {
NEW
238
    return this.loadListing;
×
239
  }
240

241
  private java.util.Optional<String> label;
242

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

249
  public java.util.Optional<String> getLabel() {
NEW
250
    return this.label;
×
251
  }
252

253
  private java.util.Optional<Object> default_;
254

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

264
  public java.util.Optional<Object> getDefault() {
NEW
265
    return this.default_;
×
266
  }
267

268
  private Object valueFrom;
269

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

298
  public Object getValueFrom() {
NEW
299
    return this.valueFrom;
×
300
  }
301

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

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

346
    } else {
NEW
347
      id = null;
×
348
    }
349

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

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

377
    } else {
378
      source = null;
1✔
379
    }
380
    java.util.Optional<LinkMergeMethod> linkMerge;
381

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

394
    } else {
395
      linkMerge = null;
1✔
396
    }
397
    java.util.Optional<PickValueMethod> pickValue;
398

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

411
    } else {
412
      pickValue = null;
1✔
413
    }
414
    java.util.Optional<Boolean> loadContents;
415

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

428
    } else {
429
      loadContents = null;
1✔
430
    }
431
    java.util.Optional<LoadListingEnum> loadListing;
432

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

445
    } else {
446
      loadListing = null;
1✔
447
    }
448
    java.util.Optional<String> label;
449

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

462
    } else {
463
      label = null;
1✔
464
    }
465
    java.util.Optional<Object> default_;
466

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

479
    } else {
480
      default_ = null;
1✔
481
    }
482
    Object valueFrom;
483

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

496
    } else {
497
      valueFrom = null;
1✔
498
    }
499
    if (!__errors.isEmpty()) {
1✔
NEW
500
      throw new ValidationException("Trying 'RecordField'", __errors);
×
501
    }
502
    this.id = (java.util.Optional<String>) id;
1✔
503
    this.source = (Object) source;
1✔
504
    this.linkMerge = (java.util.Optional<LinkMergeMethod>) linkMerge;
1✔
505
    this.pickValue = (java.util.Optional<PickValueMethod>) pickValue;
1✔
506
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
507
    this.loadListing = (java.util.Optional<LoadListingEnum>) loadListing;
1✔
508
    this.label = (java.util.Optional<String>) label;
1✔
509
    this.default_ = (java.util.Optional<Object>) default_;
1✔
510
    this.valueFrom = (Object) valueFrom;
1✔
511
    for (String field:__doc.keySet()) {
1✔
512
      if (!attrs.contains(field)) {
1✔
NEW
513
        if (field.contains(":")) {
×
NEW
514
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
515
          extensionFields_.put(expanded_field, __doc.get(field));
×
516
        }
517
      }
518
    }
1✔
519
  }
1✔
520
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "source", "linkMerge", "pickValue", "loadContents", "loadListing", "label", "default", "valueFrom");
1✔
521
}
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