org.mycore.datamodel.metadata
Class MCRMetaBoolean

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

public final class MCRMetaBoolean
extends MCRMetaDefault

This class implements all method for handling with the MCRMetaBoolean part of a metadata object. The MCRMetaBoolean class present a logical value of true or false and optional a type.

<tag class="MCRMetaBoolean" heritable="...">
<subtag type="...">
true|false or yes|no or ja|nein or wahr|falsch
</subtag>
</tag>

Version:
$Revision: 15406 $ $Date: 2009-06-26 14:18:44 +0200 (Fri, 26 Jun 2009) $
Author:
Jens Kupferschmidt

Field Summary
 
Fields inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
datapart, DEFAULT_DATAPART, DEFAULT_INHERITED, DEFAULT_LANG_LENGTH, DEFAULT_LANGUAGE, DEFAULT_STRING_LENGTH, DEFAULT_TYPE_LENGTH, inherited, lang, LOGGER, NL, subtag, type
 
Constructor Summary
MCRMetaBoolean()
          This is the constructor.
MCRMetaBoolean(String set_datapart, String set_subtag, String default_lang, String set_type, int set_inherted, boolean set_value)
          This is the constructor.
MCRMetaBoolean(String set_datapart, String set_subtag, String default_lang, String set_type, int set_inherted, String set_value)
          This is the constructor.
 
Method Summary
 Object clone()
          This method make a clone of this class.
 Element createXML()
          This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRBoolean definition for the given subtag.
 void debug()
          This method put debug data to the logger (for the debug mode).
 boolean getValue()
          This method get the value element.
 String getValueToString()
          This method get the value element as String.
 boolean isValid()
          This method check the validation of the content of this class.
 void setFromDOM(Element element)
          This method read the XML input stream part from a DOM part for the metadata of the document.
 void setValue(boolean set_value)
          This method set the value.
 void setValue(String set_value)
          This method set value.
 
Methods inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
debugDefault, decrementInherited, getDataPart, getInherited, getInheritedToString, getLang, getSubTag, getType, incrementInherited, setDataPart, setInherited, setLang, setSubTag, setType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRMetaBoolean

public MCRMetaBoolean()
This is the constructor.
The language element was set to en . The boolean value was set to false.


MCRMetaBoolean

public MCRMetaBoolean(String set_datapart,
                      String set_subtag,
                      String default_lang,
                      String set_type,
                      int set_inherted,
                      String set_value)
               throws MCRException
This is the constructor.
The language element was set to en . The subtag element was set to the value of set_subtag. If the value of set_subtag is null or empty an exception was throwed. The type element was set to the value of set_type, if it is null, an empty string was set to the type element. The boolean string set_value was set to a boolean element, if it is null, false was set.

Parameters:
set_datapart - the global part of the elements like 'metadata' or 'service'
set_subtag - the name of the subtag
set_type - the optional type string
set_inherted - a value >= 0
set_value - the boolean value (true or false) as string
Throws:
MCRException - if the set_subtag value is null or empty

MCRMetaBoolean

public MCRMetaBoolean(String set_datapart,
                      String set_subtag,
                      String default_lang,
                      String set_type,
                      int set_inherted,
                      boolean set_value)
               throws MCRException
This is the constructor.
The language element was set to en . The subtag element was set to the value of set_subtag. If the value of set_subtag is null or empty an exception was throwed. The type element was set to the value of set_type, if it is null, an empty string was set to the type element. The boolean string set_value was set to a boolean element, if it is null, false was set.

Parameters:
set_datapart - the global part of the elements like 'metadata' or 'service'
set_subtag - the name of the subtag
set_type - the optional type string
set_inherted - a value >= 0
set_value - the boolean value (true or false)
Throws:
MCRException - if the set_subtag value is null or empty
Method Detail

setValue

public final void setValue(String set_value)
This method set value. It set false if the string is corrupt.

Parameters:
set_value - the boolean value (true or false) as string

setValue

public final void setValue(boolean set_value)
This method set the value.

Parameters:
set_value - the boolean value

getValue

public final boolean getValue()
This method get the value element.

Returns:
the value as Boolean

getValueToString

public final String getValueToString()
This method get the value element as String.

Returns:
the value as String

setFromDOM

public final void setFromDOM(Element element)
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

createXML

public final Element createXML()
                        throws MCRException
This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRBoolean definition for the given subtag.

Specified by:
createXML in interface MCRMetaInterface
Specified by:
createXML in class MCRMetaDefault
Returns:
a JDOM Element with the XML MCRBoolean part
Throws:
MCRException - if the content of this class is not valid

isValid

public final boolean isValid()
This method check the validation of the content of this class. The method returns true if
  • the subtag is not null or empty
otherwise the method return false

Specified by:
isValid in interface MCRMetaInterface
Overrides:
isValid in class MCRMetaDefault
Returns:
a boolean value

clone

public final Object clone()
This method make a clone of this class.

Specified by:
clone in interface MCRMetaInterface
Specified by:
clone in class MCRMetaDefault

debug

public final 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