• 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

55.93
/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 java.util.Map<String, Object> getExtensionFields() {
NEW
42
    return this.extensionFields_;
×
43
  }
44

45
  private java.util.Optional<Boolean> loadContents;
46

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

61
  public java.util.Optional<Boolean> getLoadContents() {
62
    return this.loadContents;
×
63
  }
64

65
  private java.util.Optional<LoadListingEnum> loadListing;
66

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

83
  public java.util.Optional<LoadListingEnum> getLoadListing() {
84
    return this.loadListing;
×
85
  }
86

87
  private Object glob;
88

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

130
  public Object getGlob() {
131
    return this.glob;
×
132
  }
133

134
  private java.util.Optional<String> outputEval;
135

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

161
  public java.util.Optional<String> getOutputEval() {
162
    return this.outputEval;
×
163
  }
164

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

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

209
    } else {
210
      loadContents = null;
1✔
211
    }
212
    java.util.Optional<LoadListingEnum> loadListing;
213

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

226
    } else {
227
      loadListing = null;
1✔
228
    }
229
    Object glob;
230

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

243
    } else {
244
      glob = null;
1✔
245
    }
246
    java.util.Optional<String> outputEval;
247

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

260
    } else {
261
      outputEval = null;
1✔
262
    }
263
    if (!__errors.isEmpty()) {
1✔
264
      throw new ValidationException("Trying 'RecordField'", __errors);
×
265
    }
266
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
267
    this.loadListing = (java.util.Optional<LoadListingEnum>) loadListing;
1✔
268
    this.glob = (Object) glob;
1✔
269
    this.outputEval = (java.util.Optional<String>) outputEval;
1✔
270
  }
1✔
271
}
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