Package org.mycore.datamodel.metadata
Class MCRMetaClassification
java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
org.mycore.datamodel.metadata.MCRMetaClassification
- All Implemented Interfaces:
Cloneable
,MCRMetaInterface
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 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
ConstructorDescriptionThis is the constructor.MCRMetaClassification
(String subtag, int inherted, String type, String classid, String categid) This is the constructor.MCRMetaClassification
(String subtag, int inherted, String type, MCRCategoryID category) This is the constructor. -
Method Summary
Modifier and TypeMethodDescriptionclone()
clone of this instance you will get a (deep) clone of this elementcom.google.gson.JsonObject
Creates the JSON representation.This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaClassification definition for the given subtag.void
debug()
This method put debug data to the logger (for the debug mode).boolean
final String
The method return the category ID.final String
The method return the classification ID.void
setFromDOM
(Element element) This method read the XML input stream part from a DOM part for the metadata of the document.final void
This method set values of classid and categid.void
validate()
Validates this MCRMetaClassification.Methods inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
debugDefault, decrementInherited, getInherited, getLang, getSequence, getSubTag, getType, hashCode, incrementInherited, isValid, setInherited, setLang, setSequence, setSubTag, setType
-
Field Details
-
category
-
-
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 subtaginherted
- a value >= 0type
- the type attributeclassid
- the classification IDcategid
- 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 subtaginherted
- a value >= 0type
- the type attributecategory
- a category id- Throws:
MCRException
- if the subtag value is empty, too long or not a MCRObjectID
-
-
Method Details
-
getClassId
The method return the classification ID.- Returns:
- the classId
-
getCategId
The method return the category ID.- Returns:
- the categId
-
setValue
This method set values of classid and categid.- Parameters:
classid
- the classification IDcategid
- the category ID- Throws:
MCRException
- if the classid value or the categid are null, empty, too long or not a MCRObjectID
-
setFromDOM
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 JDOM element for the metadata- Throws:
MCRException
- if the classid value or the categid are null, empty, too long or not a MCRObjectID
-
createXML
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 interfaceMCRMetaInterface
- Overrides:
createXML
in classMCRMetaDefault
- 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 theMCRMetaDefault.createJSON()
method with the following data.{ classid: "mycore_class_00000001", categid: "category1" }
- Specified by:
createJSON
in interfaceMCRMetaInterface
- Overrides:
createJSON
in classMCRMetaDefault
- Returns:
- a GSON object containing the json data of the metadata part
-
validate
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 interfaceMCRMetaInterface
- Overrides:
validate
in classMCRMetaDefault
- Throws:
MCRException
- the MCRMetaClassification 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:
-
debug
public void debug()This method put debug data to the logger (for the debug mode).- Specified by:
debug
in interfaceMCRMetaInterface
- Overrides:
debug
in classMCRMetaDefault
-
equals
- Overrides:
equals
in classMCRMetaDefault
-