• 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

65.12
/src/main/java/org/w3id/cwl/cwl1_2/SecondaryFileSchemaImpl.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#SecondaryFileSchema</I><BR> <BLOCKQUOTE>
25
 Secondary files are specified using the following micro-DSL for secondary files:
26
 
27
 * If the value is a string, it is transformed to an object with two fields
28
   `pattern` and `required`
29
 * By default, the value of `required` is `null`
30
   (this indicates default behavior, which may be based on the context)
31
 * If the value ends with a question mark `?` the question mark is
32
   stripped off and the value of the field `required` is set to `False`
33
 * The remaining value is assigned to the field `pattern`
34
 
35
 For implementation details and examples, please see
36
 [this section](SchemaSalad.html#Domain_Specific_Language_for_secondary_files)
37
 in the Schema Salad specification.
38
  </BLOCKQUOTE>
39
 */
40
public class SecondaryFileSchemaImpl extends SaveableImpl implements SecondaryFileSchema {
41
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
42
  private java.util.Map<String, Object> extensionFields_ =
1✔
43
      new java.util.HashMap<String, Object>();
44
  public LoadingOptions getLoadingOptions() {
NEW
45
    return this.loadingOptions_;
×
46
  }
47
  public java.util.Map<String, Object> getExtensionFields() {
48
    return this.extensionFields_;
×
49
  }
50

51
  private Object pattern;
52

53
  /**
54
   * Getter for property <I>https://w3id.org/cwl/cwl#SecondaryFileSchema/pattern</I><BR>
55
   * <BLOCKQUOTE>
56
   * Provides a pattern or expression specifying files or directories that
57
   * should be included alongside the primary file.
58
   * 
59
   * If the value is an expression, the value of `self` in the
60
   * expression must be the primary input or output File object to
61
   * which this binding applies.  The `basename`, `nameroot` and
62
   * `nameext` fields must be present in `self`.  For
63
   * `CommandLineTool` inputs the `location` field must also be
64
   * present.  For `CommandLineTool` outputs the `path` field must
65
   * also be present.  If secondary files were included on an input
66
   * File object as part of the Process invocation, they must also
67
   * be present in `secondaryFiles` on `self`.
68
   * 
69
   * The expression must return either: a filename string relative
70
   * to the path to the primary File, a File or Directory object
71
   * (`class: File` or `class: Directory`) with either `location`
72
   * (for inputs) or `path` (for outputs) and `basename` fields
73
   * set, or an array consisting of strings or File or Directory
74
   * objects as previously described.
75
   * 
76
   * It is legal to use `location` from a File or Directory object
77
   * passed in as input, including `location` from secondary files
78
   * on `self`.  If an expression returns a File object with the
79
   * same `location` but a different `basename` as a secondary file
80
   * that was passed in, the expression result takes precedence.
81
   * Setting the basename with an expression this way affects the
82
   * `path` where the secondary file will be staged to in the
83
   * CommandLineTool.
84
   * 
85
   * The expression may return "null" in which case there is no
86
   * secondary file from that expression.
87
   * 
88
   * To work on non-filename-preserving storage systems, portable
89
   * tool descriptions should treat `location` as an
90
   * [opaque identifier](#opaque-strings) and avoid constructing new
91
   * values from `location`, but should construct relative references
92
   * using `basename` or `nameroot` instead, or propagate `location`
93
   * from defined inputs.
94
   * 
95
   * If a value in `secondaryFiles` is a string that is not an expression,
96
   * it specifies that the following pattern should be applied to the path
97
   * of the primary file to yield a filename relative to the primary File:
98
   * 
99
   *   1. If string ends with `?` character, remove the last `?` and mark
100
   *     the resulting secondary file as optional.
101
   *   2. If string begins with one or more caret `^` characters, for each
102
   *     caret, remove the last file extension from the path (the last
103
   *     period `.` and all following characters).  If there are no file
104
   *     extensions, the path is unchanged.
105
   *   3. Append the remainder of the string to the end of the file path.
106
   *    * </BLOCKQUOTE>
107
   */
108

109
  public Object getPattern() {
110
    return this.pattern;
1✔
111
  }
112

113
  private Object required;
114

115
  /**
116
   * Getter for property <I>https://w3id.org/cwl/cwl#SecondaryFileSchema/required</I><BR>
117
   * <BLOCKQUOTE>
118
   * An implementation must not fail workflow execution if `required` is
119
   * set to `false` and the expected secondary file does not exist.
120
   * Default value for `required` field is `true` for secondary files on
121
   * input and `false` for secondary files on output.
122
   *    * </BLOCKQUOTE>
123
   */
124

125
  public Object getRequired() {
126
    return this.required;
1✔
127
  }
128

129
  /**
130
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of SecondaryFileSchemaImpl.
131
   *
132
   * @param __doc_            Document fragment to load this record object from (presumably a
133
                              {@link java.util.Map}).
134
   * @param __baseUri_        Base URI to generate child document IDs against.
135
   * @param __loadingOptions  Context for loading URIs and populating objects.
136
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
137
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
138
   *                             or validation of fields fails.
139
   */
140
  public SecondaryFileSchemaImpl(
141
      final Object __doc_,
142
      final String __baseUri_,
143
      LoadingOptions __loadingOptions,
144
      final String __docRoot_) {
145
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
146
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
147
    // generated names.
148
    String __baseUri = __baseUri_;
1✔
149
    String __docRoot = __docRoot_;
1✔
150
    if (!(__doc_ instanceof java.util.Map)) {
1✔
151
      throw new ValidationException("SecondaryFileSchemaImpl called on non-map");
×
152
    }
153
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
154
    final java.util.List<ValidationException> __errors =
1✔
155
        new java.util.ArrayList<ValidationException>();
156
    if (__loadingOptions != null) {
1✔
157
      this.loadingOptions_ = __loadingOptions;
1✔
158
    }
159
    Object pattern;
160
    try {
161
      pattern =
1✔
162
          LoaderInstances
163
              .union_of_StringInstance_or_ExpressionLoader
164
              .loadField(__doc.get("pattern"), __baseUri, __loadingOptions);
1✔
165
    } catch (ValidationException e) {
×
166
      pattern = null; // won't be used but prevents compiler from complaining.
×
167
      final String __message = "the `pattern` field is not valid because:";
×
168
      __errors.add(new ValidationException(__message, e));
×
169
    }
1✔
170
    Object required;
171

172
    if (__doc.containsKey("required")) {
1✔
173
      try {
174
        required =
1✔
175
            LoaderInstances
176
                .union_of_NullInstance_or_BooleanInstance_or_ExpressionLoader
177
                .loadField(__doc.get("required"), __baseUri, __loadingOptions);
1✔
178
      } catch (ValidationException e) {
×
179
        required = null; // won't be used but prevents compiler from complaining.
×
180
        final String __message = "the `required` field is not valid because:";
×
181
        __errors.add(new ValidationException(__message, e));
×
182
      }
1✔
183

184
    } else {
185
      required = null;
1✔
186
    }
187
    if (!__errors.isEmpty()) {
1✔
188
      throw new ValidationException("Trying 'RecordField'", __errors);
×
189
    }
190
    this.pattern = (Object) pattern;
1✔
191
    this.required = (Object) required;
1✔
192
    for (String field:__doc.keySet()) {
1✔
193
      if (!attrs.contains(field)) {
1✔
NEW
194
        if (field.contains(":")) {
×
NEW
195
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
196
          extensionFields_.put(expanded_field, __doc.get(field));
×
197
        }
198
      }
199
    }
1✔
200
  }
1✔
201
  private java.util.List<String> attrs = java.util.Arrays.asList("pattern", "required");
1✔
202
}
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