org.mycore.datamodel.metadata
Class MCRMetaAccessRule

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

public class MCRMetaAccessRule
extends MCRMetaDefault

This class implements all method for handling with the MCRMetaAccessRule part of a metadata object. The MCRMetaAccessRule class present a single item, which hold an ACL condition for a defined permission.

Version:
$Revision: 14106 $ $Date: 2008-10-09 11:30:08 +0200 (Do, 09 Okt 2008) $
Author:
Jens Kupferschmidt

Field Summary
protected  Element condition
           
protected  String permission
           
 
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
MCRMetaAccessRule()
          This is the constructor.
MCRMetaAccessRule(String set_datapart, String set_subtag, String default_lang, String set_type, int set_inherted, String set_permission, Element set_condition)
          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 MCRMetaAccessRule definition for the given subtag.
 void debug()
          This method put debug data to the logger (for the debug mode).
 Element getCondition()
          This method get the condition.
 String getPermission()
          This method get the permission attribute.
 boolean isValid()
          This method check the validation of the content of this class.
 void set(String set_permission, Element set_condition)
          This method set the permission and the condition.
 void setCondition(Element set_condition)
          This method set the condition.
 void setFromDOM(Element element)
          This method read the XML input stream part from a DOM part for the metadata of the document.
 void setPermission(String set_permission)
          This method set the permission attribute.
 
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
 

Field Detail

condition

protected Element condition

permission

protected String permission
Constructor Detail

MCRMetaAccessRule

public MCRMetaAccessRule()
This is the constructor.
The constructor of the MCRMetaDefault runs. The permission Attribute is set to 'READ'. The condition is set to 'null'.


MCRMetaAccessRule

public MCRMetaAccessRule(String set_datapart,
                         String set_subtag,
                         String default_lang,
                         String set_type,
                         int set_inherted,
                         String set_permission,
                         Element set_condition)
                  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. This is not use in other methods of this class. The subtag element was set to the value of set_subtag. If the value of set_subtag is null or empty an exception will be 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 condition element was set to the value of set_condition, if it is null, an exception will be throwed.

Parameters:
set_datapart - the global part of the elements like 'metadata' or 'service'
set_subtag - the name of the subtag
default_lang - the default language
set_type - the optional type string
set_inherted - a value >= 0
set_permission - the format string, if it is empty 'READ' will be set.
set_condition - the JDOM Element included the condition tree
Throws:
MCRException - if the set_subtag value or set_condition is null or empty
Method Detail

set

public final void set(String set_permission,
                      Element set_condition)
               throws MCRException
This method set the permission and the condition.

Parameters:
set_permission - the format string, if it is empty 'READ' will be set.
set_condition - the JDOM Element included the condition tree
Throws:
MCRException - if the set_condition is null or empty

setCondition

public final void setCondition(Element set_condition)
                        throws MCRException
This method set the condition.

Parameters:
set_condition - the JDOM Element included the condition tree
Throws:
MCRException - if the set_condition is null or empty

setPermission

public final void setPermission(String set_permission)
This method set the permission attribute.

Parameters:
set_permission - the new permission string, if it is empty 'READ' will be set.

getCondition

public final Element getCondition()
This method get the condition.

Returns:
the condition as JDOM Element

getPermission

public final String getPermission()
This method get the permission attribute.

Returns:
the permission attribute

setFromDOM

public 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 Element createXML()
                  throws MCRException
This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaAccessRule definition for the given subtag.

Specified by:
createXML in interface MCRMetaInterface
Specified by:
createXML in class MCRMetaDefault
Returns:
a JDOM Element with the XML MCRMetaAccessRule 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 text 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 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