Class MCRClassificationUtils
java.lang.Object
org.mycore.datamodel.classifications2.utils.MCRClassificationUtils
This class contains helper methods to handle mycore classifications.
- Author:
- Matthias Eichner
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Document
asDocument
(String classId) Returns the classification as a jdom document.static String
Returns the classification as string.static void
Imports a classification from the given path.static void
fromStream
(InputStream inputStream) Imports a classification from the given input stream.
-
Field Details
-
CREATE_CLASS_PERMISSION
- See Also:
-
-
Constructor Details
-
MCRClassificationUtils
public MCRClassificationUtils()
-
-
Method Details
-
asString
Returns the classification as string. Returns null if the classification does not exists.- Parameters:
classId
- the classification root id- Returns:
- the classification as string
-
asDocument
Returns the classification as a jdom document. Returns null if the classification does not exists.- Parameters:
classId
- the classification root id- Returns:
- the classification as jdom document
-
fromPath
public static void fromPath(Path pathToClassification) throws IOException, MCRException, SAXParseException, MCRAccessException, URISyntaxException Imports a classification from the given path. If the classification already exists, it will be replaced.- Parameters:
pathToClassification
- path to the classification- Throws:
IOException
- could not read from fileMCRException
- xml parsing went wrongSAXParseException
- xml parsing went wrongURISyntaxException
- unable to transform the xml to aMCRCategory
MCRAccessException
- you are not allowed to import the classification
-
fromStream
public static void fromStream(InputStream inputStream) throws MCRException, SAXParseException, URISyntaxException, MCRAccessException Imports a classification from the given input stream. If the classification already exists, it will be replaced.- Parameters:
inputStream
- the classification stream- Throws:
MCRException
- xml parsing went wrongSAXParseException
- xml parsing went wrongURISyntaxException
- unable to transform the xml to aMCRCategory
MCRAccessException
- you are not allowed to import the classification
-