001package org.galaxyproject.gxformat2.v19_09;
002
003import org.galaxyproject.gxformat2.v19_09.utils.LoaderInstances;
004import org.galaxyproject.gxformat2.v19_09.utils.LoadingOptions;
005import org.galaxyproject.gxformat2.v19_09.utils.LoadingOptionsBuilder;
006import org.galaxyproject.gxformat2.v19_09.utils.SavableImpl;
007import org.galaxyproject.gxformat2.v19_09.utils.ValidationException;
008
009/**
010 * Auto-generated class implementation for
011 * <I>https://galaxyproject.org/gxformat2/v19_09#WorkflowOutputParameter</I><br>
012 *
013 * <BLOCKQUOTE>
014 *
015 * Describe an output parameter of a workflow. The parameter must be connected to one parameter
016 * defined in the workflow that will provide the value of the output parameter. It is legal to
017 * connect a WorkflowInputParameter to a WorkflowOutputParameter.
018 *
019 * </BLOCKQUOTE>
020 */
021public class WorkflowOutputParameterImpl extends SavableImpl implements WorkflowOutputParameter {
022  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
023  private java.util.Map<String, Object> extensionFields_ = new java.util.HashMap<String, Object>();
024
025  private java.util.Optional<String> id;
026
027  /**
028   * Getter for property <I>https://w3id.org/cwl/cwl#Identified/id</I><br>
029   *
030   * <BLOCKQUOTE>
031   *
032   * The unique identifier for this object. *
033   *
034   * </BLOCKQUOTE>
035   */
036  public java.util.Optional<String> getId() {
037    return this.id;
038  }
039
040  private Object doc;
041
042  /**
043   * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><br>
044   *
045   * <BLOCKQUOTE>
046   *
047   * A documentation string for this object, or an array of strings which should be concatenated. *
048   *
049   * </BLOCKQUOTE>
050   */
051  public Object getDoc() {
052    return this.doc;
053  }
054
055  private java.util.Optional<String> outputSource;
056
057  /**
058   * Getter for property
059   * <I>https://galaxyproject.org/gxformat2/v19_09#WorkflowOutputParameter/outputSource</I><br>
060   *
061   * <BLOCKQUOTE>
062   *
063   * Specifies workflow parameter that supply the value of to the output parameter. *
064   *
065   * </BLOCKQUOTE>
066   */
067  public java.util.Optional<String> getOutputSource() {
068    return this.outputSource;
069  }
070
071  private java.util.Optional<GalaxyType> type;
072
073  /**
074   * Getter for property <I>https://w3id.org/cwl/salad#type</I><br>
075   *
076   * <BLOCKQUOTE>
077   *
078   * Specify valid types of data that may be assigned to this parameter. *
079   *
080   * </BLOCKQUOTE>
081   */
082  public java.util.Optional<GalaxyType> getType() {
083    return this.type;
084  }
085
086  /**
087   * Used by {@link org.galaxyproject.gxformat2.v19_09.utils.RootLoader} to construct instances of
088   * WorkflowOutputParameterImpl.
089   *
090   * @param __doc_ Document fragment to load this record object from (presumably a {@link
091   *     java.util.Map}).
092   * @param __baseUri_ Base URI to generate child document IDs against.
093   * @param __loadingOptions Context for loading URIs and populating objects.
094   * @param __docRoot_ ID at this position in the document (if available) (maybe?)
095   * @throws ValidationException If the document fragment is not a {@link java.util.Map} or
096   *     validation of fields fails.
097   */
098  public WorkflowOutputParameterImpl(
099      final Object __doc_,
100      final String __baseUri_,
101      LoadingOptions __loadingOptions,
102      final String __docRoot_) {
103    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
104    // Prefix plumbing variables with '__' to reduce likelihood of collision with
105    // generated names.
106    String __baseUri = __baseUri_;
107    String __docRoot = __docRoot_;
108    if (!(__doc_ instanceof java.util.Map)) {
109      throw new ValidationException("WorkflowOutputParameterImpl called on non-map");
110    }
111    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
112    final java.util.List<ValidationException> __errors =
113        new java.util.ArrayList<ValidationException>();
114    if (__loadingOptions != null) {
115      this.loadingOptions_ = __loadingOptions;
116    }
117    java.util.Optional<String> id;
118
119    if (__doc.containsKey("id")) {
120      try {
121        id =
122            LoaderInstances.uri_optional_StringInstance_True_False_None.loadField(
123                __doc.get("id"), __baseUri, __loadingOptions);
124      } catch (ValidationException e) {
125        id = null; // won't be used but prevents compiler from complaining.
126        final String __message = "the `id` field is not valid because:";
127        __errors.add(new ValidationException(__message, e));
128      }
129
130    } else {
131      id = null;
132    }
133
134    if (id == null) {
135      if (__docRoot != null) {
136        id = java.util.Optional.of(__docRoot);
137      } else {
138        id = java.util.Optional.of("_:" + java.util.UUID.randomUUID().toString());
139      }
140    }
141    __baseUri = (String) id.orElse(null);
142    Object doc;
143
144    if (__doc.containsKey("doc")) {
145      try {
146        doc =
147            LoaderInstances.union_of_NullInstance_or_StringInstance_or_array_of_StringInstance
148                .loadField(__doc.get("doc"), __baseUri, __loadingOptions);
149      } catch (ValidationException e) {
150        doc = null; // won't be used but prevents compiler from complaining.
151        final String __message = "the `doc` field is not valid because:";
152        __errors.add(new ValidationException(__message, e));
153      }
154
155    } else {
156      doc = null;
157    }
158    java.util.Optional<String> outputSource;
159
160    if (__doc.containsKey("outputSource")) {
161      try {
162        outputSource =
163            LoaderInstances.optional_StringInstance.loadField(
164                __doc.get("outputSource"), __baseUri, __loadingOptions);
165      } catch (ValidationException e) {
166        outputSource = null; // won't be used but prevents compiler from complaining.
167        final String __message = "the `outputSource` field is not valid because:";
168        __errors.add(new ValidationException(__message, e));
169      }
170
171    } else {
172      outputSource = null;
173    }
174    java.util.Optional<GalaxyType> type;
175
176    if (__doc.containsKey("type")) {
177      try {
178        type =
179            LoaderInstances.typedsl_optional_GalaxyType_2.loadField(
180                __doc.get("type"), __baseUri, __loadingOptions);
181      } catch (ValidationException e) {
182        type = null; // won't be used but prevents compiler from complaining.
183        final String __message = "the `type` field is not valid because:";
184        __errors.add(new ValidationException(__message, e));
185      }
186
187    } else {
188      type = null;
189    }
190    if (!__errors.isEmpty()) {
191      throw new ValidationException("Trying 'RecordField'", __errors);
192    }
193    this.doc = (Object) doc;
194    this.id = (java.util.Optional<String>) id;
195    this.outputSource = (java.util.Optional<String>) outputSource;
196    this.type = (java.util.Optional<GalaxyType>) type;
197  }
198}