Package org.mycore.datamodel.metadata
Class MCRMetaAccessRule
java.lang.Object
org.mycore.datamodel.metadata.MCRMetaDefault
org.mycore.datamodel.metadata.MCRMetaAccessRule
- All Implemented Interfaces:
Cloneable
,MCRMetaInterface
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 Summary
Fields inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
datapart, DEFAULT_ATTRIBUTE_INHERITED, DEFAULT_ATTRIBUTE_LANG, DEFAULT_ATTRIBUTE_SEQUENCE, DEFAULT_ATTRIBUTE_TYPE, DEFAULT_ELEMENT_DATAPART, DEFAULT_INHERITED, DEFAULT_LANG_LENGTH, DEFAULT_LANGUAGE, DEFAULT_SEQUENCE, DEFAULT_STRING_LENGTH, DEFAULT_TYPE_LENGTH, inherited, lang, NL, sequence, subtag, type
-
Constructor Summary
ConstructorDescriptionThis is the constructor.MCRMetaAccessRule
(String subtag, String type, int inherted, String permission, Element condition) This is the constructor. -
Method Summary
Modifier and TypeMethodDescriptionclone()
This method make a clone of this class.This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRMetaAccessRule definition for the given subtag.final void
debug()
This method put debug data to the logger (for the debug mode).final Element
This method get the condition.final String
This method get the permission attribute.final void
This method set the permission and the condition.final void
setCondition
(Element 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.final void
setPermission
(String permission) This method set the permission attribute.void
validate()
Validates this MCRMetaAccessRule.Methods inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
createJSON, debugDefault, decrementInherited, equals, getInherited, getLang, getSequence, getSubTag, getType, hashCode, incrementInherited, isValid, setInherited, setLang, setSequence, setSubTag, setType
-
Field Details
-
condition
-
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 subtagtype
- the optional type stringinherted
- a value >= 0permission
- permissioncondition
- the JDOM Element included the condition tree- Throws:
MCRException
- if the subtag value or condition is null or empty
-
-
Method Details
-
set
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
This method set the condition.- Parameters:
condition
- the JDOM Element included the condition tree- Throws:
MCRException
- if the condition is null or empty
-
setPermission
This method set the permission attribute.- Parameters:
permission
- the new permission string.
-
getCondition
This method get the condition.- Returns:
- the condition as JDOM Element
-
getPermission
This method get the permission attribute.- Returns:
- the permission attribute
-
setFromDOM
This method read the XML input stream part from a DOM part for the metadata of the document.- Specified by:
setFromDOM
in interfaceMCRMetaInterface
- Overrides:
setFromDOM
in classMCRMetaDefault
- Parameters:
element
- a relevant JDOM element for the metadata
-
createXML
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 interfaceMCRMetaInterface
- Overrides:
createXML
in classMCRMetaDefault
- Returns:
- a JDOM Element with the XML MCRMetaAccessRule part
- Throws:
MCRException
- if the content of this class is not valid
-
validate
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 interfaceMCRMetaInterface
- Overrides:
validate
in classMCRMetaDefault
- Throws:
MCRException
- the MCRMetaAccessRule is invalid
-
clone
This method make a clone of this class.- Specified by:
clone
in interfaceMCRMetaInterface
- Overrides:
clone
in classMCRMetaDefault
-
debug
public final void debug()This method put debug data to the logger (for the debug mode).- Specified by:
debug
in interfaceMCRMetaInterface
- Overrides:
debug
in classMCRMetaDefault
-