Class MultipleMetadataContributor<T>
java.lang.Object
org.dspace.importer.external.metadatamapping.contributor.MultipleMetadataContributor<T>
- Type Parameters:
T- The type of record being processed.
- All Implemented Interfaces:
MetadataContributor<T>
This Contributor is helpful to avoid the limit of the Live Import Framework.
In Live Import, one dc schema/element/qualifier could be associate with one and
only one MetadataContributor, because the map they're saved in use dc entity as key.
In fact, in this implementation we use the MetadataFieldConfig present in this MultipleMetadataContributor
contributor, but the data (values of the dc metadatum) will be loaded using any of the contributor defined
in the List metadatumContributors, by iterating over them.
If the
ensureUniqueValues flag is set to true, duplicate values
will be filtered out from the final metadata collection.- Author:
- Pasquale Cavallo (pasquale.cavallo at 4science dot it)
- See Also:
-
org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping<RecordType>
-
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructorMultipleMetadataContributor(MetadataFieldConfig field, List<MetadataContributor> metadatumContributors) MultipleMetadataContributor(MetadataFieldConfig field, List<MetadataContributor> metadatumContributors, boolean ensureUniqueValues) -
Method Summary
Modifier and TypeMethodDescriptiona separate Metadatum object is created for each index of Metadatum returned from the calls to MetadatumContributor.contributeMetadata(t) for each MetadatumContributor in the metadatumContributors list.getField()Return the MetadataFieldConfig used while retrieving MetadatumDTOReturn the List of MetadataContributor objects set to this classbooleanReturns whether duplicate metadata values should be removed.voidsetEnsureUniqueValues(boolean ensureUniqueValues) Sets whether duplicate metadata values should be removed.voidsetField(MetadataFieldConfig field) Setting the MetadataFieldConfigvoidsetMetadataFieldMapping(MetadataFieldMapping<T, MetadataContributor<T>> metadataFieldMapping) Set the metadatafieldMapping used in the transforming of a record to actual metadatavoidsetMetadatumContributors(List<MetadataContributor> metadatumContributors) Set the List of MetadataContributor objects set to this class
-
Constructor Details
-
MultipleMetadataContributor
public MultipleMetadataContributor()Empty constructor -
MultipleMetadataContributor
public MultipleMetadataContributor(MetadataFieldConfig field, List<MetadataContributor> metadatumContributors) - Parameters:
field-MetadataFieldConfigused in mappingmetadatumContributors- A list of MetadataContributor
-
MultipleMetadataContributor
public MultipleMetadataContributor(MetadataFieldConfig field, List<MetadataContributor> metadatumContributors, boolean ensureUniqueValues) - Parameters:
field-MetadataFieldConfigused in mappingmetadatumContributors- A list of MetadataContributorensureUniqueValues- If true, ensures that duplicate values are filtered out
-
-
Method Details
-
setMetadataFieldMapping
public void setMetadataFieldMapping(MetadataFieldMapping<T, MetadataContributor<T>> metadataFieldMapping) Set the metadatafieldMapping used in the transforming of a record to actual metadata- Specified by:
setMetadataFieldMappingin interfaceMetadataContributor<T>- Parameters:
metadataFieldMapping- the new mapping.
-
contributeMetadata
a separate Metadatum object is created for each index of Metadatum returned from the calls to MetadatumContributor.contributeMetadata(t) for each MetadatumContributor in the metadatumContributors list. All of them have as dc schema/element/qualifier the values defined in MetadataFieldConfig. If ensureUniqueValues is enabled, duplicate metadata values will be removed, ensuring uniqueness.- Specified by:
contributeMetadatain interfaceMetadataContributor<T>- Parameters:
t- the object we are trying to translate- Returns:
- a collection of metadata got from each MetadataContributor
-
getField
Return the MetadataFieldConfig used while retrieving MetadatumDTO- Returns:
- MetadataFieldConfig
-
setField
Setting the MetadataFieldConfig- Parameters:
field- MetadataFieldConfig used while retrieving MetadatumDTO
-
getMetadatumContributors
Return the List of MetadataContributor objects set to this class- Returns:
- metadatumContributors, list of MetadataContributor
-
setMetadatumContributors
Set the List of MetadataContributor objects set to this class- Parameters:
metadatumContributors- A list of MetadatumContributor classes
-
isEnsureUniqueValues
public boolean isEnsureUniqueValues()Returns whether duplicate metadata values should be removed.- Returns:
- true if duplicate values should be filtered out, false otherwise.
-
setEnsureUniqueValues
public void setEnsureUniqueValues(boolean ensureUniqueValues) Sets whether duplicate metadata values should be removed.- Parameters:
ensureUniqueValues- if true, ensures that duplicate values are filtered out.
-