Class SimpleJsonPathMetadataContributor
- java.lang.Object
-
- org.dspace.importer.external.metadatamapping.contributor.SimpleJsonPathMetadataContributor
-
- All Implemented Interfaces:
MetadataContributor<String>
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 Modifier and Type Field Description protected JsonPathMetadataProcessormetadataProcessor
-
Constructor Summary
Constructors Constructor Description SimpleJsonPathMetadataContributor()Empty constructor for SimpleJsonPathMetadataContributorSimpleJsonPathMetadataContributor(String query, MetadataFieldConfig field)Initialize SimpleJsonPathMetadataContributor with a query, prefixToNamespaceMapping and MetadataFieldConfig
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<MetadatumDTO>contributeMetadata(String fullJson)Retrieve the metadata associated with the given object.MetadataFieldConfiggetField()Return the MetadataFieldConfig used while retrieving MetadatumDTOStringgetQuery()Return query used to create the JSonPathvoidsetField(MetadataFieldConfig field)Setting the MetadataFieldConfigvoidsetMetadataFieldMapping(MetadataFieldMapping<String,MetadataContributor<String>> rt)Unused 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.voidsetQuery(String query)Return query used to create the JSonPath
-
-
-
Field Detail
-
metadataProcessor
protected JsonPathMetadataProcessor metadataProcessor
-
-
Constructor Detail
-
SimpleJsonPathMetadataContributor
public SimpleJsonPathMetadataContributor(String query, MetadataFieldConfig field)
Initialize SimpleJsonPathMetadataContributor with a query, prefixToNamespaceMapping and MetadataFieldConfig- Parameters:
query- The JSonPath queryfield- the matadata field to map the result of the Json path query MetadataFieldConfig
-
SimpleJsonPathMetadataContributor
public SimpleJsonPathMetadataContributor()
Empty constructor for SimpleJsonPathMetadataContributor
-
-
Method Detail
-
setMetadataFieldMapping
public void setMetadataFieldMapping(MetadataFieldMapping<String,MetadataContributor<String>> rt)
Unused by this implementation- Specified by:
setMetadataFieldMappingin interfaceMetadataContributor<String>- Parameters:
rt- the MetadataFieldMapping object to set to the MetadataContributor
-
getField
public MetadataFieldConfig getField()
Return the MetadataFieldConfig used while retrieving MetadatumDTO- Returns:
- MetadataFieldConfig
-
setField
public void setField(MetadataFieldConfig field)
Setting the MetadataFieldConfig- Parameters:
field- MetadataFieldConfig used while retrieving MetadatumDTO
-
getQuery
public String getQuery()
Return query used to create the JSonPath- Returns:
- the query this instance is based on
-
setQuery
public void setQuery(String query)
Return query used to create the JSonPath
-
setMetadataProcessor
public void setMetadataProcessor(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.- Parameters:
metadataProcessor-
-
contributeMetadata
public Collection<MetadatumDTO> contributeMetadata(String fullJson)
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.
-
-