Class MCRMetaClassification

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

public class MCRMetaClassification extends MCRMetaDefault
This class implements all method for handling with the MCRMetaClassification part of a metadata object. The MCRMetaClassification class present a link to a category of a classification.

<tag class="MCRMetaClassification" heritable="...">
<subtag classid="..." categid="..." />
</tag>

Version:
$Revision$ $Date: 2008-03-18 22:53:44 +0000 (Di, 18 Mrz 2008) $
Author:
Jens Kupferschmidt
  • Field Details

  • Constructor Details

    • MCRMetaClassification

      public MCRMetaClassification()
      This is the constructor.
      The language element was set to en . The classid and categid value was set to an empty string.
    • MCRMetaClassification

      public MCRMetaClassification(String subtag, int inherted, String type, String classid, String categid) throws MCRException
      This is the constructor.
      The language element was set to en . The subtag element was set to the value of subtag. If the value of subtag is null or empty an exception was throwed. The type element was set to an empty string. the classid and the categid must be not null or empty!
      Parameters:
      subtag - the name of the subtag
      inherted - a value >= 0
      type - the type attribute
      classid - the classification ID
      categid - the category ID
      Throws:
      MCRException - if the subtag value, the classid value or the categid are null, empty, too long or not a MCRObjectID
    • MCRMetaClassification

      public MCRMetaClassification(String subtag, int inherted, String type, MCRCategoryID category) throws MCRException
      This is the constructor.
      The language element was set to en . The subtag element was set to the value of subtag. If the value of subtag is null or empty an exception was throwed. The type element was set to an empty string. the classid and the categid must be not null or empty!
      Parameters:
      subtag - the name of the subtag
      inherted - a value >= 0
      type - the type attribute
      category - a category id
      Throws:
      MCRException - if the subtag value is empty, too long or not a MCRObjectID
  • Method Details

    • getClassId

      public final String getClassId()
      The method return the classification ID.
      Returns:
      the classId
    • getCategId

      public final String getCategId()
      The method return the category ID.
      Returns:
      the categId
    • setValue

      public final void setValue(String classid, String categid) throws MCRException
      This method set values of classid and categid.
      Parameters:
      classid - the classification ID
      categid - the category ID
      Throws:
      MCRException - if the classid value or the categid are null, empty, too long or not a MCRObjectID
    • setFromDOM

      public void setFromDOM(Element element) throws MCRException
      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 JDOM element for the metadata
      Throws:
      MCRException - if the classid value or the categid are null, empty, too long or not a MCRObjectID
    • createXML

      public Element createXML() throws MCRException
      This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaClassification definition for the given subtag.
      Specified by:
      createXML in interface MCRMetaInterface
      Overrides:
      createXML in class MCRMetaDefault
      Returns:
      a JDOM Element with the XML MCRClassification 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.
         {
           classid: "mycore_class_00000001",
           categid: "category1"
         }
       
      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
      Validates this MCRMetaClassification. 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
      • the category is null
      Specified by:
      validate in interface MCRMetaInterface
      Overrides:
      validate in class MCRMetaDefault
      Throws:
      MCRException - the MCRMetaClassification is invalid
    • clone

      public MCRMetaClassification 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:
    • 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)
      Overrides:
      equals in class MCRMetaDefault