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.IndexedElement;
022import de.isas.mztab2.model.MsRun;
023import de.isas.mztab2.model.Parameter;
024import de.isas.mztab2.model.Sample;
025import io.swagger.annotations.ApiModel;
026import io.swagger.annotations.ApiModelProperty;
027import java.util.ArrayList;
028import java.util.List;
029import com.fasterxml.jackson.dataformat.xml.annotation.*;
030import javax.xml.bind.annotation.*;
031import javax.validation.constraints.*;
032import javax.validation.Valid;
033import de.isas.lipidomics.mztab2.validation.constraints.*;
034/**
035 * 
036 * Specification of assay.
037(empty) name: A name for each assay, to serve as a list of the assays that MUST be reported in the following tables. 
038custom: Additional custom parameters or values for a given assay. 
039external_uri: An external reference uri to further information about the assay, for example via a reference to an object within an ISA-TAB file. 
040sample_ref: An association from a given assay to the sample analysed. 
041ms_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.      
042
043 * 
044 *
045 * 
046 *
047 */
048@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.       ")
049@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-08-07T11:09:24.487+02:00")
050@XmlRootElement(name = "Assay")
051@XmlAccessorType(XmlAccessType.FIELD)
052@JacksonXmlRootElement(localName = "Assay")
053public class Assay extends IndexedElement {
054
055  /**
056   * Property enumeration for Assay.
057   */
058  public static enum Properties {
059      name("name"), 
060      custom("custom"), 
061      externalUri("external_uri"), 
062      sampleRef("sample_ref"), 
063      msRunRef("ms_run_ref");
064
065    private final String propertyName;
066
067    private Properties(String propertyName) {
068      this.propertyName = propertyName;
069    }
070
071    public String getPropertyName() {
072      return propertyName;
073    }
074
075    public String toString() {
076      return propertyName;
077    }
078
079    public String toUpper() {
080      return propertyName.toUpperCase();
081    }
082
083    public static Properties of(String value) {
084      if(value==null) {
085        throw new NullPointerException("Argument value must not be null!");
086      }
087      return Arrays.asList(Properties.values()).stream().filter(m -> m.propertyName.equals(value.toLowerCase())).findAny().orElseThrow(IllegalArgumentException::new);
088    }
089  };
090  
091  @JsonProperty("name")
092  @JacksonXmlProperty(localName = "name")
093  @XmlElement(name = "name")
094  private String name = null;
095  @JsonProperty("custom")
096  // Is a container wrapped=false
097  // items.name=custom items.baseName=custom items.xmlName= items.xmlNamespace=
098  // items.example= items.type=Parameter
099  @XmlElement(name = "custom")
100  private List<Parameter> custom = null;
101  @JsonProperty("external_uri")
102  @JacksonXmlProperty(localName = "external_uri")
103  @XmlElement(name = "external_uri")
104  private String externalUri = null;
105  @JsonProperty("sample_ref")
106  @JacksonXmlProperty(localName = "sample_ref")
107  @XmlElement(name = "sample_ref")
108  private Sample sampleRef = null;
109  @JsonProperty("ms_run_ref")
110  // Is a container wrapped=false
111  // items.name=msRunRef items.baseName=msRunRef items.xmlName= items.xmlNamespace=
112  // items.example= items.type=MsRun
113  @XmlElement(name = "msRunRef")
114  private List<MsRun> msRunRef = new ArrayList<>();
115  
116  @Override
117  public Assay id(Integer id) {
118   super.setId(id);
119   return this;
120  }
121  
122  @Override
123  public Assay elementType(String elementType) {
124   super.setElementType(elementType);
125   return this;
126  }
127
128 /**
129   * Builder method for name.
130   *
131   * @see Assay#setName Assay#setName for specification examples
132   * @see Assay#getName Assay#getName for validation constraints
133   * @param name a {@code String} parameter.
134   * @return Assay
135  **/
136  public Assay name(String name) {
137   this.name = name;
138   return this;
139  }
140
141   /**
142   * The assay name.
143   *
144   * @return name
145  **/
146  @NotNull
147  @ApiModelProperty(required = true, value = "The assay name.")
148  public String getName() {
149    return name;
150  }
151
152 /**
153   * Set name.
154   *
155   * 
156   * 
157   * @see #getName Assay#getName for validation constraints
158   * @param name a {@code String} parameter.
159  **/
160  public void setName(String name) {
161    this.name = name;
162  }
163
164
165 /**
166   * Builder method for custom.
167   *
168   * @see Assay#setCustom Assay#setCustom for specification examples
169   * @see Assay#getCustom Assay#getCustom for validation constraints
170   * @param custom a {@code List<Parameter>} parameter.
171   * @return Assay
172  **/
173  public Assay custom(List<Parameter> custom) {
174   this.custom = custom;
175   return this;
176  }
177
178  /**
179   * Add a single customItem to the custom collection.
180   *
181   * @see Assay#getCustom Assay#getCustom for validation constraints
182   * @param customItem a {@code Parameter} parameter.
183   * @return Assay
184   */
185  public Assay addCustomItem(Parameter customItem) {
186    if (this.custom == null) {
187      this.custom = new ArrayList<>();
188    }
189    this.custom.add(customItem);
190    return this;
191  }
192
193   /**
194   * Additional user or cv parameters.
195   *
196   * @return custom
197  **/
198  @Valid
199  @ApiModelProperty(value = "Additional user or cv parameters.")
200  public List<Parameter> getCustom() {
201    return custom;
202  }
203
204 /**
205   * Set custom.
206   *
207   * 
208   * 
209   * @see #getCustom Assay#getCustom for validation constraints
210   * @param custom a {@code List<Parameter>} parameter.
211  **/
212  public void setCustom(List<Parameter> custom) {
213    this.custom = custom;
214  }
215
216
217 /**
218   * Builder method for externalUri.
219   *
220   * @see Assay#setExternalUri Assay#setExternalUri for specification examples
221   * @see Assay#getExternalUri Assay#getExternalUri for validation constraints
222   * @param externalUri a {@code String} parameter.
223   * @return Assay
224  **/
225  public Assay externalUri(String externalUri) {
226   this.externalUri = externalUri;
227   return this;
228  }
229
230   /**
231   * An external URI to further information about this assay.
232   *
233   * @return externalUri
234  **/
235  @ApiModelProperty(value = "An external URI to further information about this assay.")
236  public String getExternalUri() {
237    return externalUri;
238  }
239
240 /**
241   * Set externalUri.
242   *
243   * 
244   * 
245   * @see #getExternalUri Assay#getExternalUri for validation constraints
246   * @param externalUri a {@code String} parameter.
247  **/
248  public void setExternalUri(String externalUri) {
249    this.externalUri = externalUri;
250  }
251
252
253 /**
254   * Builder method for sampleRef.
255   *
256   * @see Assay#setSampleRef Assay#setSampleRef for specification examples
257   * @see Assay#getSampleRef Assay#getSampleRef for validation constraints
258   * @param sampleRef a {@code Sample} parameter.
259   * @return Assay
260  **/
261  public Assay sampleRef(Sample sampleRef) {
262   this.sampleRef = sampleRef;
263   return this;
264  }
265
266   /**
267   * The sample referenced by this assay.
268   *
269   * @return sampleRef
270  **/
271  @Valid
272  @ApiModelProperty(value = "The sample referenced by this assay.")
273  public Sample getSampleRef() {
274    return sampleRef;
275  }
276
277 /**
278   * Set sampleRef.
279   *
280   * 
281   * 
282   * @see #getSampleRef Assay#getSampleRef for validation constraints
283   * @param sampleRef a {@code Sample} parameter.
284  **/
285  public void setSampleRef(Sample sampleRef) {
286    this.sampleRef = sampleRef;
287  }
288
289
290 /**
291   * Builder method for msRunRef.
292   *
293   * @see Assay#setMsRunRef Assay#setMsRunRef for specification examples
294   * @see Assay#getMsRunRef Assay#getMsRunRef for validation constraints
295   * @param msRunRef a {@code List<MsRun>} parameter.
296   * @return Assay
297  **/
298  public Assay msRunRef(List<MsRun> msRunRef) {
299   this.msRunRef = msRunRef;
300   return this;
301  }
302
303  /**
304   * Add a single msRunRefItem to the msRunRef collection.
305   *
306   * @see Assay#getMsRunRef Assay#getMsRunRef for validation constraints
307   * @param msRunRefItem a {@code MsRun} parameter.
308   * @return Assay
309   */
310  public Assay addMsRunRefItem(MsRun msRunRefItem) {
311    this.msRunRef.add(msRunRefItem);
312    return this;
313  }
314
315   /**
316   * The ms run(s) referenced by this assay.
317   *
318   * @return msRunRef
319  **/
320  @NotNull
321  @Valid
322 @Size(min=1)  @ApiModelProperty(required = true, value = "The ms run(s) referenced by this assay.")
323  public List<MsRun> getMsRunRef() {
324    return msRunRef;
325  }
326
327 /**
328   * Set msRunRef.
329   *
330   * 
331   * 
332   * @see #getMsRunRef Assay#getMsRunRef for validation constraints
333   * @param msRunRef a {@code List<MsRun>} parameter.
334  **/
335  public void setMsRunRef(List<MsRun> msRunRef) {
336    this.msRunRef = msRunRef;
337  }
338
339
340  @Override
341  public boolean equals(java.lang.Object o) {
342    if (this == o) {
343      return true;
344    }
345    if (o == null || getClass() != o.getClass()) {
346      return false;
347    }
348    Assay assay = (Assay) o;
349    return Objects.equals(this.name, assay.name) &&
350        Objects.equals(this.custom, assay.custom) &&
351        Objects.equals(this.externalUri, assay.externalUri) &&
352        Objects.equals(this.sampleRef, assay.sampleRef) &&
353        Objects.equals(this.msRunRef, assay.msRunRef) &&
354        super.equals(o);
355  }
356
357  @Override
358  public int hashCode() {
359    return Objects.hash(name, custom, externalUri, sampleRef, msRunRef, super.hashCode());
360  }
361
362
363  @Override
364  public String toString() {
365    StringBuilder sb = new StringBuilder();
366    sb.append("class Assay {\n");
367    sb.append("    ").append(toIndentedString(super.toString())).append("\n");
368    sb.append("    name: ").append(toIndentedString(name)).append("\n");
369    sb.append("    custom: ").append(toIndentedString(custom)).append("\n");
370    sb.append("    externalUri: ").append(toIndentedString(externalUri)).append("\n");
371    sb.append("    sampleRef: ").append(toIndentedString(sampleRef)).append("\n");
372    sb.append("    msRunRef: ").append(toIndentedString(msRunRef)).append("\n");
373    sb.append("}");
374    return sb.toString();
375  }
376
377  /**
378   * Convert the given object to string with each line indented by 4 spaces
379   * (except the first line).
380   */
381  private String toIndentedString(java.lang.Object o) {
382    if (o == null) {
383      return "null";
384    }
385    return o.toString().replace("\n", "\n    ");
386  }
387
388}
389