Package io.goobi.viewer.model.metadata
Class MetadataContainer
java.lang.Object
io.goobi.viewer.model.metadata.MetadataContainer
An object containing a number of translatable metadata values. The values are mapped to a key which is a string corresponding to the SOLR field
name the values are taken from Each field name/key is mapped to a list of
IMetadataValue
objects which may contain a single string or
translations in several languages Used in GeoCoordinateConverter
to add translatable metadata entites to geomap features- Author:
- florian
-
Constructor Summary
ConstructorDescriptionCloning constructor.MetadataContainer
(String solrId, de.intranda.metadata.multilanguage.IMetadataValue label) MetadataContainer
(String solrId, de.intranda.metadata.multilanguage.IMetadataValue label, Map<String, List<de.intranda.metadata.multilanguage.IMetadataValue>> metadata) MetadataContainer
(String solrId, String label) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addAll
(String key, Collection<de.intranda.metadata.multilanguage.IMetadataValue> values) void
addAll
(String key, Collection<de.intranda.metadata.multilanguage.IMetadataValue> values, boolean overwrite) static MetadataContainer
static MetadataContainer
createMetadataEntity
(org.apache.solr.common.SolrDocument doc) Returns aMetadataContainer
which includes all metadata fields matching the given fieldNameFilter from the givenSolrDocument
docstatic MetadataContainer
createMetadataEntity
(org.apache.solr.common.SolrDocument doc, Predicate<String> fieldNameFilter) Returns aMetadataContainer
which includes all metadata fields matching the given fieldNameFilter from the givenSolrDocument
docstatic MetadataContainer
createMetadataEntity
(org.apache.solr.common.SolrDocument doc, List<org.apache.solr.common.SolrDocument> children, Predicate<String> mainDocFieldNameFilter, Predicate<String> childDocFieldNameFilter) Returns aMetadataContainer
which includes all metadata fields matching the given fieldNameFilter from the givenSolrDocument
doc as well as thevalues
of those child documents whichlabel
matches the fieldnameFilterList<de.intranda.metadata.multilanguage.IMetadataValue>
Get all metadata for the given keyde.intranda.metadata.multilanguage.IMetadataValue
get the first metadata value for the given key.getFirstValue
(String key) Get the first found value in the default language for the given keygetFirstValue
(String key, Locale locale) Get the first found value for the given key and localede.intranda.metadata.multilanguage.IMetadataValue
getLabel()
Get all values of the default language (or any value of no default langauge value exists) for the given fieldGet all values of the default language (or any value of no default langauge value exists) for the given fieldvoid
void
void
setLabel
(de.intranda.metadata.multilanguage.IMetadataValue label)
-
Constructor Details
-
MetadataContainer
public MetadataContainer(String solrId, de.intranda.metadata.multilanguage.IMetadataValue label, Map<String, List<de.intranda.metadata.multilanguage.IMetadataValue>> metadata) - Parameters:
solrId
-label
-metadata
-
-
MetadataContainer
- Parameters:
solrId
-label
-
-
MetadataContainer
- Parameters:
solrId
-label
-
-
MetadataContainer
Cloning constructor.- Parameters:
orig
-
-
-
Method Details
-
getSolrId
-
getLabel
public de.intranda.metadata.multilanguage.IMetadataValue getLabel() -
setLabel
public void setLabel(de.intranda.metadata.multilanguage.IMetadataValue label) -
getLabel
-
getMetadata
-
get
Get all metadata for the given key- Parameters:
key
- the field name for which to get the metadata value- Returns:
- List
-
getFirst
get the first metadata value for the given key. If no such value exists, an emptyIMetadataValue
is returned- Parameters:
key
- the field name for which to get the metadata value- Returns:
IMetadataValue
-
getValues
Get all values of the default language (or any value of no default langauge value exists) for the given field- Parameters:
key
- the field name for which to get the metadata value- Returns:
- List
-
getFirstValue
Get the first found value in the default language for the given key- Parameters:
key
- the field name for which to get the metadata value- Returns:
- First value for the given key; empty string if not found
-
getValues
Get all values of the default language (or any value of no default langauge value exists) for the given field- Parameters:
key
- the field name for which to get the metadata valuelocale
- the language for which to find a value. If there is no translation in that langauge, use the default language and failing that any language entry- Returns:
- List of values for the given key and locale
-
getFirstValue
Get the first found value for the given key and locale- Parameters:
key
- the field name for which to get the metadata valuelocale
- the language for which to find a value. If there is no translation in that langauge, use the default language and failing that any language entry- Returns:
- First value for the given key and locale; empty string if not found
-
put
- Parameters:
key
-values
-
-
add
- Parameters:
key
-value
-
-
add
- Parameters:
key
-value
-
-
addAll
public void addAll(String key, Collection<de.intranda.metadata.multilanguage.IMetadataValue> values) - Parameters:
key
-values
-
-
addAll
public void addAll(String key, Collection<de.intranda.metadata.multilanguage.IMetadataValue> values, boolean overwrite) - Parameters:
key
-values
-overwrite
-
-
remove
- Parameters:
key
-
-
createMetadataEntity
public static MetadataContainer createMetadataEntity(org.apache.solr.common.SolrDocument doc, List<org.apache.solr.common.SolrDocument> children, Predicate<String> mainDocFieldNameFilter, Predicate<String> childDocFieldNameFilter) Returns aMetadataContainer
which includes all metadata fields matching the given fieldNameFilter from the givenSolrDocument
doc as well as thevalues
of those child documents whichlabel
matches the fieldnameFilter- Parameters:
doc
- The main DOCSTRUCT documentchildren
- METADATA type documents belonging to the main docmainDocFieldNameFilter
- A function which should return true for all metadata field names to be included in the main docchildDocFieldNameFilter
- A function which should return true for all metadata field names to be included in child docs- Returns:
- a
MetadataContainer
-
createMetadataEntity
-
createMetadataEntity
public static MetadataContainer createMetadataEntity(org.apache.solr.common.SolrDocument doc, Predicate<String> fieldNameFilter) Returns aMetadataContainer
which includes all metadata fields matching the given fieldNameFilter from the givenSolrDocument
doc- Parameters:
doc
- The main DOCSTRUCT documentfieldNameFilter
- A function which should return true for all metadata field names to be included in the return value- Returns:
- a
MetadataContainer
-
createMetadataEntity
Returns aMetadataContainer
which includes all metadata fields matching the given fieldNameFilter from the givenSolrDocument
doc- Parameters:
doc
- The main DOCSTRUCT document- Returns:
- a
MetadataContainer
-