• 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

55.22
/src/main/java/org/w3id/cwl/cwl1_2/CommandOutputBindingImpl.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#CommandOutputBinding</I><BR> <BLOCKQUOTE>
25
 Describes how to generate an output parameter based on the files produced
26
 by a CommandLineTool.
27
 
28
 The output parameter value is generated by applying these operations in the
29
 following order:
30
 
31
   - glob
32
   - loadContents
33
   - outputEval
34
   - secondaryFiles
35
  </BLOCKQUOTE>
36
 */
37
public class CommandOutputBindingImpl extends SaveableImpl implements CommandOutputBinding {
38
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
39
  private java.util.Map<String, Object> extensionFields_ =
1✔
40
      new java.util.HashMap<String, Object>();
41
  public LoadingOptions getLoadingOptions() {
NEW
42
    return this.loadingOptions_;
×
43
  }
44
  public java.util.Map<String, Object> getExtensionFields() {
45
    return this.extensionFields_;
×
46
  }
47

48
  private java.util.Optional<Boolean> loadContents;
49

50
  /**
51
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadContents</I><BR>
52
   * <BLOCKQUOTE>
53
   * Only valid when `type: File` or is an array of `items: File`.
54
   * 
55
   * If true, the file (or each file in the array) must be a UTF-8
56
   * text file 64 KiB or smaller, and the implementation must read
57
   * the entire contents of the file (or file array) and place it
58
   * in the `contents` field of the File object for use by
59
   * expressions.  If the size of the file is greater than 64 KiB,
60
   * the implementation must raise a fatal error.
61
   *    * </BLOCKQUOTE>
62
   */
63

64
  public java.util.Optional<Boolean> getLoadContents() {
65
    return this.loadContents;
×
66
  }
67

68
  private java.util.Optional<LoadListingEnum> loadListing;
69

70
  /**
71
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadListing</I><BR>
72
   * <BLOCKQUOTE>
73
   * Only valid when `type: Directory` or is an array of `items: Directory`.
74
   * 
75
   * Specify the desired behavior for loading the `listing` field of
76
   * a Directory object for use by expressions.
77
   * 
78
   * The order of precedence for loadListing is:
79
   * 
80
   *   1. `loadListing` on an individual parameter
81
   *   2. Inherited from `LoadListingRequirement`
82
   *   3. By default: `no_listing`
83
   *    * </BLOCKQUOTE>
84
   */
85

86
  public java.util.Optional<LoadListingEnum> getLoadListing() {
87
    return this.loadListing;
×
88
  }
89

90
  private Object glob;
91

92
  /**
93
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandOutputBinding/glob</I><BR>
94
   * <BLOCKQUOTE>
95
   * Find files or directories relative to the output directory, using POSIX
96
   * glob(3) pathname matching.  If an array is provided, find files or
97
   * directories that match any pattern in the array.  If an expression is
98
   * provided, the expression must return a string or an array of strings,
99
   * which will then be evaluated as one or more glob patterns.  Must only
100
   * match and return files/directories which actually exist.
101
   * 
102
   * If the value of glob is a relative path pattern (does not
103
   * begin with a slash '/') then it is resolved relative to the
104
   * output directory.  If the value of the glob is an absolute
105
   * path pattern (it does begin with a slash '/') then it must
106
   * refer to a path within the output directory.  It is an error
107
   * if any glob resolves to a path outside the output directory.
108
   * Specifically this means globs that resolve to paths outside the output
109
   * directory are illegal.
110
   * 
111
   * A glob may match a path within the output directory which is
112
   * actually a symlink to another file.  In this case, the
113
   * expected behavior is for the resulting File/Directory object to take the
114
   * `basename` (and corresponding `nameroot` and `nameext`) of the
115
   * symlink.  The `location` of the File/Directory is implementation
116
   * dependent, but logically the File/Directory should have the same content
117
   * as the symlink target.  Platforms may stage output files/directories to
118
   * cloud storage that lack the concept of a symlink.  In
119
   * this case file content and directories may be duplicated, or (to avoid
120
   * duplication) the File/Directory `location` may refer to the symlink
121
   * target.
122
   * 
123
   * It is an error if a symlink in the output directory (or any
124
   * symlink in a chain of links) refers to any file or directory
125
   * that is not under an input or output directory.
126
   * 
127
   * Implementations may shut down a container before globbing
128
   * output, so globs and expressions must not assume access to the
129
   * container filesystem except for declared input and output.
130
   *    * </BLOCKQUOTE>
131
   */
132

133
  public Object getGlob() {
134
    return this.glob;
×
135
  }
136

137
  private java.util.Optional<String> outputEval;
138

139
  /**
140
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandOutputBinding/outputEval</I><BR>
141
   * <BLOCKQUOTE>
142
   * Evaluate an expression to generate the output value.  If
143
   * `glob` was specified, the value of `self` must be an array
144
   * containing file objects that were matched.  If no files were
145
   * matched, `self` must be a zero length array; if a single file
146
   * was matched, the value of `self` is an array of a single
147
   * element.  The exit code of the process is
148
   * available in the expression as `runtime.exitCode`.
149
   * 
150
   * Additionally, if `loadContents` is true, the file must be a
151
   * UTF-8 text file 64 KiB or smaller, and the implementation must
152
   * read the entire contents of the file (or file array) and place
153
   * it in the `contents` field of the File object for use in
154
   * `outputEval`.  If the size of the file is greater than 64 KiB,
155
   * the implementation must raise a fatal error.
156
   * 
157
   * If a tool needs to return a large amount of structured data to
158
   * the workflow, loading the output object from `cwl.output.json`
159
   * bypasses `outputEval` and is not subject to the 64 KiB
160
   * `loadContents` limit.
161
   *    * </BLOCKQUOTE>
162
   */
163

164
  public java.util.Optional<String> getOutputEval() {
165
    return this.outputEval;
×
166
  }
167

168
  /**
169
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of CommandOutputBindingImpl.
170
   *
171
   * @param __doc_            Document fragment to load this record object from (presumably a
172
                              {@link java.util.Map}).
173
   * @param __baseUri_        Base URI to generate child document IDs against.
174
   * @param __loadingOptions  Context for loading URIs and populating objects.
175
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
176
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
177
   *                             or validation of fields fails.
178
   */
179
  public CommandOutputBindingImpl(
180
      final Object __doc_,
181
      final String __baseUri_,
182
      LoadingOptions __loadingOptions,
183
      final String __docRoot_) {
184
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
185
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
186
    // generated names.
187
    String __baseUri = __baseUri_;
1✔
188
    String __docRoot = __docRoot_;
1✔
189
    if (!(__doc_ instanceof java.util.Map)) {
1✔
190
      throw new ValidationException("CommandOutputBindingImpl called on non-map");
×
191
    }
192
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
193
    final java.util.List<ValidationException> __errors =
1✔
194
        new java.util.ArrayList<ValidationException>();
195
    if (__loadingOptions != null) {
1✔
196
      this.loadingOptions_ = __loadingOptions;
1✔
197
    }
198
    java.util.Optional<Boolean> loadContents;
199

200
    if (__doc.containsKey("loadContents")) {
1✔
201
      try {
202
        loadContents =
1✔
203
            LoaderInstances
204
                .optional_BooleanInstance
205
                .loadField(__doc.get("loadContents"), __baseUri, __loadingOptions);
1✔
206
      } catch (ValidationException e) {
×
207
        loadContents = null; // won't be used but prevents compiler from complaining.
×
208
        final String __message = "the `loadContents` field is not valid because:";
×
209
        __errors.add(new ValidationException(__message, e));
×
210
      }
1✔
211

212
    } else {
213
      loadContents = null;
1✔
214
    }
215
    java.util.Optional<LoadListingEnum> loadListing;
216

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

229
    } else {
230
      loadListing = null;
1✔
231
    }
232
    Object glob;
233

234
    if (__doc.containsKey("glob")) {
1✔
235
      try {
236
        glob =
1✔
237
            LoaderInstances
238
                .union_of_NullInstance_or_StringInstance_or_ExpressionLoader_or_array_of_StringInstance
239
                .loadField(__doc.get("glob"), __baseUri, __loadingOptions);
1✔
240
      } catch (ValidationException e) {
×
241
        glob = null; // won't be used but prevents compiler from complaining.
×
242
        final String __message = "the `glob` field is not valid because:";
×
243
        __errors.add(new ValidationException(__message, e));
×
244
      }
1✔
245

246
    } else {
247
      glob = null;
1✔
248
    }
249
    java.util.Optional<String> outputEval;
250

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

263
    } else {
264
      outputEval = null;
1✔
265
    }
266
    if (!__errors.isEmpty()) {
1✔
267
      throw new ValidationException("Trying 'RecordField'", __errors);
×
268
    }
269
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
270
    this.loadListing = (java.util.Optional<LoadListingEnum>) loadListing;
1✔
271
    this.glob = (Object) glob;
1✔
272
    this.outputEval = (java.util.Optional<String>) outputEval;
1✔
273
    for (String field:__doc.keySet()) {
1✔
274
      if (!attrs.contains(field)) {
1✔
NEW
275
        if (field.contains(":")) {
×
NEW
276
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
277
          extensionFields_.put(expanded_field, __doc.get(field));
×
278
        }
279
      }
280
    }
1✔
281
  }
1✔
282
  private java.util.List<String> attrs = java.util.Arrays.asList("loadContents", "loadListing", "glob", "outputEval");
1✔
283
}
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