Package org.mycore.frontend.cli
Class MCRClassification2Commands
java.lang.Object
org.mycore.frontend.cli.MCRAbstractCommands
org.mycore.frontend.cli.MCRClassification2Commands
- All Implemented Interfaces:
MCRExternalCommandInterface
@MCRCommandGroup(name="Classification Commands")
public class MCRClassification2Commands
extends MCRAbstractCommands
Commands for the classification system.
- Author:
- Thomas Scheffler (yagee)
-
Field Summary
FieldsFields inherited from class org.mycore.frontend.cli.MCRAbstractCommands
command
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static void
countChildren
(String classID) Counts the classification categories on top levelstatic void
Deletes a classificationstatic boolean
Save a MCRClassification.static boolean
Save all MCRClassifications.static void
static void
List all IDs of all classifications stored in the databasestatic void
listClassification
(String classid) List a MCRClassification.loadFromDirectory
(String directory) Loads MCRClassification from all XML files in a directory.loadFromFile
(String filename) Adds a classification.static void
loadFromURI
(String fileURI) static void
loadFromURL
(String fileURL) static void
repairCategoryWithWrongStartPos
(Number parentID, Number wrongStartPositionInParent) static void
static void
repairLeftRightValue
(String classID) static void
repairMissingParent
(String classID) static void
updateFromDirectory
(String directory) Updates MCRClassification from all XML files in a directory.updateFromFile
(String filename) Replaces a classification with a new versionstatic void
updateFromURI
(String fileURI) static void
updateFromURL
(String fileURL) Methods inherited from class org.mycore.frontend.cli.MCRAbstractCommands
addCommand, getDisplayName, getPossibleCommands, setDisplayName
-
Field Details
-
DEFAULT_TRANSFORMER
Default transformer script- See Also:
-
-
Constructor Details
-
MCRClassification2Commands
public MCRClassification2Commands()
-
-
Method Details
-
delete
@MCRCommand(syntax="delete classification {0}", help="The command remove the classification with MCRObjectID {0} from the system.", order=30) public static void delete(String classID) Deletes a classification- Parameters:
classID
- classification ID- See Also:
-
countChildren
@MCRCommand(syntax="count classification children of {0}", help="The command count the categoies of the classification with MCRObjectID {0} in the system.", order=80) public static void countChildren(String classID) Counts the classification categories on top level- Parameters:
classID
- classification ID
-
loadFromFile
@MCRCommand(syntax="load classification from file {0}", help="The command adds a new classification from file {0} to the system.", order=10) public static List<String> loadFromFile(String filename) throws URISyntaxException, MCRException, SAXParseException, IOException Adds a classification. Classification is built from a file.- Parameters:
filename
- file in mcrclass xml format- Throws:
URISyntaxException
MCRException
SAXParseException
IOException
- See Also:
-
loadFromURL
@MCRCommand(syntax="load classification from url {0}", help="The command adds a new classification from URL {0} to the system.", order=15) public static void loadFromURL(String fileURL) throws SAXParseException, MalformedURLException, URISyntaxException -
loadFromURI
@MCRCommand(syntax="load classification from uri {0}", help="The command adds a new classification from URI {0} to the system.", order=17) public static void loadFromURI(String fileURI) throws SAXParseException, URISyntaxException, TransformerException -
updateFromFile
@MCRCommand(syntax="update classification from file {0}", help="The command updates a classification from file {0} to the system.", order=20) public static List<String> updateFromFile(String filename) throws URISyntaxException, MCRException, SAXParseException, IOException Replaces a classification with a new version- Parameters:
filename
- file in mcrclass xml format- Throws:
URISyntaxException
MCRException
SAXParseException
IOException
- See Also:
-
updateFromURL
@MCRCommand(syntax="update classification from url {0}", help="The command updates a classification from URL {0} to the system.", order=25) public static void updateFromURL(String fileURL) throws SAXParseException, MalformedURLException, URISyntaxException -
updateFromURI
@MCRCommand(syntax="update classification from uri {0}", help="The command updates a classification from URI {0} to the system.", order=27) public static void updateFromURI(String fileURI) throws SAXParseException, URISyntaxException, TransformerException -
loadFromDirectory
@MCRCommand(syntax="load all classifications from directory {0}", help="The command add all classifications in the directory {0} to the system.", order=40) public static List<String> loadFromDirectory(String directory) throws MCRActiveLinkException Loads MCRClassification from all XML files in a directory.- Parameters:
directory
- the directory containing the XML files- Throws:
MCRActiveLinkException
-
updateFromDirectory
@MCRCommand(syntax="update all classifications from directory {0}", help="The command update all classifications in the directory {0} to the system.", order=50) public static List<String> updateFromDirectory(String directory) throws MCRActiveLinkException Updates MCRClassification from all XML files in a directory.- Parameters:
directory
- the directory containing the XML files- Throws:
MCRActiveLinkException
-
export
@MCRCommand(syntax="export classification {0} to directory {1} with {2}", help="The command exports the classification with MCRObjectID {0} as xml file to directory named {1} using the stylesheet {2}-object.xsl. For {2} save is the default.", order=60) public static boolean export(String id, String dirname, String style) throws Exception Save a MCRClassification.- Parameters:
id
- the ID of the MCRClassification to be save.dirname
- the directory to export the classification tostyle
- the name part of the stylesheet like style -classification.xsl- Returns:
- false if an error was occured, else true
- Throws:
Exception
-
exportAll
@MCRCommand(syntax="export all classifications to directory {0} with {1}", help="The command store all classifications to the directory with name {0} with the stylesheet {1}-object.xsl. For {1} save is the default.", order=70) public static boolean exportAll(String dirname, String style) throws Exception Save all MCRClassifications.- Parameters:
dirname
- the directory name to store all classificationsstyle
- the name part of the stylesheet like style -classification.xsl- Returns:
- false if an error was occured, else true
- Throws:
Exception
-
listAllClassifications
@MCRCommand(syntax="list all classifications", help="The command list all classification stored in the database.", order=100) public static void listAllClassifications()List all IDs of all classifications stored in the database -
listClassification
@MCRCommand(syntax="list classification {0}", help="The command list the classification with MCRObjectID {0}.", order=90) public static void listClassification(String classid) List a MCRClassification.- Parameters:
classid
- the MCRObjectID of the classification
-
repairEmptyLabels
@MCRCommand(syntax="repair category with empty labels", help="fixes all categories with no labels (adds a label with categid as @text for default lang)", order=110) public static void repairEmptyLabels() -
repairPositionInParent
@MCRCommand(syntax="repair position in parent", help="fixes all categories gaps in position in parent", order=120) public static void repairPositionInParent() -
repairCategoryWithWrongStartPos
-
repairLeftRightValue
@MCRCommand(syntax="repair left right values for classification {0}", help="fixes all left and right values in the given classification", order=130) public static void repairLeftRightValue(String classID) -
checkAllClassifications
-
checkClassification
@MCRCommand(syntax="check classification {0}", help="checks if all redundant information are stored without conflicts", order=150) public static void checkClassification(String id) -
filterClassificationWithMapping
@MCRCommand(syntax="remove unmapped categories from classification {0}", help="Deletes all Categories of classification {0} which can not be mapped from all other classifications!", order=160) public static void filterClassificationWithMapping(String id) -
repairMissingParent
@MCRCommand(syntax="repair missing parent for classification {0}", help="restores parentID from information in the given classification, if left right values are correct", order=130) public static void repairMissingParent(String classID)
-