• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

common-workflow-language / cwljava / #423

17 Dec 2025 10:33AM UTC coverage: 56.982% (-1.0%) from 57.972%
#423

push

github

web-flow
refresh 2025-12 (including extensions) (#218)

* "id" is a required field in for Parameters and WorkflowSteps
* regen; drop CommandLineBindableImpl; add optional CWL extensions

185 of 577 new or added lines in 21 files covered. (32.06%)

10 existing lines in 10 files now uncovered.

7892 of 13850 relevant lines covered (56.98%)

0.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.54
/src/main/java/org/commonwl/cwlsdk/cwl1_2/LoopImpl.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.commonwl.cwlsdk.cwl1_2;
16

17
import org.commonwl.cwlsdk.cwl1_2.utils.LoaderInstances;
18
import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptions;
19
import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptionsBuilder;
20
import org.commonwl.cwlsdk.cwl1_2.utils.SaveableImpl;
21
import org.commonwl.cwlsdk.cwl1_2.utils.ValidationException;
22

23
/**
24
* Auto-generated class implementation for <I>http://commonwl.org/cwltool#Loop</I><BR> <BLOCKQUOTE>
25
 Prototype to enable workflow-level looping of a step.
26
 
27
 Valid only under `requirements` of a https://www.commonwl.org/v1.2/Workflow.html#WorkflowStep.
28
 Unlike other CWL requirements, Loop requirement is not propagated to inner steps.
29
 
30
 `loopWhen` is an expansion of the CWL v1.2 `when` construct which controls
31
 conditional execution.
32
 
33
 Using `loopWhen` and `when` for the same step will produce an error.
34
 
35
 `loopWhen` is not compatible with `scatter` at this time and combining the
36
 two in the same step will produce an error.
37
  </BLOCKQUOTE>
38
 */
39
public class LoopImpl extends SaveableImpl implements Loop {
40
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
41
  private java.util.Map<String, Object> extensionFields_ =
1✔
42
      new java.util.HashMap<String, Object>();
43
  public LoadingOptions getLoadingOptions() {
NEW
44
    return this.loadingOptions_;
×
45
  }
46
  public java.util.Map<String, Object> getExtensionFields() {
NEW
47
    return this.extensionFields_;
×
48
  }
49

50
  private String class_;
51

52
  /**
53
   * Getter for property <I>http://commonwl.org/cwltool#Loop/class</I><BR>
54
   * <BLOCKQUOTE>
55
   * cwltool:Loop   * </BLOCKQUOTE>
56
   */
57

58
  public String getClass_() {
NEW
59
    return this.class_;
×
60
  }
61

62
  private java.util.List<Object> loop;
63

64
  /**
65
   * Getter for property <I>http://commonwl.org/cwltool#loop</I><BR>
66
   * <BLOCKQUOTE>
67
   * Defines the input parameters of the loop iterations after the first one
68
   * (inputs of the first iteration are the step input parameters). If no
69
   * `loop` rule is specified for a given step `in` field, the initial value
70
   * is kept constant among all iterations.
71
   *    * </BLOCKQUOTE>
72
   */
73

74
  public java.util.List<Object> getLoop() {
NEW
75
    return this.loop;
×
76
  }
77

78
  private String loopWhen;
79

80
  /**
81
   * Getter for property <I>http://commonwl.org/cwltool#Loop/loopWhen</I><BR>
82
   * <BLOCKQUOTE>
83
   * Only run the step while the expression evaluates to `true`.
84
   * If `false` and no iteration has been performed, the step is skipped.
85
   * 
86
   * A skipped step produces a `null` on each output.
87
   * 
88
   * The `inputs` value in the expression must be the step input object.
89
   * 
90
   * It is an error if this expression returns a value other than `true` or `false`.
91
   *    * </BLOCKQUOTE>
92
   */
93

94
  public String getLoopWhen() {
NEW
95
    return this.loopWhen;
×
96
  }
97

98
  private LoopOutputModes outputMethod;
99

100
  /**
101
   * Getter for property <I>http://commonwl.org/cwltool#Loop/outputMethod</I><BR>
102
   * <BLOCKQUOTE>
103
   * - Specify the desired method of dealing with loop outputs
104
   * - Default. Propagates only the last computed element to the subsequent steps when the loop terminates.
105
   * - Propagates a single array with all output values to the subsequent steps when the loop terminates.
106
   *    * </BLOCKQUOTE>
107
   */
108

109
  public LoopOutputModes getOutputMethod() {
NEW
110
    return this.outputMethod;
×
111
  }
112

113
  /**
114
   * Used by {@link org.commonwl.cwlsdk.cwl1_2.utils.RootLoader} to construct instances of LoopImpl.
115
   *
116
   * @param __doc_            Document fragment to load this record object from (presumably a
117
                              {@link java.util.Map}).
118
   * @param __baseUri_        Base URI to generate child document IDs against.
119
   * @param __loadingOptions  Context for loading URIs and populating objects.
120
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
121
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
122
   *                             or validation of fields fails.
123
   */
124
  public LoopImpl(
125
      final Object __doc_,
126
      final String __baseUri_,
127
      LoadingOptions __loadingOptions,
128
      final String __docRoot_) {
129
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
130
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
131
    // generated names.
132
    String __baseUri = __baseUri_;
1✔
133
    String __docRoot = __docRoot_;
1✔
134
    if (!(__doc_ instanceof java.util.Map)) {
1✔
NEW
135
      throw new ValidationException("LoopImpl called on non-map");
×
136
    }
137
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
138
    final java.util.List<ValidationException> __errors =
1✔
139
        new java.util.ArrayList<ValidationException>();
140
    if (__loadingOptions != null) {
1✔
141
      this.loadingOptions_ = __loadingOptions;
1✔
142
    }
143
    String class_;
144
    try {
145
      class_ =
1✔
146
          LoaderInstances
147
              .uri_StringInstance_False_True_None_None
148
              .loadField(__doc.get("class"), __baseUri, __loadingOptions);
1✔
NEW
149
    } catch (ValidationException e) {
×
NEW
150
      class_ = null; // won't be used but prevents compiler from complaining.
×
NEW
151
      final String __message = "the `class` field is not valid because:";
×
NEW
152
      __errors.add(new ValidationException(__message, e));
×
153
    }
1✔
154
    java.util.List<Object> loop;
155
    try {
156
      loop =
1✔
157
          LoaderInstances
158
              .idmap_loop_array_of_LoopInput
NEW
159
              .loadField(__doc.get("loop"), __baseUri, __loadingOptions);
×
160
    } catch (ValidationException e) {
1✔
161
      loop = null; // won't be used but prevents compiler from complaining.
1✔
162
      final String __message = "the `loop` field is not valid because:";
1✔
163
      __errors.add(new ValidationException(__message, e));
1✔
NEW
164
    }
×
165
    String loopWhen;
166
    try {
167
      loopWhen =
1✔
168
          LoaderInstances
169
              .ExpressionLoader
NEW
170
              .loadField(__doc.get("loopWhen"), __baseUri, __loadingOptions);
×
171
    } catch (ValidationException e) {
1✔
172
      loopWhen = null; // won't be used but prevents compiler from complaining.
1✔
173
      final String __message = "the `loopWhen` field is not valid because:";
1✔
174
      __errors.add(new ValidationException(__message, e));
1✔
NEW
175
    }
×
176
    LoopOutputModes outputMethod;
177
    try {
178
      outputMethod =
1✔
179
          LoaderInstances
180
              .LoopOutputModes
NEW
181
              .loadField(__doc.get("outputMethod"), __baseUri, __loadingOptions);
×
182
    } catch (ValidationException e) {
1✔
183
      outputMethod = null; // won't be used but prevents compiler from complaining.
1✔
184
      final String __message = "the `outputMethod` field is not valid because:";
1✔
185
      __errors.add(new ValidationException(__message, e));
1✔
NEW
186
    }
×
187
    if (!__errors.isEmpty()) {
1✔
188
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
189
    }
NEW
190
    this.class_ = (String) class_;
×
NEW
191
    this.loop = (java.util.List<Object>) loop;
×
NEW
192
    this.loopWhen = (String) loopWhen;
×
NEW
193
    this.outputMethod = (LoopOutputModes) outputMethod;
×
NEW
194
    for (String field:__doc.keySet()) {
×
NEW
195
      if (!attrs.contains(field)) {
×
NEW
196
        if (field.contains(":")) {
×
NEW
197
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
198
          extensionFields_.put(expanded_field, __doc.get(field));
×
199
        }
200
      }
NEW
201
    }
×
NEW
202
  }
×
203
  private java.util.List<String> attrs = java.util.Arrays.asList("class", "loop", "loopWhen", "outputMethod");
1✔
204
}
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

© 2025 Coveralls, Inc