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 <I>https://galaxyproject.org/gxformat2/v19_09#Report</I>
011 * <br>
012 *
013 * <BLOCKQUOTE>
014 *
015 * Definition of an invocation report for this workflow. Currently the only field is 'markdown'.
016 *
017 * </BLOCKQUOTE>
018 */
019public class ReportImpl extends SavableImpl implements Report {
020  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
021  private java.util.Map<String, Object> extensionFields_ = new java.util.HashMap<String, Object>();
022
023  private String markdown;
024
025  /**
026   * Getter for property <I>https://galaxyproject.org/gxformat2/v19_09#Report/markdown</I><br>
027   *
028   * <BLOCKQUOTE>
029   *
030   * Galaxy flavored Markdown to define an invocation report. *
031   *
032   * </BLOCKQUOTE>
033   */
034  public String getMarkdown() {
035    return this.markdown;
036  }
037
038  /**
039   * Used by {@link org.galaxyproject.gxformat2.v19_09.utils.RootLoader} to construct instances of
040   * ReportImpl.
041   *
042   * @param __doc_ Document fragment to load this record object from (presumably a {@link
043   *     java.util.Map}).
044   * @param __baseUri_ Base URI to generate child document IDs against.
045   * @param __loadingOptions Context for loading URIs and populating objects.
046   * @param __docRoot_ ID at this position in the document (if available) (maybe?)
047   * @throws ValidationException If the document fragment is not a {@link java.util.Map} or
048   *     validation of fields fails.
049   */
050  public ReportImpl(
051      final Object __doc_,
052      final String __baseUri_,
053      LoadingOptions __loadingOptions,
054      final String __docRoot_) {
055    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
056    // Prefix plumbing variables with '__' to reduce likelihood of collision with
057    // generated names.
058    String __baseUri = __baseUri_;
059    String __docRoot = __docRoot_;
060    if (!(__doc_ instanceof java.util.Map)) {
061      throw new ValidationException("ReportImpl called on non-map");
062    }
063    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
064    final java.util.List<ValidationException> __errors =
065        new java.util.ArrayList<ValidationException>();
066    if (__loadingOptions != null) {
067      this.loadingOptions_ = __loadingOptions;
068    }
069    String markdown;
070    try {
071      markdown =
072          LoaderInstances.StringInstance.loadField(
073              __doc.get("markdown"), __baseUri, __loadingOptions);
074    } catch (ValidationException e) {
075      markdown = null; // won't be used but prevents compiler from complaining.
076      final String __message = "the `markdown` field is not valid because:";
077      __errors.add(new ValidationException(__message, e));
078    }
079    if (!__errors.isEmpty()) {
080      throw new ValidationException("Trying 'RecordField'", __errors);
081    }
082    this.markdown = (String) markdown;
083  }
084}