Ignore:
Timestamp:
2020-07-23T13:41:08+12:00 (4 years ago)
Author:
ak19
Message:

Incorporating Kathy & Dr Bainbridge's improvements to the recently added export to meta CSV features: 1. Move meta to CSV now called Convert meta to CSV launch. 2. Launch Export Meta JChooser dialog in collection dir not import dir, but Convert Meta still launched in importDir as before. Also upload any metadata.csv created in collection dir to remote server if client-GLI, not just if meta.csv was created in importDir. 3. Labels of JChooser confirm button and dialog title corrected. 4. Updates to dictionary string names and values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/metadata/MetadataToCSV.java

    r34265 r34283  
    108108
    109109    /** Remove import path prefix from given file. Returned is the path of file relative to import. */
    110     public String fileToRelativeString(File f) {
     110    private String fileToRelativeString(File f) {
    111111    String fullPath = f.getAbsolutePath();
    112112    //System.err.println("@@@ fullpath:            " + fullPath);
     
    174174    // Get all meta in any metadata.csv file
    175175    // and add to it all meta assigned for docs in this collection
    176     public void amalgamateAllMeta() {
     176    private void amalgamateAllMeta() {
    177177    TreeMap<File, TreeMap<String,TreeSet<String>>> assignedMeta = getAllAssignedMetadataForAllFiles();
    178178    TreeMap<File, TreeMap<String,TreeSet<String>>> csvFileMeta = loadMetaFromCSVFile(this.metadataCSVFile);
     
    195195    }
    196196
    197     public TreeSet<String> getAllCollHeadings(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap) {
     197    private TreeSet<String> getAllCollHeadings(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap) {
    198198    TreeSet<String> collHeadings = new TreeSet<String>();
    199199
     
    221221     * A simple map.putALL()  will not do the trick as collMetaMap is a complicated data structure.
    222222     */
    223     public void 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) {
    224224
    225225    if(metaMap == null || metaMap.size() == 0) {
     
    279279     * and removes all the child elements from meta xml files' DirectoryMetadata root elements
    280280     */
    281     public boolean moveMetaXMLToCSV(File csvFile, JFrame parent) {
     281    public boolean convertMetaXMLToCSV(File csvFile, JFrame parent) {
    282282
    283283    // Warn the user about the operation being destructive
    284284    int result = JOptionPane.showConfirmDialog(parent,
    285                Dictionary.get("ExportMeta.MoveMetaXMLToCSV_Warning_Message"),
     285               Dictionary.get("MetaToCSV.ConvertMetaXMLToCSV_Warning_Message"),
    286286               Dictionary.get("General.Warning"),
    287287               JOptionPane.OK_CANCEL_OPTION,
     
    300300    } else {
    301301        JOptionPane.showMessageDialog(parent,
    302                       Dictionary.get("ExportMeta.MoveMetaXMLToCSV_Failed_Message"),
     302                      Dictionary.get("MetaToCSV.ConvertMetaXMLToCSV_Failed_Message"),
    303303                      Dictionary.get("General.Error"),
    304304                      JOptionPane.ERROR_MESSAGE);
     
    391391
    392392
    393     public TreeMap<File, TreeMap<String,TreeSet<String>>> loadMetaFromCSVFile(File csvFile) {
     393    private TreeMap<File, TreeMap<String,TreeSet<String>>> loadMetaFromCSVFile(File csvFile) {
    394394    TreeMap<File, TreeMap<String,TreeSet<String>>> csvFileMeta = new TreeMap<File, TreeMap<String,TreeSet<String>>>();
    395395   
     
    475475
    476476    /** For debugging */
    477     public void print(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap ) {
     477    private void print(TreeMap<File, TreeMap<String,TreeSet<String>>> metaMap ) {
    478478    Iterator<File> iFiles = metaMap.keySet().iterator();
    479479    while(iFiles.hasNext()) {
     
    502502   
    503503    /** For debugging */
    504     public void printOrderedCollectionMeta() {
     504    private void printOrderedCollectionMeta() {
    505505    //TreeMap<File, TreeMap<String,TreeSet<String>>> collMetaMap = getAllAssignedMetadataForAllFiles();
    506506
     
    524524    }
    525525
    526     public void getAllFiles(ArrayList<File> files, File path, FileFilter filter) {
     526    private void getAllFiles(ArrayList<File> files, File path, FileFilter filter) {
    527527    File[] fileList = path.listFiles(filter);   
    528528    for(int i = 0; i < fileList.length; i++) {
     
    563563    //}
    564564
    565     public static File chooseMetaCSVFile(String defaultSearchPath, JFrame parent) {
     565    public static File chooseMetaCSVFile(String defaultSearchPath, boolean convertNotExport, JFrame parent) {
    566566    JFileChooser chooser = new JFileChooser(defaultSearchPath);
    567567    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);
    569574    FileNameExtensionFilter filter = new FileNameExtensionFilter("CSV spreadsheet file", "csv");
    570575    chooser.setFileFilter(filter);//.addChoosableFileFilter(filter);
Note: See TracChangeset for help on using the changeset viewer.