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.PublicationItem;
023import io.swagger.annotations.ApiModel;
024import io.swagger.annotations.ApiModelProperty;
025import java.util.ArrayList;
026import java.util.List;
027import com.fasterxml.jackson.dataformat.xml.annotation.*;
028import javax.xml.bind.annotation.*;
029import javax.validation.constraints.*;
030import javax.validation.Valid;
031import de.isas.lipidomics.mztab2.validation.constraints.*;
032/**
033 * 
034 * A publication associated with this file. Several publications can be given by indicating the number in the square brackets after “publication”. PubMed ids must be prefixed by “pubmed:”, DOIs by “doi:”. Multiple identifiers MUST be separated by “|”.
035
036 * 
037 *
038 * <p>mzTab-M specification example(s):</p>
039 * <pre><code>MTD       publication[1]  pubmed:21063943|doi:10.1007/978-1-60761-987-1_6
040MTD     publication[2]  pubmed:20615486|doi:10.1016/j.jprot.2010.06.008
041</code></pre>
042 * 
043 *
044 */
045@ApiModel(description = "A publication associated with this file. Several publications can be given by indicating the number in the square brackets after “publication”. PubMed ids must be prefixed by “pubmed:”, DOIs by “doi:”. Multiple identifiers MUST be separated by “|”. ")
046@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-02-11T15:12:05.057+01:00")
047@XmlRootElement(name = "Publication")
048@XmlAccessorType(XmlAccessType.FIELD)
049@JacksonXmlRootElement(localName = "Publication")
050public class Publication extends IndexedElement {
051
052  /**
053   * Property enumeration for Publication.
054   */
055  public static enum Properties {
056      publicationItems("publicationItems");
057
058    private final String propertyName;
059
060    private Properties(String propertyName) {
061      this.propertyName = propertyName;
062    }
063
064    public String getPropertyName() {
065      return propertyName;
066    }
067
068    public String toString() {
069      return propertyName;
070    }
071
072    public String toUpper() {
073      return propertyName.toUpperCase();
074    }
075
076    public static Properties of(String value) {
077      if(value==null) {
078        throw new NullPointerException("Argument value must not be null!");
079      }
080      return Arrays.asList(Properties.values()).stream().filter(m -> m.propertyName.equals(value.toLowerCase())).findAny().orElseThrow(IllegalArgumentException::new);
081    }
082  };
083  
084  @JsonProperty("publicationItems")
085  // Is a container wrapped=false
086  // items.name=publicationItems items.baseName=publicationItems items.xmlName= items.xmlNamespace=
087  // items.example= items.type=PublicationItem
088  @XmlElement(name = "publicationItems")
089  private List<PublicationItem> publicationItems = new ArrayList<>();
090  
091  @Override
092  public Publication id(Integer id) {
093   super.setId(id);
094   return this;
095  }
096  
097  @Override
098  public Publication elementType(String elementType) {
099   super.setElementType(elementType);
100   return this;
101  }
102
103 /**
104   * Builder method for publicationItems.
105   *
106   * @see Publication#setPublicationItems Publication#setPublicationItems for specification examples
107   * @see Publication#getPublicationItems Publication#getPublicationItems for validation constraints
108   * @param publicationItems a {@code List<PublicationItem>} parameter.
109   * @return Publication
110  **/
111  public Publication publicationItems(List<PublicationItem> publicationItems) {
112   this.publicationItems = publicationItems;
113   return this;
114  }
115
116  /**
117   * Add a single publicationItemsItem to the publicationItems collection.
118   *
119   * @see Publication#getPublicationItems Publication#getPublicationItems for validation constraints
120   * @param publicationItemsItem a {@code PublicationItem} parameter.
121   * @return Publication
122   */
123  public Publication addPublicationItemsItem(PublicationItem publicationItemsItem) {
124    this.publicationItems.add(publicationItemsItem);
125    return this;
126  }
127
128   /**
129   * The publication item ids referenced by this publication.
130   *
131   * @return publicationItems
132  **/
133  @NotNull
134  @Valid
135  @ApiModelProperty(required = true, value = "The publication item ids referenced by this publication.")
136  public List<PublicationItem> getPublicationItems() {
137    return publicationItems;
138  }
139
140 /**
141   * Set publicationItems.
142   *
143   * 
144   * 
145   * @see #getPublicationItems Publication#getPublicationItems for validation constraints
146   * @param publicationItems a {@code List<PublicationItem>} parameter.
147  **/
148  public void setPublicationItems(List<PublicationItem> publicationItems) {
149    this.publicationItems = publicationItems;
150  }
151
152
153  @Override
154  public boolean equals(java.lang.Object o) {
155    if (this == o) {
156      return true;
157    }
158    if (o == null || getClass() != o.getClass()) {
159      return false;
160    }
161    Publication publication = (Publication) o;
162    return Objects.equals(this.publicationItems, publication.publicationItems) &&
163        super.equals(o);
164  }
165
166  @Override
167  public int hashCode() {
168    return Objects.hash(publicationItems, super.hashCode());
169  }
170
171
172  @Override
173  public String toString() {
174    StringBuilder sb = new StringBuilder();
175    sb.append("class Publication {\n");
176    sb.append("    ").append(toIndentedString(super.toString())).append("\n");
177    sb.append("    publicationItems: ").append(toIndentedString(publicationItems)).append("\n");
178    sb.append("}");
179    return sb.toString();
180  }
181
182  /**
183   * Convert the given object to string with each line indented by 4 spaces
184   * (except the first line).
185   */
186  private String toIndentedString(java.lang.Object o) {
187    if (o == null) {
188      return "null";
189    }
190    return o.toString().replace("\n", "\n    ");
191  }
192
193}
194