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 aDatasetand itsOrganization.generateCitation(Dataset dataset, Organization org) static StringgeneratePublisherProvidedCitation(Dataset dataset) Generate a citation for aDatasetusing the publisher's provided citation.static StringgetAuthorName(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.
-
Method Details
-
generateCitation
-
generatePublisherProvidedCitation
Generate a citation for aDatasetusing 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 aDatasetand itsOrganization. TODO add support for i18n- Returns:
- generated citation as
String
-
getAuthors
Extracts an ordered list of unique authors from a list of contacts. AContactis identified as an author when hisContactTypeis 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 aListofStringrepresenting 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
-