org.mycore.datamodel.metadata
Class MCRObjectMetadata

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

public class MCRObjectMetadata
extends Object

This class implements all methode for handling one object metadata part. This class uses only metadata type classes of the general datamodel code of MyCoRe.

Version:
$Revision: 15500 $ $Date: 2009-07-13 11:25:24 +0200 (Mon, 13 Jul 2009) $
Author:
Jens Kupferschmidt, Mathias Hegner

Field Summary
(package private) static Logger LOGGER
           
 
Constructor Summary
MCRObjectMetadata()
          This is the constructor of the MCRObjectMetadata class.
 
Method Summary
 void appendMetadata(MCRObjectMetadata input)
          This method append MCRMetaElement's from a given MCRObjectMetadata to this data set.
 Element createXML()
          This methode create a XML stream for all metadata.
 void debug()
          This method put debug data to the logger (for the debug mode).
 MCRObjectMetadata getHeritableMetadata()
          getHeritableMetadata returns an instance of MCRObjectMetadata containing all the heritable MetaElement's of this object.
 MCRMetaElement getMetadataElement(int index)
          This methode return the MCRMetaElement selected by an index.
 MCRMetaElement getMetadataElement(String tag)
          This methode return the MCRMetaElement selected by tag.
 String getMetadataTagName(int i)
          The method returns the tag name at a given index.
 boolean isValid()
          This methode check the validation of the content of this class.
 void removeInheritedMetadata()
          removeInheritedMetadata removes all inherited metadata elements
 MCRMetaElement removeMetadataElement(int index)
          This methode remove the MCRMetaElement selected a index from the list.
 MCRMetaElement removeMetadataElement(String tag)
          This methode remove the MCRMetaElement selected by tag from the list.
 void setFromDOM(Element element)
          This methode read the XML input stream part from a DOM part for the metadata of the document.
 boolean setMetadataElement(MCRMetaElement obj, String tag)
          This methode set the given MCRMetaElement to the list.
 int size()
          size returns the number of tag names in the ArrayList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

static Logger LOGGER
Constructor Detail

MCRObjectMetadata

public MCRObjectMetadata()
                  throws MCRConfigurationException
This is the constructor of the MCRObjectMetadata class. It set the default language for all metadata to the value from the configuration propertie MCR.Metadata.DefaultLang.

Throws:
MCRConfigurationException - a special exception for configuartion data
Method Detail

size

public int size()
size returns the number of tag names in the ArrayList.

Returns:
int number of tags and meta elements

getMetadataTagName

public final String getMetadataTagName(int i)
The method returns the tag name at a given index.

Parameters:
i - given index
Returns:
String the associated tag name

getHeritableMetadata

public final MCRObjectMetadata getHeritableMetadata()
                                             throws MCRConfigurationException
getHeritableMetadata returns an instance of MCRObjectMetadata containing all the heritable MetaElement's of this object.

Returns:
MCRObjectMetadata the heritable part of this MCRObjectMetadata
Throws:
MCRConfigurationException

removeInheritedMetadata

public final void removeInheritedMetadata()
removeInheritedMetadata removes all inherited metadata elements


appendMetadata

public final void appendMetadata(MCRObjectMetadata input)
This method append MCRMetaElement's from a given MCRObjectMetadata to this data set.

Parameters:
input - the MCRObjectMetadata, that should merged into this data set

getMetadataElement

public final MCRMetaElement getMetadataElement(String tag)
This methode return the MCRMetaElement selected by tag. If this was not found, null was returned.

Parameters:
tag - the element tag
Returns:
the MCRMetaElement for the tag

getMetadataElement

public final MCRMetaElement getMetadataElement(int index)
This methode return the MCRMetaElement selected by an index. If this was not found, null was returned.

Parameters:
index - the element index
Returns:
the MCRMetaElement for the index

setMetadataElement

public final boolean setMetadataElement(MCRMetaElement obj,
                                        String tag)
This methode set the given MCRMetaElement to the list. If the tag exists the MCRMetaElement was replaced.

Parameters:
obj - the MCRMetaElement object
tag - the MCRMetaElement tag
Returns:
true if set was succesful, otherwise false

removeMetadataElement

public final MCRMetaElement removeMetadataElement(String tag)
This methode remove the MCRMetaElement selected by tag from the list.

Returns:
true if set was succesful, otherwise false

removeMetadataElement

public final MCRMetaElement removeMetadataElement(int index)
This methode remove the MCRMetaElement selected a index from the list.

Returns:
true if set was succesful, otherwise false

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 list of relevant DOM elements for the metadata
Throws:
MCRException - if a problem is occured

createXML

public final Element createXML()
                        throws MCRException
This methode create a XML stream for all metadata.

Returns:
a JDOM Element with the XML data of the metadata 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

debug

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