• 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

68.52
/src/main/java/org/w3id/cwl/cwl1_2/DirentImpl.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#Dirent</I><BR> <BLOCKQUOTE>
25
 Define a file or subdirectory that must be staged to a particular
26
 place prior to executing the command line tool.  May be the result
27
 of executing an expression, such as building a configuration file
28
 from a template.
29
 
30
 Usually files are staged within the [designated output directory](#Runtime_environment).
31
 However, under certain circumstances, files may be staged at
32
 arbitrary locations, see discussion for `entryname`.
33
  </BLOCKQUOTE>
34
 */
35
public class DirentImpl extends SaveableImpl implements Dirent {
36
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
37
  private java.util.Map<String, Object> extensionFields_ =
1✔
38
      new java.util.HashMap<String, Object>();
39
  public LoadingOptions getLoadingOptions() {
NEW
40
    return this.loadingOptions_;
×
41
  }
42
  public java.util.Map<String, Object> getExtensionFields() {
43
    return this.extensionFields_;
×
44
  }
45

46
  private Object entryname;
47

48
  /**
49
   * Getter for property <I>https://w3id.org/cwl/cwl#entryname</I><BR>
50
   * <BLOCKQUOTE>
51
   * The "target" name of the file or subdirectory.  If `entry` is
52
   * a File or Directory, the `entryname` field overrides the value
53
   * of `basename` of the File or Directory object.
54
   * 
55
   * * Required when `entry` evaluates to file contents only
56
   * * Optional when `entry` evaluates to a File or Directory object with a `basename`
57
   * * Invalid when `entry` evaluates to an array of File or Directory objects.
58
   * 
59
   * If `entryname` is a relative path, it specifies a name within
60
   * the designated output directory.  A relative path starting
61
   * with `../` or that resolves to location above the designated output directory is an error.
62
   * 
63
   * If `entryname` is an absolute path (starts with a slash `/`)
64
   * it is an error unless the following conditions are met:
65
   * 
66
   *   * `DockerRequirement` is present in `requirements`
67
   *   * The program is will run inside a software container
68
   *   where, from the perspective of the program, the root
69
   *   filesystem is not shared with any other user or
70
   *   running program.
71
   * 
72
   * In this case, and the above conditions are met, then
73
   * `entryname` may specify the absolute path within the container
74
   * where the file or directory must be placed.
75
   *    * </BLOCKQUOTE>
76
   */
77

78
  public Object getEntryname() {
79
    return this.entryname;
×
80
  }
81

82
  private Object entry;
83

84
  /**
85
   * Getter for property <I>https://w3id.org/cwl/cwl#entry</I><BR>
86
   * <BLOCKQUOTE>
87
   * If the value is a string literal or an expression which evaluates to a
88
   * string, a new text file must be created with the string as the file contents.
89
   * 
90
   * If the value is an expression that evaluates to a `File` or
91
   * `Directory` object, or an array of `File` or `Directory`
92
   * objects, this indicates the referenced file or directory
93
   * should be added to the designated output directory prior to
94
   * executing the tool.
95
   * 
96
   * If the value is an expression that evaluates to `null`,
97
   * nothing is added to the designated output directory, the entry
98
   * has no effect.
99
   * 
100
   * If the value is an expression that evaluates to some other
101
   * array, number, or object not consisting of `File` or
102
   * `Directory` objects, a new file must be created with the value
103
   * serialized to JSON text as the file contents.  The JSON
104
   * serialization behavior should match the behavior of string
105
   * interpolation of [Parameter
106
   * references](#Parameter_references).
107
   *    * </BLOCKQUOTE>
108
   */
109

110
  public Object getEntry() {
111
    return this.entry;
×
112
  }
113

114
  private java.util.Optional<Boolean> writable;
115

116
  /**
117
   * Getter for property <I>https://w3id.org/cwl/cwl#Dirent/writable</I><BR>
118
   * <BLOCKQUOTE>
119
   * If true, the File or Directory (or array of Files or
120
   * Directories) declared in `entry` must be writable by the tool.
121
   * 
122
   * Changes to the file or directory must be isolated and not
123
   * visible by any other CommandLineTool process.  This may be
124
   * implemented by making a copy of the original file or
125
   * directory.
126
   * 
127
   * Disruptive changes to the referenced file or directory must not
128
   * be allowed unless `InplaceUpdateRequirement.inplaceUpdate` is true.
129
   * 
130
   * Default false (files and directories read-only by default).
131
   * 
132
   * A directory marked as `writable: true` implies that all files and
133
   * subdirectories are recursively writable as well.
134
   * 
135
   * If `writable` is false, the file may be made available using a
136
   * bind mount or file system link to avoid unnecessary copying of
137
   * the input file.  Command line tools may receive an error on
138
   * attempting to rename or delete files or directories that are
139
   * not explicitly marked as writable.
140
   *    * </BLOCKQUOTE>
141
   */
142

143
  public java.util.Optional<Boolean> getWritable() {
144
    return this.writable;
×
145
  }
146

147
  /**
148
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of DirentImpl.
149
   *
150
   * @param __doc_            Document fragment to load this record object from (presumably a
151
                              {@link java.util.Map}).
152
   * @param __baseUri_        Base URI to generate child document IDs against.
153
   * @param __loadingOptions  Context for loading URIs and populating objects.
154
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
155
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
156
   *                             or validation of fields fails.
157
   */
158
  public DirentImpl(
159
      final Object __doc_,
160
      final String __baseUri_,
161
      LoadingOptions __loadingOptions,
162
      final String __docRoot_) {
163
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
164
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
165
    // generated names.
166
    String __baseUri = __baseUri_;
1✔
167
    String __docRoot = __docRoot_;
1✔
168
    if (!(__doc_ instanceof java.util.Map)) {
1✔
169
      throw new ValidationException("DirentImpl called on non-map");
×
170
    }
171
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
172
    final java.util.List<ValidationException> __errors =
1✔
173
        new java.util.ArrayList<ValidationException>();
174
    if (__loadingOptions != null) {
1✔
175
      this.loadingOptions_ = __loadingOptions;
1✔
176
    }
177
    Object entryname;
178

179
    if (__doc.containsKey("entryname")) {
1✔
180
      try {
181
        entryname =
1✔
182
            LoaderInstances
183
                .union_of_NullInstance_or_StringInstance_or_ExpressionLoader
184
                .loadField(__doc.get("entryname"), __baseUri, __loadingOptions);
1✔
185
      } catch (ValidationException e) {
×
186
        entryname = null; // won't be used but prevents compiler from complaining.
×
187
        final String __message = "the `entryname` field is not valid because:";
×
188
        __errors.add(new ValidationException(__message, e));
×
189
      }
1✔
190

191
    } else {
192
      entryname = null;
1✔
193
    }
194
    Object entry;
195
    try {
196
      entry =
1✔
197
          LoaderInstances
198
              .union_of_StringInstance_or_ExpressionLoader
199
              .loadField(__doc.get("entry"), __baseUri, __loadingOptions);
1✔
200
    } catch (ValidationException e) {
1✔
201
      entry = null; // won't be used but prevents compiler from complaining.
1✔
202
      final String __message = "the `entry` field is not valid because:";
1✔
203
      __errors.add(new ValidationException(__message, e));
1✔
204
    }
1✔
205
    java.util.Optional<Boolean> writable;
206

207
    if (__doc.containsKey("writable")) {
1✔
208
      try {
209
        writable =
1✔
210
            LoaderInstances
211
                .optional_BooleanInstance
212
                .loadField(__doc.get("writable"), __baseUri, __loadingOptions);
1✔
213
      } catch (ValidationException e) {
×
214
        writable = null; // won't be used but prevents compiler from complaining.
×
215
        final String __message = "the `writable` field is not valid because:";
×
216
        __errors.add(new ValidationException(__message, e));
×
217
      }
1✔
218

219
    } else {
220
      writable = null;
1✔
221
    }
222
    if (!__errors.isEmpty()) {
1✔
223
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
224
    }
225
    this.entryname = (Object) entryname;
1✔
226
    this.entry = (Object) entry;
1✔
227
    this.writable = (java.util.Optional<Boolean>) writable;
1✔
228
    for (String field:__doc.keySet()) {
1✔
229
      if (!attrs.contains(field)) {
1✔
NEW
230
        if (field.contains(":")) {
×
NEW
231
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
232
          extensionFields_.put(expanded_field, __doc.get(field));
×
233
        }
234
      }
235
    }
1✔
236
  }
1✔
237
  private java.util.List<String> attrs = java.util.Arrays.asList("entryname", "entry", "writable");
1✔
238
}
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