@Test public void testCreateFolder() { File parent = temp.getRoot(); String name = FoxmlUtils.pidAsUuid("uuid:0bcf9933-84e5-460f-9e94-d798b724d394"); File expResult = new File(parent, name); File result = ExportUtils.createFolder(parent, name, appConfig.getExportOptions().isOverwritePackage()); assertEquals(expResult, result); expResult = new File(parent, name + "_1"); result = ExportUtils.createFolder(parent, name, appConfig.getExportOptions().isOverwritePackage()); assertEquals(expResult, result); }
public static File createFolder(File parent, String name, boolean overwrite) { if (name == null || name.contains(":")) { throw new IllegalArgumentException(name); } if (parent == null) { throw new NullPointerException("parent"); } File folder = new File(parent, name); if (overwrite) { if (!folder.mkdir()) { MetsUtils.deleteFolder(folder); folder.mkdir(); } } else { for (int i = 1; !folder.mkdir(); i++) { folder = new File(parent, name + '_' + i); } } return folder; }
ExportUtils { public static File createFolder(File parent, String name, boolean overwrite) { if (name == null || name.contains(":")) { throw new IllegalArgumentException(name); } if (parent == null) { throw new NullPointerException("parent"); } File folder = new File(parent, name); if (overwrite) { if (!folder.mkdir()) { MetsUtils.deleteFolder(folder); folder.mkdir(); } } else { for (int i = 1; !folder.mkdir(); i++) { folder = new File(parent, name + '_' + i); } } return folder; } }
ExportUtils { public static File createFolder(File parent, String name, boolean overwrite) { if (name == null || name.contains(":")) { throw new IllegalArgumentException(name); } if (parent == null) { throw new NullPointerException("parent"); } File folder = new File(parent, name); if (overwrite) { if (!folder.mkdir()) { MetsUtils.deleteFolder(folder); folder.mkdir(); } } else { for (int i = 1; !folder.mkdir(); i++) { folder = new File(parent, name + '_' + i); } } return folder; }  }
ExportUtils { public static File createFolder(File parent, String name, boolean overwrite) { if (name == null || name.contains(":")) { throw new IllegalArgumentException(name); } if (parent == null) { throw new NullPointerException("parent"); } File folder = new File(parent, name); if (overwrite) { if (!folder.mkdir()) { MetsUtils.deleteFolder(folder); folder.mkdir(); } } else { for (int i = 1; !folder.mkdir(); i++) { folder = new File(parent, name + '_' + i); } } return folder; }  static File createFolder(File parent, String name, boolean overwrite); static File pidAsXmlFile(File output, String pid); static void writeExportResult(File targetFolder, ExportResultLog result); static void storeObjectExportResult(String pid, String target, String type, String log); static String toString(Iterable<?> lines); static String toString(Iterable<?> lines, String lineEnd); static String toString(Throwable ex); }
ExportUtils { public static File createFolder(File parent, String name, boolean overwrite) { if (name == null || name.contains(":")) { throw new IllegalArgumentException(name); } if (parent == null) { throw new NullPointerException("parent"); } File folder = new File(parent, name); if (overwrite) { if (!folder.mkdir()) { MetsUtils.deleteFolder(folder); folder.mkdir(); } } else { for (int i = 1; !folder.mkdir(); i++) { folder = new File(parent, name + '_' + i); } } return folder; }  static File createFolder(File parent, String name, boolean overwrite); static File pidAsXmlFile(File output, String pid); static void writeExportResult(File targetFolder, ExportResultLog result); static void storeObjectExportResult(String pid, String target, String type, String log); static String toString(Iterable<?> lines); static String toString(Iterable<?> lines, String lineEnd); static String toString(Throwable ex); static final String PROARC_EXPORT_STATUSLOG; }