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

common-workflow-language / cwljava / #352

07 Apr 2025 10:22AM UTC coverage: 59.538% (-0.6%) from 60.167%
#352

Pull #193

github

web-flow
Merge d636f9333 into 46536cad2
Pull Request #193: Add accessor for the extension field.

0 of 129 new or added lines in 129 files covered. (0.0%)

7347 of 12340 relevant lines covered (59.54%)

0.6 hits per line

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

62.4
/src/main/java/org/w3id/cwl/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.w3id.cwl.cwl1_1;
16

17
import org.w3id.cwl.cwl1_1.utils.LoaderInstances;
18
import org.w3id.cwl.cwl1_1.utils.LoadingOptions;
19
import org.w3id.cwl.cwl1_1.utils.LoadingOptionsBuilder;
20
import org.w3id.cwl.cwl1_1.utils.SaveableImpl;
21
import org.w3id.cwl.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 java.util.Map<String, Object> getExtensionFields() {
NEW
39
    return this.extensionFields_;
×
40
  }
41

42
  private java.util.Optional<String> id;
43

44
  /**
45
   * Getter for property <I>https://w3id.org/cwl/cwl#Identified/id</I><BR>
46
   * <BLOCKQUOTE>
47
   * The unique identifier for this object.   * </BLOCKQUOTE>
48
   */
49

50
  public java.util.Optional<String> getId() {
51
    return this.id;
×
52
  }
53

54
  private ExpressionTool_class class_;
55

56
  /**
57
   * Getter for property <I>https://w3id.org/cwl/cwl#ExpressionTool/class</I><BR>
58

59
   */
60

61
  public ExpressionTool_class getClass_() {
62
    return this.class_;
×
63
  }
64

65
  private java.util.Optional<String> label;
66

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

73
  public java.util.Optional<String> getLabel() {
74
    return this.label;
×
75
  }
76

77
  private Object doc;
78

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

85
  public Object getDoc() {
86
    return this.doc;
×
87
  }
88

89
  private java.util.List<Object> inputs;
90

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

108
  public java.util.List<Object> getInputs() {
109
    return this.inputs;
×
110
  }
111

112
  private java.util.List<Object> outputs;
113

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

122
  public java.util.List<Object> getOutputs() {
123
    return this.outputs;
×
124
  }
125

126
  private java.util.Optional<java.util.List<Object>> requirements;
127

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

140
  public java.util.Optional<java.util.List<Object>> getRequirements() {
141
    return this.requirements;
×
142
  }
143

144
  private java.util.Optional<java.util.List<Object>> hints;
145

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

156
  public java.util.Optional<java.util.List<Object>> getHints() {
157
    return this.hints;
×
158
  }
159

160
  private java.util.Optional<CWLVersion> cwlVersion;
161

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

170
  public java.util.Optional<CWLVersion> getCwlVersion() {
171
    return this.cwlVersion;
×
172
  }
173

174
  private String expression;
175

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

184
  public String getExpression() {
185
    return this.expression;
×
186
  }
187

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

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

232
    } else {
233
      id = null;
1✔
234
    }
235

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

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

274
    } else {
275
      label = null;
1✔
276
    }
277
    Object doc;
278

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

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

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

330
    } else {
331
      requirements = null;
1✔
332
    }
333
    java.util.Optional<java.util.List<Object>> hints;
334

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

347
    } else {
348
      hints = null;
1✔
349
    }
350
    java.util.Optional<CWLVersion> cwlVersion;
351

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

364
    } else {
365
      cwlVersion = null;
1✔
366
    }
367
    String expression;
368
    try {
369
      expression =
1✔
370
          LoaderInstances
371
              .ExpressionLoader
372
              .loadField(__doc.get("expression"), __baseUri, __loadingOptions);
1✔
373
    } catch (ValidationException e) {
1✔
374
      expression = null; // won't be used but prevents compiler from complaining.
1✔
375
      final String __message = "the `expression` field is not valid because:";
1✔
376
      __errors.add(new ValidationException(__message, e));
1✔
377
    }
1✔
378
    if (!__errors.isEmpty()) {
1✔
379
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
380
    }
381
    this.id = (java.util.Optional<String>) id;
1✔
382
    this.label = (java.util.Optional<String>) label;
1✔
383
    this.doc = (Object) doc;
1✔
384
    this.inputs = (java.util.List<Object>) inputs;
1✔
385
    this.outputs = (java.util.List<Object>) outputs;
1✔
386
    this.requirements = (java.util.Optional<java.util.List<Object>>) requirements;
1✔
387
    this.hints = (java.util.Optional<java.util.List<Object>>) hints;
1✔
388
    this.cwlVersion = (java.util.Optional<CWLVersion>) cwlVersion;
1✔
389
    this.class_ = (ExpressionTool_class) class_;
1✔
390
    this.expression = (String) expression;
1✔
391
  }
1✔
392
}
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