001/*
002 * Copyright 2014 Global Biodiversity Information Facility (GBIF)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.gbif.api.model.registry.eml;
017
018import java.io.Serializable;
019import java.util.List;
020
021import com.google.common.base.Objects;
022import com.google.common.collect.Lists;
023
024
025public class SamplingDescription implements Serializable {
026
027  private static final long serialVersionUID = -9075523119279155795L;
028
029  private String studyExtent;
030
031  private String sampling;
032  private String qualityControl;
033  private List<String> methodSteps = Lists.newArrayList();
034
035  public SamplingDescription() {
036  }
037
038  public SamplingDescription(String studyExtent, String sampling, String qualityControl, List<String> methodSteps) {
039    this.studyExtent = studyExtent;
040    this.sampling = sampling;
041    this.qualityControl = qualityControl;
042    this.methodSteps = methodSteps;
043  }
044
045  public List<String> getMethodSteps() {
046    return methodSteps;
047  }
048
049  public void setMethodSteps(List<String> methodSteps) {
050    this.methodSteps = methodSteps;
051  }
052
053  public void addMethodStep(String methodStep) {
054    this.methodSteps.add(methodStep);
055  }
056
057  public String getQualityControl() {
058    return qualityControl;
059  }
060
061  public void setQualityControl(String qualityControl) {
062    this.qualityControl = qualityControl;
063  }
064
065  public String getSampling() {
066    return sampling;
067  }
068
069  public void setSampling(String sampling) {
070    this.sampling = sampling;
071  }
072
073  public String getStudyExtent() {
074    return studyExtent;
075  }
076
077  public void setStudyExtent(String studyExtent) {
078    this.studyExtent = studyExtent;
079  }
080
081  @Override
082  public boolean equals(Object obj) {
083    if (this == obj) {
084      return true;
085    }
086    if (!(obj instanceof SamplingDescription)) {
087      return false;
088    }
089
090    SamplingDescription
091      that = (SamplingDescription) obj;
092    return Objects.equal(this.studyExtent, that.studyExtent)
093           && Objects.equal(this.sampling, that.sampling)
094           && Objects.equal(this.qualityControl, that.qualityControl)
095           && Objects.equal(this.methodSteps, that.methodSteps);
096  }
097
098  @Override
099  public int hashCode() {
100    return Objects.hashCode(studyExtent, sampling, qualityControl, methodSteps);
101  }
102
103  @Override
104  public String toString() {
105    return Objects.toStringHelper(this)
106      .add("studyExtent", studyExtent)
107      .add("sampling", sampling)
108      .add("qualityControl", qualityControl)
109      .add("methodSteps", methodSteps)
110      .toString();
111  }
112
113}