Class MCRDerivateUtil

java.lang.Object
org.mycore.datamodel.niofs.utils.MCRDerivateUtil

public class MCRDerivateUtil extends Object
  • Constructor Details

    • MCRDerivateUtil

      public MCRDerivateUtil()
  • Method Details

    • renameFiles

      public static Map<String,String> renameFiles(String derivate, String pattern, String replacement) throws IOException
      Renames multiple files in one Derivate with the given pattern. You can try out your pattern with the method testRenameFile.
      Parameters:
      derivate - the Derivate ID as String
      pattern - the RegEx pattern to find the wanted files
      replacement - the new name for the files
      Returns:
      a Hashmap with the old name and the new name
      Throws:
      IOException
    • testRenameFile

      public static String testRenameFile(String filename, String pattern, String replacement)
      Tests the rename pattern on one file, so you can try the rename befor renaming all files. This method does not change any files.
      Parameters:
      filename - a filename to try the pattern on
      pattern - the RegEx pattern to find the wanted files
      replacement - the new name for the files
      Returns:
      the new filename