Package org.gbif.api.util
Class CitationGenerator
- java.lang.Object
-
- org.gbif.api.util.CitationGenerator
-
public final class CitationGenerator extends Object
Helper class tha generates a Citation String fromDataset
andOrganization
objects. Documentation : /docs/citations.md
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CitationGenerator.CitationData
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>
generateAuthorsName(List<CitationContact> authors)
static CitationGenerator.CitationData
generateCitation(Dataset dataset, String organizationTitle)
Generate a citation for aDataset
and itsOrganization
.static CitationGenerator.CitationData
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 Detail
-
generateCitation
public static CitationGenerator.CitationData generateCitation(Dataset dataset, Organization org)
-
generatePublisherProvidedCitation
public static String generatePublisherProvidedCitation(Dataset dataset)
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
public static List<CitationContact> getAuthors(Dataset dataset)
-
getAuthorsForCamtrap
public static List<CitationContact> getAuthorsForCamtrap(List<Contact> contacts)
-
getAuthors
public static List<CitationContact> getAuthors(List<Contact> contacts)
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
public static List<String> generateAuthorsName(List<CitationContact> authors)
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
public static String getAuthorName(Contact creator)
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
-
-