Class OpenAlexAuthorNameContributor
java.lang.Object
org.dspace.importer.external.metadatamapping.contributor.SimpleJsonPathMetadataContributor
org.dspace.importer.external.openalex.metadatamapping.OpenAlexAuthorNameContributor
- All Implemented Interfaces:
MetadataContributor<String>
This class is responsible for extracting and contributing author name metadata
from a JSON response using a specified query path.
The extracted name is split into given name and family name, and the metadata is stored based on the field configuration.
Example JSON structure:
{
"author": {
"full_name": "John Doe"
}
}
If the query path points to `author.full_name`, this class will extract "John" as the given name and "Doe" as the family name.
- Author:
- Adamo Fapohunda (adamo.fapohunda at 4science.com)
-
Field Summary
Fields inherited from class org.dspace.importer.external.metadatamapping.contributor.SimpleJsonPathMetadataContributor
metadataProcessor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncontributeMetadata(String fullJson) Extracts and contributes metadata based on the configured JSON query path and field.voidsetField(MetadataFieldConfig field) Sets the metadata field configuration that determines where the extracted metadata should be stored.voidSets the JSON query path for extracting the author name.Methods inherited from class org.dspace.importer.external.metadatamapping.contributor.SimpleJsonPathMetadataContributor
getField, getQuery, setMetadataFieldMapping, setMetadataProcessor
-
Constructor Details
-
OpenAlexAuthorNameContributor
public OpenAlexAuthorNameContributor()
-
-
Method Details
-
setQuery
Sets the JSON query path for extracting the author name.- Overrides:
setQueryin classSimpleJsonPathMetadataContributor- Parameters:
query- the JSON path to the author name
-
setField
Sets the metadata field configuration that determines where the extracted metadata should be stored.- Overrides:
setFieldin classSimpleJsonPathMetadataContributor- Parameters:
field- the metadata field configuration
-
contributeMetadata
Extracts and contributes metadata based on the configured JSON query path and field.If the extracted author name contains both given and family names, it assigns them accordingly based on the configured field.
- Specified by:
contributeMetadatain interfaceMetadataContributor<String>- Overrides:
contributeMetadatain classSimpleJsonPathMetadataContributor- Parameters:
fullJson- the JSON response containing author information- Returns:
- a collection of metadata entries representing the extracted name parts
-