org.mycore.datamodel.metadata
Class MCRMetaDefault

java.lang.Object
  extended by org.mycore.datamodel.metadata.MCRMetaDefault
All Implemented Interfaces:
Cloneable, MCRMetaInterface
Direct Known Subclasses:
MCRMetaAccessRule, MCRMetaAddress, MCRMetaBoolean, MCRMetaClassification, MCRMetaHistoryDate, MCRMetaIFS, MCRMetaInstitutionName, MCRMetaISBN, MCRMetaISO8601Date, MCRMetaLangText, MCRMetaLink, MCRMetaNBN, MCRMetaNumber, MCRMetaPersonName, MCRMetaXML

public abstract class MCRMetaDefault
extends Object
implements MCRMetaInterface

This class implements any methods for handling the basic data for all metadata classes of the metadata objects. The methods createXML() and createTypedContent() and createTextSearch() are abstract methods.

Version:
$Revision: 14000 $ $Date: 2008-09-16 11:21:12 +0200 (Di, 16 Sep 2008) $
Author:
Jens Kupferschmidt

Field Summary
protected  String datapart
           
protected static String DEFAULT_DATAPART
           
protected static int DEFAULT_INHERITED
           
static int DEFAULT_LANG_LENGTH
           
protected static String DEFAULT_LANGUAGE
           
static int DEFAULT_STRING_LENGTH
           
static int DEFAULT_TYPE_LENGTH
           
protected  int inherited
           
protected  String lang
           
(package private) static Logger LOGGER
           
protected static String NL
           
protected  String subtag
           
protected  String type
           
 
Constructor Summary
MCRMetaDefault()
          This is the constructor.
MCRMetaDefault(String default_lang)
          This is the constructor.
MCRMetaDefault(String set_datapart, String set_subtag, String default_lang, String set_type, int set_inherited)
          This is the constructor.
 
Method Summary
abstract  Object clone()
          This method make a clone of this class.
abstract  Element createXML()
          This abstract method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMeta...
 void debug()
          This method put debug data to the logger (for the debug mode).
 void debugDefault()
          This method put common debug data to the logger (for the debug mode).
 void decrementInherited()
          This method decrements the inherited value with 1.
 String getDataPart()
          This method get the datapart element.
 int getInherited()
          This method get the inherited element.
 String getInheritedToString()
          This method get the inherited element.
 String getLang()
          This method get the language element.
 String getSubTag()
          This method get the subtag element.
 String getType()
          This method get the type element.
 void incrementInherited()
          This method increments the inherited value with 1.
 boolean isValid()
          This method check the validation of the content of this class.
 void setDataPart(String set_datapart)
          This method set the datapart element.
 void setFromDOM(Element element)
          This method read the XML input stream part from a DOM part for the metadata of the document.
 void setInherited(int value)
          This method set the inherited level.
 void setLang(String default_lang)
          This method set the language element.
 void setSubTag(String set_subtag)
          This method set the subtag element.
 void setType(String set_type)
          This method set the type element.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LANG_LENGTH

public static final int DEFAULT_LANG_LENGTH
See Also:
Constant Field Values

DEFAULT_TYPE_LENGTH

public static final int DEFAULT_TYPE_LENGTH
See Also:
Constant Field Values

DEFAULT_STRING_LENGTH

public static final int DEFAULT_STRING_LENGTH
See Also:
Constant Field Values

NL

protected static final String NL

DEFAULT_LANGUAGE

protected static final String DEFAULT_LANGUAGE

DEFAULT_DATAPART

protected static final String DEFAULT_DATAPART
See Also:
Constant Field Values

DEFAULT_INHERITED

protected static final int DEFAULT_INHERITED
See Also:
Constant Field Values

LOGGER

static Logger LOGGER

subtag

protected String subtag

lang

protected String lang

type

protected String type

inherited

protected int inherited

datapart

protected String datapart
Constructor Detail

MCRMetaDefault

public MCRMetaDefault()
This is the constructor.
The language element was set to en . The datapart element was set to metadata All other elemnts was set to an empty string. The inherited value is set to 0!


MCRMetaDefault

public MCRMetaDefault(String default_lang)
This is the constructor.
The language element was set. If the value of default_lang is empty or false en was set. The datapart was set to default. All other elemnts was set to an empty string. The inherited value is set to 0!

Parameters:
default_lang - the default language

MCRMetaDefault

public MCRMetaDefault(String set_datapart,
                      String set_subtag,
                      String default_lang,
                      String set_type,
                      int set_inherited)
               throws MCRException
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 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 datapart element was set. If the value of set_datapart,/em> is null or empty the default was set.

Parameters:
set_datapart - the data part name
set_subtag - the name of the subtag
default_lang - the default language
set_type - the optional type string
set_inherited - a int value , > 0 if the data are inherited, else = 0.
Throws:
MCRException - if the set_subtag value is null or empty
Method Detail

setInherited

public final void setInherited(int value)
This method set the inherited level. This can be 0 or an integer higher 0.

Specified by:
setInherited in interface MCRMetaInterface
Parameters:
value - the inherited level value, if it is < 0, 0 was set

incrementInherited

public final void incrementInherited()
This method increments the inherited value with 1.

Specified by:
incrementInherited in interface MCRMetaInterface

decrementInherited

public final void decrementInherited()
This method decrements the inherited value with 1.

Specified by:
decrementInherited in interface MCRMetaInterface

setLang

public final void setLang(String default_lang)
This method set the language element. If the value of default_lang is null, empty or false nothing was changed.

Specified by:
setLang in interface MCRMetaInterface
Parameters:
default_lang - the default language

setSubTag

public final void setSubTag(String set_subtag)
                     throws MCRException
This method set the subtag element. If the value of set_subtag is null or empty an exception was throwed.

Specified by:
setSubTag in interface MCRMetaInterface
Parameters:
set_subtag - the subtag
Throws:
MCRException - if the set_subtag value is null or empty

setType

public final void setType(String set_type)
This method set the type element. If the value of set_type is null or empty nothing was changed.

Specified by:
setType in interface MCRMetaInterface
Parameters:
set_type - the optional type

setDataPart

public final void setDataPart(String set_datapart)
This method set the datapart element. If the value of set_datapart is null, empty or false nothing was changed.

Parameters:
set_datapart - the data part name

getInherited

public final int getInherited()
This method get the inherited element.

Specified by:
getInherited in interface MCRMetaInterface
Returns:
the inherited flag as int

getInheritedToString

public final String getInheritedToString()
This method get the inherited element.

Specified by:
getInheritedToString in interface MCRMetaInterface
Returns:
the inherited flag as string

getLang

public final String getLang()
This method get the language element.

Specified by:
getLang in interface MCRMetaInterface
Returns:
the language

getSubTag

public final String getSubTag()
This method get the subtag element.

Specified by:
getSubTag in interface MCRMetaInterface
Returns:
the subtag

getType

public final String getType()
This method get the type element.

Specified by:
getType in interface MCRMetaInterface
Returns:
the type

getDataPart

public final String getDataPart()
This method get the datapart element.

Returns:
the datapart

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
Parameters:
element - a relevant DOM element for the metadata
Throws:
MCRException - if the set_subtag value is null or empty

createXML

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

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

isValid

public 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
  • the lang value was supported
otherwise the method return false

Specified by:
isValid in interface MCRMetaInterface
Returns:
a boolean value

debug

public void debug()
This method put debug data to the logger (for the debug mode).

Specified by:
debug in interface MCRMetaInterface

debugDefault

public final void debugDefault()
This method put common debug data to the logger (for the debug mode).


clone

public abstract Object clone()
Description copied from interface: MCRMetaInterface
This method make a clone of this class.

Specified by:
clone in interface MCRMetaInterface
Overrides:
clone in class Object