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

common-workflow-language / cwljava / #388

30 Oct 2025 04:55PM UTC coverage: 58.693% (-0.8%) from 59.538%
#388

Pull #218

github

web-flow
Merge ab8576a5b 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

59.03
/src/main/java/org/w3id/cwl/cwl1_2/ExpressionToolImpl.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#ExpressionTool</I><BR> <BLOCKQUOTE>
25
 An ExpressionTool is a type of Process object that can be run by itself
26
 or as a Workflow step. It executes a pure Javascript expression that has
27
 access to the same input parameters as a workflow. It is meant to be used
28
 sparingly as a way to isolate complex Javascript expressions that need to
29
 operate on input data and produce some result; perhaps just a
30
 rearrangement of the inputs. No Docker software container is required
31
 or allowed.
32
  </BLOCKQUOTE>
33
 */
34
public class ExpressionToolImpl extends SaveableImpl implements ExpressionTool {
35
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
36
  private java.util.Map<String, Object> extensionFields_ =
1✔
37
      new java.util.HashMap<String, Object>();
38
  public LoadingOptions getLoadingOptions() {
NEW
39
    return this.loadingOptions_;
×
40
  }
41
  public java.util.Map<String, Object> getExtensionFields() {
42
    return this.extensionFields_;
×
43
  }
44

45
  private java.util.Optional<String> id;
46

47
  /**
48
   * Getter for property <I>https://w3id.org/cwl/cwl#Process/id</I><BR>
49
   * <BLOCKQUOTE>
50
   * The unique identifier for this object.
51
   * 
52
   * Only useful for `$graph` at `Process` level. Should not be exposed
53
   * to users in graphical or terminal user interfaces.
54
   *    * </BLOCKQUOTE>
55
   */
56

57
  public java.util.Optional<String> getId() {
58
    return this.id;
×
59
  }
60

61
  private ExpressionTool_class class_;
62

63
  /**
64
   * Getter for property <I>https://w3id.org/cwl/cwl#ExpressionTool/class</I><BR>
65

66
   */
67

68
  public ExpressionTool_class getClass_() {
69
    return this.class_;
×
70
  }
71

72
  private java.util.Optional<String> label;
73

74
  /**
75
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
76
   * <BLOCKQUOTE>
77
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
78
   */
79

80
  public java.util.Optional<String> getLabel() {
81
    return this.label;
×
82
  }
83

84
  private Object doc;
85

86
  /**
87
   * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><BR>
88
   * <BLOCKQUOTE>
89
   * A documentation string for this object, or an array of strings which should be concatenated.   * </BLOCKQUOTE>
90
   */
91

92
  public Object getDoc() {
93
    return this.doc;
×
94
  }
95

96
  private java.util.List<Object> inputs;
97

98
  /**
99
   * Getter for property <I>https://w3id.org/cwl/cwl#inputs</I><BR>
100
   * <BLOCKQUOTE>
101
   * Defines the input parameters of the process.  The process is ready to
102
   * run when all required input parameters are associated with concrete
103
   * values.  Input parameters include a schema for each parameter which is
104
   * used to validate the input object.  It may also be used to build a user
105
   * interface for constructing the input object.
106
   * 
107
   * When accepting an input object, all input parameters must have a value.
108
   * If an input parameter is missing from the input object, it must be
109
   * assigned a value of `null` (or the value of `default` for that
110
   * parameter, if provided) for the purposes of validation and evaluation
111
   * of expressions.
112
   *    * </BLOCKQUOTE>
113
   */
114

115
  public java.util.List<Object> getInputs() {
116
    return this.inputs;
×
117
  }
118

119
  private java.util.List<Object> outputs;
120

121
  /**
122
   * Getter for property <I>https://w3id.org/cwl/cwl#outputs</I><BR>
123
   * <BLOCKQUOTE>
124
   * Defines the parameters representing the output of the process.  May be
125
   * used to generate and/or validate the output object.
126
   *    * </BLOCKQUOTE>
127
   */
128

129
  public java.util.List<Object> getOutputs() {
130
    return this.outputs;
×
131
  }
132

133
  private java.util.Optional<java.util.List<Object>> requirements;
134

135
  /**
136
   * Getter for property <I>https://w3id.org/cwl/cwl#requirements</I><BR>
137
   * <BLOCKQUOTE>
138
   * Declares requirements that apply to either the runtime environment or the
139
   * workflow engine that must be met in order to execute this process.  If
140
   * an implementation cannot satisfy all requirements, or a requirement is
141
   * listed which is not recognized by the implementation, it is a fatal
142
   * error and the implementation must not attempt to run the process,
143
   * unless overridden at user option.
144
   *    * </BLOCKQUOTE>
145
   */
146

147
  public java.util.Optional<java.util.List<Object>> getRequirements() {
148
    return this.requirements;
×
149
  }
150

151
  private java.util.Optional<java.util.List<Object>> hints;
152

153
  /**
154
   * Getter for property <I>https://w3id.org/cwl/cwl#hints</I><BR>
155
   * <BLOCKQUOTE>
156
   * Declares hints applying to either the runtime environment or the
157
   * workflow engine that may be helpful in executing this process.  It is
158
   * not an error if an implementation cannot satisfy all hints, however
159
   * the implementation may report a warning.
160
   *    * </BLOCKQUOTE>
161
   */
162

163
  public java.util.Optional<java.util.List<Object>> getHints() {
164
    return this.hints;
×
165
  }
166

167
  private java.util.Optional<CWLVersion> cwlVersion;
168

169
  /**
170
   * Getter for property <I>https://w3id.org/cwl/cwl#cwlVersion</I><BR>
171
   * <BLOCKQUOTE>
172
   * CWL document version. Always required at the document root. Not
173
   * required for a Process embedded inside another Process.
174
   *    * </BLOCKQUOTE>
175
   */
176

177
  public java.util.Optional<CWLVersion> getCwlVersion() {
178
    return this.cwlVersion;
×
179
  }
180

181
  private java.util.Optional<java.util.List<String>> intent;
182

183
  /**
184
   * Getter for property <I>https://w3id.org/cwl/cwl#Process/intent</I><BR>
185
   * <BLOCKQUOTE>
186
   * An identifier for the type of computational operation, of this Process.
187
   * Especially useful for [`Operation`](Workflow.html#Operation), but can also be used for
188
   * [`CommandLineTool`](CommandLineTool.html#CommandLineTool),
189
   * [`Workflow`](Workflow.html#Workflow), or [ExpressionTool](Workflow.html#ExpressionTool).
190
   * 
191
   * If provided, then this must be an IRI of a concept node that
192
   * represents the type of operation, preferably defined within an ontology.
193
   * 
194
   * For example, in the domain of bioinformatics, one can use an IRI from
195
   * the EDAM Ontology's [Operation concept nodes](http://edamontology.org/operation_0004),
196
   * like [Alignment](http://edamontology.org/operation_2928),
197
   * or [Clustering](http://edamontology.org/operation_3432); or a more
198
   * specific Operation concept like
199
   * [Split read mapping](http://edamontology.org/operation_3199).
200
   *    * </BLOCKQUOTE>
201
   */
202

203
  public java.util.Optional<java.util.List<String>> getIntent() {
204
    return this.intent;
×
205
  }
206

207
  private String expression;
208

209
  /**
210
   * Getter for property <I>https://w3id.org/cwl/cwl#ExpressionTool/expression</I><BR>
211
   * <BLOCKQUOTE>
212
   * The expression to execute.  The expression must return a plain
213
   * Javascript object which matches the output parameters of the
214
   * ExpressionTool.
215
   *    * </BLOCKQUOTE>
216
   */
217

218
  public String getExpression() {
219
    return this.expression;
×
220
  }
221

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

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

266
    } else {
267
      id = null;
1✔
268
    }
269

270
    Boolean __original_is_null = id == null;
1✔
271
    if (id == null) {
1✔
272
      if (__docRoot != null) {
1✔
273
        id = java.util.Optional.of(__docRoot);
1✔
274
      } else {
275
        id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString());
1✔
276
      }
277
    }
278
    if (__original_is_null) {
1✔
279
        __baseUri = __baseUri_;
1✔
280
    } else {
281
        __baseUri = (String) id.orElse(null);
1✔
282
    }
283
    ExpressionTool_class class_;
284
    try {
285
      class_ =
1✔
286
          LoaderInstances
287
              .uri_ExpressionTool_class_False_True_None_None
288
              .loadField(__doc.get("class"), __baseUri, __loadingOptions);
1✔
289
    } catch (ValidationException e) {
1✔
290
      class_ = null; // won't be used but prevents compiler from complaining.
1✔
291
      final String __message = "the `class` field is not valid because:";
1✔
292
      __errors.add(new ValidationException(__message, e));
1✔
293
    }
1✔
294
    java.util.Optional<String> label;
295

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

308
    } else {
309
      label = null;
1✔
310
    }
311
    Object doc;
312

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

325
    } else {
326
      doc = null;
1✔
327
    }
328
    java.util.List<Object> inputs;
329
    try {
330
      inputs =
1✔
331
          LoaderInstances
332
              .idmap_inputs_array_of_WorkflowInputParameter
333
              .loadField(__doc.get("inputs"), __baseUri, __loadingOptions);
1✔
334
    } catch (ValidationException e) {
×
335
      inputs = null; // won't be used but prevents compiler from complaining.
×
336
      final String __message = "the `inputs` field is not valid because:";
×
337
      __errors.add(new ValidationException(__message, e));
×
338
    }
1✔
339
    java.util.List<Object> outputs;
340
    try {
341
      outputs =
1✔
342
          LoaderInstances
343
              .idmap_outputs_array_of_ExpressionToolOutputParameter
344
              .loadField(__doc.get("outputs"), __baseUri, __loadingOptions);
1✔
345
    } catch (ValidationException e) {
×
346
      outputs = null; // won't be used but prevents compiler from complaining.
×
347
      final String __message = "the `outputs` field is not valid because:";
×
348
      __errors.add(new ValidationException(__message, e));
×
349
    }
1✔
350
    java.util.Optional<java.util.List<Object>> requirements;
351

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

364
    } else {
365
      requirements = null;
1✔
366
    }
367
    java.util.Optional<java.util.List<Object>> hints;
368

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

381
    } else {
382
      hints = null;
1✔
383
    }
384
    java.util.Optional<CWLVersion> cwlVersion;
385

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

398
    } else {
399
      cwlVersion = null;
1✔
400
    }
401
    java.util.Optional<java.util.List<String>> intent;
402

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

415
    } else {
416
      intent = null;
1✔
417
    }
418
    String expression;
419
    try {
420
      expression =
1✔
421
          LoaderInstances
422
              .ExpressionLoader
423
              .loadField(__doc.get("expression"), __baseUri, __loadingOptions);
1✔
424
    } catch (ValidationException e) {
1✔
425
      expression = null; // won't be used but prevents compiler from complaining.
1✔
426
      final String __message = "the `expression` field is not valid because:";
1✔
427
      __errors.add(new ValidationException(__message, e));
1✔
428
    }
1✔
429
    if (!__errors.isEmpty()) {
1✔
430
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
431
    }
432
    this.id = (java.util.Optional<String>) id;
1✔
433
    this.label = (java.util.Optional<String>) label;
1✔
434
    this.doc = (Object) doc;
1✔
435
    this.inputs = (java.util.List<Object>) inputs;
1✔
436
    this.outputs = (java.util.List<Object>) outputs;
1✔
437
    this.requirements = (java.util.Optional<java.util.List<Object>>) requirements;
1✔
438
    this.hints = (java.util.Optional<java.util.List<Object>>) hints;
1✔
439
    this.cwlVersion = (java.util.Optional<CWLVersion>) cwlVersion;
1✔
440
    this.intent = (java.util.Optional<java.util.List<String>>) intent;
1✔
441
    this.class_ = (ExpressionTool_class) class_;
1✔
442
    this.expression = (String) expression;
1✔
443
    for (String field:__doc.keySet()) {
1✔
444
      if (!attrs.contains(field)) {
1✔
NEW
445
        if (field.contains(":")) {
×
NEW
446
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
447
          extensionFields_.put(expanded_field, __doc.get(field));
×
448
        }
449
      }
450
    }
1✔
451
  }
1✔
452
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "label", "doc", "inputs", "outputs", "requirements", "hints", "cwlVersion", "intent", "class", "expression");
1✔
453
}
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