• 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

58.54
/src/main/java/org/w3id/cwl/cwl1_2/EnvironmentDefImpl.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#EnvironmentDef</I><BR> <BLOCKQUOTE>
25
 Define an environment variable that will be set in the runtime environment
26
 by the workflow platform when executing the command line tool.  May be the
27
 result of executing an expression, such as getting a parameter from input.
28
  </BLOCKQUOTE>
29
 */
30
public class EnvironmentDefImpl extends SaveableImpl implements EnvironmentDef {
31
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
32
  private java.util.Map<String, Object> extensionFields_ =
1✔
33
      new java.util.HashMap<String, Object>();
34
  public LoadingOptions getLoadingOptions() {
NEW
35
    return this.loadingOptions_;
×
36
  }
37
  public java.util.Map<String, Object> getExtensionFields() {
38
    return this.extensionFields_;
×
39
  }
40

41
  private String envName;
42

43
  /**
44
   * Getter for property <I>https://w3id.org/cwl/cwl#EnvironmentDef/envName</I><BR>
45
   * <BLOCKQUOTE>
46
   * The environment variable name   * </BLOCKQUOTE>
47
   */
48

49
  public String getEnvName() {
50
    return this.envName;
×
51
  }
52

53
  private Object envValue;
54

55
  /**
56
   * Getter for property <I>https://w3id.org/cwl/cwl#EnvironmentDef/envValue</I><BR>
57
   * <BLOCKQUOTE>
58
   * The environment variable value   * </BLOCKQUOTE>
59
   */
60

61
  public Object getEnvValue() {
62
    return this.envValue;
×
63
  }
64

65
  /**
66
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of EnvironmentDefImpl.
67
   *
68
   * @param __doc_            Document fragment to load this record object from (presumably a
69
                              {@link java.util.Map}).
70
   * @param __baseUri_        Base URI to generate child document IDs against.
71
   * @param __loadingOptions  Context for loading URIs and populating objects.
72
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
73
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
74
   *                             or validation of fields fails.
75
   */
76
  public EnvironmentDefImpl(
77
      final Object __doc_,
78
      final String __baseUri_,
79
      LoadingOptions __loadingOptions,
80
      final String __docRoot_) {
81
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
82
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
83
    // generated names.
84
    String __baseUri = __baseUri_;
1✔
85
    String __docRoot = __docRoot_;
1✔
86
    if (!(__doc_ instanceof java.util.Map)) {
1✔
87
      throw new ValidationException("EnvironmentDefImpl called on non-map");
×
88
    }
89
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
90
    final java.util.List<ValidationException> __errors =
1✔
91
        new java.util.ArrayList<ValidationException>();
92
    if (__loadingOptions != null) {
1✔
93
      this.loadingOptions_ = __loadingOptions;
1✔
94
    }
95
    String envName;
96
    try {
97
      envName =
1✔
98
          LoaderInstances
99
              .StringInstance
100
              .loadField(__doc.get("envName"), __baseUri, __loadingOptions);
1✔
101
    } catch (ValidationException e) {
×
102
      envName = null; // won't be used but prevents compiler from complaining.
×
103
      final String __message = "the `envName` field is not valid because:";
×
104
      __errors.add(new ValidationException(__message, e));
×
105
    }
1✔
106
    Object envValue;
107
    try {
108
      envValue =
1✔
109
          LoaderInstances
110
              .union_of_StringInstance_or_ExpressionLoader
111
              .loadField(__doc.get("envValue"), __baseUri, __loadingOptions);
1✔
112
    } catch (ValidationException e) {
×
113
      envValue = null; // won't be used but prevents compiler from complaining.
×
114
      final String __message = "the `envValue` field is not valid because:";
×
115
      __errors.add(new ValidationException(__message, e));
×
116
    }
1✔
117
    if (!__errors.isEmpty()) {
1✔
118
      throw new ValidationException("Trying 'RecordField'", __errors);
×
119
    }
120
    this.envName = (String) envName;
1✔
121
    this.envValue = (Object) envValue;
1✔
122
    for (String field:__doc.keySet()) {
1✔
123
      if (!attrs.contains(field)) {
1✔
NEW
124
        if (field.contains(":")) {
×
NEW
125
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
126
          extensionFields_.put(expanded_field, __doc.get(field));
×
127
        }
128
      }
129
    }
1✔
130
  }
1✔
131
  private java.util.List<String> attrs = java.util.Arrays.asList("envName", "envValue");
1✔
132
}
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