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; 015 016import lombok.EqualsAndHashCode; 017 018import lombok.ToString; 019 020import org.gbif.api.model.common.DOI; 021import org.gbif.api.model.occurrence.Download; 022 023import java.io.Serializable; 024import java.util.Objects; 025import java.util.StringJoiner; 026import java.util.UUID; 027 028import javax.validation.constraints.NotNull; 029 030import io.swagger.v3.oas.annotations.media.Schema; 031 032/** 033 * Represents the information about the usage of one dataset in an occurrence download. 034 * Provides information about the number of records that the dataset provided to the download; additionally, provide the 035 * references to the download and dataset entities. 036 */ 037@SuppressWarnings("unused") 038@EqualsAndHashCode 039@ToString 040public class DatasetOccurrenceDownloadUsage implements Serializable { 041 042 @Schema( 043 description = "The GBIF key assigned to the download.\n\n" + 044 "Note that citations should instead use the download DOI." 045 ) 046 private String downloadKey; 047 048 @Schema( 049 description = "The GBIF dataset key of the dataset." 050 ) 051 private UUID datasetKey; 052 053 @Schema( 054 description = "The title of the dataset, at the time the download was created." 055 ) 056 private String datasetTitle; 057 058 @Schema( 059 description = "The primary Digital Object Identifier (DOI) for the dataset.", 060 implementation = String.class, 061 pattern = "(10(?:\\.[0-9]+)+)" + "/(.+)" 062 ) 063 private DOI datasetDOI; 064 065 @Schema( 066 description = "The citation for the dataset, at the time the download was created." 067 ) 068 private String datasetCitation; 069 070 @Schema( 071 description = "The number of records from this dataset included in the download." 072 ) 073 private long numberRecords; 074 075 @Schema( 076 description = "Further information about the download." 077 ) 078 private Download download; 079 080 @Schema( 081 description = "The publishing country code of the publishing organization of the dataset." 082 ) 083 private String publishingCountryCode; 084 085 /** 086 * Dataset key. 087 */ 088 @NotNull 089 public UUID getDatasetKey() { 090 return datasetKey; 091 } 092 093 /** 094 * @return the download 095 */ 096 public Download getDownload() { 097 return download; 098 } 099 100 /** 101 * Occurrence download key. 102 */ 103 @NotNull 104 public String getDownloadKey() { 105 return downloadKey; 106 } 107 108 /** 109 * Number of records that the dataset has provided to the occurrence download. 110 */ 111 @NotNull 112 public long getNumberRecords() { 113 return numberRecords; 114 } 115 116 /** 117 * Dataset title at the moment when the download was created. 118 */ 119 public String getDatasetTitle() { 120 return datasetTitle; 121 } 122 123 /** 124 * Dataset DOI at the moment when the download was created. 125 */ 126 public DOI getDatasetDOI() { 127 return datasetDOI; 128 } 129 130 /** 131 * Dataset citation at the moment when the download was created. 132 */ 133 public String getDatasetCitation() { 134 return datasetCitation; 135 } 136 137 public void setDatasetKey(UUID datasetKey) { 138 this.datasetKey = datasetKey; 139 } 140 141 public void setDownload(Download download) { 142 this.download = download; 143 } 144 145 public void setDownloadKey(String downloadKey) { 146 this.downloadKey = downloadKey; 147 } 148 149 public void setNumberRecords(long numberOfRecords) { 150 this.numberRecords = numberOfRecords; 151 } 152 153 public void setDatasetTitle(String datasetTitle) { 154 this.datasetTitle = datasetTitle; 155 } 156 157 public void setDatasetDOI(DOI datasetDOI) { 158 this.datasetDOI = datasetDOI; 159 } 160 161 public void setDatasetCitation(String datasetCitation) { 162 this.datasetCitation = datasetCitation; 163 } 164 165 public String getPublishingCountryCode() { 166 return publishingCountryCode; 167 } 168 169 public void setPublishingCountryCode(String publishingCountryCode) { 170 this.publishingCountryCode = publishingCountryCode; 171 } 172}