org.mycore.datamodel.metadata
Class MCRMetaElement

java.lang.Object
  extended by org.mycore.datamodel.metadata.MCRMetaElement

public class MCRMetaElement
extends Object

This class is designed to to have a basic class for all metadata. The class has inside a ArrayList that holds all metaddata elements for one XML tag. Furthermore, this class supports the linking of a document owing this metadata element to another document, the id of which is given in the xlink:href attribute of the MCRMetaLink representing the link. The class name of such a metadata element must be MCRMetaLink, and the metadata element is considered to be a folder of links.

Version:
$Revision: 14003 $ $Date: 2008-09-16 11:45:07 +0200 (Di, 16 Sep 2008) $
Author:
Jens Kupferschmidt, Mathias Hegner

Field Summary
protected static MCRConfiguration CONFIG
           
static boolean DEFAULT_HERITABLE
           
static String DEFAULT_LANGUAGE
           
static boolean DEFAULT_NOT_INHERIT
           
(package private) static Logger LOGGER
           
 
Constructor Summary
MCRMetaElement()
          This is the constructor of the MCRMetaElement class.
MCRMetaElement(String default_lang)
          This is the constructor of the MCRMetaElement class.
MCRMetaElement(String set_lang, String set_classname, String set_tag, boolean set_heritable, boolean set_notinherit, ArrayList<MCRMetaInterface> set_list)
          This is the constructor of the MCRMetaElement class.
 
Method Summary
 void addMetaObject(MCRMetaInterface obj)
          The method add a metadata object, that implements the MCRMetaInterface to this element.
 Object clone()
          This method make a clone of this class.
 Element createXML(boolean flag)
          This methode create a XML stream for all data in this class, defined by the MyCoRe XML MCRLangText definition for the given subtag.
 void debug()
          This method put debug data to the logger (for the debug mode).
 String getClassName()
          This methode return the name of this metadata class as string.
 MCRMetaInterface getElement(int index)
          This methode return the instance of an element from the list with index i.
 boolean getHeritable()
          This methode return the heritable flag of this metadata as boolean value.
 String getLang()
          This methode return the default language of this metadata class as string.
 boolean getNotInherit()
          This methode return the nonherit flag of this metadata as boolean value.
 String getTag()
          This methode return the tag of this metadata class as string.
 boolean isValid()
          This methode check the validation of the content of this class.
 void removeInheritedObject()
          The method removes all inherited metadata objects of this MCRMetaElement.
 void setClassName(String classname)
          This methode set the element class name for the metadata elements.
 void setFromDOM(Element element)
          This methode read the XML input stream part from a DOM part for the metadata of the document.
 void setHeritable(boolean heritable)
          This methode set the heritable flag for the metadata class.
 void setHeritable(String heritable)
          This methode set the heritable flag for the metadata class.
 void setNotInherit(boolean notinherit)
          This methode set the notinherit flag for the metadata class.
 void setNotInherit(String notinherit)
          This methode set the notinherit flag for the metadata class.
 void setTag(String tag)
          This methode set the tag for the metadata class.
 int size()
          size returns the number of elements in this instance.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LANGUAGE

public static final String DEFAULT_LANGUAGE
See Also:
Constant Field Values

DEFAULT_HERITABLE

public static final boolean DEFAULT_HERITABLE
See Also:
Constant Field Values

DEFAULT_NOT_INHERIT

public static final boolean DEFAULT_NOT_INHERIT
See Also:
Constant Field Values

CONFIG

protected static final MCRConfiguration CONFIG

LOGGER

static Logger LOGGER
Constructor Detail

MCRMetaElement

public MCRMetaElement()
This is the constructor of the MCRMetaElement class. The default language for the element was set to en .


MCRMetaElement

public MCRMetaElement(String default_lang)
This is the constructor of the MCRMetaElement class. The default language for the element was set. If the default languge is empty or false de was set.

Parameters:
default_lang - the default language

MCRMetaElement

public MCRMetaElement(String set_lang,
                      String set_classname,
                      String set_tag,
                      boolean set_heritable,
                      boolean set_notinherit,
                      ArrayList<MCRMetaInterface> set_list)
This is the constructor of the MCRMetaElement class.

Parameters:
set_lang - the default language
set_classname - the name of the MCRMeta... class
set_tag - the name of this tag
set_heritable - set this flag to true if all child objects of this element can inherit this data
set_notinherit - set this flag to true if this element should not inherit from his parent object
set_list - a list of MCRMeta... data lines to add in this element
Method Detail

getClassName

public final String getClassName()
This methode return the name of this metadata class as string.

Returns:
the name of this metadata class as string

getElement

public final MCRMetaInterface getElement(int index)
This methode return the instance of an element from the list with index i.

Returns:
the instance of an element, if index is out of range return null

getHeritable

public final boolean getHeritable()
This methode return the heritable flag of this metadata as boolean value.

Returns:
the heritable flag of this metadata class

getNotInherit

public final boolean getNotInherit()
This methode return the nonherit flag of this metadata as boolean value.

Returns:
the notherit flag of this metadata class

getLang

public final String getLang()
This methode return the default language of this metadata class as string.

Returns:
the default language of this metadata class as string

getTag

public final String getTag()
This methode return the tag of this metadata class as string.

Returns:
the tag of this metadata class as string

setHeritable

public void setHeritable(String heritable)
This methode set the heritable flag for the metadata class.

Parameters:
heritable - the heritable flag as string

setHeritable

public void setHeritable(boolean heritable)
This methode set the heritable flag for the metadata class.

Parameters:
heritable - the heritable flag as boolean value

setNotInherit

public void setNotInherit(String notinherit)
This methode set the notinherit flag for the metadata class.

Parameters:
notinherit - the notinherit flag as string

setNotInherit

public void setNotInherit(boolean notinherit)
This methode set the notinherit flag for the metadata class.

Parameters:
notinherit - the notinherit flag as boolean value

setTag

public void setTag(String tag)
This methode set the tag for the metadata class.

Parameters:
tag - the tag for the metadata class

setClassName

public final void setClassName(String classname)
This methode set the element class name for the metadata elements.

Parameters:
classname - the class name for the metadata elements

size

public final int size()
size returns the number of elements in this instance.

Returns:
int the size of "list"

addMetaObject

public final void addMetaObject(MCRMetaInterface obj)
The method add a metadata object, that implements the MCRMetaInterface to this element.

Parameters:
obj - a metadata object
Throws:
MCRException - if the class name of the object is not the same like the name of all store metadata in this element.

removeInheritedObject

public final void removeInheritedObject()
The method removes all inherited metadata objects of this MCRMetaElement.


setFromDOM

public final void setFromDOM(Element element)
                      throws MCRException
This methode read the XML input stream part from a DOM part for the metadata of the document.

Parameters:
element - a relevant JDOM element for the metadata
Throws:
MCRException - if the class can't loaded

createXML

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

Parameters:
flag - true if all inherited data should be include, else false
Returns:
a JDOM Element with the XML Element part
Throws:
MCRException - if the content of this class is not valid

isValid

public final boolean isValid()
This methode check the validation of the content of this class. The methode returns true if otherwise the methode return false

Returns:
a boolean value

clone

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

Overrides:
clone in class Object

debug

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