Package org.mycore.datamodel.metadata
Class MCRMetaHistoryDate
java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
org.mycore.datamodel.metadata.MCRMetaHistoryDate
- All Implemented Interfaces:
Cloneable
,MCRMetaInterface
This class implements all methods for handling the MCRMetaHistoryDate
part of a metadata object. It uses the GPL licensed ICU library of IBM.
- Version:
- $Revision$ $Date$
- Author:
- Juergen Vogler, Jens Kupferschmidt, Thomas Junge
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This class describes the structure of pair of language an text. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximal length of 'text'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.MCRMetaHistoryDate
(String subtag, String type, int inherted) This is the constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
This method add a MCRMetaHistoryDateTexts instance to the ArrayList of texts.clone()
clone of this instance you will get a (deep) clone of this elementThis method creates a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaHistoryDate definition for the given subtag.void
debug()
This method put debug data to the logger (for the debug mode).boolean
This method compares this instance with a MCRMetaHistoryDate objectfinal com.ibm.icu.util.Calendar
getBis()
This method get the bis element as ICU-Calendar.final String
This method return the bis as string.final String
This method get the 'calendar' text element.final int
getIbis()
This method get the ibis element as Julian Day integer.final int
getIvon()
This method get the ivon element as Julian Day integer.getText
(int index) This method return the MCRMetaHistoryDateTexts instance of the indexed element of the ArrayList.This method return the MCRMetaHistoryDateTexts instance with the corresponding language.getTexts()
This method read the ArryList textsfinal com.ibm.icu.util.Calendar
getVon()
This method get the von element as ICU-Calendar.final String
This method return the von as string.final void
setBisDate
(com.ibm.icu.util.Calendar calendar) This method set the bis to the given date of a supported calendar.final void
setBisDate
(String date, String calendar) This method set the bis to the given date.final void
setCalendar
(com.ibm.icu.util.Calendar calendar) The method set the calendar String value.final void
setCalendar
(String calstr) The method set the calendar String value.final void
The method set the bis values to the default.final void
The method set the von values to the default.void
setFromDOM
(Element element) This method reads the XML input stream part from a DOM part for the metadata of the document.final void
Deprecated.final void
This method set the text field for the given language.final void
setVonDate
(com.ibm.icu.util.Calendar calendar) This method set the von to the given date of a supported calendar.final void
setVonDate
(String date, String calendar) This method set the von to the given date.final int
textSize()
This method read the size of textsvoid
validate()
Validates this MCRMetaHistoryDate.Methods inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
createJSON, debugDefault, decrementInherited, getInherited, getLang, getSequence, getSubTag, getType, hashCode, incrementInherited, isValid, setInherited, setLang, setSequence, setSubTag, setType
-
Field Details
-
MCRHISTORYDATE_MAX_TEXT
public static final int MCRHISTORYDATE_MAX_TEXTThe maximal length of 'text'- See Also:
-
-
Constructor Details
-
MCRMetaHistoryDate
public MCRMetaHistoryDate()This is the constructor.
The language element was set to configured default. The text element is set to an empty string. The calendar is set to 'Gregorian Calendar'. The von value is set to MIN_JULIAN_DAY_NUMBER, the bis value is set to MAX_JULIAN_DAY_NUMBER; -
MCRMetaHistoryDate
This is the constructor.
The language element was set. If the value of default_lang 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 text element is set to an empty string. The calendar is set to 'Gregorian Calendar'. The von value is set to MIN_JULIAN_DAY_NUMBER, the bis value is set to MAX_JULIAN_DAY_NUMBER;- Parameters:
subtag
- the name of the subtagtype
- the optional type stringinherted
- a value >= 0- Throws:
MCRException
- if the parameter values are invalid
-
-
Method Details
-
setText
Deprecated.This method set the text field for the default language. If data exists, it overwrites the value of text.- Parameters:
text
- the text string for a date or range
-
setText
This method set the text field for the given language. If data exists, it overwrites the value of text.- Parameters:
text
- the text string for a date or rangelang
- the language of the text in the ISO format
-
addText
This method add a MCRMetaHistoryDateTexts instance to the ArrayList of texts.- Parameters:
text
- the text- Stringlang
- the lang- String
-
getText
This method return the MCRMetaHistoryDateTexts instance with the corresponding language.- Parameters:
lang
- the language String in ISO format- Returns:
- an instance of MCRMetaHistoryDateTexts or null
-
getText
This method return the MCRMetaHistoryDateTexts instance of the indexed element of the ArrayList.- Parameters:
index
- the index of ArryList texts- Returns:
- an instance of MCRMetaHistoryDateTexts or null
-
getTexts
This method read the ArryList texts- Returns:
- an ArrayList of MCRMetaHistoryDateTexts instances
-
textSize
public final int textSize()This method read the size of texts- Returns:
- the size of the ArrayList of language dependence texts
-
setCalendar
The method set the calendar String value.- Parameters:
calstr
- the calendar as String, one of CALENDARS.
-
setCalendar
public final void setCalendar(com.ibm.icu.util.Calendar calendar) The method set the calendar String value.- Parameters:
calendar
- the date of the calendar.
-
setDefaultVon
public final void setDefaultVon()The method set the von values to the default. -
setDefaultBis
public final void setDefaultBis()The method set the bis values to the default. -
setVonDate
public final void setVonDate(com.ibm.icu.util.Calendar calendar) This method set the von to the given date of a supported calendar.- Parameters:
calendar
- the date of a ICU supported calendar.
-
setVonDate
This method set the von to the given date.- Parameters:
date
- a date stringcalendar
- the calendar as String, one of CALENDARS.
-
setBisDate
public final void setBisDate(com.ibm.icu.util.Calendar calendar) This method set the bis to the given date of a supported calendar.- Parameters:
calendar
- the date of a ICU supported calendar
-
setBisDate
This method set the bis to the given date.- Parameters:
date
- a date stringcalendar
- the calendar as String, one of CALENDARS.
-
getCalendar
This method get the 'calendar' text element.- Returns:
- the calendar string
-
getVon
public final com.ibm.icu.util.Calendar getVon()This method get the von element as ICU-Calendar.- Returns:
- the date
-
getVonToString
This method return the von as string.- Returns:
- the date
-
getIvon
public final int getIvon()This method get the ivon element as Julian Day integer.- Returns:
- the date
-
getBis
public final com.ibm.icu.util.Calendar getBis()This method get the bis element as ICU-Calendar.- Returns:
- the date
-
getBisToString
This method return the bis as string.- Returns:
- the date
-
getIbis
public final int getIbis()This method get the ibis element as Julian Day integer.- Returns:
- the date
-
setFromDOM
This method reads 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
-
createXML
This method creates a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaHistoryDate definition for the given subtag.- Specified by:
createXML
in interfaceMCRMetaInterface
- Overrides:
createXML
in classMCRMetaDefault
- Returns:
- a JDOM Element with the XML MCRMetaHistoryDate part
- Throws:
MCRException
- if the content of this class is not valid
-
validate
Validates this MCRMetaHistoryDate. 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 number of texts is 0 (empty texts are delete)
- von is null or bis is null or calendar is null
- Specified by:
validate
in interfaceMCRMetaInterface
- Overrides:
validate
in classMCRMetaDefault
- Throws:
MCRException
- the MCRMetaHistoryDate 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
This method compares this instance with a MCRMetaHistoryDate object- Overrides:
equals
in classMCRMetaDefault
-