org.mycore.frontend.cli
Class MCRClassification2Commands

java.lang.Object
  extended by org.mycore.frontend.cli.MCRAbstractCommands
      extended by org.mycore.frontend.cli.MCRClassification2Commands
All Implemented Interfaces:
MCRExternalCommandInterface

public class MCRClassification2Commands
extends MCRAbstractCommands

Commands for the classification system.

Author:
Thomas Scheffler (yagee)

Field Summary
static String DEFAULT_TRANSFORMER
          Default transformer script
 
Fields inherited from class org.mycore.frontend.cli.MCRAbstractCommands
command, CONFIG
 
Constructor Summary
MCRClassification2Commands()
           
 
Method Summary
static void countChildren(String classID)
          Deletes a classification
static void delete(String classID)
          Deletes a classification
static boolean export(String ID, String dirname, String style)
          Save a MCRClassification.
static boolean exportAll(String dirname, String style)
          Save all MCRClassifications.
static void listAllClassifications()
          List all IDs of all classifications stored in the database
static void listClassification(String classid)
          List a MCRClassification.
static List<String> loadFromDirectory(String directory)
          Loads MCRClassification from all XML files in a directory.
static void loadFromFile(String filename)
          Adds a classification.
static List<String> updateFromDirectory(String directory)
          Updates MCRClassification from all XML files in a directory.
static void updateFromFile(String filename)
          Replaces a classification with a new version
 
Methods inherited from class org.mycore.frontend.cli.MCRAbstractCommands
getPossibleCommands
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TRANSFORMER

public static final String DEFAULT_TRANSFORMER
Default transformer script

See Also:
Constant Field Values
Constructor Detail

MCRClassification2Commands

public MCRClassification2Commands()
Method Detail

delete

public static void delete(String classID)
Deletes a classification

Parameters:
classID -
See Also:
MCRCategoryDAO.deleteCategory(MCRCategoryID)

countChildren

public static void countChildren(String classID)
Deletes a classification

Parameters:
classID -
See Also:
MCRCategoryDAO.deleteCategory(MCRCategoryID)

loadFromFile

public static void loadFromFile(String filename)
                         throws URISyntaxException
Adds a classification. Classification is built from a file.

Parameters:
filname - file in mcrclass xml format
Throws:
URISyntaxException
See Also:
MCRCategoryDAO.addCategory(MCRCategoryID, MCRCategory)

updateFromFile

public static void updateFromFile(String filename)
                           throws URISyntaxException
Replaces a classification with a new version

Parameters:
filename - file in mcrclass xml format
Throws:
URISyntaxException
See Also:
MCRCategoryDAO.replaceCategory(MCRCategory)

loadFromDirectory

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

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

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.
filename - the filename to store the classification
style - the name part of the stylesheet like style -classification.xsl
Returns:
false if an error was occured, else true
Throws:
Exception

exportAll

public static boolean exportAll(String dirname,
                                String style)
                         throws Exception
Save all MCRClassifications.

Parameters:
dirname - the directory name to store all classifications
style - the name part of the stylesheet like style -classification.xsl
Returns:
false if an error was occured, else true
Throws:
Exception

listAllClassifications

public static void listAllClassifications()
List all IDs of all classifications stored in the database


listClassification

public static void listClassification(String classid)
List a MCRClassification.

Parameters:
classid - the MCRObjectID of the classification