Package org.gbif.api.util
Class CitationGenerator
java.lang.Object
org.gbif.api.util.CitationGenerator
Helper class tha generates a Citation String from
Dataset
and Organization
objects. Documentation : /docs/citations.md-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiongenerateAuthorsName
(List<CitationContact> authors) generateCitation
(Dataset dataset, String organizationTitle) Generate a citation for aDataset
and itsOrganization
.generateCitation
(Dataset dataset, Organization org) static String
generatePublisherProvidedCitation
(Dataset dataset) Generate a citation for aDataset
using the publisher's provided citation.static String
getAuthorName
(Contact creator) Given aContact
, generates a String for that contact for citation purpose.static List<CitationContact>
getAuthors
(List<Contact> contacts) Extracts an ordered list of unique authors from a list of contacts.static List<CitationContact>
getAuthors
(Dataset dataset) static List<CitationContact>
getAuthorsForCamtrap
(List<Contact> contacts)
-
Method Details
-
generateCitation
-
generatePublisherProvidedCitation
Generate a citation for aDataset
using the publisher's provided citation.- Parameters:
dataset
- dataset- Returns:
- generated citation as
String
-
generateCitation
public static CitationGenerator.CitationData generateCitation(Dataset dataset, String organizationTitle) Generate a citation for aDataset
and itsOrganization
. TODO add support for i18n- Returns:
- generated citation as
String
-
getAuthors
-
getAuthorsForCamtrap
-
getAuthors
Extracts an ordered list of unique authors from a list of contacts. AContact
is identified as an author when hisContactType
is contained inAUTHOR_CONTACT_TYPE
. But, we shall at least have one contact of type MANDATORY_CONTACT_TYPE.- Parameters:
contacts
- list of contacts available- Returns:
- ordered list of authors or empty list, never null
-
generateAuthorsName
Given a list of authors, generates aList
ofString
representing the authors name. If a contact doesn't have a first AND last name it will not be included.- Parameters:
authors
- ordered list of authors- Returns:
- list of author names (if it can be generated) or empty list, never null
-
getAuthorName
Given aContact
, generates a String for that contact for citation purpose. The organization will be used (if present) in case we don't have both lastName and firstNames of the contact.- Parameters:
creator
- contact object- Returns:
- name
-