Class MCRMetaAddress

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

public final class MCRMetaAddress extends MCRMetaDefault
This class implements all methods for handling with the MCRMetaAddress part of a metadata object. The MCRMetaAddress class represents a natural address specified by a list of names.
Author:
J. Vogler
  • Constructor Details

    • MCRMetaAddress

      public MCRMetaAddress()
      This is the constructor.
      The language element was set to en . All other elemnts are set to an empty string.
    • MCRMetaAddress

      public MCRMetaAddress(String subtag, String defaultLang, String type, int inherted, String country, String state, String zipcode, String city, String street, String number) throws MCRException
      This is the constructor.
      The language element was set. If the value of defaultLang is null, empty or false en was set. The subtag element was set to the value of subtag. If the value of subtag is null or empty an exception was thrown. The type element was set to the value of type, if it is null, an empty string was set to the type element. The country, state, zipCode, city, street and number element was set to the value of ..., if they are null, an empty string was set to this element.
      Parameters:
      subtag - the name of the subtag
      defaultLang - the default language
      type - the optional type string
      inherted - a value >= 0
      country - the country name
      state - the state name
      zipcode - the zipCode string
      city - the city name
      street - the street name
      number - the number string
      Throws:
      MCRException - if the parameter values are invalid
  • Method Details

    • clone

      public MCRMetaAddress 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:
    • createXML

      public Element createXML() throws MCRException
      This method creates a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaAddress definition for the given subtag.
      Specified by:
      createXML in interface MCRMetaInterface
      Overrides:
      createXML in class MCRMetaDefault
      Returns:
      a JDOM Element with the XML MCRMetaAddress 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.
         {
           "country": "Deutschland",
           "state": "Thüringen",
           "zipcode": "07743",
           "city": "Jena",
           "street": "Bibliothekspl.",
           "number": "2"
         }
       
      Specified by:
      createJSON in interface MCRMetaInterface
      Overrides:
      createJSON in class MCRMetaDefault
      Returns:
      a GSON object containing the json data of the metadata part
    • debug

      public void debug()
      This method put debug data to the logger (for the debug mode).
      Specified by:
      debug in interface MCRMetaInterface
      Overrides:
      debug in class MCRMetaDefault
    • equals

      public boolean equals(Object obj)
      Check the equivalence between this instance and the given object.
      Overrides:
      equals in class MCRMetaDefault
      Parameters:
      obj - the MCRMetaAddress object
      Returns:
      true if its equal
    • getCity

      public String getCity()
      Returns:
      the city
    • getCountry

      public String getCountry()
      Returns:
      the country
    • getNumber

      public String getNumber()
      Returns:
      the number
    • getState

      public String getState()
      Returns:
      the state
    • getStreet

      public String getStreet()
      Returns:
      the street
    • getZipCode

      public String getZipCode()
      Returns:
      the zipCode
    • validate

      public void validate() throws MCRException
      Validates this MCRMetaAddress. 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
      • all of country, state, zip, city, street and number is empty
      Specified by:
      validate in interface MCRMetaInterface
      Overrides:
      validate in class MCRMetaDefault
      Throws:
      MCRException - the MCRMetaAddress is invalid
    • setCity

      public void setCity(String city)
      Parameters:
      city - the city to set
    • setCountry

      public void setCountry(String country)
      Parameters:
      country - the country to set
    • setFromDOM

      public void setFromDOM(Element element)
      This method reads 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 JDOM element for the metadata
    • setNumber

      public void setNumber(String number)
      Parameters:
      number - the number to set
    • setState

      public void setState(String state)
      Parameters:
      state - the state to set
    • setStreet

      public void setStreet(String street)
      Parameters:
      street - the street to set
    • setZipCode

      public void setZipCode(String zipCode)
      Parameters:
      zipCode - the zipCode to set