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.registry.eml;
015
016import javax.annotation.Nullable;
017import javax.validation.constraints.NotNull;
018import java.util.ArrayList;
019import java.util.List;
020import java.util.Objects;
021import java.util.StringJoiner;
022
023/**
024 * ProjectAward is used to enter information about a funding award associated with a project. The containing project
025 * contains the list of investigators and for the award, while the `award` field contains specifics such as the agency
026 * name, award number, and funding program identifiers.
027 */
028@SuppressWarnings({"unused", "LombokSetterMayBeUsed", "LombokGetterMayBeUsed"})
029public class ProjectAward {
030
031  private String funderName;
032  private List<String> funderIdentifiers = new ArrayList<>();
033  private String awardNumber;
034  private String title;
035  private String awardUrl;
036
037  @NotNull
038  public String getFunderName() {
039    return funderName;
040  }
041
042  public void setFunderName(String funderName) {
043    this.funderName = funderName;
044  }
045
046  public List<String> getFunderIdentifiers() {
047    return funderIdentifiers;
048  }
049
050  public void setFunderIdentifiers(List<String> funderIdentifiers) {
051    this.funderIdentifiers = funderIdentifiers;
052  }
053
054  public void addFunderIdentifier(String funderIdentifier) {
055    this.funderIdentifiers.add(funderIdentifier);
056  }
057
058  @Nullable
059  public String getAwardNumber() {
060    return awardNumber;
061  }
062
063  public void setAwardNumber(@Nullable String awardNumber) {
064    this.awardNumber = awardNumber;
065  }
066
067  @NotNull
068  public String getTitle() {
069    return title;
070  }
071
072  public void setTitle(String title) {
073    this.title = title;
074  }
075
076  @Nullable
077  public String getAwardUrl() {
078    return awardUrl;
079  }
080
081  public void setAwardUrl(@Nullable String awardUrl) {
082    this.awardUrl = awardUrl;
083  }
084
085  @Override
086  public boolean equals(Object o) {
087    if (this == o) return true;
088    if (o == null || getClass() != o.getClass()) return false;
089    ProjectAward that = (ProjectAward) o;
090    return Objects.equals(funderName, that.funderName)
091        && Objects.equals(funderIdentifiers, that.funderIdentifiers)
092        && Objects.equals(awardNumber, that.awardNumber)
093        && Objects.equals(title, that.title)
094        && Objects.equals(awardUrl, that.awardUrl);
095  }
096
097  @Override
098  public int hashCode() {
099    return Objects.hash(funderName, funderIdentifiers, awardNumber, title, awardUrl);
100  }
101
102  @Override
103  public String toString() {
104    return new StringJoiner(", ", ProjectAward.class.getSimpleName() + "[", "]")
105        .add("funderName='" + funderName + "'")
106        .add("funderIdentifiers=" + funderIdentifiers)
107        .add("awardNumber='" + awardNumber + "'")
108        .add("title='" + title + "'")
109        .add("awardUrl='" + awardUrl + "'")
110        .toString();
111  }
112}