Class MCRMetaSpatial

java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
org.mycore.datamodel.metadata.MCRMetaSpatial
All Implemented Interfaces:
Cloneable, MCRMetaInterface

public class MCRMetaSpatial extends MCRMetaDefault
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
  • 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

      public MCRMetaSpatial(String subtag, String type, Integer inherited) throws MCRException
      The constructor for a MCRMetaSpatial instance with an empty data container.
      Parameters:
      subtag - the name of the subtag
      type - an optional type or an empty string
      inherited - a value >= 0
      Throws:
      MCRException - if the set_subtag value is null or empty
  • Method Details

    • getData

      public List<BigDecimal> 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

      public void setData(List<BigDecimal> data)
    • add

      public void add(BigDecimal lat, BigDecimal lng)
      Adds a new point to the data.
      Parameters:
      lat - the latitude value
      lng - the longitude value
    • setFromDOM

      public void setFromDOM(Element element) throws MCRException
      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 interface MCRMetaInterface
      Overrides:
      setFromDOM in class MCRMetaDefault
      Parameters:
      element - a relevant DOM element for the metadata
      Throws:
      MCRException - if the subtag value is null or empty
    • createXML

      public Element createXML() throws MCRException
      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 interface MCRMetaInterface
      Overrides:
      createXML in class MCRMetaDefault
      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 the MCRMetaDefault.createJSON() method with the following data.
         {
           data: [50.92878, 11.5899]
         }
       
      Specified by:
      createJSON in interface MCRMetaInterface
      Overrides:
      createJSON in class MCRMetaDefault
      Returns:
      a GSON object containing the json data of the metadata part
    • validate

      public void validate() throws MCRException
      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 interface MCRMetaInterface
      Overrides:
      validate in class MCRMetaDefault
      Throws:
      MCRException - the MCRMetaDefault is invalid
    • clone

      public MCRMetaSpatial clone()
      clone of this instance you will get a (deep) clone of this element
      Specified by:
      clone in interface MCRMetaInterface
      Overrides:
      clone in class MCRMetaDefault
      See Also: