• 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

60.83
/src/main/java/org/w3id/cwl/cwl1_2/ResourceRequirementImpl.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#ResourceRequirement</I><BR> <BLOCKQUOTE>
25
 Specify basic hardware resource requirements.
26
 
27
 "min" is the minimum amount of a resource that must be reserved to
28
 schedule a job. If "min" cannot be satisfied, the job should not
29
 be run.
30
 
31
 "max" is the maximum amount of a resource that the job shall be
32
 allocated. If a node has sufficient resources, multiple jobs may
33
 be scheduled on a single node provided each job's "max" resource
34
 requirements are met. If a job attempts to exceed its resource
35
 allocation, an implementation may deny additional resources, which
36
 may result in job failure.
37
 
38
 If both "min" and "max" are specified, an implementation may
39
 choose to allocate any amount between "min" and "max", with the
40
 actual allocation provided in the `runtime` object.
41
 
42
 If "min" is specified but "max" is not, then "max" == "min"
43
 If "max" is specified by "min" is not, then "min" == "max".
44
 
45
 It is an error if max < min.
46
 
47
 It is an error if the value of any of these fields is negative.
48
 
49
 If neither "min" nor "max" is specified for a resource, use the default values below.
50
  </BLOCKQUOTE>
51
 */
52
public class ResourceRequirementImpl extends SaveableImpl implements ResourceRequirement {
53
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
54
  private java.util.Map<String, Object> extensionFields_ =
1✔
55
      new java.util.HashMap<String, Object>();
56
  public LoadingOptions getLoadingOptions() {
NEW
57
    return this.loadingOptions_;
×
58
  }
59
  public java.util.Map<String, Object> getExtensionFields() {
60
    return this.extensionFields_;
×
61
  }
62

63
  private ResourceRequirement_class class_;
64

65
  /**
66
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/class</I><BR>
67
   * <BLOCKQUOTE>
68
   * Always 'ResourceRequirement'   * </BLOCKQUOTE>
69
   */
70

71
  public ResourceRequirement_class getClass_() {
72
    return this.class_;
×
73
  }
74

75
  private Object coresMin;
76

77
  /**
78
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/coresMin</I><BR>
79
   * <BLOCKQUOTE>
80
   * Minimum reserved number of CPU cores (default is 1).
81
   * 
82
   * May be a fractional value to indicate to a scheduling
83
   * algorithm that one core can be allocated to multiple
84
   * jobs. For example, a value of 0.25 indicates that up to 4
85
   * jobs may run in parallel on 1 core.  A value of 1.25 means
86
   * that up to 3 jobs can run on a 4 core system (4/1.25 ≈ 3).
87
   * 
88
   * Processes can only share a core allocation if the sum of each
89
   * of their `ramMax`, `tmpdirMax`, and `outdirMax` requests also
90
   * do not exceed the capacity of the node.
91
   * 
92
   * Processes sharing a core must have the same level of isolation
93
   * (typically a container or VM) that they would normally have.
94
   * 
95
   * The reported number of CPU cores reserved for the process,
96
   * which is available to expressions on the CommandLineTool as
97
   * `runtime.cores`, must be a non-zero integer, and may be
98
   * calculated by rounding up the cores request to the next whole
99
   * number.
100
   * 
101
   * Scheduling systems may allocate fractional CPU resources by
102
   * setting quotas or scheduling weights.  Scheduling systems that
103
   * do not support fractional CPUs may round up the request to the
104
   * next whole number.
105
   *    * </BLOCKQUOTE>
106
   */
107

108
  public Object getCoresMin() {
109
    return this.coresMin;
×
110
  }
111

112
  private Object coresMax;
113

114
  /**
115
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/coresMax</I><BR>
116
   * <BLOCKQUOTE>
117
   * Maximum reserved number of CPU cores.
118
   * 
119
   * See `coresMin` for discussion about fractional CPU requests.
120
   *    * </BLOCKQUOTE>
121
   */
122

123
  public Object getCoresMax() {
124
    return this.coresMax;
×
125
  }
126

127
  private Object ramMin;
128

129
  /**
130
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/ramMin</I><BR>
131
   * <BLOCKQUOTE>
132
   * Minimum reserved RAM in mebibytes (2**20) (default is 256)
133
   * 
134
   * May be a fractional value.  If so, the actual RAM request must
135
   * be rounded up to the next whole number.  The reported amount of
136
   * RAM reserved for the process, which is available to
137
   * expressions on the CommandLineTool as `runtime.ram`, must be a
138
   * non-zero integer.
139
   *    * </BLOCKQUOTE>
140
   */
141

142
  public Object getRamMin() {
143
    return this.ramMin;
×
144
  }
145

146
  private Object ramMax;
147

148
  /**
149
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/ramMax</I><BR>
150
   * <BLOCKQUOTE>
151
   * Maximum reserved RAM in mebibytes (2**20)
152
   * 
153
   * See `ramMin` for discussion about fractional RAM requests.
154
   *    * </BLOCKQUOTE>
155
   */
156

157
  public Object getRamMax() {
158
    return this.ramMax;
×
159
  }
160

161
  private Object tmpdirMin;
162

163
  /**
164
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/tmpdirMin</I><BR>
165
   * <BLOCKQUOTE>
166
   * Minimum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20) (default is 1024)
167
   * 
168
   * May be a fractional value.  If so, the actual storage request
169
   * must be rounded up to the next whole number.  The reported
170
   * amount of storage reserved for the process, which is available
171
   * to expressions on the CommandLineTool as `runtime.tmpdirSize`,
172
   * must be a non-zero integer.
173
   *    * </BLOCKQUOTE>
174
   */
175

176
  public Object getTmpdirMin() {
177
    return this.tmpdirMin;
×
178
  }
179

180
  private Object tmpdirMax;
181

182
  /**
183
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/tmpdirMax</I><BR>
184
   * <BLOCKQUOTE>
185
   * Maximum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20)
186
   * 
187
   * See `tmpdirMin` for discussion about fractional storage requests.
188
   *    * </BLOCKQUOTE>
189
   */
190

191
  public Object getTmpdirMax() {
192
    return this.tmpdirMax;
×
193
  }
194

195
  private Object outdirMin;
196

197
  /**
198
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/outdirMin</I><BR>
199
   * <BLOCKQUOTE>
200
   * Minimum reserved filesystem based storage for the designated output directory, in mebibytes (2**20) (default is 1024)
201
   * 
202
   * May be a fractional value.  If so, the actual storage request
203
   * must be rounded up to the next whole number.  The reported
204
   * amount of storage reserved for the process, which is available
205
   * to expressions on the CommandLineTool as `runtime.outdirSize`,
206
   * must be a non-zero integer.
207
   *    * </BLOCKQUOTE>
208
   */
209

210
  public Object getOutdirMin() {
211
    return this.outdirMin;
×
212
  }
213

214
  private Object outdirMax;
215

216
  /**
217
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/outdirMax</I><BR>
218
   * <BLOCKQUOTE>
219
   * Maximum reserved filesystem based storage for the designated output directory, in mebibytes (2**20)
220
   * 
221
   * See `outdirMin` for discussion about fractional storage requests.
222
   *    * </BLOCKQUOTE>
223
   */
224

225
  public Object getOutdirMax() {
226
    return this.outdirMax;
×
227
  }
228

229
  /**
230
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of ResourceRequirementImpl.
231
   *
232
   * @param __doc_            Document fragment to load this record object from (presumably a
233
                              {@link java.util.Map}).
234
   * @param __baseUri_        Base URI to generate child document IDs against.
235
   * @param __loadingOptions  Context for loading URIs and populating objects.
236
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
237
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
238
   *                             or validation of fields fails.
239
   */
240
  public ResourceRequirementImpl(
241
      final Object __doc_,
242
      final String __baseUri_,
243
      LoadingOptions __loadingOptions,
244
      final String __docRoot_) {
245
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
246
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
247
    // generated names.
248
    String __baseUri = __baseUri_;
1✔
249
    String __docRoot = __docRoot_;
1✔
250
    if (!(__doc_ instanceof java.util.Map)) {
1✔
251
      throw new ValidationException("ResourceRequirementImpl called on non-map");
×
252
    }
253
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
254
    final java.util.List<ValidationException> __errors =
1✔
255
        new java.util.ArrayList<ValidationException>();
256
    if (__loadingOptions != null) {
1✔
257
      this.loadingOptions_ = __loadingOptions;
1✔
258
    }
259
    ResourceRequirement_class class_;
260
    try {
261
      class_ =
1✔
262
          LoaderInstances
263
              .uri_ResourceRequirement_class_False_True_None_None
264
              .loadField(__doc.get("class"), __baseUri, __loadingOptions);
1✔
265
    } catch (ValidationException e) {
1✔
266
      class_ = null; // won't be used but prevents compiler from complaining.
1✔
267
      final String __message = "the `class` field is not valid because:";
1✔
268
      __errors.add(new ValidationException(__message, e));
1✔
269
    }
1✔
270
    Object coresMin;
271

272
    if (__doc.containsKey("coresMin")) {
1✔
273
      try {
274
        coresMin =
1✔
275
            LoaderInstances
276
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
277
                .loadField(__doc.get("coresMin"), __baseUri, __loadingOptions);
1✔
278
      } catch (ValidationException e) {
×
279
        coresMin = null; // won't be used but prevents compiler from complaining.
×
280
        final String __message = "the `coresMin` field is not valid because:";
×
281
        __errors.add(new ValidationException(__message, e));
×
282
      }
1✔
283

284
    } else {
285
      coresMin = null;
1✔
286
    }
287
    Object coresMax;
288

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

301
    } else {
302
      coresMax = null;
1✔
303
    }
304
    Object ramMin;
305

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

318
    } else {
319
      ramMin = null;
1✔
320
    }
321
    Object ramMax;
322

323
    if (__doc.containsKey("ramMax")) {
1✔
324
      try {
325
        ramMax =
1✔
326
            LoaderInstances
327
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
328
                .loadField(__doc.get("ramMax"), __baseUri, __loadingOptions);
1✔
329
      } catch (ValidationException e) {
×
330
        ramMax = null; // won't be used but prevents compiler from complaining.
×
331
        final String __message = "the `ramMax` field is not valid because:";
×
332
        __errors.add(new ValidationException(__message, e));
×
333
      }
1✔
334

335
    } else {
336
      ramMax = null;
1✔
337
    }
338
    Object tmpdirMin;
339

340
    if (__doc.containsKey("tmpdirMin")) {
1✔
341
      try {
342
        tmpdirMin =
1✔
343
            LoaderInstances
344
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
345
                .loadField(__doc.get("tmpdirMin"), __baseUri, __loadingOptions);
1✔
346
      } catch (ValidationException e) {
×
347
        tmpdirMin = null; // won't be used but prevents compiler from complaining.
×
348
        final String __message = "the `tmpdirMin` field is not valid because:";
×
349
        __errors.add(new ValidationException(__message, e));
×
350
      }
1✔
351

352
    } else {
353
      tmpdirMin = null;
1✔
354
    }
355
    Object tmpdirMax;
356

357
    if (__doc.containsKey("tmpdirMax")) {
1✔
358
      try {
359
        tmpdirMax =
1✔
360
            LoaderInstances
361
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
362
                .loadField(__doc.get("tmpdirMax"), __baseUri, __loadingOptions);
1✔
363
      } catch (ValidationException e) {
×
364
        tmpdirMax = null; // won't be used but prevents compiler from complaining.
×
365
        final String __message = "the `tmpdirMax` field is not valid because:";
×
366
        __errors.add(new ValidationException(__message, e));
×
367
      }
1✔
368

369
    } else {
370
      tmpdirMax = null;
1✔
371
    }
372
    Object outdirMin;
373

374
    if (__doc.containsKey("outdirMin")) {
1✔
375
      try {
376
        outdirMin =
1✔
377
            LoaderInstances
378
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
379
                .loadField(__doc.get("outdirMin"), __baseUri, __loadingOptions);
1✔
380
      } catch (ValidationException e) {
×
381
        outdirMin = null; // won't be used but prevents compiler from complaining.
×
382
        final String __message = "the `outdirMin` field is not valid because:";
×
383
        __errors.add(new ValidationException(__message, e));
×
384
      }
1✔
385

386
    } else {
387
      outdirMin = null;
1✔
388
    }
389
    Object outdirMax;
390

391
    if (__doc.containsKey("outdirMax")) {
1✔
392
      try {
393
        outdirMax =
1✔
394
            LoaderInstances
395
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
396
                .loadField(__doc.get("outdirMax"), __baseUri, __loadingOptions);
1✔
397
      } catch (ValidationException e) {
×
398
        outdirMax = null; // won't be used but prevents compiler from complaining.
×
399
        final String __message = "the `outdirMax` field is not valid because:";
×
400
        __errors.add(new ValidationException(__message, e));
×
401
      }
1✔
402

403
    } else {
404
      outdirMax = null;
1✔
405
    }
406
    if (!__errors.isEmpty()) {
1✔
407
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
408
    }
409
    this.class_ = (ResourceRequirement_class) class_;
1✔
410
    this.coresMin = (Object) coresMin;
1✔
411
    this.coresMax = (Object) coresMax;
1✔
412
    this.ramMin = (Object) ramMin;
1✔
413
    this.ramMax = (Object) ramMax;
1✔
414
    this.tmpdirMin = (Object) tmpdirMin;
1✔
415
    this.tmpdirMax = (Object) tmpdirMax;
1✔
416
    this.outdirMin = (Object) outdirMin;
1✔
417
    this.outdirMax = (Object) outdirMax;
1✔
418
    for (String field:__doc.keySet()) {
1✔
419
      if (!attrs.contains(field)) {
1✔
NEW
420
        if (field.contains(":")) {
×
NEW
421
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
422
          extensionFields_.put(expanded_field, __doc.get(field));
×
423
        }
424
      }
425
    }
1✔
426
  }
1✔
427
  private java.util.List<String> attrs = java.util.Arrays.asList("class", "coresMin", "coresMax", "ramMin", "ramMax", "tmpdirMin", "tmpdirMax", "outdirMin", "outdirMax");
1✔
428
}
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