001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014package org.gbif.api.model.checklistbank; 015 016import java.util.Objects; 017import java.util.StringJoiner; 018 019import javax.annotation.Nullable; 020 021import io.swagger.v3.oas.annotations.media.Schema; 022 023/** 024 * SpeciesProfile Model Object represents a species profile which describes basic species characteristics. 025 * 026 * @see <a href="http://rs.gbif.org/terms/1.0/SpeciesProfile">Species Profile Extension Definition</a> 027 */ 028@SuppressWarnings("unused") 029public class SpeciesProfile implements NameUsageExtension { 030 031 private Integer taxonKey; 032 private String livingPeriod; 033 private String lifeForm; 034 private String habitat; 035 private Boolean marine; 036 private Boolean freshwater; 037 private Boolean terrestrial; 038 private Boolean extinct; 039 private Boolean hybrid; 040 private Integer ageInDays; 041 private Integer sizeInMillimeter; 042 private Integer massInGram; 043 private String source; 044 private Integer sourceTaxonKey; 045 046 /** 047 * The name usage "taxon" key this species profile belongs to. 048 */ 049 @Schema(description = "The name usage “taxon“ key to which this species profile belongs.") 050 @Override 051 public Integer getTaxonKey() { 052 return taxonKey; 053 } 054 055 @Override 056 public void setTaxonKey(Integer taxonKey) { 057 this.taxonKey = taxonKey; 058 } 059 060 /** 061 * Maximum observed age of an organism given as number of days. 062 * <blockquote> 063 * <p> 064 * <i>Example:</i> 5. 065 * </p> 066 * </blockquote> 067 * 068 * @return the ageInDays 069 */ 070 @Schema(description = "Maximum observed age of an organism given as number of days.") 071 @Nullable 072 public Integer getAgeInDays() { 073 return ageInDays; 074 } 075 076 /** 077 * @param ageInDays the ageInDays to set 078 */ 079 public void setAgeInDays(Integer ageInDays) { 080 this.ageInDays = ageInDays; 081 } 082 083 /** 084 * A Boolean flag indicating whether the taxon is a freshwater organism. 085 * 086 * @return freshwater flag 087 */ 088 @Schema(description = "Flag indicating whether the taxon is a freshwater organism.") 089 @Nullable 090 public Boolean isFreshwater() { 091 return freshwater; 092 } 093 094 public void setFreshwater(Boolean freshwater) { 095 this.freshwater = freshwater; 096 } 097 098 /** 099 * Comma separated list of mayor habitat classification as defined by IUCN in which a species is known to exist: 100 * <a href="https://rs.gbif.org/vocabulary/iucn/habitat/">Habitats Vocabulary</a> 101 * <blockquote> 102 * <p> 103 * <i>Example:</i> 1.1. 104 * </p> 105 * </blockquote> 106 * 107 * @return the habitat 108 */ 109 @Schema(description = "Comma-separated list of major habitat classifications as defined by the IUCN in which " + 110 "a species is known to exist.\n\n" + 111 "See [Habitats vocabulary](https://rs.gbif.org/vocabulary/iucn/habitat/).") 112 @Nullable 113 public String getHabitat() { 114 return habitat; 115 } 116 117 /** 118 * @param habitat the habitat to set. 119 */ 120 public void setHabitat(String habitat) { 121 this.habitat = habitat; 122 } 123 124 /** 125 * A term describing the growth/lifeform of an organism. Should be based on a vocabulary like Raunkiær for plants: 126 * <a href="http://en.wikipedia.org/wiki/Raunkiær_plant_life-form">http://en.wikipedia.org/wiki/Raunkiær_plant_life- 127 * form</a>. Recommended vocabulary: 128 * <a href="https://rs.gbif.org/vocabulary/gbif/life_form">http://rs.gbif.org/vocabulary/gbif/life_form.xml</a> 129 * <blockquote> 130 * <p> 131 * <i>Example:</i> Phanerophyte. 132 * </p> 133 * </blockquote> 134 * 135 * @return the lifeForm 136 */ 137 @Schema(description = "A term describing the growth/lifeform of an organism.\n\n" + 138 "See [Life Form vocabulary](https://rs.gbif.org/vocabulary/gbif/life_form).") 139 @Nullable 140 public String getLifeForm() { 141 return lifeForm; 142 } 143 144 /** 145 * @param lifeForm the lifeForm to set 146 */ 147 public void setLifeForm(String lifeForm) { 148 this.lifeForm = lifeForm; 149 } 150 151 /** 152 * The (geological) time a currently extinct organism is known to have lived. For geological times of fossils ideally 153 * based on a vocabulary like <a 154 * href="http://en.wikipedia.org/wiki/Geologic_column">http://en.wikipedia.org/wiki/Geologic_column</a> 155 * <blockquote> 156 * <p> 157 * <i>Example:</i> Cretaceous. 158 * </p> 159 * </blockquote> 160 * 161 * @return the livingPeriod 162 */ 163 @Schema(description = "The geological time a currently extinct organism is known to have lived.") 164 @Nullable 165 public String getLivingPeriod() { 166 return livingPeriod; 167 } 168 169 /** 170 * @param livingPeriod the livingPeriod to set 171 */ 172 public void setLivingPeriod(String livingPeriod) { 173 this.livingPeriod = livingPeriod; 174 } 175 176 /** 177 * Maximum observed weight of an organism in grams. 178 * <blockquote> 179 * <p> 180 * <i>Example:</i> 12. 181 * </p> 182 * </blockquote> 183 * 184 * @return the massInGram 185 */ 186 @Schema(description = "Maximum observed weight of an organism in grams.") 187 @Nullable 188 public Integer getMassInGram() { 189 return massInGram; 190 } 191 192 /** 193 * @param massInGram the massInGram to set 194 */ 195 public void setMassInGram(Integer massInGram) { 196 this.massInGram = massInGram; 197 } 198 199 /** 200 * Maximum observed size of an organism in millimetres. Can be either height, length or width, whichever is greater. 201 * <blockquote> 202 * <p> 203 * <i>Example:</i> 1500. 204 * </p> 205 * </blockquote> 206 * 207 * @return the sizeInMillimeter 208 */ 209 @Schema(description = "Maximum observed size of an organism in millimetres.\n\n" + 210 "Can be either height, length or width, whichever is greater.") 211 @Nullable 212 public Integer getSizeInMillimeter() { 213 return sizeInMillimeter; 214 } 215 216 /** 217 * @param sizeInMillimeter the sizeInMillimeter to se 218 */ 219 public void setSizeInMillimeter(Integer sizeInMillimeter) { 220 this.sizeInMillimeter = sizeInMillimeter; 221 } 222 223 /** 224 * Flag indicating an extinct organism. Details about the timeperiod the organism has lived in can be supplied below. 225 * <blockquote> 226 * <p> 227 * <i>Example:</i> true - false. 228 * </p> 229 * </blockquote> 230 * 231 * @return the extinct 232 */ 233 @Schema(description = "Flag indicating an extinct organism.") 234 @Nullable 235 public Boolean isExtinct() { 236 return extinct; 237 } 238 239 /** 240 * @param extinct the extinct to set 241 */ 242 public void setExtinct(Boolean extinct) { 243 this.extinct = extinct; 244 } 245 246 /** 247 * Flag indicating a hybrid organism. This does not have to be reflected in the name, but can be based on other 248 * studies like chromosome numbers etc. 249 * <blockquote> 250 * <p> 251 * <i>Example:</i> true - false. 252 * </p> 253 * </blockquote> 254 * 255 * @return the hybrid 256 */ 257 @Schema(description = "Flag indicating a hybrid organism.") 258 @Nullable 259 public Boolean isHybrid() { 260 return hybrid; 261 } 262 263 /** 264 * @param hybrid the hybrid to set 265 */ 266 public void setHybrid(Boolean hybrid) { 267 this.hybrid = hybrid; 268 } 269 270 /** 271 * A Boolean flag indicating whether the taxon is a marine organism, i.e. can be found in/above sea water 272 * <blockquote> 273 * <p> 274 * <i>Example:</i> true - false. 275 * </p> 276 * </blockquote> 277 * 278 * @return is marine flag 279 */ 280 @Schema(description = "A Boolean flag indicating whether the taxon is a marine organism, i.e. can be found in/above sea water.") 281 @Nullable 282 public Boolean isMarine() { 283 return marine; 284 } 285 286 /** 287 * @param marine the marine to set 288 */ 289 public void setMarine(Boolean marine) { 290 this.marine = marine; 291 } 292 293 /** 294 * A Boolean flag indicating the taxon is a terrestrial organism, i.e. occurs on land as opposed to the sea. 295 * <blockquote> 296 * <p> 297 * <i>Example:</i> true - false. 298 * </p> 299 * </blockquote> 300 * 301 * @return the terrestrial 302 */ 303 @Schema(description = "A Boolean flag indicating the taxon is a terrestrial organism, i.e. occurs on land as opposed to the sea.") 304 @Nullable 305 public Boolean isTerrestrial() { 306 return terrestrial; 307 } 308 309 /** 310 * @param terrestrial the terrestrial to set 311 */ 312 public void setTerrestrial(Boolean terrestrial) { 313 this.terrestrial = terrestrial; 314 } 315 316 @Schema(description = "Bibliographic citation referencing a source for the species profile.") 317 @Nullable 318 @Override 319 public String getSource() { 320 return source; 321 } 322 323 @Override 324 public void setSource(String source) { 325 this.source = source; 326 } 327 328 @Schema(description = "The name usage key of the taxon in the checklist including this species profile.") 329 @Nullable 330 @Override 331 public Integer getSourceTaxonKey() { 332 return sourceTaxonKey; 333 } 334 335 @Override 336 public void setSourceTaxonKey(Integer sourceTaxonKey) { 337 this.sourceTaxonKey = sourceTaxonKey; 338 } 339 340 @Override 341 public boolean equals(Object o) { 342 if (this == o) { 343 return true; 344 } 345 if (o == null || getClass() != o.getClass()) { 346 return false; 347 } 348 SpeciesProfile that = (SpeciesProfile) o; 349 return Objects.equals(livingPeriod, that.livingPeriod) && 350 Objects.equals(lifeForm, that.lifeForm) && 351 Objects.equals(habitat, that.habitat) && 352 Objects.equals(marine, that.marine) && 353 Objects.equals(terrestrial, that.terrestrial) && 354 Objects.equals(extinct, that.extinct) && 355 Objects.equals(hybrid, that.hybrid) && 356 Objects.equals(ageInDays, that.ageInDays) && 357 Objects.equals(sizeInMillimeter, that.sizeInMillimeter) && 358 Objects.equals(massInGram, that.massInGram) && 359 Objects.equals(source, that.source) && 360 Objects.equals(sourceTaxonKey, that.sourceTaxonKey); 361 } 362 363 @Override 364 public int hashCode() { 365 return Objects 366 .hash(livingPeriod, lifeForm, habitat, marine, terrestrial, extinct, hybrid, ageInDays, 367 sizeInMillimeter, massInGram, source, sourceTaxonKey); 368 } 369 370 @Override 371 public String toString() { 372 return new StringJoiner(", ", SpeciesProfile.class.getSimpleName() + "[", "]") 373 .add("livingPeriod='" + livingPeriod + "'") 374 .add("lifeForm='" + lifeForm + "'") 375 .add("habitat='" + habitat + "'") 376 .add("marine=" + marine) 377 .add("freshwater=" + freshwater) 378 .add("terrestrial=" + terrestrial) 379 .add("extinct=" + extinct) 380 .add("hybrid=" + hybrid) 381 .add("ageInDays=" + ageInDays) 382 .add("sizeInMillimeter=" + sizeInMillimeter) 383 .add("massInGram=" + massInGram) 384 .add("source='" + source + "'") 385 .add("sourceTaxonKey=" + sourceTaxonKey) 386 .toString(); 387 } 388}