Class SimpleJsonPathMetadataContributor
java.lang.Object
org.dspace.importer.external.metadatamapping.contributor.SimpleJsonPathMetadataContributor
- All Implemented Interfaces:
MetadataContributor<String>
- Direct Known Subclasses:
ConditionEqualJsonPathMetadataContributor,OpenAlexAuthorNameContributor,RorParentOrgUnitMetadataContributor
public class SimpleJsonPathMetadataContributor
extends Object
implements MetadataContributor<String>
A simple JsonPath Metadata processor
that allow extract value from json object
by configuring the path in the query variable via the bean.
moreover this can also perform more compact extractions
by configuring specific json processor in "metadataProcessor"
- Author:
- Mykhaylo Boychuk (mykhaylo.boychuk@4science.com)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor for SimpleJsonPathMetadataContributorSimpleJsonPathMetadataContributor(String query, MetadataFieldConfig field) Initialize SimpleJsonPathMetadataContributor with a query, prefixToNamespaceMapping and MetadataFieldConfig -
Method Summary
Modifier and TypeMethodDescriptioncontributeMetadata(String fullJson) Retrieve the metadata associated with the given object.getField()Return the MetadataFieldConfig used while retrieving MetadatumDTOgetQuery()Return query used to create the JSonPathvoidsetField(MetadataFieldConfig field) Setting the MetadataFieldConfigvoidUnused by this implementationvoidsetMetadataProcessor(JsonPathMetadataProcessor metadataProcessor) Used to process data got by jsonpath expression, like arrays to stringify, change date format or else If it is null, toString will be used.voidReturn query used to create the JSonPath
-
Field Details
-
metadataProcessor
-
-
Constructor Details
-
SimpleJsonPathMetadataContributor
Initialize SimpleJsonPathMetadataContributor with a query, prefixToNamespaceMapping and MetadataFieldConfig- Parameters:
query- The JSonPath queryfield- the metadata field to map the result of the Json path query MetadataFieldConfig
-
SimpleJsonPathMetadataContributor
public SimpleJsonPathMetadataContributor()Empty constructor for SimpleJsonPathMetadataContributor
-
-
Method Details
-
setMetadataFieldMapping
Unused by this implementation- Specified by:
setMetadataFieldMappingin interfaceMetadataContributor<String>- Parameters:
rt- the MetadataFieldMapping object to set to the MetadataContributor
-
getField
Return the MetadataFieldConfig used while retrieving MetadatumDTO- Returns:
- MetadataFieldConfig
-
setField
Setting the MetadataFieldConfig- Parameters:
field- MetadataFieldConfig used while retrieving MetadatumDTO
-
getQuery
Return query used to create the JSonPath- Returns:
- the query this instance is based on
-
setQuery
Return query used to create the JSonPath -
setMetadataProcessor
Used to process data got by jsonpath expression, like arrays to stringify, change date format or else If it is null, toString will be used.- Parameters:
metadataProcessor-
-
contributeMetadata
Retrieve the metadata associated with the given object. The toString() of the resulting object will be used.- Specified by:
contributeMetadatain interfaceMetadataContributor<String>- Parameters:
fullJson- A class to retrieve metadata from.- Returns:
- a collection of import records. Only the identifier of the found records may be put in the record.
-