• 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

52.94
/src/main/java/org/commonwl/cwlsdk/cwl1_1/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_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#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 additonal 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
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 data links
50
 listed in the `source` field.  The values from the input links are merged
51
 depending on the method specified in the `linkMerge` field.  If not
52
 specified, the default method is "merge_nested".
53
 
54
 * **merge_nested**
55
 
56
   The input must be an array consisting of exactly one entry for each
57
   input link.  If "merge_nested" is specified with a single link, the value
58
   from the link must be wrapped in a single-item list.
59
 
60
 * **merge_flattened**
61
 
62
   1. The source and sink parameters must be compatible types, or the source
63
      type must be compatible with single element from the "items" type of
64
      the destination array parameter.
65
   2. Source parameters which are arrays are concatenated.
66
      Source parameters which are single element types are appended as
67
      single elements.
68
  </BLOCKQUOTE>
69
 */
70
public class WorkflowStepInputImpl extends SaveableImpl implements WorkflowStepInput {
71
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
72
  private java.util.Map<String, Object> extensionFields_ =
1✔
73
      new java.util.HashMap<String, Object>();
74
  public LoadingOptions getLoadingOptions() {
NEW
75
    return this.loadingOptions_;
×
76
  }
77
  public java.util.Map<String, Object> getExtensionFields() {
NEW
78
    return this.extensionFields_;
×
79
  }
80

81
  private java.util.Optional<String> id;
82

83
  /**
84
   * Getter for property <I>https://w3id.org/cwl/cwl#Identified/id</I><BR>
85
   * <BLOCKQUOTE>
86
   * The unique identifier for this object.   * </BLOCKQUOTE>
87
   */
88

89
  public java.util.Optional<String> getId() {
90
    return this.id;
1✔
91
  }
92

93
  private Object source;
94

95
  /**
96
   * Getter for property <I>https://w3id.org/cwl/cwl#source</I><BR>
97
   * <BLOCKQUOTE>
98
   * Specifies one or more workflow parameters that will provide input to
99
   * the underlying step parameter.
100
   *    * </BLOCKQUOTE>
101
   */
102

103
  public Object getSource() {
104
    return this.source;
1✔
105
  }
106

107
  private java.util.Optional<LinkMergeMethod> linkMerge;
108

109
  /**
110
   * Getter for property <I>https://w3id.org/cwl/cwl#Sink/linkMerge</I><BR>
111
   * <BLOCKQUOTE>
112
   * The method to use to merge multiple inbound links into a single array.
113
   * If not specified, the default method is "merge_nested".
114
   *    * </BLOCKQUOTE>
115
   */
116

117
  public java.util.Optional<LinkMergeMethod> getLinkMerge() {
NEW
118
    return this.linkMerge;
×
119
  }
120

121
  private java.util.Optional<Boolean> loadContents;
122

123
  /**
124
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadContents</I><BR>
125
   * <BLOCKQUOTE>
126
   * Only valid when `type: File` or is an array of `items: File`.
127
   * 
128
   * Read up to the first 64 KiB of text from the file and place it in the
129
   * "contents" field of the file object for use by expressions.
130
   *    * </BLOCKQUOTE>
131
   */
132

133
  public java.util.Optional<Boolean> getLoadContents() {
NEW
134
    return this.loadContents;
×
135
  }
136

137
  private java.util.Optional<LoadListingEnum> loadListing;
138

139
  /**
140
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadListing</I><BR>
141
   * <BLOCKQUOTE>
142
   * Only valid when `type: Directory` or is an array of `items: Directory`.
143
   * 
144
   * Specify the desired behavior for loading the `listing` field of
145
   * a Directory object for use by expressions.
146
   * 
147
   * The order of precedence for loadListing is:
148
   * 
149
   *   1. `loadListing` on an individual parameter
150
   *   2. Inherited from `LoadListingRequirement`
151
   *   3. By default: `no_listing`
152
   *    * </BLOCKQUOTE>
153
   */
154

155
  public java.util.Optional<LoadListingEnum> getLoadListing() {
NEW
156
    return this.loadListing;
×
157
  }
158

159
  private java.util.Optional<String> label;
160

161
  /**
162
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
163
   * <BLOCKQUOTE>
164
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
165
   */
166

167
  public java.util.Optional<String> getLabel() {
NEW
168
    return this.label;
×
169
  }
170

171
  private java.util.Optional<Object> default_;
172

173
  /**
174
   * Getter for property <I>https://w3id.org/cwl/salad#default</I><BR>
175
   * <BLOCKQUOTE>
176
   * The default value for this parameter to use if either there is no
177
   * `source` field, or the value produced by the `source` is `null`.  The
178
   * default must be applied prior to scattering or evaluating `valueFrom`.
179
   *    * </BLOCKQUOTE>
180
   */
181

182
  public java.util.Optional<Object> getDefault() {
NEW
183
    return this.default_;
×
184
  }
185

186
  private Object valueFrom;
187

188
  /**
189
   * Getter for property <I>https://w3id.org/cwl/cwl#WorkflowStepInput/valueFrom</I><BR>
190
   * <BLOCKQUOTE>
191
   * To use valueFrom, [StepInputExpressionRequirement](#StepInputExpressionRequirement) must
192
   * be specified in the workflow or workflow step requirements.
193
   * 
194
   * If `valueFrom` is a constant string value, use this as the value for
195
   * this input parameter.
196
   * 
197
   * If `valueFrom` is a parameter reference or expression, it must be
198
   * evaluated to yield the actual value to be assiged to the input field.
199
   * 
200
   * The `self` value in the parameter reference or expression must be
201
   * 1. `null` if there is no `source` field
202
   * 2. the value of the parameter(s) specified in the `source` field when this
203
   * workflow input parameter **is not** specified in this workflow step's `scatter` field.
204
   * 3. an element of the parameter specified in the `source` field when this workflow input
205
   * parameter **is** specified in this workflow step's `scatter` field.
206
   * 
207
   * The value of `inputs` in the parameter reference or expression must be
208
   * the input object to the workflow step after assigning the `source`
209
   * values, applying `default`, and then scattering.  The order of
210
   * evaluating `valueFrom` among step input parameters is undefined and the
211
   * result of evaluating `valueFrom` on a parameter must not be visible to
212
   * evaluation of `valueFrom` on other parameters.
213
   *    * </BLOCKQUOTE>
214
   */
215

216
  public Object getValueFrom() {
NEW
217
    return this.valueFrom;
×
218
  }
219

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

252
    if (__doc.containsKey("id")) {
1✔
253
      try {
254
        id =
1✔
255
            LoaderInstances
256
                .uri_optional_StringInstance_True_False_None_None
257
                .loadField(__doc.get("id"), __baseUri, __loadingOptions);
1✔
NEW
258
      } catch (ValidationException e) {
×
NEW
259
        id = null; // won't be used but prevents compiler from complaining.
×
NEW
260
        final String __message = "the `id` field is not valid because:";
×
NEW
261
        __errors.add(new ValidationException(__message, e));
×
262
      }
1✔
263

264
    } else {
NEW
265
      id = null;
×
266
    }
267

268
    Boolean __original_is_null = id == null;
1✔
269
    if (id == null) {
1✔
NEW
270
      if (__docRoot != null) {
×
NEW
271
        id = java.util.Optional.of(__docRoot);
×
272
      } else {
NEW
273
        id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString());
×
274
      }
275
    }
276
    if (__original_is_null) {
1✔
NEW
277
        __baseUri = __baseUri_;
×
278
    } else {
279
        __baseUri = (String) id.orElse(null);
1✔
280
    }
281
    Object source;
282

283
    if (__doc.containsKey("source")) {
1✔
284
      try {
285
        source =
1✔
286
            LoaderInstances
287
                .uri_union_of_NullInstance_or_StringInstance_or_array_of_StringInstance_False_False_2_None
288
                .loadField(__doc.get("source"), __baseUri, __loadingOptions);
1✔
NEW
289
      } catch (ValidationException e) {
×
NEW
290
        source = null; // won't be used but prevents compiler from complaining.
×
NEW
291
        final String __message = "the `source` field is not valid because:";
×
NEW
292
        __errors.add(new ValidationException(__message, e));
×
293
      }
1✔
294

295
    } else {
296
      source = null;
1✔
297
    }
298
    java.util.Optional<LinkMergeMethod> linkMerge;
299

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

312
    } else {
313
      linkMerge = null;
1✔
314
    }
315
    java.util.Optional<Boolean> loadContents;
316

317
    if (__doc.containsKey("loadContents")) {
1✔
318
      try {
319
        loadContents =
1✔
320
            LoaderInstances
321
                .optional_BooleanInstance
322
                .loadField(__doc.get("loadContents"), __baseUri, __loadingOptions);
1✔
NEW
323
      } catch (ValidationException e) {
×
NEW
324
        loadContents = null; // won't be used but prevents compiler from complaining.
×
NEW
325
        final String __message = "the `loadContents` field is not valid because:";
×
NEW
326
        __errors.add(new ValidationException(__message, e));
×
327
      }
1✔
328

329
    } else {
330
      loadContents = null;
1✔
331
    }
332
    java.util.Optional<LoadListingEnum> loadListing;
333

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

346
    } else {
347
      loadListing = null;
1✔
348
    }
349
    java.util.Optional<String> label;
350

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

363
    } else {
364
      label = null;
1✔
365
    }
366
    java.util.Optional<Object> default_;
367

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

380
    } else {
381
      default_ = null;
1✔
382
    }
383
    Object valueFrom;
384

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

397
    } else {
398
      valueFrom = null;
1✔
399
    }
400
    if (!__errors.isEmpty()) {
1✔
NEW
401
      throw new ValidationException("Trying 'RecordField'", __errors);
×
402
    }
403
    this.id = (java.util.Optional<String>) id;
1✔
404
    this.source = (Object) source;
1✔
405
    this.linkMerge = (java.util.Optional<LinkMergeMethod>) linkMerge;
1✔
406
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
407
    this.loadListing = (java.util.Optional<LoadListingEnum>) loadListing;
1✔
408
    this.label = (java.util.Optional<String>) label;
1✔
409
    this.default_ = (java.util.Optional<Object>) default_;
1✔
410
    this.valueFrom = (Object) valueFrom;
1✔
411
    for (String field:__doc.keySet()) {
1✔
412
      if (!attrs.contains(field)) {
1✔
NEW
413
        if (field.contains(":")) {
×
NEW
414
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
415
          extensionFields_.put(expanded_field, __doc.get(field));
×
416
        }
417
      }
418
    }
1✔
419
  }
1✔
420
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "source", "linkMerge", "loadContents", "loadListing", "label", "default", "valueFrom");
1✔
421
}
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