- Timestamp:
- 2020-07-23T13:41:08+12:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/metadata/MetadataToCSV.java
r34265 r34283 108 108 109 109 /** Remove import path prefix from given file. Returned is the path of file relative to import. */ 110 p ublicString fileToRelativeString(File f) {110 private String fileToRelativeString(File f) { 111 111 String fullPath = f.getAbsolutePath(); 112 112 //System.err.println("@@@ fullpath: " + fullPath); … … 174 174 // Get all meta in any metadata.csv file 175 175 // and add to it all meta assigned for docs in this collection 176 p ublicvoid amalgamateAllMeta() {176 private void amalgamateAllMeta() { 177 177 TreeMap<File, TreeMap<String,TreeSet<String>>> assignedMeta = getAllAssignedMetadataForAllFiles(); 178 178 TreeMap<File, TreeMap<String,TreeSet<String>>> csvFileMeta = loadMetaFromCSVFile(this.metadataCSVFile); … … 195 195 } 196 196 197 p ublicTreeSet<String> getAllCollHeadings(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap) {197 private TreeSet<String> getAllCollHeadings(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap) { 198 198 TreeSet<String> collHeadings = new TreeSet<String>(); 199 199 … … 221 221 * A simple map.putALL() will not do the trick as collMetaMap is a complicated data structure. 222 222 */ 223 p ublicvoid merge(TreeMap<File, TreeMap<String,TreeSet<String>>> baseMetaMap, TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap) {223 private void merge(TreeMap<File, TreeMap<String,TreeSet<String>>> baseMetaMap, TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap) { 224 224 225 225 if(metaMap == null || metaMap.size() == 0) { … … 279 279 * and removes all the child elements from meta xml files' DirectoryMetadata root elements 280 280 */ 281 public boolean moveMetaXMLToCSV(File csvFile, JFrame parent) {281 public boolean convertMetaXMLToCSV(File csvFile, JFrame parent) { 282 282 283 283 // Warn the user about the operation being destructive 284 284 int result = JOptionPane.showConfirmDialog(parent, 285 Dictionary.get(" ExportMeta.MoveMetaXMLToCSV_Warning_Message"),285 Dictionary.get("MetaToCSV.ConvertMetaXMLToCSV_Warning_Message"), 286 286 Dictionary.get("General.Warning"), 287 287 JOptionPane.OK_CANCEL_OPTION, … … 300 300 } else { 301 301 JOptionPane.showMessageDialog(parent, 302 Dictionary.get(" ExportMeta.MoveMetaXMLToCSV_Failed_Message"),302 Dictionary.get("MetaToCSV.ConvertMetaXMLToCSV_Failed_Message"), 303 303 Dictionary.get("General.Error"), 304 304 JOptionPane.ERROR_MESSAGE); … … 391 391 392 392 393 p ublicTreeMap<File, TreeMap<String,TreeSet<String>>> loadMetaFromCSVFile(File csvFile) {393 private TreeMap<File, TreeMap<String,TreeSet<String>>> loadMetaFromCSVFile(File csvFile) { 394 394 TreeMap<File, TreeMap<String,TreeSet<String>>> csvFileMeta = new TreeMap<File, TreeMap<String,TreeSet<String>>>(); 395 395 … … 475 475 476 476 /** For debugging */ 477 p ublicvoid print(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap ) {477 private void print(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap ) { 478 478 Iterator<File> iFiles = metaMap.keySet().iterator(); 479 479 while(iFiles.hasNext()) { … … 502 502 503 503 /** For debugging */ 504 p ublicvoid printOrderedCollectionMeta() {504 private void printOrderedCollectionMeta() { 505 505 //TreeMap<File, TreeMap<String,TreeSet<String>>> collMetaMap = getAllAssignedMetadataForAllFiles(); 506 506 … … 524 524 } 525 525 526 p ublicvoid getAllFiles(ArrayList<File> files, File path, FileFilter filter) {526 private void getAllFiles(ArrayList<File> files, File path, FileFilter filter) { 527 527 File[] fileList = path.listFiles(filter); 528 528 for(int i = 0; i < fileList.length; i++) { … … 563 563 //} 564 564 565 public static File chooseMetaCSVFile(String defaultSearchPath, JFrame parent) {565 public static File chooseMetaCSVFile(String defaultSearchPath, boolean convertNotExport, JFrame parent) { 566 566 JFileChooser chooser = new JFileChooser(defaultSearchPath); 567 567 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); 568 chooser.setDialogTitle(Dictionary.get("ExportMeta.ChooseMetaCSVFile")); 568 String actionName = Dictionary.get("MetaToCSV.ExportAction"); // Export or Convert 569 if(convertNotExport) { 570 actionName = Dictionary.get("MetaToCSV.ConvertAction"); 571 } 572 chooser.setDialogTitle(Dictionary.get("MetaToCSV.ChooseMetaCSVFile", actionName)); 573 chooser.setApproveButtonText(Dictionary.get("MetaToCSV.Choose"));//actionName); 569 574 FileNameExtensionFilter filter = new FileNameExtensionFilter("CSV spreadsheet file", "csv"); 570 575 chooser.setFileFilter(filter);//.addChoosableFileFilter(filter);
Note:
See TracChangeset
for help on using the changeset viewer.