Class MCRMetaAccessRule

java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
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$ $Date$
Author:
Jens Kupferschmidt
  • Field Details

    • condition

      protected Element condition
    • permission

      protected String permission
  • Constructor Details

    • 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 subtag, String type, int inherted, String permission, Element 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 subtag. If the value of subtag is null or empty an exception will be throwed. The type element was set to the value of type, if it is null, an empty string was set to the type element. The condition element was set to the value of condition, if it is null, an exception will be throwed.
      Parameters:
      subtag - the name of the subtag
      type - the optional type string
      inherted - a value >= 0
      permission - permission
      condition - the JDOM Element included the condition tree
      Throws:
      MCRException - if the subtag value or condition is null or empty
  • Method Details

    • set

      public final void set(String permission, Element condition) throws MCRException
      This method set the permission and the condition.
      Parameters:
      permission - the format string, if it is empty 'READ' will be set.
      condition - the JDOM Element included the condition tree
      Throws:
      MCRException - if the condition is null or empty
    • setCondition

      public final void setCondition(Element condition) throws MCRException
      This method set the condition.
      Parameters:
      condition - the JDOM Element included the condition tree
      Throws:
      MCRException - if the condition is null or empty
    • setPermission

      public final void setPermission(String permission)
      This method set the permission attribute.
      Parameters:
      permission - the new permission string.
    • 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
      Overrides:
      createXML in class MCRMetaDefault
      Returns:
      a JDOM Element with the XML MCRMetaAccessRule part
      Throws:
      MCRException - if the content of this class is not valid
    • validate

      public void validate() throws MCRException
      Validates this MCRMetaAccessRule. This method throws an exception if:
      • the subtag is not null or empty
      • the lang value was supported
      • the inherited value is lower than zero
      • the condition is null
      • the permission is null or empty
      Specified by:
      validate in interface MCRMetaInterface
      Overrides:
      validate in class MCRMetaDefault
      Throws:
      MCRException - the MCRMetaAccessRule is invalid
    • clone

      public MCRMetaAccessRule clone()
      This method make a clone of this class.
      Specified by:
      clone in interface MCRMetaInterface
      Overrides:
      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