• 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

61.65
/src/main/java/org/commonwl/cwlsdk/cwl1_1/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.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#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() {
NEW
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#Identified/id</I><BR>
49
   * <BLOCKQUOTE>
50
   * The unique identifier for this object.   * </BLOCKQUOTE>
51
   */
52

53
  public java.util.Optional<String> getId() {
NEW
54
    return this.id;
×
55
  }
56

57
  private ExpressionTool_class class_;
58

59
  /**
60
   * Getter for property <I>https://w3id.org/cwl/cwl#ExpressionTool/class</I><BR>
61

62
   */
63

64
  public ExpressionTool_class getClass_() {
NEW
65
    return this.class_;
×
66
  }
67

68
  private java.util.Optional<String> label;
69

70
  /**
71
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
72
   * <BLOCKQUOTE>
73
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
74
   */
75

76
  public java.util.Optional<String> getLabel() {
NEW
77
    return this.label;
×
78
  }
79

80
  private Object doc;
81

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

88
  public Object getDoc() {
NEW
89
    return this.doc;
×
90
  }
91

92
  private java.util.List<Object> inputs;
93

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

111
  public java.util.List<Object> getInputs() {
NEW
112
    return this.inputs;
×
113
  }
114

115
  private java.util.List<Object> outputs;
116

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

125
  public java.util.List<Object> getOutputs() {
NEW
126
    return this.outputs;
×
127
  }
128

129
  private java.util.Optional<java.util.List<Object>> requirements;
130

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

143
  public java.util.Optional<java.util.List<Object>> getRequirements() {
NEW
144
    return this.requirements;
×
145
  }
146

147
  private java.util.Optional<java.util.List<Object>> hints;
148

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

159
  public java.util.Optional<java.util.List<Object>> getHints() {
NEW
160
    return this.hints;
×
161
  }
162

163
  private java.util.Optional<CWLVersion> cwlVersion;
164

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

173
  public java.util.Optional<CWLVersion> getCwlVersion() {
NEW
174
    return this.cwlVersion;
×
175
  }
176

177
  private String expression;
178

179
  /**
180
   * Getter for property <I>https://w3id.org/cwl/cwl#ExpressionTool/expression</I><BR>
181
   * <BLOCKQUOTE>
182
   * The expression to execute.  The expression must return a JSON object which
183
   * matches the output parameters of the ExpressionTool.
184
   *    * </BLOCKQUOTE>
185
   */
186

187
  public String getExpression() {
NEW
188
    return this.expression;
×
189
  }
190

191
  /**
192
   * Used by {@link org.commonwl.cwlsdk.cwl1_1.utils.RootLoader} to construct instances of ExpressionToolImpl.
193
   *
194
   * @param __doc_            Document fragment to load this record object from (presumably a
195
                              {@link java.util.Map}).
196
   * @param __baseUri_        Base URI to generate child document IDs against.
197
   * @param __loadingOptions  Context for loading URIs and populating objects.
198
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
199
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
200
   *                             or validation of fields fails.
201
   */
202
  public ExpressionToolImpl(
203
      final Object __doc_,
204
      final String __baseUri_,
205
      LoadingOptions __loadingOptions,
206
      final String __docRoot_) {
207
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
208
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
209
    // generated names.
210
    String __baseUri = __baseUri_;
1✔
211
    String __docRoot = __docRoot_;
1✔
212
    if (!(__doc_ instanceof java.util.Map)) {
1✔
NEW
213
      throw new ValidationException("ExpressionToolImpl called on non-map");
×
214
    }
215
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
216
    final java.util.List<ValidationException> __errors =
1✔
217
        new java.util.ArrayList<ValidationException>();
218
    if (__loadingOptions != null) {
1✔
219
      this.loadingOptions_ = __loadingOptions;
1✔
220
    }
221
    java.util.Optional<String> id;
222

223
    if (__doc.containsKey("id")) {
1✔
224
      try {
225
        id =
1✔
226
            LoaderInstances
227
                .uri_optional_StringInstance_True_False_None_None
228
                .loadField(__doc.get("id"), __baseUri, __loadingOptions);
1✔
NEW
229
      } catch (ValidationException e) {
×
NEW
230
        id = null; // won't be used but prevents compiler from complaining.
×
NEW
231
        final String __message = "the `id` field is not valid because:";
×
NEW
232
        __errors.add(new ValidationException(__message, e));
×
233
      }
1✔
234

235
    } else {
236
      id = null;
1✔
237
    }
238

239
    Boolean __original_is_null = id == null;
1✔
240
    if (id == null) {
1✔
241
      if (__docRoot != null) {
1✔
242
        id = java.util.Optional.of(__docRoot);
1✔
243
      } else {
244
        id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString());
1✔
245
      }
246
    }
247
    if (__original_is_null) {
1✔
248
        __baseUri = __baseUri_;
1✔
249
    } else {
250
        __baseUri = (String) id.orElse(null);
1✔
251
    }
252
    ExpressionTool_class class_;
253
    try {
254
      class_ =
1✔
255
          LoaderInstances
256
              .uri_ExpressionTool_class_False_True_None_None
257
              .loadField(__doc.get("class"), __baseUri, __loadingOptions);
1✔
258
    } catch (ValidationException e) {
1✔
259
      class_ = null; // won't be used but prevents compiler from complaining.
1✔
260
      final String __message = "the `class` field is not valid because:";
1✔
261
      __errors.add(new ValidationException(__message, e));
1✔
262
    }
1✔
263
    java.util.Optional<String> label;
264

265
    if (__doc.containsKey("label")) {
1✔
266
      try {
NEW
267
        label =
×
268
            LoaderInstances
269
                .optional_StringInstance
NEW
270
                .loadField(__doc.get("label"), __baseUri, __loadingOptions);
×
NEW
271
      } catch (ValidationException e) {
×
NEW
272
        label = null; // won't be used but prevents compiler from complaining.
×
NEW
273
        final String __message = "the `label` field is not valid because:";
×
NEW
274
        __errors.add(new ValidationException(__message, e));
×
NEW
275
      }
×
276

277
    } else {
278
      label = null;
1✔
279
    }
280
    Object doc;
281

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

294
    } else {
295
      doc = null;
1✔
296
    }
297
    java.util.List<Object> inputs;
298
    try {
299
      inputs =
1✔
300
          LoaderInstances
301
              .idmap_inputs_array_of_WorkflowInputParameter
302
              .loadField(__doc.get("inputs"), __baseUri, __loadingOptions);
1✔
NEW
303
    } catch (ValidationException e) {
×
NEW
304
      inputs = null; // won't be used but prevents compiler from complaining.
×
NEW
305
      final String __message = "the `inputs` field is not valid because:";
×
NEW
306
      __errors.add(new ValidationException(__message, e));
×
307
    }
1✔
308
    java.util.List<Object> outputs;
309
    try {
310
      outputs =
1✔
311
          LoaderInstances
312
              .idmap_outputs_array_of_ExpressionToolOutputParameter
313
              .loadField(__doc.get("outputs"), __baseUri, __loadingOptions);
1✔
NEW
314
    } catch (ValidationException e) {
×
NEW
315
      outputs = null; // won't be used but prevents compiler from complaining.
×
NEW
316
      final String __message = "the `outputs` field is not valid because:";
×
NEW
317
      __errors.add(new ValidationException(__message, e));
×
318
    }
1✔
319
    java.util.Optional<java.util.List<Object>> requirements;
320

321
    if (__doc.containsKey("requirements")) {
1✔
322
      try {
323
        requirements =
1✔
324
            LoaderInstances
325
                .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
326
                .loadField(__doc.get("requirements"), __baseUri, __loadingOptions);
1✔
NEW
327
      } catch (ValidationException e) {
×
NEW
328
        requirements = null; // won't be used but prevents compiler from complaining.
×
NEW
329
        final String __message = "the `requirements` field is not valid because:";
×
NEW
330
        __errors.add(new ValidationException(__message, e));
×
331
      }
1✔
332

333
    } else {
334
      requirements = null;
1✔
335
    }
336
    java.util.Optional<java.util.List<Object>> hints;
337

338
    if (__doc.containsKey("hints")) {
1✔
339
      try {
340
        hints =
1✔
341
            LoaderInstances
342
                .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
343
                .loadField(__doc.get("hints"), __baseUri, __loadingOptions);
1✔
NEW
344
      } catch (ValidationException e) {
×
NEW
345
        hints = null; // won't be used but prevents compiler from complaining.
×
NEW
346
        final String __message = "the `hints` field is not valid because:";
×
NEW
347
        __errors.add(new ValidationException(__message, e));
×
348
      }
1✔
349

350
    } else {
351
      hints = null;
1✔
352
    }
353
    java.util.Optional<CWLVersion> cwlVersion;
354

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

367
    } else {
368
      cwlVersion = null;
1✔
369
    }
370
    String expression;
371
    try {
372
      expression =
1✔
373
          LoaderInstances
374
              .ExpressionLoader
375
              .loadField(__doc.get("expression"), __baseUri, __loadingOptions);
1✔
376
    } catch (ValidationException e) {
1✔
377
      expression = null; // won't be used but prevents compiler from complaining.
1✔
378
      final String __message = "the `expression` field is not valid because:";
1✔
379
      __errors.add(new ValidationException(__message, e));
1✔
380
    }
1✔
381
    if (!__errors.isEmpty()) {
1✔
382
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
383
    }
384
    this.id = (java.util.Optional<String>) id;
1✔
385
    this.label = (java.util.Optional<String>) label;
1✔
386
    this.doc = (Object) doc;
1✔
387
    this.inputs = (java.util.List<Object>) inputs;
1✔
388
    this.outputs = (java.util.List<Object>) outputs;
1✔
389
    this.requirements = (java.util.Optional<java.util.List<Object>>) requirements;
1✔
390
    this.hints = (java.util.Optional<java.util.List<Object>>) hints;
1✔
391
    this.cwlVersion = (java.util.Optional<CWLVersion>) cwlVersion;
1✔
392
    this.class_ = (ExpressionTool_class) class_;
1✔
393
    this.expression = (String) expression;
1✔
394
    for (String field:__doc.keySet()) {
1✔
395
      if (!attrs.contains(field)) {
1✔
NEW
396
        if (field.contains(":")) {
×
NEW
397
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
398
          extensionFields_.put(expanded_field, __doc.get(field));
×
399
        }
400
      }
401
    }
1✔
402
  }
1✔
403
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "label", "doc", "inputs", "outputs", "requirements", "hints", "cwlVersion", "class", "expression");
1✔
404
}
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