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

common-workflow-language / cwljava / #339

29 Jan 2025 01:23PM UTC coverage: 59.538% (-0.6%) from 60.167%
#339

Pull #193

github

web-flow
Merge 94c260498 into 0978523bc
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

59.56
/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 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#Process/id</I><BR>
46
   * <BLOCKQUOTE>
47
   * The unique identifier for this object.
48
   * 
49
   * Only useful for `$graph` at `Process` level. Should not be exposed
50
   * to users in graphical or terminal user interfaces.
51
   *    * </BLOCKQUOTE>
52
   */
53

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

58
  private ExpressionTool_class class_;
59

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

63
   */
64

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

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

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

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

81
  private Object doc;
82

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

178
  private java.util.Optional<java.util.List<String>> intent;
179

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

200
  public java.util.Optional<java.util.List<String>> getIntent() {
201
    return this.intent;
×
202
  }
203

204
  private String expression;
205

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

215
  public String getExpression() {
216
    return this.expression;
×
217
  }
218

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

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

263
    } else {
264
      id = null;
1✔
265
    }
266

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

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

305
    } else {
306
      label = null;
1✔
307
    }
308
    Object doc;
309

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

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

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

361
    } else {
362
      requirements = null;
1✔
363
    }
364
    java.util.Optional<java.util.List<Object>> hints;
365

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

378
    } else {
379
      hints = null;
1✔
380
    }
381
    java.util.Optional<CWLVersion> cwlVersion;
382

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

395
    } else {
396
      cwlVersion = null;
1✔
397
    }
398
    java.util.Optional<java.util.List<String>> intent;
399

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

412
    } else {
413
      intent = null;
1✔
414
    }
415
    String expression;
416
    try {
417
      expression =
1✔
418
          LoaderInstances
419
              .ExpressionLoader
420
              .loadField(__doc.get("expression"), __baseUri, __loadingOptions);
1✔
421
    } catch (ValidationException e) {
1✔
422
      expression = null; // won't be used but prevents compiler from complaining.
1✔
423
      final String __message = "the `expression` field is not valid because:";
1✔
424
      __errors.add(new ValidationException(__message, e));
1✔
425
    }
1✔
426
    if (!__errors.isEmpty()) {
1✔
427
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
428
    }
429
    this.id = (java.util.Optional<String>) id;
1✔
430
    this.label = (java.util.Optional<String>) label;
1✔
431
    this.doc = (Object) doc;
1✔
432
    this.inputs = (java.util.List<Object>) inputs;
1✔
433
    this.outputs = (java.util.List<Object>) outputs;
1✔
434
    this.requirements = (java.util.Optional<java.util.List<Object>>) requirements;
1✔
435
    this.hints = (java.util.Optional<java.util.List<Object>>) hints;
1✔
436
    this.cwlVersion = (java.util.Optional<CWLVersion>) cwlVersion;
1✔
437
    this.intent = (java.util.Optional<java.util.List<String>>) intent;
1✔
438
    this.class_ = (ExpressionTool_class) class_;
1✔
439
    this.expression = (String) expression;
1✔
440
  }
1✔
441
}
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