001/*
002 * mzTab-M reference implementation and validation API.
003 * This is the mzTab-M reference implementation and validation API service.
004 *
005 * OpenAPI spec version: 2.0.0
006 * Contact: nils.hoffmann@isas.de
007 *
008 * NOTE: This class is auto generated by the swagger code generator program.
009 * https://github.com/swagger-api/swagger-codegen.git
010 * Do not edit the class manually.
011 */
012
013
014package de.isas.mztab2.model;
015
016import java.util.Objects;
017import java.util.Arrays;
018import com.fasterxml.jackson.annotation.JsonProperty;
019import com.fasterxml.jackson.annotation.JsonCreator;
020import com.fasterxml.jackson.annotation.JsonValue;
021import de.isas.mztab2.model.MsRun;
022import de.isas.mztab2.model.Parameter;
023import de.isas.mztab2.model.Sample;
024import io.swagger.annotations.ApiModel;
025import io.swagger.annotations.ApiModelProperty;
026import java.util.ArrayList;
027import java.util.List;
028import com.fasterxml.jackson.dataformat.xml.annotation.*;
029import javax.xml.bind.annotation.*;
030import javax.validation.constraints.*;
031import javax.validation.Valid;
032import de.isas.lipidomics.mztab2.validation.constraints.*;
033/**
034 * 
035 * Specification of assay.
036(empty) name: A name for each assay, to serve as a list of the assays that MUST be reported in the following tables. 
037custom: Additional custom parameters or values for a given assay. 
038external_uri: An external reference uri to further information about the assay, for example via a reference to an object within an ISA-TAB file. 
039sample_ref: An association from a given assay to the sample analysed. 
040ms_run_ref: An association from a given assay to the source MS run. All assays MUST reference exactly one ms_run unless a workflow with pre-fractionation is being encoded, in which case each assay MUST reference n ms_runs where n fractions have been collected. Multiple assays SHOULD reference the same ms_run to capture multiplexed experimental designs.
041
042 * 
043 *
044 * <p>mzTab-M specification example(s):</p>
045 * <pre><code>MTD       assay[1]        first assay
046MTD     assay[1]-custom[1]      [MS, , Assay operator, Fred Blogs]
047MTD     assay[1]-external_uri   https://www.ebi.ac.uk/metabolights/MTBLS517/files/i_Investigation.txt?STUDYASSAY=a_e04_c18pos.txt
048MTD     assay[1]-sample_ref     sample[1]
049MTD     assay[1]-ms_run_ref     ms_run[1]
050</code></pre>
051 * 
052 *
053 */
054@com.fasterxml.jackson.annotation.JsonIdentityInfo(generator = com.fasterxml.jackson.annotation.ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = Assay.class)
055@ApiModel(description = "Specification of assay. (empty) name: A name for each assay, to serve as a list of the assays that MUST be reported in the following tables.  custom: Additional custom parameters or values for a given assay.  external_uri: An external reference uri to further information about the assay, for example via a reference to an object within an ISA-TAB file.  sample_ref: An association from a given assay to the sample analysed.  ms_run_ref: An association from a given assay to the source MS run. All assays MUST reference exactly one ms_run unless a workflow with pre-fractionation is being encoded, in which case each assay MUST reference n ms_runs where n fractions have been collected. Multiple assays SHOULD reference the same ms_run to capture multiplexed experimental designs. ")
056@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2021-01-02T19:25:37.430+01:00")
057@XmlRootElement(name = "Assay")
058@XmlAccessorType(XmlAccessType.FIELD)
059@JacksonXmlRootElement(localName = "Assay")
060public class Assay {
061
062  /**
063   * Property enumeration for Assay.
064   */
065  public static enum Properties {
066      id("id"), 
067      name("name"), 
068      custom("custom"), 
069      externalUri("external_uri"), 
070      sampleRef("sample_ref"), 
071      msRunRef("ms_run_ref");
072
073    private final String propertyName;
074
075    private Properties(String propertyName) {
076      this.propertyName = propertyName;
077    }
078
079    public String getPropertyName() {
080      return propertyName;
081    }
082
083    public String toString() {
084      return propertyName;
085    }
086
087    public String toUpper() {
088      return propertyName.toUpperCase();
089    }
090
091    public static Properties of(String value) {
092      if(value==null) {
093        throw new NullPointerException("Argument value must not be null!");
094      }
095      return Arrays.asList(Properties.values()).stream().filter(m -> m.propertyName.equals(value.toLowerCase())).findAny().orElseThrow(IllegalArgumentException::new);
096    }
097  };
098  
099  @JsonProperty("id")
100  @JacksonXmlProperty(localName = "id")
101  @XmlElement(name = "id")
102  private Integer id = null;
103  @JsonProperty("name")
104  @JacksonXmlProperty(localName = "name")
105  @XmlElement(name = "name")
106  private String name = null;
107  @JsonProperty("custom")
108  // Is a container wrapped=false
109  // items.name=custom items.baseName=custom items.xmlName= items.xmlNamespace=
110  // items.example= items.type=Parameter
111  @XmlElement(name = "custom")
112  private List<Parameter> custom = null;
113  @JsonProperty("external_uri")
114  @JacksonXmlProperty(localName = "external_uri")
115  @XmlElement(name = "external_uri")
116  private String externalUri = null;
117  @JsonProperty("sample_ref")
118  @JacksonXmlProperty(localName = "sample_ref")
119  @XmlElement(name = "sample_ref")
120  private Sample sampleRef = null;
121  @JsonProperty("ms_run_ref")
122  // Is a container wrapped=false
123  // items.name=msRunRef items.baseName=msRunRef items.xmlName= items.xmlNamespace=
124  // items.example= items.type=MsRun
125  @XmlElement(name = "msRunRef")
126  private List<MsRun> msRunRef = new ArrayList<>();
127
128 /**
129   * Builder method for id.
130   *
131   * @see Assay#setId Assay#setId for specification examples
132   * @see Assay#getId Assay#getId for validation constraints
133   * @param id a {@code Integer} parameter.
134   * @return Assay
135  **/
136  public Assay id(Integer id) {
137   this.id = id;
138   return this;
139  }
140
141   /**
142   * <p>Get id.</p>
143   *
144   * <p>Minimum: 1</p>
145   * @return id
146  **/
147 @Min(1)  @ApiModelProperty(value = "")
148  public Integer getId() {
149    return id;
150  }
151
152 /**
153   * Set id.
154   *
155   * 
156   * 
157   * @see #getId Assay#getId for validation constraints
158   * @param id a {@code Integer} parameter.
159  **/
160  public void setId(Integer id) {
161    this.id = id;
162  }
163
164
165 /**
166   * Builder method for name.
167   *
168   * @see Assay#setName Assay#setName for specification examples
169   * @see Assay#getName Assay#getName for validation constraints
170   * @param name a {@code String} parameter.
171   * @return Assay
172  **/
173  public Assay name(String name) {
174   this.name = name;
175   return this;
176  }
177
178   /**
179   * The assay name.
180   *
181   * @return name
182  **/
183  @NotNull
184  @ApiModelProperty(required = true, value = "The assay name.")
185  public String getName() {
186    return name;
187  }
188
189 /**
190   * Set name.
191   *
192   * 
193   * 
194   * @see #getName Assay#getName for validation constraints
195   * @param name a {@code String} parameter.
196  **/
197  public void setName(String name) {
198    this.name = name;
199  }
200
201
202 /**
203   * Builder method for custom.
204   *
205   * @see Assay#setCustom Assay#setCustom for specification examples
206   * @see Assay#getCustom Assay#getCustom for validation constraints
207   * @param custom a {@code List<Parameter>} parameter.
208   * @return Assay
209  **/
210  public Assay custom(List<Parameter> custom) {
211   this.custom = custom;
212   return this;
213  }
214
215  /**
216   * Add a single customItem to the custom collection.
217   *
218   * @see Assay#getCustom Assay#getCustom for validation constraints
219   * @param customItem a {@code Parameter} parameter.
220   * @return Assay
221   */
222  public Assay addCustomItem(Parameter customItem) {
223    if (this.custom == null) {
224      this.custom = new ArrayList<>();
225    }
226    this.custom.add(customItem);
227    return this;
228  }
229
230   /**
231   * Additional user or cv parameters.
232   *
233   * @return custom
234  **/
235  @Valid
236  @ApiModelProperty(value = "Additional user or cv parameters.")
237  public List<Parameter> getCustom() {
238    return custom;
239  }
240
241 /**
242   * Set custom.
243   *
244   * 
245   * 
246   * @see #getCustom Assay#getCustom for validation constraints
247   * @param custom a {@code List<Parameter>} parameter.
248  **/
249  public void setCustom(List<Parameter> custom) {
250    this.custom = custom;
251  }
252
253
254 /**
255   * Builder method for externalUri.
256   *
257   * @see Assay#setExternalUri Assay#setExternalUri for specification examples
258   * @see Assay#getExternalUri Assay#getExternalUri for validation constraints
259   * @param externalUri a {@code String} parameter.
260   * @return Assay
261  **/
262  public Assay externalUri(String externalUri) {
263   this.externalUri = externalUri;
264   return this;
265  }
266
267   /**
268   * An external URI to further information about this assay.
269   *
270   * @return externalUri
271  **/
272  @ApiModelProperty(value = "An external URI to further information about this assay.")
273  public String getExternalUri() {
274    return externalUri;
275  }
276
277 /**
278   * Set externalUri.
279   *
280   * 
281   * 
282   * @see #getExternalUri Assay#getExternalUri for validation constraints
283   * @param externalUri a {@code String} parameter.
284  **/
285  public void setExternalUri(String externalUri) {
286    this.externalUri = externalUri;
287  }
288
289
290 /**
291   * Builder method for sampleRef.
292   *
293   * @see Assay#setSampleRef Assay#setSampleRef for specification examples
294   * @see Assay#getSampleRef Assay#getSampleRef for validation constraints
295   * @param sampleRef a {@code Sample} parameter.
296   * @return Assay
297  **/
298  public Assay sampleRef(Sample sampleRef) {
299   this.sampleRef = sampleRef;
300   return this;
301  }
302
303   /**
304   * The sample referenced by this assay.
305   *
306   * @return sampleRef
307  **/
308  @Valid
309  @ApiModelProperty(value = "The sample referenced by this assay.")
310  public Sample getSampleRef() {
311    return sampleRef;
312  }
313
314 /**
315   * Set sampleRef.
316   *
317   * 
318   * 
319   * @see #getSampleRef Assay#getSampleRef for validation constraints
320   * @param sampleRef a {@code Sample} parameter.
321  **/
322  public void setSampleRef(Sample sampleRef) {
323    this.sampleRef = sampleRef;
324  }
325
326
327 /**
328   * Builder method for msRunRef.
329   *
330   * @see Assay#setMsRunRef Assay#setMsRunRef for specification examples
331   * @see Assay#getMsRunRef Assay#getMsRunRef for validation constraints
332   * @param msRunRef a {@code List<MsRun>} parameter.
333   * @return Assay
334  **/
335  public Assay msRunRef(List<MsRun> msRunRef) {
336   this.msRunRef = msRunRef;
337   return this;
338  }
339
340  /**
341   * Add a single msRunRefItem to the msRunRef collection.
342   *
343   * @see Assay#getMsRunRef Assay#getMsRunRef for validation constraints
344   * @param msRunRefItem a {@code MsRun} parameter.
345   * @return Assay
346   */
347  public Assay addMsRunRefItem(MsRun msRunRefItem) {
348    this.msRunRef.add(msRunRefItem);
349    return this;
350  }
351
352   /**
353   * The ms run(s) referenced by this assay.
354   *
355   * @return msRunRef
356  **/
357  @NotNull
358  @Valid
359 @Size(min=1)  @ApiModelProperty(required = true, value = "The ms run(s) referenced by this assay.")
360  public List<MsRun> getMsRunRef() {
361    return msRunRef;
362  }
363
364 /**
365   * Set msRunRef.
366   *
367   * 
368   * 
369   * @see #getMsRunRef Assay#getMsRunRef for validation constraints
370   * @param msRunRef a {@code List<MsRun>} parameter.
371  **/
372  public void setMsRunRef(List<MsRun> msRunRef) {
373    this.msRunRef = msRunRef;
374  }
375
376
377  @Override
378  public boolean equals(java.lang.Object o) {
379    if (this == o) {
380      return true;
381    }
382    if (o == null || getClass() != o.getClass()) {
383      return false;
384    }
385    Assay assay = (Assay) o;
386    return Objects.equals(this.id, assay.id) &&
387        Objects.equals(this.name, assay.name) &&
388        Objects.equals(this.custom, assay.custom) &&
389        Objects.equals(this.externalUri, assay.externalUri) &&
390        Objects.equals(this.sampleRef, assay.sampleRef) &&
391        Objects.equals(this.msRunRef, assay.msRunRef);
392  }
393
394  @Override
395  public int hashCode() {
396    return Objects.hash(id, name, custom, externalUri, sampleRef, msRunRef);
397  }
398
399
400  @Override
401  public String toString() {
402    StringBuilder sb = new StringBuilder();
403    sb.append("class Assay {\n");
404    
405    sb.append("    id: ").append(toIndentedString(id)).append("\n");
406    sb.append("    name: ").append(toIndentedString(name)).append("\n");
407    sb.append("    custom: ").append(toIndentedString(custom)).append("\n");
408    sb.append("    externalUri: ").append(toIndentedString(externalUri)).append("\n");
409    sb.append("    sampleRef: ").append(toIndentedString(sampleRef)).append("\n");
410    sb.append("    msRunRef: ").append(toIndentedString(msRunRef)).append("\n");
411    sb.append("}");
412    return sb.toString();
413  }
414
415  /**
416   * Convert the given object to string with each line indented by 4 spaces
417   * (except the first line).
418   */
419  private String toIndentedString(java.lang.Object o) {
420    if (o == null) {
421      return "null";
422    }
423    return o.toString().replace("\n", "\n    ");
424  }
425
426}
427