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

common-workflow-language / cwljava / #418

08 Dec 2025 09:55AM UTC coverage: 57.962% (-0.01%) from 57.972%
#418

Pull #218

github

web-flow
Merge b21aa5610 into 365de94c4
Pull Request #218: "id" is a required field in for `Parameter`s and `WorkflowStep`s

23 of 43 new or added lines in 12 files covered. (53.49%)

10 existing lines in 10 files now uncovered.

7735 of 13345 relevant lines covered (57.96%)

0.58 hits per line

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

53.06
/src/main/java/org/commonwl/cwlsdk/cwl1_2/CommandInputParameterImpl.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#CommandInputParameter</I><BR> <BLOCKQUOTE>
25
 An input parameter for a CommandLineTool. </BLOCKQUOTE>
26
 */
27
public class CommandInputParameterImpl extends SaveableImpl implements CommandInputParameter {
28
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
29
  private java.util.Map<String, Object> extensionFields_ =
1✔
30
      new java.util.HashMap<String, Object>();
31
  public LoadingOptions getLoadingOptions() {
32
    return this.loadingOptions_;
×
33
  }
34
  public java.util.Map<String, Object> getExtensionFields() {
35
    return this.extensionFields_;
×
36
  }
37

38
  private String id;
39

40
  /**
41
   * Getter for property <I>https://w3id.org/cwl/cwl#Parameter/id</I><BR>
42
   * <BLOCKQUOTE>
43
   * The unique identifier for this Parameter.   * </BLOCKQUOTE>
44
   */
45

46
  public String getId() {
47
    return this.id;
×
48
  }
49

50
  private java.util.Optional<String> label;
51

52
  /**
53
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
54
   * <BLOCKQUOTE>
55
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
56
   */
57

58
  public java.util.Optional<String> getLabel() {
59
    return this.label;
×
60
  }
61

62
  private Object secondaryFiles;
63

64
  /**
65
   * Getter for property <I>https://w3id.org/cwl/cwl#secondaryFiles</I><BR>
66
   * <BLOCKQUOTE>
67
   * Only valid when `type: File` or is an array of `items: File`.
68
   * 
69
   * Provides a pattern or expression specifying files or
70
   * directories that should be included alongside the primary
71
   * file.  Secondary files may be required or optional.  When not
72
   * explicitly specified, secondary files specified for `inputs`
73
   * are required and `outputs` are optional.  An implementation
74
   * must include matching Files and Directories in the
75
   * `secondaryFiles` property of the primary file.  These Files
76
   * and Directories must be transferred and staged alongside the
77
   * primary file.  An implementation may fail workflow execution
78
   * if a required secondary file does not exist.
79
   * 
80
   * If the value is an expression, the value of `self` in the expression
81
   * must be the primary input or output File object to which this binding
82
   * applies.  The `basename`, `nameroot` and `nameext` fields must be
83
   * present in `self`.  For `CommandLineTool` outputs the `path` field must
84
   * also be present.  The expression must return a filename string relative
85
   * to the path to the primary File, a File or Directory object with either
86
   * `path` or `location` and `basename` fields set, or an array consisting
87
   * of strings or File or Directory objects.  It is legal to reference an
88
   * unchanged File or Directory object taken from input as a secondaryFile.
89
   * The expression may return &quot;null&quot; in which case there is no secondaryFile
90
   * from that expression.
91
   * 
92
   * To work on non-filename-preserving storage systems, portable tool
93
   * descriptions should avoid constructing new values from `location`, but
94
   * should construct relative references using `basename` or `nameroot`
95
   * instead.
96
   * 
97
   * If a value in `secondaryFiles` is a string that is not an expression,
98
   * it specifies that the following pattern should be applied to the path
99
   * of the primary file to yield a filename relative to the primary File:
100
   * 
101
   *   1. If string ends with `?` character, remove the last `?` and mark
102
   *     the resulting secondary file as optional.
103
   *   2. If string begins with one or more caret `^` characters, for each
104
   *     caret, remove the last file extension from the path (the last
105
   *     period `.` and all following characters).  If there are no file
106
   *     extensions, the path is unchanged.
107
   *   3. Append the remainder of the string to the end of the file path.
108
   *    * </BLOCKQUOTE>
109
   */
110

111
  public Object getSecondaryFiles() {
112
    return this.secondaryFiles;
×
113
  }
114

115
  private java.util.Optional<Boolean> streamable;
116

117
  /**
118
   * Getter for property <I>https://w3id.org/cwl/cwl#FieldBase/streamable</I><BR>
119
   * <BLOCKQUOTE>
120
   * Only valid when `type: File` or is an array of `items: File`.
121
   * 
122
   * A value of `true` indicates that the file is read or written
123
   * sequentially without seeking.  An implementation may use this flag to
124
   * indicate whether it is valid to stream file contents using a named
125
   * pipe.  Default: `false`.
126
   *    * </BLOCKQUOTE>
127
   */
128

129
  public java.util.Optional<Boolean> getStreamable() {
130
    return this.streamable;
×
131
  }
132

133
  private Object doc;
134

135
  /**
136
   * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><BR>
137
   * <BLOCKQUOTE>
138
   * A documentation string for this object, or an array of strings which should be concatenated.   * </BLOCKQUOTE>
139
   */
140

141
  public Object getDoc() {
142
    return this.doc;
×
143
  }
144

145
  private Object format;
146

147
  /**
148
   * Getter for property <I>https://w3id.org/cwl/cwl#format</I><BR>
149
   * <BLOCKQUOTE>
150
   * Only valid when `type: File` or is an array of `items: File`.
151
   * 
152
   * This must be one or more IRIs of concept nodes
153
   * that represents file formats which are allowed as input to this
154
   * parameter, preferably defined within an ontology.  If no ontology is
155
   * available, file formats may be tested by exact match.
156
   *    * </BLOCKQUOTE>
157
   */
158

159
  public Object getFormat() {
160
    return this.format;
×
161
  }
162

163
  private java.util.Optional<Boolean> loadContents;
164

165
  /**
166
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadContents</I><BR>
167
   * <BLOCKQUOTE>
168
   * Only valid when `type: File` or is an array of `items: File`.
169
   * 
170
   * If true, the file (or each file in the array) must be a UTF-8
171
   * text file 64 KiB or smaller, and the implementation must read
172
   * the entire contents of the file (or file array) and place it
173
   * in the `contents` field of the File object for use by
174
   * expressions.  If the size of the file is greater than 64 KiB,
175
   * the implementation must raise a fatal error.
176
   *    * </BLOCKQUOTE>
177
   */
178

179
  public java.util.Optional<Boolean> getLoadContents() {
180
    return this.loadContents;
×
181
  }
182

183
  private java.util.Optional<LoadListingEnum> loadListing;
184

185
  /**
186
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadListing</I><BR>
187
   * <BLOCKQUOTE>
188
   * Only valid when `type: Directory` or is an array of `items: Directory`.
189
   * 
190
   * Specify the desired behavior for loading the `listing` field of
191
   * a Directory object for use by expressions.
192
   * 
193
   * The order of precedence for loadListing is:
194
   * 
195
   *   1. `loadListing` on an individual parameter
196
   *   2. Inherited from `LoadListingRequirement`
197
   *   3. By default: `no_listing`
198
   *    * </BLOCKQUOTE>
199
   */
200

201
  public java.util.Optional<LoadListingEnum> getLoadListing() {
202
    return this.loadListing;
×
203
  }
204

205
  private java.util.Optional<Object> default_;
206

207
  /**
208
   * Getter for property <I>https://w3id.org/cwl/salad#default</I><BR>
209
   * <BLOCKQUOTE>
210
   * The default value to use for this parameter if the parameter is missing
211
   * from the input object, or if the value of the parameter in the input
212
   * object is `null`.  Default values are applied before evaluating expressions
213
   * (e.g. dependent `valueFrom` fields).
214
   *    * </BLOCKQUOTE>
215
   */
216

217
  public java.util.Optional<Object> getDefault() {
218
    return this.default_;
×
219
  }
220

221
  private Object type;
222

223
  /**
224
   * Getter for property <I>https://w3id.org/cwl/salad#type</I><BR>
225
   * <BLOCKQUOTE>
226
   * Specify valid types of data that may be assigned to this parameter.
227
   *    * </BLOCKQUOTE>
228
   */
229

230
  public Object getType() {
231
    return this.type;
×
232
  }
233

234
  private java.util.Optional<CommandLineBinding> inputBinding;
235

236
  /**
237
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandInputParameter/inputBinding</I><BR>
238
   * <BLOCKQUOTE>
239
   * Describes how to turn the input parameters of a process into
240
   * command line arguments.
241
   *    * </BLOCKQUOTE>
242
   */
243

244
  public java.util.Optional<CommandLineBinding> getInputBinding() {
245
    return this.inputBinding;
×
246
  }
247

248
  /**
249
   * Used by {@link org.commonwl.cwlsdk.cwl1_2.utils.RootLoader} to construct instances of CommandInputParameterImpl.
250
   *
251
   * @param __doc_            Document fragment to load this record object from (presumably a
252
                              {@link java.util.Map}).
253
   * @param __baseUri_        Base URI to generate child document IDs against.
254
   * @param __loadingOptions  Context for loading URIs and populating objects.
255
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
256
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
257
   *                             or validation of fields fails.
258
   */
259
  public CommandInputParameterImpl(
260
      final Object __doc_,
261
      final String __baseUri_,
262
      LoadingOptions __loadingOptions,
263
      final String __docRoot_) {
264
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
265
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
266
    // generated names.
267
    String __baseUri = __baseUri_;
1✔
268
    String __docRoot = __docRoot_;
1✔
269
    if (!(__doc_ instanceof java.util.Map)) {
1✔
270
      throw new ValidationException("CommandInputParameterImpl called on non-map");
×
271
    }
272
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
273
    final java.util.List<ValidationException> __errors =
1✔
274
        new java.util.ArrayList<ValidationException>();
275
    if (__loadingOptions != null) {
1✔
276
      this.loadingOptions_ = __loadingOptions;
1✔
277
    }
278
    String id;
279

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

292
    } else {
293
      id = null;
×
294
    }
295

296
    if (id == null) {
1✔
UNCOV
297
      if (__docRoot != null) {
×
NEW
298
        id = __docRoot;
×
299
      } else {
NEW
300
        throw new ValidationException("Missing id");
×
301
      }
302
    }
303
    __baseUri = (String) id;
1✔
304
    java.util.Optional<String> label;
305

306
    if (__doc.containsKey("label")) {
1✔
307
      try {
308
        label =
1✔
309
            LoaderInstances
310
                .optional_StringInstance
311
                .loadField(__doc.get("label"), __baseUri, __loadingOptions);
1✔
312
      } catch (ValidationException e) {
×
313
        label = null; // won't be used but prevents compiler from complaining.
×
314
        final String __message = "the `label` field is not valid because:";
×
315
        __errors.add(new ValidationException(__message, e));
×
316
      }
1✔
317

318
    } else {
319
      label = null;
1✔
320
    }
321
    Object secondaryFiles;
322

323
    if (__doc.containsKey("secondaryFiles")) {
1✔
324
      try {
325
        secondaryFiles =
1✔
326
            LoaderInstances
327
                .secondaryfilesdsl_union_of_NullInstance_or_SecondaryFileSchema_or_array_of_SecondaryFileSchema
328
                .loadField(__doc.get("secondaryFiles"), __baseUri, __loadingOptions);
1✔
329
      } catch (ValidationException e) {
×
330
        secondaryFiles = null; // won't be used but prevents compiler from complaining.
×
331
        final String __message = "the `secondaryFiles` field is not valid because:";
×
332
        __errors.add(new ValidationException(__message, e));
×
333
      }
1✔
334

335
    } else {
336
      secondaryFiles = null;
1✔
337
    }
338
    java.util.Optional<Boolean> streamable;
339

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

352
    } else {
353
      streamable = null;
1✔
354
    }
355
    Object doc;
356

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

369
    } else {
370
      doc = null;
1✔
371
    }
372
    Object format;
373

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

386
    } else {
387
      format = null;
1✔
388
    }
389
    java.util.Optional<Boolean> loadContents;
390

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

403
    } else {
404
      loadContents = null;
1✔
405
    }
406
    java.util.Optional<LoadListingEnum> loadListing;
407

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

420
    } else {
421
      loadListing = null;
1✔
422
    }
423
    java.util.Optional<Object> default_;
424

425
    if (__doc.containsKey("default")) {
1✔
426
      try {
427
        default_ =
1✔
428
            LoaderInstances
429
                .optional_CWLObjectType
430
                .loadField(__doc.get("default"), __baseUri, __loadingOptions);
1✔
431
      } catch (ValidationException e) {
×
432
        default_ = null; // won't be used but prevents compiler from complaining.
×
433
        final String __message = "the `default` field is not valid because:";
×
434
        __errors.add(new ValidationException(__message, e));
×
435
      }
1✔
436

437
    } else {
438
      default_ = null;
1✔
439
    }
440
    Object type;
441
    try {
442
      type =
1✔
443
          LoaderInstances
444
              .typedsl_union_of_CWLType_or_stdin_or_CommandInputRecordSchema_or_CommandInputEnumSchema_or_CommandInputArraySchema_or_StringInstance_or_array_of_union_of_CWLType_or_CommandInputRecordSchema_or_CommandInputEnumSchema_or_CommandInputArraySchema_or_StringInstance_2
445
              .loadField(__doc.get("type"), __baseUri, __loadingOptions);
1✔
446
    } catch (ValidationException e) {
×
447
      type = null; // won't be used but prevents compiler from complaining.
×
448
      final String __message = "the `type` field is not valid because:";
×
449
      __errors.add(new ValidationException(__message, e));
×
450
    }
1✔
451
    java.util.Optional<CommandLineBinding> inputBinding;
452

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

465
    } else {
466
      inputBinding = null;
1✔
467
    }
468
    if (!__errors.isEmpty()) {
1✔
469
      throw new ValidationException("Trying 'RecordField'", __errors);
×
470
    }
471
    this.label = (java.util.Optional<String>) label;
1✔
472
    this.secondaryFiles = (Object) secondaryFiles;
1✔
473
    this.streamable = (java.util.Optional<Boolean>) streamable;
1✔
474
    this.doc = (Object) doc;
1✔
475
    this.id = (String) id;
1✔
476
    this.format = (Object) format;
1✔
477
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
478
    this.loadListing = (java.util.Optional<LoadListingEnum>) loadListing;
1✔
479
    this.default_ = (java.util.Optional<Object>) default_;
1✔
480
    this.type = (Object) type;
1✔
481
    this.inputBinding = (java.util.Optional<CommandLineBinding>) inputBinding;
1✔
482
    for (String field:__doc.keySet()) {
1✔
483
      if (!attrs.contains(field)) {
1✔
484
        if (field.contains(":")) {
×
485
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
486
          extensionFields_.put(expanded_field, __doc.get(field));
×
487
        }
488
      }
489
    }
1✔
490
  }
1✔
491
  private java.util.List<String> attrs = java.util.Arrays.asList("label", "secondaryFiles", "streamable", "doc", "id", "format", "loadContents", "loadListing", "default", "type", "inputBinding");
1✔
492
}
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

© 2025 Coveralls, Inc