Package org.mycore.datamodel.metadata
Class MCRMetaSpatial
java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
org.mycore.datamodel.metadata.MCRMetaSpatial
- All Implemented Interfaces:
Cloneable
,MCRMetaInterface
Stores spatial information for geographic references. The latitude longitude values are stored in an array list,
where two BigDecimal build a point.
- Author:
- Matthias Eichner, Jens Kupferschmidt
-
Field Summary
Fields inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
datapart, DEFAULT_ATTRIBUTE_INHERITED, DEFAULT_ATTRIBUTE_LANG, DEFAULT_ATTRIBUTE_SEQUENCE, DEFAULT_ATTRIBUTE_TYPE, DEFAULT_ELEMENT_DATAPART, DEFAULT_INHERITED, DEFAULT_LANG_LENGTH, DEFAULT_LANGUAGE, DEFAULT_SEQUENCE, DEFAULT_STRING_LENGTH, DEFAULT_TYPE_LENGTH, inherited, lang, NL, sequence, subtag, type
-
Constructor Summary
ConstructorDescriptioninitializes with empty values.MCRMetaSpatial
(String subtag, String type, Integer inherited) The constructor for a MCRMetaSpatial instance with an empty data container.MCRMetaSpatial
(String subtag, String defaultLanguage, String type, Integer inherited) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(BigDecimal lat, BigDecimal lng) Adds a new point to the data.clone()
clone of this instance you will get a (deep) clone of this elementcom.google.gson.JsonObject
Creates the JSON representation.This abstract method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMeta... definition for the given subtag.getData()
Returns the spatial data.void
setData
(List<BigDecimal> data) void
setFromDOM
(Element element) This method read the XML input stream part from a DOM part for the metadata of the document.void
validate()
Validates this MCRMetaDefault.Methods inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
debug, debugDefault, decrementInherited, equals, getInherited, getLang, getSequence, getSubTag, getType, hashCode, incrementInherited, isValid, setInherited, setLang, setSequence, setSubTag, setType
-
Constructor Details
-
MCRMetaSpatial
public MCRMetaSpatial()initializes with empty values. -
MCRMetaSpatial
@Deprecated public MCRMetaSpatial(String subtag, String defaultLanguage, String type, Integer inherited) throws MCRException Deprecated.- Throws:
MCRException
-
MCRMetaSpatial
The constructor for a MCRMetaSpatial instance with an empty data container.- Parameters:
subtag
- the name of the subtagtype
- an optional type or an empty stringinherited
- a value >= 0- Throws:
MCRException
- if the set_subtag value is null or empty
-
-
Method Details
-
getData
Returns the spatial data. Two entries build a point. The first is always the latitude and the second one is always the longitude value.- Returns:
- list of the spatial data
-
setData
-
add
Adds a new point to the data.- Parameters:
lat
- the latitude valuelng
- the longitude value
-
setFromDOM
Description copied from class:MCRMetaDefault
This method read the XML input stream part from a DOM part for the metadata of the document.- Specified by:
setFromDOM
in interfaceMCRMetaInterface
- Overrides:
setFromDOM
in classMCRMetaDefault
- Parameters:
element
- a relevant DOM element for the metadata- Throws:
MCRException
- if the subtag value is null or empty
-
createXML
Description copied from class:MCRMetaDefault
This abstract method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMeta... definition for the given subtag.- Specified by:
createXML
in interfaceMCRMetaInterface
- Overrides:
createXML
in classMCRMetaDefault
- Returns:
- a JDOM Element with the XML MCRMeta... part
- Throws:
MCRException
- if the content of this class is not valid
-
createJSON
public com.google.gson.JsonObject createJSON()Creates the JSON representation. Extends theMCRMetaDefault.createJSON()
method with the following data.{ data: [50.92878, 11.5899] }
- Specified by:
createJSON
in interfaceMCRMetaInterface
- Overrides:
createJSON
in classMCRMetaDefault
- Returns:
- a GSON object containing the json data of the metadata part
-
validate
Description copied from class:MCRMetaDefault
Validates this MCRMetaDefault. This method throws an exception if:- the subtag is not null or empty
- the lang value was supported
- the inherited value is lower than zero
- Specified by:
validate
in interfaceMCRMetaInterface
- Overrides:
validate
in classMCRMetaDefault
- Throws:
MCRException
- the MCRMetaDefault is invalid
-
clone
clone of this instance you will get a (deep) clone of this element- Specified by:
clone
in interfaceMCRMetaInterface
- Overrides:
clone
in classMCRMetaDefault
- See Also:
-