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/gxformat2common#ToolShedRepository</I><br>
012 */
013public class ToolShedRepositoryImpl extends SavableImpl implements ToolShedRepository {
014  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
015  private java.util.Map<String, Object> extensionFields_ = new java.util.HashMap<String, Object>();
016
017  private String name;
018
019  /**
020   * Getter for property
021   * <I>https://galaxyproject.org/gxformat2/gxformat2common#ToolShedRepository/name</I><br>
022   *
023   * <BLOCKQUOTE>
024   *
025   * The name of the tool shed repository this tool can be found in. *
026   *
027   * </BLOCKQUOTE>
028   */
029  public String getName() {
030    return this.name;
031  }
032
033  private String changeset_revision;
034
035  /**
036   * Getter for property
037   * <I>https://galaxyproject.org/gxformat2/gxformat2common#ToolShedRepository/changeset_revision</I>
038   * <br>
039   *
040   * <BLOCKQUOTE>
041   *
042   * The revision of the tool shed repository this tool can be found in. *
043   *
044   * </BLOCKQUOTE>
045   */
046  public String getChangeset_revision() {
047    return this.changeset_revision;
048  }
049
050  private String owner;
051
052  /**
053   * Getter for property
054   * <I>https://galaxyproject.org/gxformat2/gxformat2common#ToolShedRepository/owner</I><br>
055   *
056   * <BLOCKQUOTE>
057   *
058   * The owner of the tool shed repository this tool can be found in. *
059   *
060   * </BLOCKQUOTE>
061   */
062  public String getOwner() {
063    return this.owner;
064  }
065
066  private String tool_shed;
067
068  /**
069   * Getter for property
070   * <I>https://galaxyproject.org/gxformat2/gxformat2common#ToolShedRepository/tool_shed</I><br>
071   *
072   * <BLOCKQUOTE>
073   *
074   * The URI of the tool shed containing the repository this tool can be found in - typically this
075   * should be toolshed.g2.bx.psu.edu. *
076   *
077   * </BLOCKQUOTE>
078   */
079  public String getTool_shed() {
080    return this.tool_shed;
081  }
082
083  /**
084   * Used by {@link org.galaxyproject.gxformat2.v19_09.utils.RootLoader} to construct instances of
085   * ToolShedRepositoryImpl.
086   *
087   * @param __doc_ Document fragment to load this record object from (presumably a {@link
088   *     java.util.Map}).
089   * @param __baseUri_ Base URI to generate child document IDs against.
090   * @param __loadingOptions Context for loading URIs and populating objects.
091   * @param __docRoot_ ID at this position in the document (if available) (maybe?)
092   * @throws ValidationException If the document fragment is not a {@link java.util.Map} or
093   *     validation of fields fails.
094   */
095  public ToolShedRepositoryImpl(
096      final Object __doc_,
097      final String __baseUri_,
098      LoadingOptions __loadingOptions,
099      final String __docRoot_) {
100    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
101    // Prefix plumbing variables with '__' to reduce likelihood of collision with
102    // generated names.
103    String __baseUri = __baseUri_;
104    String __docRoot = __docRoot_;
105    if (!(__doc_ instanceof java.util.Map)) {
106      throw new ValidationException("ToolShedRepositoryImpl called on non-map");
107    }
108    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
109    final java.util.List<ValidationException> __errors =
110        new java.util.ArrayList<ValidationException>();
111    if (__loadingOptions != null) {
112      this.loadingOptions_ = __loadingOptions;
113    }
114    String name;
115
116    if (__doc.containsKey("name")) {
117      try {
118        name =
119            LoaderInstances.uri_StringInstance_True_False_None.loadField(
120                __doc.get("name"), __baseUri, __loadingOptions);
121      } catch (ValidationException e) {
122        name = null; // won't be used but prevents compiler from complaining.
123        final String __message = "the `name` field is not valid because:";
124        __errors.add(new ValidationException(__message, e));
125      }
126
127    } else {
128      name = null;
129    }
130
131    if (name == null) {
132      if (__docRoot != null) {
133        name = __docRoot;
134      } else {
135        throw new ValidationException("Missing name");
136      }
137    }
138    __baseUri = (String) name;
139    String changeset_revision;
140    try {
141      changeset_revision =
142          LoaderInstances.StringInstance.loadField(
143              __doc.get("changeset_revision"), __baseUri, __loadingOptions);
144    } catch (ValidationException e) {
145      changeset_revision = null; // won't be used but prevents compiler from complaining.
146      final String __message = "the `changeset_revision` field is not valid because:";
147      __errors.add(new ValidationException(__message, e));
148    }
149    String owner;
150    try {
151      owner =
152          LoaderInstances.StringInstance.loadField(__doc.get("owner"), __baseUri, __loadingOptions);
153    } catch (ValidationException e) {
154      owner = null; // won't be used but prevents compiler from complaining.
155      final String __message = "the `owner` field is not valid because:";
156      __errors.add(new ValidationException(__message, e));
157    }
158    String tool_shed;
159    try {
160      tool_shed =
161          LoaderInstances.StringInstance.loadField(
162              __doc.get("tool_shed"), __baseUri, __loadingOptions);
163    } catch (ValidationException e) {
164      tool_shed = null; // won't be used but prevents compiler from complaining.
165      final String __message = "the `tool_shed` field is not valid because:";
166      __errors.add(new ValidationException(__message, e));
167    }
168    if (!__errors.isEmpty()) {
169      throw new ValidationException("Trying 'RecordField'", __errors);
170    }
171    this.changeset_revision = (String) changeset_revision;
172    this.name = (String) name;
173    this.owner = (String) owner;
174    this.tool_shed = (String) tool_shed;
175  }
176}